📄 functions.m4
字号:
# AC_FUNC_CHOWN# -------------# Determine whether chown accepts arguments of -1 for uid and gid.AN_FUNCTION([chown], [AC_FUNC_CHOWN])AC_DEFUN([AC_FUNC_CHOWN],[AC_REQUIRE([AC_TYPE_UID_T])dnlAC_CHECK_HEADERS(unistd.h)AC_CACHE_CHECK([for working chown], ac_cv_func_chown_works,[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT#include <fcntl.h>],[[ char *f = "conftest.chown"; struct stat before, after; if (creat (f, 0600) < 0) return 1; if (stat (f, &before) < 0) return 1; if (chown (f, (uid_t) -1, (gid_t) -1) == -1) return 1; if (stat (f, &after) < 0) return 1; return ! (before.st_uid == after.st_uid && before.st_gid == after.st_gid);]])], [ac_cv_func_chown_works=yes], [ac_cv_func_chown_works=no], [ac_cv_func_chown_works=no])rm -f conftest.chown])if test $ac_cv_func_chown_works = yes; then AC_DEFINE(HAVE_CHOWN, 1, [Define to 1 if your system has a working `chown' function.])fi])# AC_FUNC_CHOWN# AC_FUNC_CLOSEDIR_VOID# ---------------------# Check whether closedir returns void, and #define CLOSEDIR_VOID in# that case.AN_FUNCTION([closedir], [AC_FUNC_CLOSEDIR_VOID])AC_DEFUN([AC_FUNC_CLOSEDIR_VOID],[AC_REQUIRE([AC_HEADER_DIRENT])dnlAC_CACHE_CHECK([whether closedir returns void], [ac_cv_func_closedir_void],[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT#include <$ac_header_dirent>#ifndef __cplusplusint closedir ();#endif], [[return closedir (opendir (".")) != 0;]])], [ac_cv_func_closedir_void=no], [ac_cv_func_closedir_void=yes], [ac_cv_func_closedir_void=yes])])if test $ac_cv_func_closedir_void = yes; then AC_DEFINE(CLOSEDIR_VOID, 1, [Define to 1 if the `closedir' function returns void instead of `int'.])fi])# AC_FUNC_ERROR_AT_LINE# ---------------------AN_FUNCTION([error], [AC_FUNC_ERROR_AT_LINE])AN_FUNCTION([error_at_line], [AC_FUNC_ERROR_AT_LINE])AC_DEFUN([AC_FUNC_ERROR_AT_LINE],[AC_LIBSOURCES([error.h, error.c])dnlAC_CACHE_CHECK([for error_at_line], ac_cv_lib_error_at_line,[AC_LINK_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [error_at_line (0, 0, "", 0, "");])], [ac_cv_lib_error_at_line=yes], [ac_cv_lib_error_at_line=no])])if test $ac_cv_lib_error_at_line = no; then AC_LIBOBJ(error)fi])# AU::AM_FUNC_ERROR_AT_LINE# -------------------------AU_ALIAS([AM_FUNC_ERROR_AT_LINE], [AC_FUNC_ERROR_AT_LINE])# _AC_FUNC_FNMATCH_IF(STANDARD = GNU | POSIX, CACHE_VAR, IF-TRUE, IF-FALSE)# -------------------------------------------------------------------------# If a STANDARD compliant fnmatch is found, run IF-TRUE, otherwise# IF-FALSE. Use CACHE_VAR.AC_DEFUN([_AC_FUNC_FNMATCH_IF],[AC_CACHE_CHECK( [for working $1 fnmatch], [$2], [# Some versions of Solaris, SCO, and the GNU C Library # have a broken or incompatible fnmatch. # So we run a test program. If we are cross-compiling, take no chance. # Thanks to John Oleynick, Franc,ois Pinard, and Paul Eggert for this test. AC_RUN_IFELSE( [AC_LANG_PROGRAM( [#include <fnmatch.h># define y(a, b, c) (fnmatch (a, b, c) == 0)# define n(a, b, c) (fnmatch (a, b, c) == FNM_NOMATCH) ], [return (!(y ("a*", "abc", 0) && n ("d*/*1", "d/s/1", FNM_PATHNAME) && y ("a\\\\bc", "abc", 0) && n ("a\\\\bc", "abc", FNM_NOESCAPE) && y ("*x", ".x", 0) && n ("*x", ".x", FNM_PERIOD) && m4_if([$1], [GNU], [y ("xxXX", "xXxX", FNM_CASEFOLD) && y ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH) && n ("d*/*1", "d/s/1", FNM_FILE_NAME) && y ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR) && y ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR) && y ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR)], 1)));])], [$2=yes], [$2=no], [$2=cross])])AS_IF([test $$2 = yes], [$3], [$4])])# _AC_FUNC_FNMATCH_IF# AC_FUNC_FNMATCH# ---------------AC_DEFUN([AC_FUNC_FNMATCH],[_AC_FUNC_FNMATCH_IF([POSIX], [ac_cv_func_fnmatch_works], [AC_DEFINE([HAVE_FNMATCH], 1, [Define to 1 if your system has a working POSIX `fnmatch' function.])])])# AC_FUNC_FNMATCH# _AC_LIBOBJ_FNMATCH# ------------------# Prepare the replacement of fnmatch.AC_DEFUN([_AC_LIBOBJ_FNMATCH],[AC_REQUIRE([AC_C_CONST])dnlAC_REQUIRE([AC_FUNC_ALLOCA])dnlAC_REQUIRE([AC_TYPE_MBSTATE_T])dnlAC_CHECK_DECLS([getenv])AC_CHECK_FUNCS([btowc mbsrtowcs mempcpy wmempcpy])AC_CHECK_HEADERS([wchar.h wctype.h])AC_LIBOBJ([fnmatch])AC_CONFIG_LINKS([$ac_config_libobj_dir/fnmatch.h:$ac_config_libobj_dir/fnmatch_.h])AC_DEFINE(fnmatch, rpl_fnmatch, [Define to rpl_fnmatch if the replacement function should be used.])])# _AC_LIBOBJ_FNMATCH# AC_REPLACE_FNMATCH# ------------------AN_FUNCTION([fnmatch], [AC_REPLACE_FNMATCH])AC_DEFUN([AC_REPLACE_FNMATCH],[_AC_FUNC_FNMATCH_IF([POSIX], [ac_cv_func_fnmatch_works], [rm -f "$ac_config_libobj_dir/fnmatch.h"], [_AC_LIBOBJ_FNMATCH])])# AC_REPLACE_FNMATCH# AC_FUNC_FNMATCH_GNU# -------------------AC_DEFUN([AC_FUNC_FNMATCH_GNU],[AC_REQUIRE([AC_GNU_SOURCE])_AC_FUNC_FNMATCH_IF([GNU], [ac_cv_func_fnmatch_gnu], [rm -f "$ac_config_libobj_dir/fnmatch.h"], [_AC_LIBOBJ_FNMATCH])])# AC_FUNC_FNMATCH_GNU# AU::AM_FUNC_FNMATCH# AU::fp_FUNC_FNMATCH# -------------------AU_ALIAS([AM_FUNC_FNMATCH], [AC_FUNC_FNMATCH])AU_ALIAS([fp_FUNC_FNMATCH], [AC_FUNC_FNMATCH])# AC_FUNC_FSEEKO# --------------AN_FUNCTION([ftello], [AC_FUNC_FSEEKO])AN_FUNCTION([fseeko], [AC_FUNC_FSEEKO])AC_DEFUN([AC_FUNC_FSEEKO],[_AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1, [ac_cv_sys_largefile_source], [Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2).], [@%:@include <stdio.h>], [return !fseeko;])# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug# in glibc 2.1.3, but that breaks too many other things.# If you want fseeko and ftello with glibc, upgrade to a fixed glibc.AC_CACHE_CHECK([for fseeko], [ac_cv_func_fseeko],[AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@include <stdio.h>], [[return fseeko && fseeko (stdin, 0, 0);]])], [ac_cv_func_fseeko=yes], [ac_cv_func_fseeko=no])])if test $ac_cv_func_fseeko = yes; then AC_DEFINE(HAVE_FSEEKO, 1, [Define to 1 if fseeko (and presumably ftello) exists and is declared.])fi])# AC_FUNC_FSEEKO# AC_FUNC_GETGROUPS# -----------------# Try to find `getgroups', and check that it works.# When cross-compiling, assume getgroups is broken.AN_FUNCTION([getgroups], [AC_FUNC_GETGROUPS])AC_DEFUN([AC_FUNC_GETGROUPS],[AC_REQUIRE([AC_TYPE_GETGROUPS])dnlAC_REQUIRE([AC_TYPE_SIZE_T])dnlAC_CHECK_FUNC(getgroups)# If we don't yet have getgroups, see if it's in -lbsd.# This is reported to be necessary on an ITOS 3000WS running SEIUX 3.1.ac_save_LIBS=$LIBSif test $ac_cv_func_getgroups = no; then AC_CHECK_LIB(bsd, getgroups, [GETGROUPS_LIB=-lbsd])fi# Run the program to test the functionality of the system-supplied# getgroups function only if there is such a function.if test $ac_cv_func_getgroups = yes; then AC_CACHE_CHECK([for working getgroups], ac_cv_func_getgroups_works, [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [[/* On Ultrix 4.3, getgroups (0, 0) always fails. */ return getgroups (0, 0) == -1;]])], [ac_cv_func_getgroups_works=yes], [ac_cv_func_getgroups_works=no], [ac_cv_func_getgroups_works=no]) ]) if test $ac_cv_func_getgroups_works = yes; then AC_DEFINE(HAVE_GETGROUPS, 1, [Define to 1 if your system has a working `getgroups' function.]) fifiLIBS=$ac_save_LIBS])# AC_FUNC_GETGROUPS# _AC_LIBOBJ_GETLOADAVG# ---------------------# Set up the AC_LIBOBJ replacement of `getloadavg'.m4_define([_AC_LIBOBJ_GETLOADAVG],[AC_LIBOBJ(getloadavg)AC_DEFINE(C_GETLOADAVG, 1, [Define to 1 if using `getloadavg.c'.])# Figure out what our getloadavg.c needs.ac_have_func=noAC_CHECK_HEADER(sys/dg_sys_info.h,[ac_have_func=yes AC_DEFINE(DGUX, 1, [Define to 1 for DGUX with <sys/dg_sys_info.h>.]) AC_CHECK_LIB(dgc, dg_sys_info)])AC_CHECK_HEADER(locale.h)AC_CHECK_FUNCS(setlocale)# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it# uses stabs), but it is still SVR4. We cannot check for <elf.h> because# Irix 4.0.5F has the header but not the library.if test $ac_have_func = no && test "$ac_cv_lib_elf_elf_begin" = yes; then ac_have_func=yes AC_DEFINE(SVR4, 1, [Define to 1 on System V Release 4.])fiif test $ac_have_func = no; then AC_CHECK_HEADER(inq_stats/cpustats.h, [ac_have_func=yes AC_DEFINE(UMAX, 1, [Define to 1 for Encore UMAX.]) AC_DEFINE(UMAX4_3, 1, [Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h> instead of <sys/cpustats.h>.])])fiif test $ac_have_func = no; then AC_CHECK_HEADER(sys/cpustats.h, [ac_have_func=yes; AC_DEFINE(UMAX)])fiif test $ac_have_func = no; then AC_CHECK_HEADERS(mach/mach.h)fiAC_CHECK_HEADERS(nlist.h,[AC_CHECK_MEMBERS([struct nlist.n_un.n_name], [AC_DEFINE(NLIST_NAME_UNION, 1, [Define to 1 if your `struct nlist' has an `n_un' member. Obsolete, depend on `HAVE_STRUCT_NLIST_N_UN_N_NAME])], [], [@%:@include <nlist.h>])])dnl])# _AC_LIBOBJ_GETLOADAVG# AC_FUNC_GETLOADAVG# ------------------AN_FUNCTION([getloadavg], [AC_FUNC_GETLOADAVG])AC_DEFUN([AC_FUNC_GETLOADAVG],[ac_have_func=no # yes means we've found a way to get the load average.# Make sure getloadavg.c is where it belongs, at configure-time.test -f "$srcdir/$ac_config_libobj_dir/getloadavg.c" || AC_MSG_ERROR([$srcdir/$ac_config_libobj_dir/getloadavg.c is missing])ac_save_LIBS=$LIBS# Check for getloadavg, but be sure not to touch the cache variable.(AC_CHECK_FUNC(getloadavg, exit 0, exit 1)) && ac_have_func=yes# On HPUX9, an unprivileged user can get load averages through this function.AC_CHECK_FUNCS(pstat_getdynamic)# Solaris has libkstat which does not require root.AC_CHECK_LIB(kstat, kstat_open)test $ac_cv_lib_kstat_kstat_open = yes && ac_have_func=yes# Some systems with -lutil have (and need) -lkvm as well, some do not.# On Solaris, -lkvm requires nlist from -lelf, so check that first# to get the right answer into the cache.# For kstat on solaris, we need libelf to force the definition of SVR4 below.if test $ac_have_func = no; then AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS")fiif test $ac_have_func = no; then AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS") # Check for the 4.4BSD definition of getloadavg. AC_CHECK_LIB(util, getloadavg, [LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes])fiif test $ac_have_func = no; then # There is a commonly available library for RS/6000 AIX. # Since it is not a standard part of AIX, it might be installed locally. ac_getloadavg_LIBS=$LIBS LIBS="-L/usr/local/lib $LIBS" AC_CHECK_LIB(getloadavg, getloadavg, [LIBS="-lgetloadavg $LIBS"], [LIBS=$ac_getloadavg_LIBS])fi# Make sure it is really in the library, if we think we found it,# otherwise set up the replacement function.AC_CHECK_FUNCS(getloadavg, [], [_AC_LIBOBJ_GETLOADAVG])# Some definitions of getloadavg require that the program be installed setgid.AC_CACHE_CHECK(whether getloadavg requires setgid, ac_cv_func_getloadavg_setgid,[AC_EGREP_CPP([Yowza Am I SETGID yet],[#include "$srcdir/$ac_config_libobj_dir/getloadavg.c"#ifdef LDAV_PRIVILEGEDYowza Am I SETGID yet@%:@endif], ac_cv_func_getloadavg_setgid=yes, ac_cv_func_getloadavg_setgid=no)])if test $ac_cv_func_getloadavg_setgid = yes; then NEED_SETGID=true AC_DEFINE(GETLOADAVG_PRIVILEGED, 1, [Define to 1 if the `getloadavg' function needs to be run setuid or setgid.])else NEED_SETGID=falsefiAC_SUBST(NEED_SETGID)dnlif test $ac_cv_func_getloadavg_setgid = yes; then AC_CACHE_CHECK(group of /dev/kmem, ac_cv_group_kmem,[ # On Solaris, /dev/kmem is a symlink. Get info on the real file. ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null` # If we got an error (system does not support symlinks), try without -L. test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem` ac_cv_group_kmem=`echo $ac_ls_output \ | sed -ne ['s/[ ][ ]*/ /g; s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/; / /s/.* //;p;']`]) AC_SUBST(KMEM_GROUP, $ac_cv_group_kmem)dnlfiif test "x$ac_save_LIBS" = x; then GETLOADAVG_LIBS=$LIBSelse GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$ac_save_LIBS!!"`fiLIBS=$ac_save_LIBSAC_SUBST(GETLOADAVG_LIBS)dnl])# AC_FUNC_GETLOADAVG# AU::AC_GETLOADAVG# -----------------AU_ALIAS([AC_GETLOADAVG], [AC_FUNC_GETLOADAVG])# AC_FUNC_GETMNTENT# -----------------AN_FUNCTION([getmntent], [AC_FUNC_GETMNTENT])AC_DEFUN([AC_FUNC_GETMNTENT],[# getmntent is in the standard C library on UNICOS, in -lsun on Irix 4,# -lseq on Dynix/PTX, -lgen on Unixware.AC_SEARCH_LIBS(getmntent, [sun seq gen])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -