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> --- .travis.yml | 1 + configure | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/.travis.yml b/.travis.yml index fb7dd31..aca9e1a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,3 +34,4 @@ script: - CC=$CC ./configure --disable-geoip && make clean && make CC=$CC - CC=$CC ./configure --disable-zlib && make clean && make CC=$CC - CC=$CC ./configure --disable-geoip --disable-zlib && make clean && make CC=$CC + - CC=$CC ./configure --disable-libnl && make clean && make CC=$CC diff --git a/configure b/configure index c7ba9a0..b9760bd 100755 --- a/configure +++ b/configure @@ -21,6 +21,8 @@ HAVE_TPACKET3=0 DISABLE_GEOIP=0 DISABLE_ZLIB=0 +CONFIG_LIBNL=1 + usage() { echo "Usage: ./configure [OPTION]... [VAR=VALUE]..." @@ -30,6 +32,7 @@ usage() echo "Optional Features:" echo " --disable-geoip Disable geoip support" echo " --disable-zlib Disable zlib support" + echo " --disable-libnl Disable libnl support" echo "" echo "Some influential environment variables:" echo " CC C compiler command" @@ -49,6 +52,9 @@ while [ $# -gt 0 ] ; do --disable-zlib) DISABLE_ZLIB=1 ;; + --disable-libnl) + CONFIG_LIBNL=0 + ;; *) echo "[!] Unrecognized option: '$1'. Try './configure --help' for more information" exit 1 @@ -198,6 +204,11 @@ check_libnl() { echo -n "[*] Checking libnl ... " + if [ "$CONFIG_LIBNL" == "0" ] ; then + echo "[DISABLED]" + return + fi + cat > $TMPDIR/libnltest.c << EOF #include <netlink/genl/genl.h> #include <netlink/genl/family.h> @@ -242,6 +253,11 @@ check_libnl_route() { echo -n "[*] Checking libnl-route ... " + if [ "$CONFIG_LIBNL" == "0" ] ; then + echo "[DISABLED]" + return + fi + cat > $TMPDIR/libnlroutetest.c << EOF #include <netlink/route/link.h> #include <netlink/route/addr.h> @@ -637,6 +653,7 @@ gen_config_hdr() local _have_libz="" local _have_hwts="" local _have_tp3="" + local _config_libnl="" echo "[*] Generating config.h ..." @@ -677,6 +694,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 @@ -691,6 +714,7 @@ $_have_libgeoip $_have_libz $_have_hwts $_have_tp3 +$_config_libnl #endif /* CONFIG_H */ EOF } @@ -758,6 +782,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.9.2 -- 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.