]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: make it build with older compilers again
authorJohannes Berg <johannes.berg@intel.com>
Mon, 4 Feb 2019 13:32:36 +0000 (14:32 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 4 Feb 2019 13:37:39 +0000 (14:37 +0100)
There's no reason to require a newer compiler that understands
-Wstringop-overflow=4, make that optional.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Makefile

index 46d30306f63109dccf620b99a7dac79174079335..33aaf6aab6d05e9b0674cba4bcac2aa735286b32 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -9,10 +9,14 @@ MKDIR ?= mkdir -p
 INSTALL ?= install
 CC ?= "gcc"
 
+cc-option = $(shell set -e ; $(CC) $(1) -c -x c /dev/null -o /dev/null >/dev/null 2>&1 && echo '$(1)')
+
+CFLAGS_EVAL := $(call cc-option,-Wstringop-overflow=4)
+
 CFLAGS ?= -O2 -g
 CFLAGS += -Wall -Wextra -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common \
          -Werror-implicit-function-declaration -Wsign-compare -Wno-unused-parameter \
-         -Wstringop-overflow=4
+         $(CFLAGS_EVAL)
 
 OBJS = iw.o genl.o event.o info.o phy.o \
        interface.o ibss.o station.o survey.o util.o ocb.o \