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

📄 c.m4

📁 autoconf是一个产生可以自动配置源代码包
💻 M4
📖 第 1 页 / 共 4 页
字号:
# --------------AC_DEFUN([AC_PROG_CC_C89],[ AC_REQUIRE([AC_PROG_CC])dnl  _AC_PROG_CC_C89])# AC_PROG_CC_C99# --------------AC_DEFUN([AC_PROG_CC_C99],[ AC_REQUIRE([AC_PROG_CC])dnl  _AC_PROG_CC_C99])# AC_PROG_CC_STDC# ---------------AC_DEFUN([AC_PROG_CC_STDC],[ AC_REQUIRE([AC_PROG_CC])dnl  AS_CASE([$ac_cv_prog_cc_stdc],    [no], [ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no],	  [_AC_PROG_CC_C99([ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99],	     [_AC_PROG_CC_C89([ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89],			      [ac_cv_prog_cc_stdc=no])])])dnl  AC_MSG_CHECKING([for $CC option to accept ISO Standard C])  AC_CACHE_VAL([ac_cv_prog_cc_stdc], [])  AS_CASE([$ac_cv_prog_cc_stdc],    [no], [AC_MSG_RESULT([unsupported])],    [''], [AC_MSG_RESULT([none needed])],          [AC_MSG_RESULT([$ac_cv_prog_cc_stdc])])])# AC_C_BACKSLASH_A# ----------------AC_DEFUN([AC_C_BACKSLASH_A],[  AC_CACHE_CHECK([whether backslash-a works in strings], ac_cv_c_backslash_a,   [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],     [[#if '\a' == 'a'      syntax error;#endif      char buf['\a' == 'a' ? -1 : 1];      buf[0] = '\a';      return buf[0] != "\a"[0];     ]])],     [ac_cv_c_backslash_a=yes],     [ac_cv_c_backslash_a=no])])  if test $ac_cv_c_backslash_a = yes; then    AC_DEFINE(HAVE_C_BACKSLASH_A, 1,      [Define if backslash-a works in C strings.])  fi])# AC_C_CROSS# ----------# Has been merged into AC_PROG_CC.AU_DEFUN([AC_C_CROSS], [])# AC_C_CHAR_UNSIGNED# ------------------AC_DEFUN([AC_C_CHAR_UNSIGNED],[AH_VERBATIM([__CHAR_UNSIGNED__],[/* Define to 1 if type `char' is unsigned and you are not using gcc.  */#ifndef __CHAR_UNSIGNED__# undef __CHAR_UNSIGNED__#endif])dnlAC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned,[AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT([])],					     [((char) -1) < 0])],		   ac_cv_c_char_unsigned=no, ac_cv_c_char_unsigned=yes)])if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then  AC_DEFINE(__CHAR_UNSIGNED__)fi])# AC_C_CHAR_UNSIGNED# AC_C_BIGENDIAN ([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN])# -------------------------------------------------------------------------AC_DEFUN([AC_C_BIGENDIAN],[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian,[# See if sys/param.h defines the BYTE_ORDER macro.AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>#include <sys/param.h>],[#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN bogus endian macros#endif])],[# It does; now see whether it defined to BIG_ENDIAN or not.AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>#include <sys/param.h>], [#if BYTE_ORDER != BIG_ENDIAN not big endian#endif])], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=no])],[# It does not; compile a test program.AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [[  /* Are we little or big endian?  From Harbison&Steele.  */  union  {    long int l;    char c[sizeof (long int)];  } u;  u.l = 1;  return u.c[sizeof (long int) - 1] == 1;]])],	      [ac_cv_c_bigendian=no],	      [ac_cv_c_bigendian=yes],[# try to guess the endianness by grepping values into an object file  ac_cv_c_bigendian=unknown  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }]],[[ _ascii (); _ebcdic (); ]])],[if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then  ac_cv_c_bigendian=yesfiif grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then  if test "$ac_cv_c_bigendian" = unknown; then    ac_cv_c_bigendian=no  else    # finding both strings is unlikely to happen, but who knows?    ac_cv_c_bigendian=unknown  fifi])])])])case $ac_cv_c_bigendian in  yes)    m4_default([$1],      [AC_DEFINE([WORDS_BIGENDIAN], 1,	[Define to 1 if your processor stores words with the most significant	 byte first (like Motorola and SPARC, unlike Intel and VAX).])]) ;;  no)    $2 ;;  *)    m4_default([$3],      [AC_MSG_ERROR([unknown endiannesspresetting ac_cv_c_bigendian=no (or yes) will help])]) ;;esac])# AC_C_BIGENDIAN# AC_C_INLINE# -----------# Do nothing if the compiler accepts the inline keyword.# Otherwise define inline to __inline__ or __inline if one of those work,# otherwise define inline to be empty.## HP C version B.11.11.04 doesn't allow a typedef as the return value for an# inline function, only builtin types.#AN_IDENTIFIER([inline], [AC_C_INLINE])AC_DEFUN([AC_C_INLINE],[AC_CACHE_CHECK([for inline], ac_cv_c_inline,[ac_cv_c_inline=nofor ac_kw in inline __inline__ __inline; do  AC_COMPILE_IFELSE([AC_LANG_SOURCE([#ifndef __cplusplustypedef int foo_t;static $ac_kw foo_t static_foo () {return 0; }$ac_kw foo_t foo () {return 0; }#endif])],		    [ac_cv_c_inline=$ac_kw])  test "$ac_cv_c_inline" != no && breakdone])AH_VERBATIM([inline],[/* Define to `__inline__' or `__inline' if that's what the C compiler   calls it, or to nothing if 'inline' is not supported under any name.  */#ifndef __cplusplus#undef inline#endif])case $ac_cv_c_inline in  inline | yes) ;;  *)    case $ac_cv_c_inline in      no) ac_val=;;      *) ac_val=$ac_cv_c_inline;;    esac    cat >>confdefs.h <<_ACEOF#ifndef __cplusplus#define inline $ac_val#endif_ACEOF    ;;esac])# AC_C_INLINE# AC_C_CONST# ----------AN_IDENTIFIER([const],  [AC_C_CONST])AC_DEFUN([AC_C_CONST],[AC_CACHE_CHECK([for an ANSI C-conforming const], ac_cv_c_const,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[/* FIXME: Include the comments suggested by Paul. */#ifndef __cplusplus  /* Ultrix mips cc rejects this.  */  typedef int charset[2];  const charset x;  /* SunOS 4.1.1 cc rejects this.  */  char const *const *ccp;  char **p;  /* NEC SVR4.0.2 mips cc rejects this.  */  struct point {int x, y;};  static struct point const zero = {0,0};  /* AIX XL C 1.02.0.0 rejects this.     It does not let you subtract one const X* pointer from another in     an arm of an if-expression whose if-part is not a constant     expression */  const char *g = "string";  ccp = &g + (g ? g-g : 0);  /* HPUX 7.0 cc rejects these. */  ++ccp;  p = (char**) ccp;  ccp = (char const *const *) p;  { /* SCO 3.2v4 cc rejects this.  */    char *t;    char const *s = 0 ? (char *) 0 : (char const *) 0;    *t++ = 0;    if (s) return 0;  }  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */    int x[] = {25, 17};    const int *foo = &x[0];    ++foo;  }  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */    typedef const int *iptr;    iptr p = 0;    ++p;  }  { /* AIX XL C 1.02.0.0 rejects this saying       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */    struct s { int j; const int *ap[3]; };    struct s *b; b->j = 5;  }  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */    const int foo = 10;    if (!foo) return 0;  }  return !x[0] && !zero.x;#endif]])],		   [ac_cv_c_const=yes],		   [ac_cv_c_const=no])])if test $ac_cv_c_const = no; then  AC_DEFINE(const,,	    [Define to empty if `const' does not conform to ANSI C.])fi])# AC_C_CONST# AC_C_RESTRICT# -------------# based on acx_restrict.m4, from the GNU Autoconf Macro Archive at:# http://autoconf-archive.cryp.to/acx_restrict.html## Determine whether the C/C++ compiler supports the "restrict" keyword# introduced in ANSI C99, or an equivalent.  Do nothing if the compiler# accepts it.  Otherwise, if the compiler supports an equivalent,# define "restrict" to be that.  Here are some variants:# - GCC supports both __restrict and __restrict__# - older DEC Alpha C compilers support only __restrict# - _Restrict is the only spelling accepted by Sun WorkShop 6 update 2 C# Otherwise, define "restrict" to be empty.AN_IDENTIFIER([restrict], [AC_C_RESTRICT])AC_DEFUN([AC_C_RESTRICT],[AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict,  [ac_cv_c_restrict=no   # Try the official restrict keyword, then gcc's __restrict, and   # the less common variants.   for ac_kw in restrict __restrict __restrict__ _Restrict; do     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(      [[typedef int * int_ptr;        int foo (int_ptr $ac_kw ip) {        return ip[0];       }]],      [[int s[1];        int * $ac_kw t = s;        t[0] = 0;        return foo(t)]])],      [ac_cv_c_restrict=$ac_kw])     test "$ac_cv_c_restrict" != no && break   done  ]) case $ac_cv_c_restrict in   restrict) ;;   no) AC_DEFINE(restrict,,	[Define to equivalent of C99 restrict keyword, or to nothing if this	is not supported.  Do not define if restrict is supported directly.]) ;;   *)  AC_DEFINE_UNQUOTED(restrict, $ac_cv_c_restrict) ;; esac])# AC_C_RESTRICT# AC_C_VOLATILE# -------------# Note that, unlike const, #defining volatile to be the empty string can# actually turn a correct program into an incorrect one, since removing# uses of volatile actually grants the compiler permission to perform# optimizations that could break the user's code.  So, do not #define# volatile away unless it is really necessary to allow the user's code# to compile cleanly.  Benign compiler failures should be tolerated.AN_IDENTIFIER([volatile], [AC_C_VOLATILE])AC_DEFUN([AC_C_VOLATILE],[AC_CACHE_CHECK([for working volatile], ac_cv_c_volatile,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [volatile int x;int * volatile y = (int *) 0;return !x && !y;])],		   [ac_cv_c_volatile=yes],		   [ac_cv_c_volatile=no])])if test $ac_cv_c_volatile = no; then  AC_DEFINE(volatile,,	    [Define to empty if the keyword `volatile' does not work.	     Warning: valid code using `volatile' can become incorrect	     without.  Disable with care.])fi])# AC_C_VOLATILE# AC_C_STRINGIZE# --------------# Checks if `#' can be used to glue strings together at the CPP level.# Defines HAVE_STRINGIZE if positive.AC_DEFUN([AC_C_STRINGIZE],[AC_CACHE_CHECK([for preprocessor stringizing operator],		[ac_cv_c_stringize],[AC_EGREP_CPP([@%:@teststring],	      [@%:@define x(y) #ychar *s = x(teststring);],	      [ac_cv_c_stringize=no],	      [ac_cv_c_stringize=yes])])if test $ac_cv_c_stringize = yes; then  AC_DEFINE(HAVE_STRINGIZE, 1,	    [Define to 1 if cpp supports the ANSI @%:@ stringizing operator.])fi])# AC_C_STRINGIZE# AC_C_PROTOTYPES# ---------------# Check if the C compiler supports prototypes, included if it needs# options.AC_DEFUN([AC_C_PROTOTYPES],[AC_REQUIRE([AC_PROG_CC])dnlAC_MSG_CHECKING([for function prototypes])if test "$ac_cv_prog_cc_c89" != no; then  AC_MSG_RESULT([yes])  AC_DEFINE(PROTOTYPES, 1,	    [Define to 1 if the C compiler supports function prototypes.])  AC_DEFINE(__PROTOTYPES, 1,	    [Define like PROTOTYPES; this can be used by system headers.])else  AC_MSG_RESULT([no])fi])# AC_C_PROTOTYPES# AC_C_TYPEOF# -----------# Check if the C compiler supports GCC's typeof syntax.# The test case provokes incompatibilities in the Sun C compilers# (both Solaris 8 and Solaris 10).AC_DEFUN([AC_C_TYPEOF],[  AC_CACHE_CHECK([for typeof syntax and keyword spelling], ac_cv_c_typeof,    [ac_cv_c_typeof=no     for ac_kw in typeof __typeof__ no; do       test $ac_kw = no && break       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],	 [[	   int value;	   typedef struct {		   char a [1			   + ! (($ac_kw (value))				(($ac_kw (value)) 0 < ($ac_kw (value)) -1				 ? ($ac_kw (value)) - 1				 : ~ (~ ($ac_kw (value)) 0				      << sizeof ($ac_kw (value)))))]; }	      ac__typeof_type_;	   return	     (! ((void) ((ac__typeof_type_ *) 0), 0));	 ]])],	 [ac_cv_c_typeof=$ac_kw])       test $ac_cv_c_typeof != no && break     done])  if test $ac_cv_c_typeof != no; then    AC_DEFINE([HAVE_TYPEOF], 1,      [Define to 1 if typeof works with your compiler.])    if test $ac_cv_c_typeof != typeof; then      AC_DEFINE_UNQUOTED([typeof], [$ac_cv_c_typeof],	[Define to __typeof__ if your compiler spells it that way.])    fi  fi])

⌨️ 快捷键说明

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