]> granicus.if.org Git - graphviz/commitdiff
improve test for bool support, uses stdbool.h if available
authorellson <devnull@localhost>
Fri, 27 Jan 2006 23:37:15 +0000 (23:37 +0000)
committerellson <devnull@localhost>
Fri, 27 Jan 2006 23:37:15 +0000 (23:37 +0000)
configure.ac
lib/common/logic.h

index 4960296f78a8c776444b6bf94289f896f0cb5de7..2af1c119d730866dbb481c2b7bd498361207201e 100644 (file)
@@ -1394,6 +1394,22 @@ if test $ac_cv_type_socklen_t = no; then
     AC_DEFINE(socklen_t, unsigned, [Define to unsigned if socklet_t is missing])
 fi
 
+# -----------------------------------
+# Test if compiler supports bool
+AC_MSG_CHECKING([for bool])
+AC_TRY_COMPILE([
+    #ifdef HAVE_STDBOOL_H>
+    #include <stdbool.h>
+    #endif
+    ],[
+    bool foo = true, bar = false;
+    ],[
+AC_MSG_RESULT(yes)
+AC_DEFINE(HAVE_BOOL, 1,[Define to 1 if compiler supports bool])
+    ],[
+AC_MSG_RESULT(no)])
+
+# -----------------------------------
 # Test for direct I/O
 AC_MSG_CHECKING([for struct dioattr])
 AC_TRY_COMPILE([#include <sys/types.h>
index 8056e9def3754dde8e0ff5fbe2d191fae32f8ec4..dd08c8a9edb922ecf7704f4c37f8c5a4750f4791 100644 (file)
 extern "C" {
 #endif
 
+#ifdef HAVE_STDBOOL_H
+#include <stdbool.h>
+#endif
+
 #define NOT(v) (!(v))
 
-#ifndef __cplusplus
+#ifndef HAVE_BOOL
 typedef unsigned char bool;
 #define false 0
 #define true NOT(false)