📄 acspecific.m4
字号:
|| status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); }}],ac_cv_func_vfork_works=yes, ac_cv_func_vfork_works=no, AC_CHECK_FUNC(vfork)ac_cv_func_vfork_works=$ac_cv_func_vfork)])if test $ac_cv_func_vfork_works = no; then AC_DEFINE(vfork, fork)fi])AC_DEFUN(AC_FUNC_WAIT3,[AC_CACHE_CHECK(for wait3 that fills in rusage, ac_cv_func_wait3_rusage,[AC_TRY_RUN([#include <sys/types.h>#include <sys/time.h>#include <sys/resource.h>#include <stdio.h>/* HP-UX has wait3 but does not fill in rusage at all. */main() { struct rusage r; int i; /* Use a field that we can force nonzero -- voluntary context switches. For systems like NeXT and OSF/1 that don't set it, also use the system CPU time. And page faults (I/O) for Linux. */ r.ru_nvcsw = 0; r.ru_stime.tv_sec = 0; r.ru_stime.tv_usec = 0; r.ru_majflt = r.ru_minflt = 0; switch (fork()) { case 0: /* Child. */ sleep(1); /* Give up the CPU. */ _exit(0); case -1: _exit(0); /* What can we do? */ default: /* Parent. */ wait3(&i, 0, &r); sleep(2); /* Avoid "text file busy" from rm on fast HP-UX machines. */ exit(r.ru_nvcsw == 0 && r.ru_majflt == 0 && r.ru_minflt == 0 && r.ru_stime.tv_sec == 0 && r.ru_stime.tv_usec == 0); }}], ac_cv_func_wait3_rusage=yes, ac_cv_func_wait3_rusage=no,ac_cv_func_wait3_rusage=no)])if test $ac_cv_func_wait3_rusage = yes; then AC_DEFINE(HAVE_WAIT3)fi])AC_DEFUN(AC_FUNC_ALLOCA,[AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally.# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works# for constant arguments. Useless!AC_CACHE_CHECK([for working alloca.h], ac_cv_header_alloca_h,[AC_TRY_LINK([#include <alloca.h>], [char *p = alloca(2 * sizeof(int));], ac_cv_header_alloca_h=yes, ac_cv_header_alloca_h=no)])if test $ac_cv_header_alloca_h = yes; then AC_DEFINE(HAVE_ALLOCA_H)fiAC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works,[AC_TRY_LINK([#ifdef __GNUC__# define alloca __builtin_alloca#else# ifdef _MSC_VER# include <malloc.h># define alloca _alloca# else# if HAVE_ALLOCA_H# include <alloca.h># else# ifdef _AIX #pragma alloca# else# ifndef alloca /* predefined by HP cc +Olibcalls */char *alloca ();# endif# endif# endif# endif#endif], [char *p = (char *) alloca(1);], ac_cv_func_alloca_works=yes, ac_cv_func_alloca_works=no)])if test $ac_cv_func_alloca_works = yes; then AC_DEFINE(HAVE_ALLOCA)fiif test $ac_cv_func_alloca_works = no; then # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=alloca.${ac_objext} AC_DEFINE(C_ALLOCA)AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray,[AC_EGREP_CPP(webecray,[#if defined(CRAY) && ! defined(CRAY2)webecray#elsewenotbecray#endif], ac_cv_os_cray=yes, ac_cv_os_cray=no)])if test $ac_cv_os_cray = yes; thenfor ac_func in _getb67 GETB67 getb67; do AC_CHECK_FUNC($ac_func, [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func) break])donefiAC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,[AC_TRY_RUN([find_stack_direction (){ static char *addr = 0; auto char dummy; if (addr == 0) { addr = &dummy; return find_stack_direction (); } else return (&dummy > addr) ? 1 : -1;}main (){ exit (find_stack_direction() < 0);}], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1, ac_cv_c_stack_direction=0)])AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)fiAC_SUBST(ALLOCA)dnl])AC_DEFUN(AC_FUNC_GETLOADAVG,[ac_have_func=no # yes means we've found a way to get the load average.# 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.AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS")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])if 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.AC_REPLACE_FUNCS(getloadavg)if test $ac_cv_func_getloadavg = yes; then AC_DEFINE(HAVE_GETLOADAVG) ac_have_func=yeselse # Figure out what our getloadavg.c needs. ac_have_func=no AC_CHECK_HEADER(sys/dg_sys_info.h, [ac_have_func=yes; AC_DEFINE(DGUX) AC_CHECK_LIB(dgc, dg_sys_info)]) # 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) fi if test $ac_have_func = no; then AC_CHECK_HEADER(inq_stats/cpustats.h, [ac_have_func=yes; AC_DEFINE(UMAX) AC_DEFINE(UMAX4_3)]) fi if test $ac_have_func = no; then AC_CHECK_HEADER(sys/cpustats.h, [ac_have_func=yes; AC_DEFINE(UMAX)]) fi if test $ac_have_func = no; then AC_CHECK_HEADERS(mach/mach.h) fi AC_CHECK_HEADER(nlist.h, [AC_DEFINE(NLIST_STRUCT) AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un, [AC_TRY_COMPILE([#include <nlist.h>], [struct nlist n; n.n_un.n_name = 0;], ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)]) if test $ac_cv_struct_nlist_n_un = yes; then AC_DEFINE(NLIST_NAME_UNION) fi ])dnlfi # Do not have getloadavg in system libraries.# Some definitions of getloadavg require that the program be installed setgid.dnl FIXME Don't hardwire the path of getloadavg.c in the top-level directory.AC_CACHE_CHECK(whether getloadavg requires setgid, ac_cv_func_getloadavg_setgid,[AC_EGREP_CPP([Yowza Am I SETGID yet],[#include "$srcdir/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)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,[changequote(, )dnl # 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;'`changequote([, ])dnl]) KMEM_GROUP=$ac_cv_group_kmemfiAC_SUBST(KMEM_GROUP)dnl])AC_DEFUN(AC_FUNC_UTIME_NULL,[AC_CACHE_CHECK(whether utime accepts a null argument, ac_cv_func_utime_null,[rm -f conftestdata; > conftestdata# Sequent interprets utime(file, 0) to mean use start of epoch. Wrong.AC_TRY_RUN([#include <sys/types.h>#include <sys/stat.h>main() {struct stat s, t;exit(!(stat ("conftestdata", &s) == 0 && utime("conftestdata", (long *)0) == 0&& stat("conftestdata", &t) == 0 && t.st_mtime >= s.st_mtime&& t.st_mtime - s.st_mtime < 120));}], ac_cv_func_utime_null=yes, ac_cv_func_utime_null=no, ac_cv_func_utime_null=no)rm -f core core.* *.core])if test $ac_cv_func_utime_null = yes; then AC_DEFINE(HAVE_UTIME_NULL)fi])AC_DEFUN(AC_FUNC_STRCOLL,[AC_CACHE_CHECK(for working strcoll, ac_cv_func_strcoll_works,[AC_TRY_RUN([#include <string.h>main (){ exit (strcoll ("abc", "def") >= 0 || strcoll ("ABC", "DEF") >= 0 || strcoll ("123", "456") >= 0);}], ac_cv_func_strcoll_works=yes, ac_cv_func_strcoll_works=no,ac_cv_func_strcoll_works=no)])if test $ac_cv_func_strcoll_works = yes; then AC_DEFINE(HAVE_STRCOLL)fi])AC_DEFUN(AC_FUNC_SETVBUF_REVERSED,[AC_CACHE_CHECK(whether setvbuf arguments are reversed, ac_cv_func_setvbuf_reversed,[AC_TRY_RUN([#include <stdio.h>/* If setvbuf has the reversed format, exit 0. */main () { /* This call has the arguments reversed. A reversed system may check and see that the address of main is not _IOLBF, _IONBF, or _IOFBF, and return nonzero. */ if (setvbuf(stdout, _IOLBF, (char *) main, BUFSIZ) != 0) exit(1); putc('\r', stdout); exit(0); /* Non-reversed systems segv here. */}], ac_cv_func_setvbuf_reversed=yes, ac_cv_func_setvbuf_reversed=no)rm -f core core.* *.core])if test $ac_cv_func_setvbuf_reversed = yes; then AC_DEFINE(SETVBUF_REVERSED)fi])AC_DEFUN(AC_FUNC_GETMNTENT,[# getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX, -lgen on Unixware.AC_CHECK_LIB(sun, getmntent, LIBS="-lsun $LIBS", [AC_CHECK_LIB(seq, getmntent, LIBS="-lseq $LIBS", [AC_CHECK_LIB(gen, getmntent, LIBS="-lgen $LIBS")])])AC_CHECK_FUNC(getmntent, [AC_DEFINE(HAVE_GETMNTENT)])])AC_DEFUN(AC_FUNC_STRFTIME,[AC_CHECK_FUNC(strftime, [AC_DEFINE(HAVE_STRFTIME)],[# strftime is in -lintl on SCO UNIX.AC_CHECK_LIB(intl, strftime, [AC_DEFINE(HAVE_STRFTIME)LIBS="-lintl $LIBS"])])])AC_DEFUN(AC_FUNC_MEMCMP,[AC_CACHE_CHECK(for 8-bit clean memcmp, ac_cv_func_memcmp_clean,[AC_TRY_RUN([main(){ char c0 = 0x40, c1 = 0x80, c2 = 0x81; exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);}], ac_cv_func_memcmp_clean=yes, ac_cv_func_memcmp_clean=no,ac_cv_func_memcmp_clean=no)])test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"AC_SUBST(LIBOBJS)dnl])AC_DEFUN(AC_FUNC_SELECT_ARGTYPES,[AC_MSG_CHECKING([types of arguments for select()]) AC_CACHE_VAL(ac_cv_func_select_arg234,dnl [AC_CACHE_VAL(ac_cv_func_select_arg1,dnl [AC_CACHE_VAL(ac_cv_func_select_arg5,dnl [for ac_cv_func_select_arg234 in 'fd_set *' 'int *' 'void *'; do for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do AC_TRY_COMPILE(dnl[#ifdef HAVE_SYS_TYPES_H#include <sys/types.h>#endif#ifdef HAVE_SYS_TIME_H#include <sys/time.h>#endif#ifdef HAVE_SYS_SELECT_H#include <sys/select.h>#endif#ifdef HAVE_SYS_SOCKET_H#include <sys/socket.h>#endifextern select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5);],,dnl [ac_not_found=no ; break 3],ac_not_found=yes) done done done ])dnl AC_CACHE_VAL ])dnl AC_CACHE_VAL ])dnl AC_CACHE_VAL if test "$ac_not_found" = yes; then ac_cv_func_select_arg1=int ac_cv_func_select_arg234='int *' ac_cv_func_select_arg5='struct timeval *' fi AC_MSG_RESULT([$ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5]) AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1,$ac_cv_func_select_arg1) AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234,($ac_cv_func_select_arg234)) AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5,($ac_cv_func_select_arg5))])dnl ### Checks for structure membersAC_DEFUN(AC_HEADER_TIME,[AC_CACHE_CHECK([whether time.h and sys/time.h may both be included], ac_cv_header_time,[AC_TRY_COMPILE([#include <sys/types.h>#include <sys/time.h>#include <time.h>],[struct tm *tp;], ac_cv_header_time=yes, ac_cv_header_time=no)])if test $ac_cv_header_time = yes; then AC_DEFINE(TIME_WITH_SYS_TIME)fi])AC_DEFUN(AC_STRUCT_TM,[AC_CACHE_CHECK([whether struct tm is in sys/time.h or time.h], ac_cv_struct_tm,[AC_TRY_COMPILE([#include <sys/types.h>#include <time.h>],[struct tm *tp; tp->tm_sec;], ac_cv_struct_tm=time.h, ac_cv_struct_tm=sys/time.h)])if test $ac_cv_struct_tm = sys/time.h; then AC_DEFINE(TM_IN_SYS_TIME)fi])AC_DEFUN(AC_STRUCT_TIMEZONE,[AC_REQUIRE([AC_STRUCT_TM])dnlAC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone,[AC_TRY_COMPILE([#include <sys/types.h>#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;], ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])if test "$ac_cv_struct_tm_zone" = yes; then AC_DEFINE(HAVE_TM_ZONE)else AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,[AC_TRY_LINK(changequote(<<, >>)dnl<<#include <time.h>#ifndef tzname /* For SGI. */extern char *tzname[]; /* RS6000 and others reject char **tzname. */#endif>>,changequote([, ])dnl[atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)]) if test $ac_cv_var_tzname = yes; then AC_DEFINE(HAVE_TZNAME) fifi])AC_DEFUN(AC_STRUCT_ST_BLOCKS,[AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks,[AC_TRY_COMPILE([#include <sys/types.h>#include <sys/stat.h>], [struct stat s; s.st_blocks;],ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])if test $ac_cv_struct_st_blocks = yes; then AC_DEFINE(HAVE_ST_BLOCKS)else LIBOBJS="$LIBOBJS fileblocks.${ac_objext}"fiAC_SUBST(LIBOBJS)dnl])AC_DEFUN(AC_STRUCT_ST_BLKSIZE,[AC_CACHE_CHECK([for st_blksize in struct stat], ac_cv_struct_st_blksize,[AC_TRY_COMPILE([#include <sys/types.h>#include <sys/stat.h>], [struct stat s; s.st_blksize;],ac_cv_struct_st_blksize=yes, ac_cv_struct_st_blksize=no)])if test $ac_cv_struct_st_blksize = yes; then AC_DEFINE(HAVE_ST_BLKSIZE)fi])AC_DEFUN(AC_STRUCT_ST_RDEV,[AC_CACHE_CHECK([for st_rdev in struct stat], ac_cv_struct_st_rdev,[AC_TRY_COMPILE([#include <sys/types.h>#include <sys/stat.h>], [struct stat s; s.st_rdev;],ac_cv_struct_st_rdev=yes, ac_cv_struct_st_rdev=no)])if test $ac_cv_struct_st_rdev = yes; then AC_DEFINE(HAVE_ST_RDEV)fi])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -