bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] AC_PROG_CC_C99 should not use stdbool.h


From: Lasse Collin
Subject: [PATCH] AC_PROG_CC_C99 should not use stdbool.h
Date: Sun, 1 Mar 2009 01:56:42 +0200
User-agent: KMail/1.11.0 (Linux/2.6.28-ARCH; KDE/4.2.0; i686; ; )

AC_PROG_CC_C99 doesn't work on systems which have C99 compiler but non-
C99 libc which lacks stdbool.h.

An example of such a system is Tru64 5.1; the box to which I have access 
doesn't have stdbool.h when using the native C99 compiler. Since my code 
has a workaround for missing stdbool.h, I can compile the code 
successfully if I pass ac_cv_prog_cc_c99= to configure.

GCC uses its own copy of stdbool.h on that system, so AC_PROG_CC_C99 
works if GCC is used.

I suggest omitting #include <stdbool.h> from the test, and using 0 and 1 
instead of false and true. The test already uses _Bool instead of bool, 
and _Bool doesn't need stdbool.h. (People can use AC_HEADER_STDBOOL to 
test usability of stdbool.h.) With these changes, configure works as 
expected on Tru64.

diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index 3fa9c04..20e1751 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -1060,7 +1060,6 @@ AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$5], 
[$6])
 AC_DEFUN([_AC_PROG_CC_C99],
 [_AC_C_STD_TRY([c99],
 [[#include <stdarg.h>
-#include <stdbool.h>
 #include <stdlib.h>
 #include <wchar.h>
 #include <stdio.h>
@@ -1155,11 +1154,11 @@ test_varargs (const char *format, ...)
 ]],
 [[
   // Check bool.
-  _Bool success = false;
+  _Bool success = 0;

   // Check restrict.
   if (test_restrict ("String literal") == 0)
-    success = true;
+    success = 1;
   char *restrict newvar = "Another string";

   // Check varargs.

-- 
Lasse Collin  |  IRC: Larhzu @ IRCnet & Freenode




reply via email to

[Prev in Thread] Current Thread [Next in Thread]