From 71dcf3565dff3f77ec2ea1f7f3f2035bb573dcab Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Fri, 3 May 2013 11:33:36 +0200 Subject: [PATCH] miniupnpd: Use pkg-config under linux to find libiptc. Thanks to Olivier Langlois --- miniupnpd/Changelog.txt | 5 ++++- miniupnpd/INSTALL | 6 ++---- miniupnpd/Makefile.linux | 24 +++++++++++++++++++++++- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/miniupnpd/Changelog.txt b/miniupnpd/Changelog.txt index be13d78..8b173f7 100644 --- a/miniupnpd/Changelog.txt +++ b/miniupnpd/Changelog.txt @@ -1,4 +1,7 @@ -$Id: Changelog.txt,v 1.337 2013/04/29 09:34:13 nanard Exp $ +$Id: Changelog.txt,v 1.338 2013/05/03 09:30:32 nanard Exp $ + +2013/05/03: + Use pkg-config under linux to find libiptc. Thanks to Olivier Langlois 2013/04/29: Add warning message when using IPv4 address for listening_ip with IPv6 enabled diff --git a/miniupnpd/INSTALL b/miniupnpd/INSTALL index f0ab093..e6a6fbc 100644 --- a/miniupnpd/INSTALL +++ b/miniupnpd/INSTALL @@ -1,5 +1,5 @@ MiniUPnP project. -(c) 2006-2012 Thomas Bernard +(c) 2006-2013 Thomas Bernard Homepage : http://miniupnp.free.fr/ Mirror: http://miniupnp.tuxfamily.org/ github: https://github.com/miniupnp/miniupnp @@ -74,8 +74,6 @@ To Build and install : > make -f Makefile.linux If not using iptables from your system, > IPTABLESPATH=/path/to/iptables-1.4.1 make -f Makefile.linux - note : make sure you have iptables with static libraries compiled. - use "./configure --enable-static" before compiling iptables - install as root using : > make -f Makefile.linux install - A miniupnpd script should be installed to /etc/init.d @@ -101,7 +99,7 @@ How to get libiptc with its headers on debian : > ./configure --enable-static > make - it is now possible to compile miniupnpd using the following command : - > IPTABLESPATH=§path/to/iptables-x.x.x make -f Makefile.linux + > IPTABLESPATH=/path/to/iptables-x.x.x make -f Makefile.linux =========================== Configuration ============================= Edit the /etc/miniupnpd.conf file to set options. Almost all options are diff --git a/miniupnpd/Makefile.linux b/miniupnpd/Makefile.linux index ba3c648..9d357f8 100644 --- a/miniupnpd/Makefile.linux +++ b/miniupnpd/Makefile.linux @@ -1,4 +1,4 @@ -# $Id: Makefile.linux,v 1.76 2013/02/07 15:56:10 nanard Exp $ +# $Id: Makefile.linux,v 1.78 2013/05/03 09:30:33 nanard Exp $ # MiniUPnP project # (c) 2006-2013 Thomas Bernard # http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ @@ -54,6 +54,27 @@ NETFILTEROBJS = netfilter/iptcrdr.o netfilter/iptpinhole.o ALLOBJS = $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS) +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 ) +# test if iptables version >= 1.4.3 +TEST := $(shell [ \( \( $(IPTABLESVERSION1) -ge 1 \) -a \( $(IPTABLESVERSION2) -ge 4 \) \) -a \( $(IPTABLESVERSION3) -ge 3 \) ] && echo 1 ) +ifeq ($(TEST), 1) +CFLAGS += -DIPTABLES_143 +endif + +CFLAGS += $(shell pkg-config --cflags libiptc) +LIBS += $(shell pkg-config --libs-only-l libiptc) +LDFLAGS += $(shell pkg-config --libs-only-L libiptc) +LDFLAGS += $(shell pkg-config --libs-only-other libiptc) + +else + ifeq "$(wildcard /etc/gentoo-release )" "" LIBS ?= -liptc else # gentoo @@ -115,6 +136,7 @@ LIBS := $(LIBS) -lip6tc endif # ($(TESTIP6TC), 1) endif # ($(TEST), 1) endif # ifdef IPTABLESPATH +endif # ifdef PCFILE_FOUND LIBS += -lnfnetlink