Brad Bishop | c1d3433 | 2019-09-09 14:56:00 -0400 | [diff] [blame^] | 1 | From 6df092a4153c6c37cfaddcabf2cd25a910a7f6e1 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Mon, 2 Sep 2019 15:40:52 -0700 |
| 4 | Subject: [PATCH] Detect bool definition considering stdbool.h being present |
| 5 | |
| 6 | This helps in defining the value correctly on different platforms e.g. |
| 7 | clang/libc++ depends on the definition coming from stdbool.h |
| 8 | current builds fail to compile therefore |
| 9 | |
| 10 | TMPDIR/work/cortexa7t2hf-neon-vfpv4-yoe-linux-gnueabi/iperf2/2.0.13-r0/recipe-sysroot/usr/include/c++/v1/type_traits:742:29: error: redefinition of '__libcpp_is_integral<int>' |
| 11 | template <> struct __libcpp_is_integral<int> : public true_type {}; |
| 12 | ^~~~~~~~~~~~~~~~~~~~~~~~~ |
| 13 | |
| 14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 15 | --- |
| 16 | m4/dast.m4 | 7 ++++++- |
| 17 | 1 file changed, 6 insertions(+), 1 deletion(-) |
| 18 | |
| 19 | --- a/m4/dast.m4 |
| 20 | +++ b/m4/dast.m4 |
| 21 | @@ -11,7 +11,12 @@ AH_TEMPLATE([false]) |
| 22 | |
| 23 | AC_DEFUN(DAST_CHECK_BOOL, [ |
| 24 | |
| 25 | -AC_CHECK_SIZEOF(bool) |
| 26 | +if test "$ac_cv_header_stdbool_h" = yes; then |
| 27 | + AC_CHECK_SIZEOF(bool,,[#include <stdbool.h>]) |
| 28 | +else |
| 29 | + AC_CHECK_SIZEOF(bool) |
| 30 | +fi |
| 31 | + |
| 32 | if test "$ac_cv_sizeof_bool" = 0 ; then |
| 33 | AC_DEFINE(bool, int) |
| 34 | fi |
| 35 | --- a/configure.ac |
| 36 | +++ b/configure.ac |
| 37 | @@ -113,7 +113,7 @@ AC_SEARCH_LIBS([socket], [socket], [], |
| 38 | |
| 39 | dnl Checks for header files. |
| 40 | AC_HEADER_STDC |
| 41 | -AC_CHECK_HEADERS([arpa/inet.h libintl.h net/ethernet.h net/if.h linux/ip.h linux/udp.h linux/if_packet.h linux/filter.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/socket.h sys/time.h syslog.h unistd.h signal.h ifaddrs.h]) |
| 42 | +AC_CHECK_HEADERS([arpa/inet.h libintl.h net/ethernet.h net/if.h linux/ip.h linux/udp.h linux/if_packet.h linux/filter.h netdb.h netinet/in.h stdbool.h stdlib.h string.h strings.h sys/socket.h sys/time.h syslog.h unistd.h signal.h ifaddrs.h]) |
| 43 | |
| 44 | dnl =================================================================== |
| 45 | dnl Checks for typedefs, structures |
| 46 | --- a/include/util.h |
| 47 | +++ b/include/util.h |
| 48 | @@ -56,7 +56,9 @@ |
| 49 | #ifdef HAVE_CONFIG_H |
| 50 | #include "config.h" |
| 51 | #endif |
| 52 | - |
| 53 | +#ifdef HAVE_STDBOOL_H |
| 54 | +# include <stdbool.h> |
| 55 | +#endif |
| 56 | #ifdef __cplusplus |
| 57 | extern "C" { |
| 58 | #endif |