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

📄 functions.m4

📁 autoconf 2.59版,可用于redhat系统.用于编译原码,编写makefile文件.
💻 M4
📖 第 1 页 / 共 5 页
字号:
#     endif /* no CLSIZE */#    else /* no NBPG */#     ifdef NBPC#      define getpagesize() NBPC#     else /* no NBPC */#      ifdef PAGESIZE#       define getpagesize() PAGESIZE#      endif /* PAGESIZE */#     endif /* no NBPC */#    endif /* no NBPG */#   endif /* no EXEC_PAGESIZE */#  else /* no HAVE_SYS_PARAM_H */#   define getpagesize() 8192	/* punt totally */#  endif /* no HAVE_SYS_PARAM_H */# endif /* no _SC_PAGESIZE */#endif /* no HAVE_GETPAGESIZE */intmain (){  char *data, *data2, *data3;  int i, pagesize;  int fd;  pagesize = getpagesize ();  /* First, make a file with some known garbage in it. */  data = (char *) malloc (pagesize);  if (!data)    exit (1);  for (i = 0; i < pagesize; ++i)    *(data + i) = rand ();  umask (0);  fd = creat ("conftest.mmap", 0600);  if (fd < 0)    exit (1);  if (write (fd, data, pagesize) != pagesize)    exit (1);  close (fd);  /* Next, try to mmap the file at a fixed address which already has     something else allocated at it.  If we can, also make sure that     we see the same garbage.  */  fd = open ("conftest.mmap", O_RDWR);  if (fd < 0)    exit (1);  data2 = (char *) malloc (2 * pagesize);  if (!data2)    exit (1);  data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1);  if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,		     MAP_PRIVATE | MAP_FIXED, fd, 0L))    exit (1);  for (i = 0; i < pagesize; ++i)    if (*(data + i) != *(data2 + i))      exit (1);  /* Finally, make sure that changes to the mapped area do not     percolate back to the file as seen by read().  (This is a bug on     some variants of i386 svr4.0.)  */  for (i = 0; i < pagesize; ++i)    *(data2 + i) = *(data2 + i) + 1;  data3 = (char *) malloc (pagesize);  if (!data3)    exit (1);  if (read (fd, data3, pagesize) != pagesize)    exit (1);  for (i = 0; i < pagesize; ++i)    if (*(data + i) != *(data3 + i))      exit (1);  close (fd);  exit (0);}]])],	       [ac_cv_func_mmap_fixed_mapped=yes],	       [ac_cv_func_mmap_fixed_mapped=no],	       [ac_cv_func_mmap_fixed_mapped=no])])if test $ac_cv_func_mmap_fixed_mapped = yes; then  AC_DEFINE(HAVE_MMAP, 1,	    [Define to 1 if you have a working `mmap' system call.])firm -f conftest.mmap])# AC_FUNC_MMAP# AU::AC_MMAP# -----------AU_ALIAS([AC_MMAP], [AC_FUNC_MMAP])# AC_FUNC_OBSTACK# ---------------# Ensure obstack support.  Yeah, this is not exactly a `FUNC' check.AN_FUNCTION([obstack_init], [AC_FUNC_OBSTACK])AN_IDENTIFIER([obstack],    [AC_FUNC_OBSTACK])AC_DEFUN([AC_FUNC_OBSTACK],[AC_LIBSOURCES([obstack.h, obstack.c])dnlAC_CACHE_CHECK([for obstacks], ac_cv_func_obstack,[AC_LINK_IFELSE(    [AC_LANG_PROGRAM([[@%:@include "obstack.h"]],		     [[struct obstack *mem; obstack_free(mem,(char *) 0)]])],		[ac_cv_func_obstack=yes],		[ac_cv_func_obstack=no])])if test $ac_cv_func_obstack = yes; then  AC_DEFINE(HAVE_OBSTACK, 1, [Define to 1 if libc includes obstacks.])else  AC_LIBOBJ(obstack)fi])# AC_FUNC_OBSTACK# AU::AM_FUNC_OBSTACK# -------------------AU_ALIAS([AM_FUNC_OBSTACK], [AC_FUNC_OBSTACK])# _AC_FUNC_REALLOC_IF(IF-WORKS, IF-NOT)# -------------------------------------# If `realloc (0, 0)' properly handled, run IF-WORKS, otherwise, IF-NOT.AC_DEFUN([_AC_FUNC_REALLOC_IF],[AC_REQUIRE([AC_HEADER_STDC])dnlAC_CHECK_HEADERS(stdlib.h)AC_CACHE_CHECK([for GNU libc compatible realloc], ac_cv_func_realloc_0_nonnull,[AC_RUN_IFELSE([AC_LANG_PROGRAM([[#if STDC_HEADERS || HAVE_STDLIB_H# include <stdlib.h>#elsechar *realloc ();#endif]],		 [exit (realloc (0, 0) ? 0 : 1);])],	       [ac_cv_func_realloc_0_nonnull=yes],	       [ac_cv_func_realloc_0_nonnull=no],	       [ac_cv_func_realloc_0_nonnull=no])])AS_IF([test $ac_cv_func_realloc_0_nonnull = yes], [$1], [$2])])# AC_FUNC_REALLOC# AC_FUNC_REALLOC# ---------------# Report whether `realloc (0, 0)' properly handled, and replace realloc if# needed.AN_FUNCTION([realloc], [AC_FUNC_REALLOC])AC_DEFUN([AC_FUNC_REALLOC],[_AC_FUNC_REALLOC_IF(  [AC_DEFINE([HAVE_REALLOC], 1,	     [Define to 1 if your system has a GNU libc compatible `realloc'	      function, and to 0 otherwise.])],  [AC_DEFINE([HAVE_REALLOC], 0)   AC_LIBOBJ([realloc])   AC_DEFINE([realloc], [rpl_realloc],      [Define to rpl_realloc if the replacement function should be used.])])])# AC_FUNC_REALLOC# AC_FUNC_SELECT_ARGTYPES# -----------------------# Determine the correct type to be passed to each of the `select'# function's arguments, and define those types in `SELECT_TYPE_ARG1',# `SELECT_TYPE_ARG234', and `SELECT_TYPE_ARG5'.AN_FUNCTION([select], [AC_FUNC_SELECT_ARGTYPES])AC_DEFUN([AC_FUNC_SELECT_ARGTYPES],[AC_CHECK_HEADERS(sys/select.h sys/socket.h)AC_CACHE_CHECK([types of arguments for select],[ac_cv_func_select_args],[for ac_arg234 in 'fd_set *' 'int *' 'void *'; do for ac_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do  for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do   AC_COMPILE_IFELSE(       [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT#if HAVE_SYS_SELECT_H# include <sys/select.h>#endif#if HAVE_SYS_SOCKET_H# include <sys/socket.h>#endif],			[extern int select ($ac_arg1,					    $ac_arg234, $ac_arg234, $ac_arg234,					    $ac_arg5);])],	      [ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3])  done donedone# Provide a safe default value.: ${ac_cv_func_select_args='int,int *,struct timeval *'}])ac_save_IFS=$IFS; IFS=','set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'`IFS=$ac_save_IFSshiftAC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $[1],		   [Define to the type of arg 1 for `select'.])AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, ($[2]),		   [Define to the type of args 2, 3 and 4 for `select'.])AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, ($[3]),		   [Define to the type of arg 5 for `select'.])rm -f conftest*])# AC_FUNC_SELECT_ARGTYPES# AC_FUNC_SETPGRP# ---------------AN_FUNCTION([setpgrp], [AC_FUNC_SETPGRP])AC_DEFUN([AC_FUNC_SETPGRP],[AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void,[AC_RUN_IFELSE([AC_LANG_PROGRAM([#if HAVE_UNISTD_H# include <unistd.h>#endif],[/* If this system has a BSD-style setpgrp which takes arguments,  setpgrp(1, 1) will fail with ESRCH and return -1, in that case  exit successfully. */  exit (setpgrp (1,1) == -1 ? 0 : 1);])],	       [ac_cv_func_setpgrp_void=no],	       [ac_cv_func_setpgrp_void=yes],	       [AC_MSG_ERROR([cannot check setpgrp when cross compiling])])])if test $ac_cv_func_setpgrp_void = yes; then  AC_DEFINE(SETPGRP_VOID, 1,	    [Define to 1 if the `setpgrp' function takes no argument.])fi])# AC_FUNC_SETPGRP# _AC_FUNC_STAT(STAT | LSTAT)# ---------------------------# Determine whether stat or lstat have the bug that it succeeds when# given the zero-length file name argument.  The stat and lstat from# SunOS4.1.4 and the Hurd (as of 1998-11-01) do this.## If it does, then define HAVE_STAT_EMPTY_STRING_BUG (or# HAVE_LSTAT_EMPTY_STRING_BUG) and arrange to compile the wrapper# function.m4_define([_AC_FUNC_STAT],[AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])dnlAC_CACHE_CHECK([whether $1 accepts an empty string],	       [ac_cv_func_$1_empty_string_bug],[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],[[struct stat sbuf;  exit ($1 ("", &sbuf) ? 1 : 0);]])],	    [ac_cv_func_$1_empty_string_bug=yes],	    [ac_cv_func_$1_empty_string_bug=no],	    [ac_cv_func_$1_empty_string_bug=yes])])if test $ac_cv_func_$1_empty_string_bug = yes; then  AC_LIBOBJ([$1])  AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$1_EMPTY_STRING_BUG]), 1,		     [Define to 1 if `$1' has the bug that it succeeds when		      given the zero-length file name argument.])fi])# _AC_FUNC_STAT# AC_FUNC_STAT & AC_FUNC_LSTAT# ----------------------------AN_FUNCTION([stat], [AC_FUNC_STAT])AC_DEFUN([AC_FUNC_STAT],  [_AC_FUNC_STAT(stat)])AN_FUNCTION([lstat], [AC_FUNC_LSTAT])AC_DEFUN([AC_FUNC_LSTAT], [_AC_FUNC_STAT(lstat)])# _AC_LIBOBJ_STRTOD# -----------------m4_define([_AC_LIBOBJ_STRTOD],[AC_LIBOBJ(strtod)AC_CHECK_FUNC(pow)if test $ac_cv_func_pow = no; then  AC_CHECK_LIB(m, pow,	       [POW_LIB=-lm],	       [AC_MSG_WARN([cannot find library containing definition of pow])])fi])# _AC_LIBOBJ_STRTOD# AC_FUNC_STRTOD# --------------AN_FUNCTION([strtod], [AC_FUNC_STRTOD])AC_DEFUN([AC_FUNC_STRTOD],[AC_SUBST(POW_LIB)dnlAC_CACHE_CHECK(for working strtod, ac_cv_func_strtod,[AC_RUN_IFELSE([AC_LANG_SOURCE([[double strtod ();intmain(){  {    /* Some versions of Linux strtod mis-parse strings with leading '+'.  */    char *string = " +69";    char *term;    double value;    value = strtod (string, &term);    if (value != 69 || term != (string + 4))      exit (1);  }  {    /* Under Solaris 2.4, strtod returns the wrong value for the       terminating character under some conditions.  */    char *string = "NaN";    char *term;    strtod (string, &term);    if (term != string && *(term - 1) == 0)      exit (1);  }  exit (0);}]])],	       ac_cv_func_strtod=yes,	       ac_cv_func_strtod=no,	       ac_cv_func_strtod=no)])if test $ac_cv_func_strtod = no; then  _AC_LIBOBJ_STRTODfi])# AU::AM_FUNC_STRTOD# ------------------AU_ALIAS([AM_FUNC_STRTOD], [AC_FUNC_STRTOD])# AC_FUNC_STRERROR_R# ------------------AN_FUNCTION([strerror_r], [AC_FUNC_STRERROR_R])AC_DEFUN([AC_FUNC_STRERROR_R],[AC_CHECK_DECLS([strerror_r])AC_CHECK_FUNCS([strerror_r])AC_CACHE_CHECK([whether strerror_r returns char *],	       ac_cv_func_strerror_r_char_p,   [    ac_cv_func_strerror_r_char_p=no    if test $ac_cv_have_decl_strerror_r = yes; then      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],	[[	  char buf[100];	  char x = *strerror_r (0, buf, sizeof buf);	  char *p = strerror_r (0, buf, sizeof buf);	]])],			ac_cv_func_strerror_r_char_p=yes)    else      # strerror_r is not declared.  Choose between      # systems that have relatively inaccessible declarations for the      # function.  BeOS and DEC UNIX 4.0 fall in this category, but the      # former has a strerror_r that returns char*, while the latter      # has a strerror_r that returns `int'.      # This test should segfault on the DEC system.      AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT	extern char *strerror_r ();],	[[char buf[100];	  char x = *strerror_r (0, buf, sizeof buf);	  exit (!isalpha (x));]])],		    ac_cv_func_strerror_r_char_p=yes, , :)    fi  ])if test $ac_cv_func_strerror_r_char_p = yes; then  AC_DEFINE([STRERROR_R_CHAR_P], 1,	    [Define to 1 if strerror_r returns char *.])fi])# AC_FUNC_STRERROR_R# AC_FUNC_STRFTIME# ----------------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;

⌨️ 快捷键说明

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