1 dnl The following are from prerelease autoconf 2.14a. When 2.14 is
2 dnl released, we should be able to zap them and AC_PREREQ(2.14).
7 # If the C compiler in not in ANSI C mode by default, try to add an
8 # option to output variable @code{CC} to make it so. This macro tries
9 # various options that select ANSI C on some system or another. It
10 # considers the compiler to be in ANSI C mode if it handles function
11 # prototypes correctly.
12 AC_DEFUN(AC_PROG_CC_STDC,
13 [AC_REQUIRE([AC_PROG_CC])dnl
14 AC_BEFORE([$0], [AC_C_INLINE])dnl
15 AC_BEFORE([$0], [AC_C_CONST])dnl
16 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
17 dnl a magic option to avoid problems with ANSI preprocessor commands
19 dnl FIXME: can't do this because then AC_AIX won't work due to a
20 dnl circular dependency.
21 dnl AC_BEFORE([$0], [AC_PROG_CPP])
22 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
23 AC_CACHE_VAL(ac_cv_prog_cc_stdc,
24 [ac_cv_prog_cc_stdc=no
26 # Don't try gcc -ansi; that turns off useful extensions and
27 # breaks some systems' header files.
29 # Ultrix and OSF/1 -std1
30 # HP-UX 10.20 and later -Ae
31 # HP-UX older versions -Aa -D_HPUX_SOURCE
32 # SVR4 -Xc -D__EXTENSIONS__
33 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
35 CC="$ac_save_CC $ac_arg"
39 #include <sys/types.h>
41 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
42 struct buf { int x; };
43 FILE * (*rcsopen) (struct buf *, struct stat *, int);
50 static char *f (char * (*g) (char **, int), char **p, ...)
55 s = g (p, va_arg (v,int));
59 int test (int i, double x);
60 struct s1 {int (*f) (int a);};
61 struct s2 {int (*f) (double a);};
62 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
65 [return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];],
66 [ac_cv_prog_cc_stdc="$ac_arg"; break])
70 case "x$ac_cv_prog_cc_stdc" in
72 AC_MSG_RESULT([none needed]) ;;
74 AC_MSG_RESULT($ac_cv_prog_cc_stdc)
75 CC="$CC $ac_cv_prog_cc_stdc" ;;
81 # Note that, unlike const, #defining volatile to be the empty string can
82 # actually turn a correct program into an incorrect one, since removing
83 # uses of volatile actually grants the compiler permission to perform
84 # optimizations that could break the user's code. So, do not #define
85 # volatile away unless it is really necessary to allow the user's code
86 # to compile cleanly. Benign compiler failures should be tolerated.
87 AC_DEFUN(AC_C_VOLATILE,
88 [AC_REQUIRE([AC_PROG_CC_STDC])dnl
89 AC_CACHE_CHECK([for working volatile], ac_cv_c_volatile,
93 ac_cv_c_volatile=yes, ac_cv_c_volatile=no)])
94 if test $ac_cv_c_volatile = no; then
96 [Define to empty if the keyword `volatile' does not work.
97 Warning: valid code using `volatile' can become incorrect
98 without. Disable with care.])
104 # Check if the C compiler supports prototypes, included if it needs
106 AC_DEFUN(AC_C_PROTOTYPES,
107 [AC_REQUIRE([AC_PROG_CC_STDC])dnl
108 AC_REQUIRE([AC_PROG_CPP])dnl
109 AC_MSG_CHECKING([for function prototypes])
110 if test "$ac_cv_prog_cc_stdc" != no; then
112 AC_DEFINE(PROTOTYPES, 1,
113 [Define if the compiler supports function prototypes.])