[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
AC_HEADER_STDBOOL: checking for _Bool separately for C and C++
From: |
Mojca Miklavec |
Subject: |
AC_HEADER_STDBOOL: checking for _Bool separately for C and C++ |
Date: |
Sun, 26 Aug 2012 14:47:33 +0200 |
Hello,
A sparc solaris user reported a _Bool-related problem to gnuplot tracker.
Long story short: stdbool.h is absent, _Bool is defined in C, but not
in C++. Current header file in gnuplot sources which is used both in C
and C++ goes like
# if ! HAVE__BOOL
# ifdef __cplusplus
typedef bool _Bool;
# else
typedef unsigned char _Bool;
# endif
# endif
But there is a problem. If
AC_HEADER_STDBOOL
is called with C compiler, it would figure out that _Bool is defined
and thus skip defining _Bool in C++. If the macro is called with C++
compiler, it would figure out that _Bool is undefined and try to
define it for C as well. In either case compilation fails.
My question is: what is the proper way to test for existence of _Bool
in C and C++ separately? Something like this should work in the header
file:
# ifdef __cplusplus
# if !HAVE__BOOL_IN_CXX
typedef bool _Bool;
# endif
# else
# if !HAVE__BOOL_IN_C
typedef unsigned char _Bool;
# endif
# endif
but I don't know what would be the proper way to get HAVE__BOOL_IN_CXX
& HAVE__BOOL_IN_C without completely (re)defining AC_HEADER_STDBOOL
macro.
Thank you,
Mojca
- AC_HEADER_STDBOOL: checking for _Bool separately for C and C++,
Mojca Miklavec <=