From 36476eaf763d29e8885f519ab1e0b8beda28074a Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Mon, 8 Jul 2013 18:49:25 +0200 Subject: configure: netsniff-ng: libpcap is not a hard dependency netsniff-ng uses libpcap only for high-level filter compiling. Thus, let netsniff-ng not "hard-depend" on libpcap, but rather disable filter compiling in case the user does not want to install libpcap. Signed-off-by: Daniel Borkmann --- Makefile | 8 +++++++- configure | 3 ++- netsniff-ng/Makefile | 10 ++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 5fe3447..f1a75a9 100644 --- a/Makefile +++ b/Makefile @@ -81,6 +81,12 @@ CFLAGS_DEF += -D_LARGEFILE_SOURCE CFLAGS_DEF += -D_LARGEFILE64_SOURCE CFLAGS_DEF += -D_FILE_OFFSET_BITS=64 +ifeq ($(CONFIG_LIBPCAP), 1) + CFLAGS_PCAP = -D__WITH_TCPDUMP_LIKE_FILTER +else + CFLAGS_PCAP = +endif + WFLAGS_DEF = -Wall WFLAGS_DEF += -Wformat=2 WFLAGS_DEF += -Wmissing-prototypes @@ -245,7 +251,7 @@ $(foreach tool,$(TOOLS),$(eval $(call TOOL_templ,$(tool)))) %:: ; -netsniff-ng: ALL_CFLAGS += $(shell pkg-config --cflags libnl-3.0) $(shell pkg-config --cflags libnl-genl-3.0) -D__WITH_PROTOS -D__WITH_TCPDUMP_LIKE_FILTER +netsniff-ng: ALL_CFLAGS += $(shell pkg-config --cflags libnl-3.0) $(shell pkg-config --cflags libnl-genl-3.0) $(CFLAGS_PCAP) -D__WITH_PROTOS trafgen: ALL_CFLAGS += -I.. $(shell pkg-config --cflags libnl-3.0) $(shell pkg-config --cflags libnl-genl-3.0) -D__WITH_PROTOS ifpps: ALL_CFLAGS += $(shell pkg-config --cflags ncurses) flowtop: ALL_CFLAGS += $(shell pkg-config --cflags ncurses) diff --git a/configure b/configure index f31cfa0..04c9c4e 100755 --- a/configure +++ b/configure @@ -359,11 +359,12 @@ EOF $CC -o $TMPDIR/pcaptest $TMPDIR/pcaptest.c -lpcap >> $TMPDIR/config.log 2>&1 if [ ! -x $TMPDIR/pcaptest ] ; then echo "[NO]" + echo "CONFIG_LIBPCAP=0" >> Config MISSING_DEFS=1 - tools_remove "netsniff-ng" tools_remove "mausezahn" else echo "[YES]" + echo "CONFIG_LIBPCAP=1" >> Config fi } diff --git a/netsniff-ng/Makefile b/netsniff-ng/Makefile index 356ae2e..e05ad1d 100644 --- a/netsniff-ng/Makefile +++ b/netsniff-ng/Makefile @@ -1,10 +1,13 @@ netsniff-ng-libs = -lGeoIP \ $(shell pkg-config --libs libnl-3.0) \ $(shell pkg-config --libs libnl-genl-3.0) \ - -lpcap \ -lpthread \ -lz +ifeq ($(CONFIG_LIBPCAP), 1) +netsniff-ng-libs += -lpcap +endif + netsniff-ng-objs = dissector.o \ dissector_eth.o \ dissector_80211.o \ @@ -46,7 +49,6 @@ netsniff-ng-objs = dissector.o \ xmalloc.o \ hash.o \ bpf.o \ - bpf_comp.o \ oui.o \ pcap_rw.o \ pcap_sg.o \ @@ -60,3 +62,7 @@ netsniff-ng-objs = dissector.o \ geoip.o \ mac80211.o \ netsniff-ng.o + +ifeq ($(CONFIG_LIBPCAP), 1) +netsniff-ng-objs += bpf_comp.o +endif -- cgit v1.2.3-54-g00ecf