This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Detect _Bool in bootstrap compiler
Joseph S. Myers writes:
> Enough people have reported bootstrap problems using compilers from the
> relevant date range (2000-11-13 to 2001-01-20) that testing for it seems
> worthwhile.
agreed: here's the updated patch. I've tested it by running configure in
three variations:
* using gcc 2.95 (which has a working stdbool.h) as the bootstrap compiler
* using gcc 2.95 with CPPFLAGS pointing to a directory which contains just
and empty stdbool.h (to simulate an existing but broken file)
* using cc (which has _Bool, but no stdbool.h)
All three cases worked as expected.
Besides, this patch fixes a typo in aclocal.a4: the first character is a
superfluous F:
Fdnl See whether we can include both string.h and strings.h.
I've included this here since I have to touch the same region of the file.
I've also included the updated version of the original patch (_Bool
detection), with augmented wording according to Fergus' suggestions and
simplified by using the optional third arg to AC_DEFINE instead of
providing a template in acconfig.h.
Ok now?
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Email: ro@TechFak.Uni-Bielefeld.DE
Wed Apr 11 14:13:40 2001 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* aclocal.m4: Fixed typo.
(gcc_AC_HEADER_STDBOOL): Define.
* configure.in: Use it.
(AC_CHECK_HEADERS): Remove stdbool.h
* configure, config.in: Regenerate.
Wed Apr 4 00:28:23 2001 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* aclocal.m4 (gcc_AC_C__BOOL): Define.
* configure.in: Use it.
* configure, config.in: Regenerate.
Index: aclocal.m4
===================================================================
RCS file: /cvs/gcc/egcs/gcc/aclocal.m4,v
retrieving revision 1.40.4.1
diff -u -p -r1.40.4.1 aclocal.m4
--- aclocal.m4 2001/02/18 05:41:46 1.40.4.1
+++ aclocal.m4 2001/04/11 12:24:24
@@ -1,4 +1,17 @@
-Fdnl See whether we can include both string.h and strings.h.
+dnl See if stdbool.h properly defines bool and true/false.
+AC_DEFUN(gcc_AC_HEADER_STDBOOL,
+[AC_CACHE_CHECK([for working stdbool.h],
+ ac_cv_header_stdbool_h,
+[AC_TRY_COMPILE([#include <stdbool.h>],
+[bool foo = false;],
+ac_cv_header_stdbool_h=yes, ac_cv_header_stdbool_h=no)])
+if test $ac_cv_header_stdbool_h = yes; then
+ AC_DEFINE(HAVE_STDBOOL_H, ,
+ [Define if you have a working <stdbool.h> header file.])
+fi
+])
+
+dnl See whether we can include both string.h and strings.h.
AC_DEFUN(gcc_AC_HEADER_STRING,
[AC_CACHE_CHECK([whether string.h and strings.h may both be included],
gcc_cv_header_string,
@@ -194,6 +207,18 @@ gcc_cv_c_long_double=yes, gcc_cv_c_long_
fi])
if test $gcc_cv_c_long_double = yes; then
AC_DEFINE(HAVE_LONG_DOUBLE)
+fi
+])
+
+dnl Check whether _Bool is built-in.
+AC_DEFUN(gcc_AC_C__BOOL,
+[AC_CACHE_CHECK(for built-in _Bool, gcc_cv_c__bool,
+[AC_TRY_COMPILE(,
+[_Bool foo;],
+gcc_cv_c__bool=yes, gcc_cv_c__bool=no)
+])
+if test $gcc_cv_c__bool = yes; then
+ AC_DEFINE(HAVE__BOOL, , [Define if the \`_Bool' type is built-in.])
fi
])
Index: configure.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/configure.in,v
retrieving revision 1.483.2.8
diff -u -p -r1.483.2.8 configure.in
--- configure.in 2001/03/17 18:43:30 1.483.2.8
+++ configure.in 2001/04/11 12:24:25
@@ -347,6 +349,7 @@ AC_SUBST(NO_MINUS_C_MINUS_O)
AC_SUBST(OUTPUT_OPTION)
gcc_AC_C_LONG_DOUBLE
+gcc_AC_C__BOOL
AC_CACHE_CHECK(whether ${CC-cc} accepts -Wno-long-long,
ac_cv_prog_cc_no_long_long,
@@ -434,12 +437,13 @@ gcc_AC_PROG_INSTALL
AC_HEADER_STDC
AC_HEADER_TIME
+gcc_AC_HEADER_STDBOOL
gcc_AC_HEADER_STRING
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h \
fcntl.h unistd.h stab.h sys/file.h sys/time.h \
sys/resource.h sys/param.h sys/times.h sys/stat.h \
- direct.h malloc.h langinfo.h iconv.h stdbool.h)
+ direct.h malloc.h langinfo.h iconv.h)
# Check for thread headers.
AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])