diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-07-11 14:34:16 +0200 |
---|---|---|
committer | Daniel Borkmann <dborkman@redhat.com> | 2013-07-11 14:34:16 +0200 |
commit | 5cbeddbe19f6001d540b062deb3618200c8ca372 (patch) | |
tree | e92ebd16150361d1337af69d35c6c3a6fc09f973 | |
parent | aae407f55ffb2ce5211898559b81898af8d9d994 (diff) |
configure, netsniff-ng: if no libgeopip, do not link against libz
In netsniff-ng, we only use libz in combination with libgeoip, so if
we lack either one of them, do not link against the other either.
This would be a waste otherwise.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
-rwxr-xr-x | configure | 17 | ||||
-rw-r--r-- | geoip.h | 2 | ||||
-rw-r--r-- | netsniff-ng/Makefile | 10 |
3 files changed, 22 insertions, 7 deletions
@@ -15,6 +15,7 @@ TOOLS_NOBUILD="" HAVE_LIBPCAP=0 HAVE_HWTSTAMP=0 HAVE_LIBGEOIP=0 +HAVE_LIBZ=0 [ -z $CC ] && CC=cc @@ -347,12 +348,14 @@ EOF $CC -o $TMPDIR/ztest $TMPDIR/ztest.c -lz >> $TMPDIR/config.log 2>&1 if [ ! -x $TMPDIR/ztest ] ; then echo "[NO]" + echo "CONFIG_LIBZ=0" >> Config MISSING_DEFS=1 - tools_remove "netsniff-ng" tools_remove "astraceroute" tools_remove "flowtop" else echo "[YES]" + echo "CONFIG_LIBZ=1" >> Config + HAVE_LIBZ=1 fi } @@ -507,6 +510,7 @@ gen_config_hdr() local _version="`git describe --always`" local _have_libpcap="" local _have_libgeoip="" + local _have_libz="" local _have_hwts="" echo "[*] Generating config.h ... " @@ -523,6 +527,10 @@ gen_config_hdr() _have_libgeoip="#define HAVE_GEOIP 1" fi + if [ "$HAVE_LIBZ" == "1" ] ; then + _have_libz="#define HAVE_LIBZ 1" + fi + cat > config.h << EOF #ifndef CONFIG_H #define CONFIG_H @@ -534,6 +542,7 @@ gen_config_hdr() #define GITVERSION "$_version" $_have_libpcap $_have_libgeoip +$_have_libz $_have_hwts #endif /* CONFIG_H */ EOF @@ -588,6 +597,12 @@ else echo "[*] Looks good! All tools will be built!" fi +if [ "$HAVE_LIBGEOIP" == "1" -a "$HAVE_LIBZ" == "1" ] ; then + echo "CONFIG_GEOIP=1" >> Config +else + echo "CONFIG_GEOIP=0" >> Config +fi + echo "CONFIG_TOOLS=$TOOLS" >> Config echo "CONFIG_OK=1" >> Config @@ -7,7 +7,7 @@ #include "config.h" #include "die.h" -#ifdef HAVE_GEOIP +#if defined(HAVE_GEOIP) && defined(HAVE_LIBZ) extern void init_geoip(int enforce); extern void update_geoip(void); extern int geoip_working(void); diff --git a/netsniff-ng/Makefile b/netsniff-ng/Makefile index fb913d6..55335e5 100644 --- a/netsniff-ng/Makefile +++ b/netsniff-ng/Makefile @@ -1,13 +1,13 @@ netsniff-ng-libs = $(shell pkg-config --libs libnl-3.0) \ $(shell pkg-config --libs libnl-genl-3.0) \ - -lpthread \ - -lz + -lpthread ifeq ($(CONFIG_LIBPCAP), 1) netsniff-ng-libs += -lpcap endif -ifeq ($(CONFIG_LIBGEOIP), 1) -netsniff-ng-libs += -lGeoIP +ifeq ($(CONFIG_GEOIP), 1) +netsniff-ng-libs += -lGeoIP \ + -lz endif netsniff-ng-objs = dissector.o \ @@ -66,7 +66,7 @@ netsniff-ng-objs = dissector.o \ ifeq ($(CONFIG_LIBPCAP), 1) netsniff-ng-objs += bpf_comp.o endif -ifeq ($(CONFIG_LIBGEOIP), 1) +ifeq ($(CONFIG_GEOIP), 1) netsniff-ng-objs += geoip.o endif ifeq ($(CONFIG_HWTSTAMP), 1) |