Add command line parsing function which allows to compile tools (trafgen, netsniff-ng) without libnl-xxx libraries.
Option --disable-libnl sets CONFIG_LIBNL=0 which means compile tools without libnl dependencies. Signed-off-by: Vadim Kochan <vadi...@gmail.com> --- configure | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 105b1ec..61b2e31 100755 --- a/configure +++ b/configure @@ -18,8 +18,36 @@ HAVE_LIBGEOIP=0 HAVE_LIBZ=0 HAVE_TPACKET3=0 +CONFIG_LIBNL=1 + # use "CROSS_COMPILE=<prefix> SYSROOT=<path> ./configure && make" for cross compilation +usage() +{ + echo "Usage: ./configure [OPTIONS]" + echo -e "\t-h, --help - print usage" + echo -ne "\t--disable-libnl - compile without libnl." + echo "Some features (rfraw, nlmsg dissect) will not work in trafgen, netsniff-ng." + + exit 0 +} + +while [ $# -gt 0 ] +do + case "$1" in + -h|--help) + usage + ;; + --disable-libnl) + CONFIG_LIBNL=0 + ;; + *) + usage + ;; + esac + shift +done + [ -z "$CC" ] && CC="${CROSS_COMPILE}gcc" [ -z "$LD" ] && LD="${CROSS_COMPILE}gcc" if [ "x$SYSROOT" != "x" ] ; then @@ -194,8 +222,10 @@ EOF if [ ! -x $TMPDIR/libnltest ] ; then echo "[NO]" MISSING_DEFS=1 - tools_remove "trafgen" - tools_remove "netsniff-ng" + if [ "$CONFIG_LIBNL" == "1" ]; then + tools_remove "trafgen" + tools_remove "netsniff-ng" + fi else echo "[YES]" fi @@ -230,7 +260,9 @@ EOF if [ ! -x $TMPDIR/libnlroutetest ] ; then echo "[NO]" MISSING_DEFS=1 - tools_remove "netsniff-ng" + if [ "$CONFIG_LIBNL" == "1" ]; then + tools_remove "netsniff-ng" + fi else echo "[YES]" fi @@ -600,6 +632,7 @@ gen_config_hdr() local _have_libz="" local _have_hwts="" local _have_tp3="" + local _config_libnl="" echo "[*] Generating config.h ..." @@ -640,6 +673,12 @@ gen_config_hdr() _have_tp3="/* HAVE_TPACKET3 is not defined */" fi + if [ "$CONFIG_LIBNL" == "1" ] ; then + _config_libnl="#define CONFIG_LIBNL 1" + else + _config_libnl="/* CONFIG_LIBNL is not defined */" + fi + cat > config.h << EOF #ifndef CONFIG_H #define CONFIG_H @@ -654,6 +693,7 @@ $_have_libgeoip $_have_libz $_have_hwts $_have_tp3 +$_config_libnl #endif /* CONFIG_H */ EOF } @@ -721,6 +761,7 @@ else echo "CONFIG_GEOIP=0" >> Config fi +echo "CONFIG_LIBNL=$CONFIG_LIBNL" >> Config echo "CONFIG_TOOLS=$TOOLS" >> Config echo "CONFIG_OK=1" >> Config -- 2.6.3 -- You received this message because you are subscribed to the Google Groups "netsniff-ng" group. To unsubscribe from this group and stop receiving emails from it, send an email to netsniff-ng+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.