From 5b0bee7086222085c3c0e5fc33989ee277d00d82 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Wed, 15 Jan 2020 10:00:44 +0100 Subject: [PATCH] use pkg-config to detect xtables library for iptables-extension --- iptables-extension/Makefile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/iptables-extension/Makefile b/iptables-extension/Makefile index 0d3e0bdbf..61c5aef5d 100644 --- a/iptables-extension/Makefile +++ b/iptables-extension/Makefile @@ -11,7 +11,17 @@ else endif endif -XTABLES = $(shell test -e /usr/include/xtables.h && echo 1) +XTABLES_INSTALLED=$(shell \ + if pkg-config --exists xtables; then \ + echo 'xtables found'; \ + fi) +ifneq ($(XTABLES_INSTALLED),) +XTABLES = 1 +CFLAGS += $(shell pkg-config --cflags --libs xtables) +else +XTABLES = $(shell test -e /usr/include/xtables.h && echo 1) +endif + IPTABLES = $(shell test -e /usr/include/iptables.h && echo 1) IP6TABLES = $(shell test -e /usr/include/ip6tables.h && echo 1)