]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
build: use stdbool.h if available
authorAlon Bar-Lev <alon.barlev@gmail.com>
Fri, 27 Apr 2012 12:09:15 +0000 (15:09 +0300)
committerDavid Sommerseth <davids@redhat.com>
Fri, 27 Apr 2012 22:09:46 +0000 (00:09 +0200)
If stdbool.h is available use it, otherwise create emulation.

basic.h defines a type 'bool' that conflicts with
the altivec keyword bool which has to be fixed upstream, see
bugs[1][2].

[1] https://bugs.gentoo.org/show_bug.cgi?id=293840
[2] https://bugs.gentoo.org/show_bug.cgi?id=297854

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Acked-by: David Sommerseth <davids@redhat.com>
Message-Id: 1335528555-13225-1-git-send-email-alon.barlev@gmail.com
URL: http://article.gmane.org/gmane.network.openvpn.devel/6363
Signed-off-by: David Sommerseth <davids@redhat.com>
configure.ac
src/compat/Makefile.am
src/compat/compat-stdbool.h [new file with mode: 0644]
src/openvpn/basic.h
src/openvpn/syshead.h

index 5c9af308c958a96530972dd48b95ce2c720714dc..82076af2bad7910e4fe4edc23a7c6d2fca9099d2 100644 (file)
@@ -354,7 +354,7 @@ AX_EMPTY_ARRAY
 AC_CHECK_SIZEOF([unsigned int])
 AC_CHECK_SIZEOF([unsigned long])
 AC_CHECK_HEADERS([ \
-       stdio.h stdarg.h limits.h \
+       stdio.h stdarg.h stdbool.h limits.h \
        time.h errno.h fcntl.h io.h direct.h \
        ctype.h sys/types.h sys/socket.h \
        signal.h unistd.h dlfcn.h \
index 5ee35f7237683b69486ad3fa00e2fc6bc27deeb2..7ad4452533a3395097e1e692c8d73a212347b7ed 100644 (file)
@@ -20,6 +20,7 @@ noinst_LTLIBRARIES = libcompat.la
 
 libcompat_la_SOURCES = \
        compat.h \
+       compat-stdbool.h \
        compat-dirname.c \
        compat-basename.c \
        compat-gettimeofday.c \
diff --git a/src/compat/compat-stdbool.h b/src/compat/compat-stdbool.h
new file mode 100644 (file)
index 0000000..9941218
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef __COMPAT_STDBOOL_H
+#define __COMPAT_STDBOOL_H
+
+#ifdef HAVE_STDBOOL_H
+#include <stdbool.h>
+#else
+typedef int bool;
+#define false 0
+#define true 1
+#endif
+
+#endif
index 7c13e2219ba7b3f47cc6a3f9076b2963601efef5..298cf10373489b51ee8d6156309fd2c63282cb01 100644 (file)
 #ifndef BASIC_H
 #define BASIC_H
 
-/* bool definitions */
-#ifndef bool
-#define bool int
-#endif
-
-#ifndef true
-#define true 1
-#endif
-
-#ifndef false
-#define false 0
-#endif
-
 #define BOOL_CAST(x) ((x) ? (true) : (false))
 
 /* size of an array */
index 6f9422c8308d5665755d45a4ab9b0865699caa09..3337764b1ca1b5769870a54049921b0adf01b1ad 100644 (file)
@@ -26,6 +26,7 @@
 #define SYSHEAD_H
 
 #include "compat.h"
+#include "compat-stdbool.h"
 
 /* branch prediction hints */
 #if defined(__GNUC__)