342 |
AU_ALIAS([AM_FUNC_ERROR_AT_LINE], [AC_FUNC_ERROR_AT_LINE]) |
AU_ALIAS([AM_FUNC_ERROR_AT_LINE], [AC_FUNC_ERROR_AT_LINE]) |
343 |
|
|
344 |
|
|
345 |
# _AC_FUNC_FNMATCH([DIR], STANDARD, SHELL_VAR, VARIABLE) |
# _AC_FUNC_FNMATCH_IF(STANDARD = GNU | POSIX, CACHE_VAR, IF-TRUE, IF-FALSE) |
346 |
# --------------------------------------------- |
# ------------------------------------------------------------------------- |
347 |
AC_DEFUN([_AC_FUNC_FNMATCH], |
# If a STANDARD compliant fnmatch is found, run IF-TRUE, otherwise |
348 |
[m4_ifval([$1], |
# IF-FALSE. Use CACHE_VAR. |
349 |
[AC_REQUIRE([AC_C_CONST]) |
AC_DEFUN([_AC_FUNC_FNMATCH_IF], |
350 |
AC_REQUIRE([AC_FUNC_ALLOCA]) |
[AC_CACHE_CHECK( |
351 |
AC_REQUIRE([AC_TYPE_MBSTATE_T])]) |
[for working $1 fnmatch], |
352 |
AC_CACHE_CHECK( |
[$2], |
353 |
[for working $2 fnmatch], |
[# Some versions of Solaris, SCO, and the GNU C Library |
|
[$3], |
|
|
# Some versions of Solaris, SCO, and the GNU C Library |
|
354 |
# have a broken or incompatible fnmatch. |
# have a broken or incompatible fnmatch. |
355 |
# So we run a test program. If we are cross-compiling, take no chance. |
# So we run a test program. If we are cross-compiling, take no chance. |
356 |
# Thanks to John Oleynick, Franc,ois Pinard, and Paul Eggert for this test. |
# Thanks to John Oleynick, Franc,ois Pinard, and Paul Eggert for this test. |
357 |
[AC_RUN_IFELSE( |
AC_RUN_IFELSE( |
358 |
[AC_LANG_PROGRAM( |
[AC_LANG_PROGRAM( |
359 |
[#include <fnmatch.h> |
[#include <fnmatch.h> |
360 |
# define y(a, b, c) (fnmatch (a, b, c) == 0) |
# define y(a, b, c) (fnmatch (a, b, c) == 0) |
361 |
# define n(a, b, c) (fnmatch (a, b, c) == FNM_NOMATCH)], |
# define n(a, b, c) (fnmatch (a, b, c) == FNM_NOMATCH) |
362 |
|
], |
363 |
[exit |
[exit |
364 |
(!(y ("a*", "abc", 0) |
(!(y ("a*", "abc", 0) |
365 |
&& n ("d*/*1", "d/s/1", FNM_PATHNAME) |
&& n ("d*/*1", "d/s/1", FNM_PATHNAME) |
367 |
&& n ("a\\\\bc", "abc", FNM_NOESCAPE) |
&& n ("a\\\\bc", "abc", FNM_NOESCAPE) |
368 |
&& y ("*x", ".x", 0) |
&& y ("*x", ".x", 0) |
369 |
&& n ("*x", ".x", FNM_PERIOD) |
&& n ("*x", ".x", FNM_PERIOD) |
370 |
&& m4_if([$2], [GNU], |
&& m4_if([$1], [GNU], |
371 |
[y ("xxXX", "xXxX", FNM_CASEFOLD) |
[y ("xxXX", "xXxX", FNM_CASEFOLD) |
372 |
&& y ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH) |
&& y ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH) |
373 |
&& n ("d*/*1", "d/s/1", FNM_FILE_NAME) |
&& n ("d*/*1", "d/s/1", FNM_FILE_NAME) |
375 |
&& y ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR) |
&& y ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR) |
376 |
&& y ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR)], |
&& y ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR)], |
377 |
1)));])], |
1)));])], |
378 |
[$3=yes], |
[$2=yes], |
379 |
[$3=no], |
[$2=no], |
380 |
[$3=cross])]) |
[$2=cross])]) |
381 |
if test $$3 = yes; then |
AS_IF([test $$2 = yes], [$3], [$4]) |
382 |
m4_ifval([$1], [rm -f $1/fnmatch.h]) |
])# _AC_FUNC_FNMATCH_IF |
|
AC_DEFINE([$4], 1, |
|
|
[Define to 1 if your system has a working $2 `fnmatch' function.]) |
|
|
else |
|
|
m4_ifval([$1], |
|
|
[AC_CHECK_DECLS([getenv]) |
|
|
AC_CHECK_FUNCS(mbsrtowcs mempcpy wmempcpy) |
|
|
AC_CHECK_HEADERS(wchar.h wctype.h) |
|
|
AC_LIBOBJ(fnmatch) |
|
|
AC_CONFIG_LINKS([$1/fnmatch.h:$1/fnmatch_.h]) |
|
|
AC_DEFINE(fnmatch, rpl_fnmatch, |
|
|
[Define to rpl_fnmatch if the replacement function should be used.]) |
|
|
], |
|
|
[:]) |
|
|
fi |
|
|
])# _AC_FUNC_FNMATCH |
|
383 |
|
|
384 |
# AC_FUNC_FNMATCH([DIR]) |
|
385 |
# ---------------------- |
# AC_FUNC_FNMATCH |
386 |
|
# --------------- |
387 |
AC_DEFUN([AC_FUNC_FNMATCH], |
AC_DEFUN([AC_FUNC_FNMATCH], |
388 |
[_AC_FUNC_FNMATCH([$1], [POSIX], [ac_cv_func_fnmatch_works], [HAVE_FNMATCH])]) |
[_AC_FUNC_FNMATCH_IF([POSIX], [ac_cv_func_fnmatch_works], |
389 |
|
[AC_DEFINE([HAVE_FNMATCH], 1, |
390 |
|
[Define to 1 if your system has a working POSIX `fnmatch' |
391 |
|
function.])]) |
392 |
|
])# AC_FUNC_FNMATCH |
393 |
|
|
394 |
|
|
395 |
# AC_FUNC_FNMATCH_GNU([DIR]) |
# AC_FUNC_FNMATCH_GNU |
396 |
# -------------------------- |
# ------------------- |
397 |
AC_DEFUN([AC_FUNC_FNMATCH_GNU], |
AC_DEFUN([AC_FUNC_FNMATCH_GNU], |
398 |
[AC_REQUIRE([AC_GNU_SOURCE]) |
[AC_REQUIRE([AC_GNU_SOURCE]) |
399 |
_AC_FUNC_FNMATCH([$1], [GNU], [ac_cv_func_fnmatch_gnu], [HAVE_FNMATCH_GNU])]) |
_AC_FUNC_FNMATCH_IF([GNU], [ac_cv_func_fnmatch_gnu], |
400 |
|
[AC_DEFINE([HAVE_FNMATCH], 1, |
401 |
|
[Define to 1 if your system has a working GNU `fnmatch' |
402 |
|
function.])]) |
403 |
|
])# AC_FUNC_FNMATCH_GNU |
404 |
|
|
405 |
|
|
406 |
|
# _AC_LIBOBJ_FNMATCH |
407 |
|
# ------------------ |
408 |
|
# Prepare the replacement of fnmatch. |
409 |
|
AC_DEFUN([_AC_LIBOBJ_FNMATCH], |
410 |
|
[AC_REQUIRE([AC_C_CONST])dnl |
411 |
|
AC_REQUIRE([AC_FUNC_ALLOCA])dnl |
412 |
|
AC_REQUIRE([AC_TYPE_MBSTATE_T])dnl |
413 |
|
AC_CHECK_DECLS([getenv]) |
414 |
|
AC_CHECK_FUNCS([mbsrtowcs mempcpy wmempcpy]) |
415 |
|
AC_CHECK_HEADERS([wchar.h wctype.h]) |
416 |
|
AC_LIBOBJ([fnmatch]) |
417 |
|
AC_CONFIG_LINKS([$ac_config_libobj_dir/fnmatch.h:$ac_config_libobj_dir/fnmatch_.h]) |
418 |
|
AC_DEFINE(fnmatch, rpl_fnmatch, |
419 |
|
[Define to rpl_fnmatch if the replacement function should be used.]) |
420 |
|
])# _AC_LIBOBJ_FNMATCH |
421 |
|
|
422 |
|
|
423 |
|
# AC_REPLACE_FUNC_FNMATCH |
424 |
|
# ----------------------- |
425 |
|
AC_DEFUN([AC_REPLACE_FUNC_FNMATCH], |
426 |
|
[_AC_FUNC_FNMATCH_IF([POSIX], [ac_cv_func_fnmatch_works], |
427 |
|
[rm -f $ac_config_libobj_dir/fnmatch.h], |
428 |
|
[_AC_LIBOBJ_FNMATCH]) |
429 |
|
])# AC_REPLACE_FUNC_FNMATCH |
430 |
|
|
431 |
|
|
432 |
|
# AC_REPLACE_FUNC_FNMATCH_GNU |
433 |
|
# --------------------------- |
434 |
|
AC_DEFUN([AC_REPLACE_FNMATCH_GNU], |
435 |
|
[AC_REQUIRE([AC_GNU_SOURCE]) |
436 |
|
_AC_FUNC_FNMATCH_IF([GNU], [ac_cv_func_fnmatch_gnu], |
437 |
|
[rm -f $ac_config_libobj_dir/fnmatch.h], |
438 |
|
[_AC_LIBOBJ_FNMATCH]) |
439 |
|
])# AC_REPLACE_FUNC_FNMATCH_GNU |
440 |
|
|
441 |
|
|
442 |
# AU::AM_FUNC_FNMATCH |
# AU::AM_FUNC_FNMATCH |
443 |
# AU::fp_FUNC_FNMATCH |
# AU::fp_FUNC_FNMATCH |
563 |
AC_DEFUN([AC_FUNC_GETLOADAVG], |
AC_DEFUN([AC_FUNC_GETLOADAVG], |
564 |
[ac_have_func=no # yes means we've found a way to get the load average. |
[ac_have_func=no # yes means we've found a way to get the load average. |
565 |
|
|
|
# The directory to find getloadavg.c in. |
|
|
ac_lib_dir_getloadavg=$srcdir[]m4_ifval([$1], [/$1]) |
|
|
|
|
566 |
# Make sure getloadavg.c is where it belongs, at configure-time. |
# Make sure getloadavg.c is where it belongs, at configure-time. |
567 |
test -f "$ac_lib_dir_getloadavg/getloadavg.c" || |
test -f "$ac_config_libobj_dir/getloadavg.c" || |
568 |
AC_MSG_ERROR([$ac_lib_dir_getloadavg/getloadavg.c is missing]) |
AC_MSG_ERROR([$ac_config_libobj_dir/getloadavg.c is missing]) |
|
# FIXME: Add an autoconf-time test, too? |
|
569 |
|
|
570 |
ac_save_LIBS=$LIBS |
ac_save_LIBS=$LIBS |
571 |
|
|
611 |
AC_CACHE_CHECK(whether getloadavg requires setgid, |
AC_CACHE_CHECK(whether getloadavg requires setgid, |
612 |
ac_cv_func_getloadavg_setgid, |
ac_cv_func_getloadavg_setgid, |
613 |
[AC_EGREP_CPP([Yowza Am I SETGID yet], |
[AC_EGREP_CPP([Yowza Am I SETGID yet], |
614 |
[#include "$ac_lib_dir_getloadavg/getloadavg.c" |
[#include "$ac_config_libobj_dir/getloadavg.c" |
615 |
#ifdef LDAV_PRIVILEGED |
#ifdef LDAV_PRIVILEGED |
616 |
Yowza Am I SETGID yet |
Yowza Am I SETGID yet |
617 |
@%:@endif], |
@%:@endif], |