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 3 of the License, or
11 # (at your option) any later version.
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, see <http://www.gnu.org/licenses/>.
22 # Since the macros which compile are required by most tests, check
23 # them first. But remember that looking for a compiler is even more
24 # primitive, so check those first.
31 # As far as we know only `foo', `foo.exe' are possible executable,
32 # and `foo.o', `foo.obj' are possible object files. Autoconf must not
33 # know that, but it is OK for the test suite to take this into account.
34 AT_CHECK_MACRO([Extensions],
38 * ) AC_MSG_ERROR([suspicious executable suffix: $ac_exeext]);;
43 * ) AC_MSG_ERROR([suspicious object suffix: $ac_objext]);;
49 ## -------------------------- ##
50 ## Broken/missing compilers. ##
51 ## -------------------------- ##
54 # Check that Autoconf correctly diagnoses broken compilers, and in
55 # particular, if it does not exit 77, the test suite is in trouble...
56 # FIXME: Once a precise message decided, check stderr of configure.
57 AT_SETUP([Broken/missing compilers])
59 AT_DATA([configure.ac],
66 AT_CHECK_CONFIGURE([], 77, ignore, ignore)
75 # GCC supports `const', `typeof', and `volatile'.
76 AT_CHECK_MACRO([C keywords],
81 case $GCC,$ac_cv_c_const,$ac_cv_c_typeof,$ac_cv_c_volatile in
83 AC_MSG_ERROR([failed to detect `const', `typeof', or `volatile' support]);;
89 ## --------------------------------- ##
90 ## AC_PROG_CPP requires AC_PROG_CC. ##
91 ## --------------------------------- ##
93 # Must invoke AC_PROG_CC.
94 AT_CHECK_MACRO([AC_PROG_CPP requires AC_PROG_CC],
97 AC_MSG_ERROR([looked for a C preprocessor without looking for a compiler])
102 ## --------------------------- ##
103 ## AC_PROG_CPP with warnings. ##
104 ## --------------------------- ##
107 # It's Ok for strict preprocessors to produce warnings.
109 AT_SETUP([AC_PROG_CPP with warnings])
121 # If the preprocessor is not strict, just ignore
122 test "x$ac_c_preproc_warn_flag" = xyes &&
123 AC_MSG_ERROR([preprocessor has no warning option], 77)
125 AC_CHECK_HEADERS(stdio.h autoconf_io.h)]])
128 [/* #undef HAVE_AUTOCONF_IO_H */
129 #define HAVE_STDIO_H 1
135 ## ------------------------------ ##
136 ## AC_PROG_CPP without warnings. ##
137 ## ------------------------------ ##
139 AT_SETUP([AC_PROG_CPP without warnings])
141 # Ignore if /lib/cpp doesn't work
142 AT_CHECK([[echo '#include <stdio.h>' | /lib/cpp || exit 77]],
143 [], [ignore], [ignore])
145 # A cpp which exit status is meaningless.
157 test "x$ac_c_preproc_warn_flag" != xyes &&
158 AC_MSG_ERROR([failed to detect preprocessor warning option])
159 AC_CHECK_HEADERS(stdio.h autoconf_io.h)]])
162 [/* #undef HAVE_AUTOCONF_IO_H */
163 #define HAVE_STDIO_H 1
170 ## -------------------- ##
171 ## AC_PROG_CPP via CC. ##
172 ## -------------------- ##
175 # It's Ok for strict preprocessors to produce warnings.
177 AT_SETUP([AC_PROG_CPP via CC])
179 # Ignore if /lib/cpp doesn't work
180 AT_CHECK([[echo '#include <stdio.h>' | /lib/cpp || exit 77]],
181 [], [ignore], [ignore])
185 echo "Annoying copyright message" >&2
191 # We go through the following contortions, in order to have the
192 # configure script go down the same codepaths as it would during a
193 # normal CPP selection check. If we explicitly set CPP, it goes down
194 # a different codepath.
199 # The test $CC compiler should have been selected.
200 test "$CPP" != "$CC -E" &&
201 AC_MSG_ERROR([error messages on stderr cause the preprocessor selection to fail])
204 AC_CHECK_HEADERS(stdio.h autoconf_io.h)]])
207 [/* #undef HAVE_AUTOCONF_IO_H */
208 #define HAVE_STDIO_H 1