3 AT_BANNER([C low level compiling/preprocessing macros.])
5 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 # Since the macros which compile are required by most tests, check
25 # them first. But remember that looking for a compiler is even more
26 # primitive, so check those first.
33 # As far as we know only `foo', `foo.exe' are possible executable,
34 # and `foo.o', `foo.obj' are possible object files. Autoconf must not
35 # know that, but it is OK for the test suite to take this into account.
36 AT_CHECK_MACRO([Extensions],
40 * ) AC_MSG_ERROR([suspicious executable suffix: $ac_exeext]);;
45 * ) AC_MSG_ERROR([suspicious object suffix: $ac_objext]);;
51 ## -------------------------- ##
52 ## Broken/missing compilers. ##
53 ## -------------------------- ##
56 # Check that Autoconf correctly diagnoses broken compilers, and in
57 # particular, if it does not exit 77, the test suite is in trouble...
58 # FIXME: Once a precise message decided, check stderr of configure.
59 AT_SETUP([Broken/missing compilers])
61 AT_DATA([configure.ac],
68 AT_CHECK_CONFIGURE([], 77, ignore, ignore)
77 # GCC supports `const', `typeof', and `volatile'.
78 AT_CHECK_MACRO([C keywords],
83 case $GCC,$ac_cv_c_const,$ac_cv_c_typeof,$ac_cv_c_volatile in
85 AC_MSG_ERROR([failed to detect `const', `typeof', or `volatile' support]);;
91 ## --------------------------------- ##
92 ## AC_PROG_CPP requires AC_PROG_CC. ##
93 ## --------------------------------- ##
95 # Must invoke AC_PROG_CC.
96 AT_CHECK_MACRO([AC_PROG_CPP requires AC_PROG_CC],
99 AC_MSG_ERROR([looked for a C preprocessor without looking for a compiler])
104 ## --------------------------- ##
105 ## AC_PROG_CPP with warnings. ##
106 ## --------------------------- ##
109 # It's Ok for strict preprocessors to produce warnings.
111 AT_SETUP([AC_PROG_CPP with warnings])
123 # If the preprocessor is not strict, just ignore
124 test "x$ac_c_preproc_warn_flag" = xyes &&
125 AC_MSG_ERROR([preprocessor has no warning option], 77)
127 AC_CHECK_HEADERS(stdio.h autoconf_io.h)]])
130 [/* #undef HAVE_AUTOCONF_IO_H */
131 #define HAVE_STDIO_H 1
137 ## ------------------------------ ##
138 ## AC_PROG_CPP without warnings. ##
139 ## ------------------------------ ##
141 AT_SETUP([AC_PROG_CPP without warnings])
143 # Ignore if /lib/cpp doesn't work
144 AT_CHECK([[echo '#include <stdio.h>' | /lib/cpp || exit 77]],
145 [], [ignore], [ignore])
147 # A cpp which exit status is meaningless.
159 test "x$ac_c_preproc_warn_flag" != xyes &&
160 AC_MSG_ERROR([failed to detect preprocessor warning option])
161 AC_CHECK_HEADERS(stdio.h autoconf_io.h)]])
164 [/* #undef HAVE_AUTOCONF_IO_H */
165 #define HAVE_STDIO_H 1
172 ## -------------------- ##
173 ## AC_PROG_CPP via CC. ##
174 ## -------------------- ##
177 # It's Ok for strict preprocessors to produce warnings.
179 AT_SETUP([AC_PROG_CPP via CC])
181 # Ignore if /lib/cpp doesn't work
182 AT_CHECK([[echo '#include <stdio.h>' | /lib/cpp || exit 77]],
183 [], [ignore], [ignore])
187 echo "Annoying copyright message" >&2
193 # We go through the following contortions, in order to have the
194 # configure script go down the same codepaths as it would during a
195 # normal CPP selection check. If we explicitly set CPP, it goes down
196 # a different codepath.
201 # The test $CC compiler should have been selected.
202 test "$CPP" != "$CC -E" &&
203 AC_MSG_ERROR([error messages on stderr cause the preprocessor selection to fail])
206 AC_CHECK_HEADERS(stdio.h autoconf_io.h)]])
209 [/* #undef HAVE_AUTOCONF_IO_H */
210 #define HAVE_STDIO_H 1