Fix test of iptables(libiptc) version

fix for versions >= 1.5.x
This commit is contained in:
Thomas Bernard 2016-04-18 11:00:53 +02:00
parent 0877a65ed6
commit 60b38bf556
1 changed files with 14 additions and 8 deletions

View File

@ -60,11 +60,14 @@ PCFILE_FOUND := $(shell $(PKG_CONFIG) --exists libiptc; echo $$?)
ifeq (${PCFILE_FOUND},0)
IPTABLESVERSION := $(shell $(PKG_CONFIG) --modversion libiptc)
IPTABLESVERSION1 := $(shell echo $(IPTABLESVERSION) | cut -d. -f1 )
IPTABLESVERSION2 := $(shell echo $(IPTABLESVERSION) | cut -d. -f2 )
IPTABLESVERSION3 := $(shell echo $(IPTABLESVERSION) | cut -d. -f3 )
IPTVER1 := $(shell echo $(IPTABLESVERSION) | cut -d. -f1 )
IPTVER2 := $(shell echo $(IPTABLESVERSION) | cut -d. -f2 )
IPTVER3 := $(shell echo $(IPTABLESVERSION) | cut -d. -f3 )
# test if iptables version >= 1.4.3
TEST := $(shell [ \( \( $(IPTABLESVERSION1) -ge 1 \) -a \( $(IPTABLESVERSION2) -ge 4 \) \) -a \( $(IPTABLESVERSION3) -ge 3 \) ] && echo 1 )
TEST := $(shell [ $(IPTVER1) -gt 1 ] || \
[ \( $(IPTVER1) -eq 1 \) -a \
\( \( $(IPTVER2) -gt 4 \) -o \
\( \( $(IPTVER2) -eq 4 \) -a \( $(IPTVER3) -ge 3 \) \) \) ] && echo 1 )
ifeq ($(TEST), 1)
CPPFLAGS += -DIPTABLES_143
endif
@ -92,11 +95,14 @@ LDFLAGS := $(LDFLAFGS) -L$(IPTABLESPATH)/libiptc/
# get iptables version and set IPTABLES_143 macro if needed
ifeq ($(TARGET_OPENWRT),)
IPTABLESVERSION := $(shell grep "\#define VERSION" $(IPTABLESPATH)/config.h | tr -d \" |cut -d" " -f3 )
IPTABLESVERSION1 := $(shell echo $(IPTABLESVERSION) | cut -d. -f1 )
IPTABLESVERSION2 := $(shell echo $(IPTABLESVERSION) | cut -d. -f2 )
IPTABLESVERSION3 := $(shell echo $(IPTABLESVERSION) | cut -d. -f3 )
IPTVER1 := $(shell echo $(IPTABLESVERSION) | cut -d. -f1 )
IPTVER2 := $(shell echo $(IPTABLESVERSION) | cut -d. -f2 )
IPTVER3 := $(shell echo $(IPTABLESVERSION) | cut -d. -f3 )
# test if iptables version >= 1.4.3
TEST := $(shell [ \( \( $(IPTABLESVERSION1) -ge 1 \) -a \( $(IPTABLESVERSION2) -ge 4 \) \) -a \( $(IPTABLESVERSION3) -ge 3 \) ] && echo 1 )
TEST := $(shell [ $(IPTVER1) -gt 1 ] || \
[ \( $(IPTVER1) -eq 1 \) -a \
\( \( $(IPTVER2) -gt 4 \) -o \
\( \( $(IPTVER2) -eq 4 \) -a \( $(IPTVER3) -ge 3 \) \) \) ] && echo 1 )
ifeq ($(TEST), 1)
CPPFLAGS := $(CPPFLAGS) -DIPTABLES_143
# the following sucks, but works