]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/autoconf/headers.m4 (AC_HEADER_STDBOOL): New, based on CVS
authorAkim Demaille <akim@epita.fr>
Tue, 22 Oct 2002 12:34:21 +0000 (12:34 +0000)
committerAkim Demaille <akim@epita.fr>
Tue, 22 Oct 2002 12:34:21 +0000 (12:34 +0000)
Bison, by Paul Eggert.
* doc/autoconf.texi (Particular Headers): Document it.

ChangeLog
NEWS
doc/autoconf.texi
lib/autoconf/headers.m4
lib/autoscan/autoscan.list

index 1975a3a6687d93bd4024c8974b12005a428a21fa..4ece9a9c1acc196369db8683dfaf024a56cdd293 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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
diff --git a/NEWS b/NEWS
index 96166bc49f616cf5099ad5f1eac17ed88f4f0f1f..026cf7bf52835764cd4a30b99ef664104c154adc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,7 +11,7 @@
 ** Macros
 
 - New macros
-  AC_FUNC_MBRTOWC
+  AC_FUNC_MBRTOWC, AC_HEADER_STDBOOL.
 
 - Obsoleted
   Obsoleted macros are kept for Autoconf backward compatibility, but
index 7c9be2aa55b6e8968a1213244fa9246cbb15ba20..853692314c3a47facef6c124a5bc219d8c60b3cd 100644 (file)
@@ -4281,6 +4281,22 @@ define @code{STAT_MACROS_BROKEN}.  This is the case on Tektronix UTekV,
 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
index c7a10fa0eb64375128b3f8c4d28ac0d12e2556c9..dcdf7efb7b747a589737ca550fc806f48a7c700d 100644 (file)
@@ -487,6 +487,58 @@ fi
 ])# 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
index 9198f2f358c0df0b710de16d883fc83f666aa426..d3ecd3bd9d504afb02ddf0113fc677d9094c0aaf 100644 (file)
@@ -247,7 +247,9 @@ identifier: S_ISFIFO                AC_HEADER_STAT
 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
@@ -263,6 +265,7 @@ identifier: sys_siglist             AC_CHECK_DECLS([sys_siglist])
 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