From a9f56adb59323e889e2e8bcf53a3af997e01ecfc Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Wed, 6 May 2009 07:30:38 -0400 Subject: [PATCH] more portable handling of the bool data type (Mac OS X has stdbool.h) --- configure.in | 6 ++++-- src/libstrongswan/utils.h | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/configure.in b/configure.in index f2997ba47..fe60e63b4 100644 --- a/configure.in +++ b/configure.in @@ -762,9 +762,11 @@ if test x$medcli = xtrue; then me=true fi -dnl ========================================== +dnl =========================================== dnl check required libraries and header files -dnl ========================================== +dnl =========================================== + +AC_HEADER_STDBOOL saved_LIBS=$LIBS LIBS="" diff --git a/src/libstrongswan/utils.h b/src/libstrongswan/utils.h index 091890658..debd0145b 100644 --- a/src/libstrongswan/utils.h +++ b/src/libstrongswan/utils.h @@ -116,12 +116,22 @@ /** * General purpose boolean type. */ -typedef int bool; +#ifdef HAVE_STDBOOL_H +# include +#else +# ifndef HAVE__BOOL +# define _Bool signed char +# endif /* HAVE__BOOL */ +# define bool _Bool +# define false 0 +# define true 1 +# define __bool_true_false_are_defined 1 +#endif /* HAVE_STDBOOL_H */ #ifndef FALSE -# define FALSE 0 +# define FALSE false #endif /* FALSE */ #ifndef TRUE -# define TRUE 1 +# define TRUE true #endif /* TRUE */ typedef enum status_t status_t;