summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-09-10 12:23:47 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:18:11 -0500
commit3f8383cd6169eeefdb06172fc1388b6743ad3ae0 (patch)
tree45b6e7cb5181ec4948f67997904239f73f60dee7
parentee66b69a8bd6ec5291cdbc3071fdd01f3784c5a8 (diff)
downloadsamba-3f8383cd6169eeefdb06172fc1388b6743ad3ae0.tar.gz
samba-3f8383cd6169eeefdb06172fc1388b6743ad3ae0.tar.bz2
samba-3f8383cd6169eeefdb06172fc1388b6743ad3ae0.zip
r18335: more portable bool tests
(This used to be commit 45a3a6a566de020578c24feb5788367efd685f29)
-rw-r--r--source4/lib/replace/libreplace.m49
-rw-r--r--source4/lib/replace/replace.h15
2 files changed, 22 insertions, 2 deletions
diff --git a/source4/lib/replace/libreplace.m4 b/source4/lib/replace/libreplace.m4
index cd9d171662..a734704ae8 100644
--- a/source4/lib/replace/libreplace.m4
+++ b/source4/lib/replace/libreplace.m4
@@ -81,6 +81,15 @@ AC_INCLUDES_DEFAULT
#endif]
)
+AC_CHECK_TYPE(_Bool,
+[AC_DEFINE(HAVE__Bool, 1, [Whether the _Bool type is available])],,
+[
+AC_INCLUDES_DEFAULT
+#ifdef HAVE_STDBOOL_H
+#include <stdbool.h>
+#endif]
+)
+
AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
AC_TRY_RUN([#include "$libreplacedir/test/shared_mmap.c"],
diff --git a/source4/lib/replace/replace.h b/source4/lib/replace/replace.h
index 3bf884c80c..88fec3f4d7 100644
--- a/source4/lib/replace/replace.h
+++ b/source4/lib/replace/replace.h
@@ -310,12 +310,23 @@ char *rep_mkdtemp(char *template);
#ifdef HAVE_STDBOOL_H
#include <stdbool.h>
-#elif !defined(HAVE_BOOL)
+#endif
+
+#if !defined(HAVE_BOOL)
+#ifdef HAVE__Bool
+#define bool _Bool
+#else
#define __bool_true_false_are_defined
typedef int bool;
-#define false (0)
+#endif
+#endif
+
+#ifndef true
#define true (1)
#endif
+#ifndef false
+#define false (0)
+#endif
#ifndef HAVE_FUNCTION_MACRO
#ifdef HAVE_func_MACRO