summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorportix <portix@gmx.net>2013-05-09 12:07:55 +0200
committerportix <portix@gmx.net>2013-05-09 12:07:55 +0200
commit2ca48c07ddedb109b6bd0fad57319d906362a6d4 (patch)
tree0700f9c5cde7345296f70cde2bcaa3ba19726074
parent9acf73f81af08ee4c05a10f6f72ee8b73ac75706 (diff)
downloaddwb-2ca48c07ddedb109b6bd0fad57319d906362a6d4.zip
Check for missing header files automatically
-rw-r--r--config.mk5
-rw-r--r--src/Makefile1
-rw-r--r--src/config.mk3
-rwxr-xr-xtools/check_header.sh12
4 files changed, 16 insertions, 5 deletions
diff --git a/config.mk b/config.mk
index aae09506..d0c7f1f4 100644
--- a/config.mk
+++ b/config.mk
@@ -150,11 +150,6 @@ else
M4FLAGS += --define=WITH_HSTS=1
endif
-# If execinfo.h is not available, e.g. freebsd
-ifneq (${WITHOUT_EXECINFO}, 1)
-CFLAGS += -DHAS_EXECINFO
-endif
-
CFLAGS_OPTIONS := $(CFLAGS)
ifeq (${USEGTK3}, 1)
diff --git a/src/Makefile b/src/Makefile
index a1a3f287..3c0213c5 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -3,6 +3,7 @@
BASEDIR=..
include $(BASEDIR)/config.mk
+include config.mk
DEPS=$(patsubst %.o, %.d, $(OBJ))
diff --git a/src/config.mk b/src/config.mk
new file mode 100644
index 00000000..bb4706af
--- /dev/null
+++ b/src/config.mk
@@ -0,0 +1,3 @@
+ifeq ($(shell $(BASEDIR)/$(TOOLDIR)/check_header.sh execinfo.h $(CC)), 1)
+CFLAGS += -DHAS_EXECINFO
+endif
diff --git a/tools/check_header.sh b/tools/check_header.sh
new file mode 100755
index 00000000..19d7064a
--- /dev/null
+++ b/tools/check_header.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+HEADER="$1"
+CC="${2:-gcc}"
+
+echo "#include <$HEADER>" | "${CC}" -E - &>/dev/null
+if [ $? -eq 0 ]; then
+ echo 1
+else
+ echo 0
+fi
+