+2002-10-22 Akim Demaille <akim@epita.fr>
+
+ * lib/autoconf/headers.m4 (AC_HEADER_STDBOOL): New, based on CVS
+ Bison, by Paul Eggert.
+ * doc/autoconf.texi (Particular Headers): Document it.
+
2002-10-22 Aaron M. Ucko <amu@alum.mit.edu>
* lib/autoconf/general.m4 (_AC_INIT_PREPARE): Avoid duplicates in
Amdahl UTS and Motorola System V/88.
@end defmac
+@defmac AC_HEADER_STDBOOL
+@acindex HEADER_STDBOOL
+@cvindex HAVE_STDBOOL_H
+If @file{stdbool.h} exists and is conformant to C99, define
+@code{HAVE_STDBOOL_H} to 1. Your @file{system.h} should contain the
+following code:
+
+@verbatim
+#if HAVE_STDBOOL_H
+# include <stdbool.h>
+#else
+typedef enum {false = 0, true = 1} bool;
+#endif
+@end verbatim
+@end defmac
+
@defmac AC_HEADER_STDC
@acindex HEADER_STDC
])# AC_HEADER_STAT
+# AC_HEADER_STDBOOL
+# -----------------
+# Check for stdbool.h that conforms to C99.
+AN_IDENTIFIER([bool], [AC_HEADER_STDBOOL])
+AN_IDENTIFIER([true], [AC_HEADER_STDBOOL])
+AN_IDENTIFIER([false],[AC_HEADER_STDBOOL])
+AC_DEFUN([AC_HEADER_STDBOOL],
+[AC_CACHE_CHECK([for stdbool.h that conforms to C99],
+ [ac_cv_header_stdbool_h],
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ [[
+#include <stdbool.h>
+#ifndef bool
+# error bool is not defined
+#endif
+#ifndef false
+# error false is not defined
+#endif
+#if false
+# error false is not 0
+#endif
+#ifndef true
+# error false is not defined
+#endif
+#if true != 1
+# error true is not 1
+#endif
+#ifndef __bool_true_false_are_defined
+# error __bool_true_false_are_defined is not defined
+#endif
+
+ struct s { _Bool s: 1; _Bool t; } s;
+
+ char a[true == 1 ? 1 : -1];
+ char b[false == 0 ? 1 : -1];
+ char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+ char d[(bool) -0.5 == true ? 1 : -1];
+ bool e = &s;
+ char f[(_Bool) -0.0 == false ? 1 : -1];
+ char g[true];
+ char h[sizeof (_Bool)];
+ char i[sizeof s.t];
+ ]],
+ [[ return !a + !b + !c + !d + !e + !f + !g + !h + !i; ]])],
+ [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, 1, [Define to 1 if stdbool.h conforms to C99.])
+fi
+])# AC_HEADER_STDBOOL
+
+
# AC_HEADER_STDC
# --------------
# FIXME: I find this list very strange. It comes from the original
identifier: S_ISLNK AC_HEADER_STAT
identifier: S_ISREG AC_HEADER_STAT
identifier: S_ISSOCK AC_HEADER_STAT
+identifier: bool AC_HEADER_STDBOOL
identifier: const AC_C_CONST
+identifier: false AC_HEADER_STDBOOL
identifier: gid_t AC_TYPE_UID_T
identifier: inline AC_C_INLINE
identifier: mode_t AC_TYPE_MODE_T
identifier: timeval AC_HEADER_TIME
identifier: tm AC_STRUCT_TM
identifier: tm_zone AC_STRUCT_TIMEZONE
+identifier: true AC_HEADER_STDBOOL
identifier: uid_t AC_TYPE_UID_T
identifier: volatile AC_C_VOLATILE
makevar: AWK AC_PROG_AWK