⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 functions.m4

📁 autoconf是一个产生可以自动配置源代码包
💻 M4
📖 第 1 页 / 共 5 页
字号:
AN_FUNCTION([strftime], [AC_FUNC_STRFTIME])AC_DEFUN([AC_FUNC_STRFTIME],[AC_CHECK_FUNCS(strftime, [],[# strftime is in -lintl on SCO UNIX.AC_CHECK_LIB(intl, strftime,	     [AC_DEFINE(HAVE_STRFTIME)LIBS="-lintl $LIBS"])])dnl])# AC_FUNC_STRFTIME# AC_FUNC_STRNLEN# ---------------AN_FUNCTION([strnlen], [AC_FUNC_STRNLEN])AC_DEFUN([AC_FUNC_STRNLEN],[AC_CACHE_CHECK([for working strnlen], ac_cv_func_strnlen_working,[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [[#define S "foobar"#define S_LEN (sizeof S - 1)  /* At least one implementation is buggy: that of AIX 4.3 would     give strnlen (S, 1) == 3.  */  int i;  for (i = 0; i < S_LEN + 1; ++i)    {      int expected = i <= S_LEN ? i : S_LEN;      if (strnlen (S, i) != expected)	return 1;    }  return 0;]])],	       [ac_cv_func_strnlen_working=yes],	       [ac_cv_func_strnlen_working=no],	       [ac_cv_func_strnlen_working=no])])test $ac_cv_func_strnlen_working = no && AC_LIBOBJ([strnlen])])# AC_FUNC_STRNLEN# AC_FUNC_SETVBUF_REVERSED# ------------------------AN_FUNCTION([setvbuf], [AC_FUNC_SETVBUF_REVERSED])AC_DEFUN([AC_FUNC_SETVBUF_REVERSED],[AC_REQUIRE([AC_C_PROTOTYPES])dnlAC_CACHE_CHECK(whether setvbuf arguments are reversed,  ac_cv_func_setvbuf_reversed,  [ac_cv_func_setvbuf_reversed=no   AC_LINK_IFELSE(     [AC_LANG_PROGRAM(	[[#include <stdio.h>#	  if PROTOTYPES	   int (setvbuf) (FILE *, int, char *, size_t);#	  endif]],	[[char buf; return setvbuf (stdout, _IOLBF, &buf, 1);]])],     [AC_LINK_IFELSE(	[AC_LANG_PROGRAM(	   [[#include <stdio.h>#	     if PROTOTYPES	      int (setvbuf) (FILE *, int, char *, size_t);#	     endif]],	   [[char buf; return setvbuf (stdout, &buf, _IOLBF, 1);]])],	[# It compiles and links either way, so it must not be declared	 # with a prototype and most likely this is a K&R C compiler.	 # Try running it.	 AC_RUN_IFELSE(	   [AC_LANG_PROGRAM(	      [AC_INCLUDES_DEFAULT],	      [[/* This call has the arguments reversed.		   A reversed system may check and see that the address of buf		   is not _IOLBF, _IONBF, or _IOFBF, and return nonzero.  */		char buf;		if (setvbuf (stdout, _IOLBF, &buf, 1) != 0)		  return 1;		putchar ('\r');		return 0; /* Non-reversed systems SEGV here.  */]])],	   [ac_cv_func_setvbuf_reversed=yes],	   [],	   [[: # Assume setvbuf is not reversed when cross-compiling.]])]	ac_cv_func_setvbuf_reversed=yes)])])if test $ac_cv_func_setvbuf_reversed = yes; then  AC_DEFINE(SETVBUF_REVERSED, 1,	    [Define to 1 if the `setvbuf' function takes the buffering type as	     its second argument and the buffer pointer as the third, as on	     System V before release 3.])fi])# AC_FUNC_SETVBUF_REVERSED# AU::AC_SETVBUF_REVERSED# -----------------------AU_ALIAS([AC_SETVBUF_REVERSED], [AC_FUNC_SETVBUF_REVERSED])# AC_FUNC_STRCOLL# ---------------AN_FUNCTION([strcoll], [AC_FUNC_STRCOLL])AC_DEFUN([AC_FUNC_STRCOLL],[AC_CACHE_CHECK(for working strcoll, ac_cv_func_strcoll_works,[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],  [[return (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, 1,	    [Define to 1 if you have the `strcoll' function and it is properly	     defined.])fi])# AC_FUNC_STRCOLL# AU::AC_STRCOLL# --------------AU_ALIAS([AC_STRCOLL], [AC_FUNC_STRCOLL])# AC_FUNC_UTIME_NULL# ------------------AN_FUNCTION([utime], [AC_FUNC_UTIME_NULL])AC_DEFUN([AC_FUNC_UTIME_NULL],[AC_CACHE_CHECK(whether utime accepts a null argument, ac_cv_func_utime_null,[rm -f conftest.data; >conftest.data# Sequent interprets utime(file, 0) to mean use start of epoch.  Wrong.AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],[[struct stat s, t;  return ! (stat ("conftest.data", &s) == 0	    && utime ("conftest.data", 0) == 0	    && stat ("conftest.data", &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)])if test $ac_cv_func_utime_null = yes; then  AC_DEFINE(HAVE_UTIME_NULL, 1,	    [Define to 1 if `utime(file, NULL)' sets file's timestamp to the	     present.])firm -f conftest.data])# AC_FUNC_UTIME_NULL# AU::AC_UTIME_NULL# -----------------AU_ALIAS([AC_UTIME_NULL], [AC_FUNC_UTIME_NULL])# AC_FUNC_FORK# -------------AN_FUNCTION([fork],  [AC_FUNC_FORK])AN_FUNCTION([vfork], [AC_FUNC_FORK])AC_DEFUN([AC_FUNC_FORK],[AC_REQUIRE([AC_TYPE_PID_T])dnlAC_CHECK_HEADERS(vfork.h)AC_CHECK_FUNCS(fork vfork)if test "x$ac_cv_func_fork" = xyes; then  _AC_FUNC_FORKelse  ac_cv_func_fork_works=$ac_cv_func_forkfiif test "x$ac_cv_func_fork_works" = xcross; then  case $host in    *-*-amigaos* | *-*-msdosdjgpp*)      # Override, as these systems have only a dummy fork() stub      ac_cv_func_fork_works=no      ;;    *)      ac_cv_func_fork_works=yes      ;;  esac  AC_MSG_WARN([result $ac_cv_func_fork_works guessed because of cross compilation])fiac_cv_func_vfork_works=$ac_cv_func_vforkif test "x$ac_cv_func_vfork" = xyes; then  _AC_FUNC_VFORKfi;if test "x$ac_cv_func_fork_works" = xcross; then  ac_cv_func_vfork_works=$ac_cv_func_vfork  AC_MSG_WARN([result $ac_cv_func_vfork_works guessed because of cross compilation])fiif test "x$ac_cv_func_vfork_works" = xyes; then  AC_DEFINE(HAVE_WORKING_VFORK, 1, [Define to 1 if `vfork' works.])else  AC_DEFINE(vfork, fork, [Define as `fork' if `vfork' does not work.])fiif test "x$ac_cv_func_fork_works" = xyes; then  AC_DEFINE(HAVE_WORKING_FORK, 1, [Define to 1 if `fork' works.])fi])# AC_FUNC_FORK# _AC_FUNC_FORK# -------------AC_DEFUN([_AC_FUNC_FORK],  [AC_CACHE_CHECK(for working fork, ac_cv_func_fork_works,    [AC_RUN_IFELSE(      [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],	[	  /* By Ruediger Kuhlmann. */	  return fork () < 0;	])],      [ac_cv_func_fork_works=yes],      [ac_cv_func_fork_works=no],      [ac_cv_func_fork_works=cross])])])# _AC_FUNC_FORK# _AC_FUNC_VFORK# -------------AC_DEFUN([_AC_FUNC_VFORK],[AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works,[AC_RUN_IFELSE([AC_LANG_SOURCE([[/* Thanks to Paul Eggert for this test.  */]AC_INCLUDES_DEFAULT[#include <sys/wait.h>#if HAVE_VFORK_H# include <vfork.h>#endif/* On some sparc systems, changes by the child to local and incoming   argument registers are propagated back to the parent.  The compiler   is told about this with #include <vfork.h>, but some compilers   (e.g. gcc -O) don't grok <vfork.h>.  Test for this by using a   static variable whose address is put into a register that is   clobbered by the vfork.  */static void#ifdef __cplusplussparc_address_test (int arg)# elsesparc_address_test (arg) int arg;#endif{  static pid_t child;  if (!child) {    child = vfork ();    if (child < 0) {      perror ("vfork");      _exit(2);    }    if (!child) {      arg = getpid();      write(-1, "", 0);      _exit (arg);    }  }}intmain (){  pid_t parent = getpid ();  pid_t child;  sparc_address_test (0);  child = vfork ();  if (child == 0) {    /* Here is another test for sparc vfork register problems.  This       test uses lots of local variables, at least as many local       variables as main has allocated so far including compiler       temporaries.  4 locals are enough for gcc 1.40.3 on a Solaris       4.1.3 sparc, but we use 8 to be safe.  A buggy compiler should       reuse the register of parent for one of the local variables,       since it will think that parent can't possibly be used any more       in this routine.  Assigning to the local variable will thus       munge parent in the parent process.  */    pid_t      p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),      p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();    /* Convince the compiler that p..p7 are live; otherwise, it might       use the same hardware register for all 8 local variables.  */    if (p != p1 || p != p2 || p != p3 || p != p4	|| p != p5 || p != p6 || p != p7)      _exit(1);    /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent       from child file descriptors.  If the child closes a descriptor       before it execs or exits, this munges the parent's descriptor       as well.  Test for this by closing stdout in the child.  */    _exit(close(fileno(stdout)) != 0);  } else {    int status;    struct stat st;    while (wait(&status) != child)      ;    return (	 /* Was there some problem with vforking?  */	 child < 0	 /* Did the child fail?  (This shouldn't happen.)  */	 || 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_cv_func_vfork_works=cross])])])# _AC_FUNC_VFORK# AU::AC_FUNC_VFORK# ------------AU_ALIAS([AC_FUNC_VFORK], [AC_FUNC_FORK])# AU::AC_VFORK# ------------AU_ALIAS([AC_VFORK], [AC_FUNC_FORK])# AC_FUNC_VPRINTF# ---------------# Why the heck is that _doprnt does not define HAVE__DOPRNT???# That the logical name!AN_FUNCTION([vfprintf], [AC_FUNC_VPRINTF])AN_FUNCTION([vprintf],  [AC_FUNC_VPRINTF])AN_FUNCTION([vsprintf], [AC_FUNC_VPRINTF])AN_FUNCTION([_doprnt],  [AC_FUNC_VPRINTF])AC_DEFUN([AC_FUNC_VPRINTF],[AC_CHECK_FUNCS(vprintf, [][AC_CHECK_FUNC(_doprnt,	       [AC_DEFINE(HAVE_DOPRNT, 1,			  [Define to 1 if you don't have `vprintf' but do have			  `_doprnt.'])])])])# AU::AC_VPRINTF# --------------AU_ALIAS([AC_VPRINTF], [AC_FUNC_VPRINTF])# AC_FUNC_WAIT3# -------------# Don't bother too hard maintaining this macro, as it's obsoleted.# We don't AU define it, since we don't have any alternative to propose,# any invocation should be removed, and the code adjusted.AN_FUNCTION([wait3], [AC_FUNC_WAIT3])AC_DEFUN([AC_FUNC_WAIT3],[AC_DIAGNOSE([obsolete],[$0: `wait3' has been removed from POSIX.Remove this `AC_FUNC_WAIT3' and adjust your code to use `waitpid' instead.])dnlAC_CACHE_CHECK([for wait3 that fills in rusage],	       [ac_cv_func_wait3_rusage],[AC_RUN_IFELSE([AC_LANG_SOURCE([AC_INCLUDES_DEFAULT[#include <sys/time.h>#include <sys/resource.h>/* HP-UX has wait3 but does not fill in rusage at all.  */intmain (){  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);      break;    case -1: /* What can we do?  */      _exit(0);      break;    default: /* Parent.  */      wait3(&i, 0, &r);      /* Avoid "text file busy" from rm on fast HP-UX machines.  */      sleep(2);      return (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, 1,	    [Define to 1 if you have the `wait3' system call.	     Deprecated, you should no longer depend upon `wait3'.])fi])# AC_FUNC_WAIT3# AU::AC_WAIT3# ------------AU_ALIAS([AC_WAIT3], [AC_FUNC_WAIT3])

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -