0001-util.h-add-missing-stdbool-header.patch 1.68 KB
From babf9a5c2bbce4725963b21e47f413962e33ea88 Mon Sep 17 00:00:00 2001
From: Baruch Siach <baruch@tkos.co.il>
Date: Sat, 30 Jul 2016 14:24:33 +0200
Subject: [PATCH] util.h: add missing stdbool header
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

C requires the stdbool.h header for the 'bool' type.

Fixes the following build failure under uClibc-ng C library:

.../arm-linux-gcc -DHAVE_CONFIG_H -I. -I..  -I../include -I../include -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os   -c delay.c
In file included from delay.c:55:0:
../include/util.h:73:1: error: unknown type name ‘bool’
 bool setsock_blocking(int fd, bool blocking);
 ^

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
[Thomas: add AC_PROG_CC_C99, since C99 is needed for the bool type.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 configure.ac   | 1 +
 include/util.h | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/configure.ac b/configure.ac
index d59107a..ba30cb7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,6 +46,7 @@ dnl ===================================================================
 AC_PROG_CXX
 CXXFLAGS=`echo " $CXXFLAGS " | sed -e "s/ -g / /"` # do not want it implicitly
 AC_PROG_CC
+AC_PROG_CC_C99
 CFLAGS=`echo " $CFLAGS " | sed -e "s/ -g / /"` # do not want it implicitly
 AC_ISC_POSIX
 AC_PROG_INSTALL
diff --git a/include/util.h b/include/util.h
index f4ae3d8..91540a9 100644
--- a/include/util.h
+++ b/include/util.h
@@ -57,6 +57,8 @@
     #include "config.h"
 #endif
 
+#include <stdbool.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
-- 
2.7.4