summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2016-08-04 19:30:20 +0300
committerTobias Klauser <tklauser@distanz.ch>2016-08-05 11:32:47 +0200
commitb073c8e5fd7f8c723680b659bd81afd231ef32f5 (patch)
tree1fb86f5f2c1455848420fd0c52ab5de2b7368c30
parent20a5e15443bfbbb7e6624a754832cdce19d462a0 (diff)
build: configure: Allow to compile tools without libnl
With libnl being made optional in commits 20a5e15443bf ("netsniff-ng: Allow to compile without libnl") and c831bcda3e26 ("trafgen: Allow to compile without libnl"), we can now compile netsniff-ng and trafgen without libnl being present. For now we don't consider libnl and libnl-route separately, meaning that if libnl-route is not present, we disable libnl support entirely. Also add a configure option to explicitely disable building netsniff-ng and trafgen with libnl support. Based on original patch by Vadim Kochan. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r--.travis.yml1
-rwxr-xr-xconfigure37
2 files changed, 35 insertions, 3 deletions
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..399733f 100755
--- a/configure
+++ b/configure
@@ -12,12 +12,14 @@ MISSING_NACL=0
TOOLS="netsniff-ng trafgen astraceroute flowtop ifpps bpfc curvetun mausezahn"
TOOLS_NOBUILD=""
+HAVE_LIBNL=0
HAVE_LIBPCAP=0
HAVE_HWTSTAMP=0
HAVE_LIBGEOIP=0
HAVE_LIBZ=0
HAVE_TPACKET3=0
+DISABLE_LIBNL=0
DISABLE_GEOIP=0
DISABLE_ZLIB=0
@@ -28,6 +30,7 @@ usage()
echo " -h, --help Display this help and exit"
echo ""
echo "Optional Features:"
+ echo " --disable-libnl Disable libnl support"
echo " --disable-geoip Disable geoip support"
echo " --disable-zlib Disable zlib support"
echo ""
@@ -43,6 +46,9 @@ while [ $# -gt 0 ] ; do
-h|--help)
usage
;;
+ --disable-libnl)
+ DISABLE_LIBNL=1
+ ;;
--disable-geoip)
DISABLE_GEOIP=1
;;
@@ -198,6 +204,11 @@ check_libnl()
{
echo -n "[*] Checking libnl ... "
+ if [ "$DISABLE_LIBNL" == "1" ] ; then
+ echo "[DISABLED]"
+ return
+ fi
+
cat > $TMPDIR/libnltest.c << EOF
#include <netlink/genl/genl.h>
#include <netlink/genl/family.h>
@@ -231,10 +242,9 @@ EOF
if [ ! -x $TMPDIR/libnltest ] ; then
echo "[NO]"
MISSING_DEFS=1
- tools_remove "trafgen"
- tools_remove "netsniff-ng"
else
echo "[YES]"
+ HAVE_LIBNL=1
fi
}
@@ -242,6 +252,16 @@ check_libnl_route()
{
echo -n "[*] Checking libnl-route ... "
+ if [ "$DISABLE_LIBNL" == "1" ] ; then
+ echo "[DISABLED]"
+ return
+ fi
+
+ if [ "$HAVE_LIBNL" == "0" ] ; then
+ echo "[SKIPPED]"
+ return
+ fi
+
cat > $TMPDIR/libnlroutetest.c << EOF
#include <netlink/route/link.h>
#include <netlink/route/addr.h>
@@ -267,9 +287,10 @@ EOF
if [ ! -x $TMPDIR/libnlroutetest ] ; then
echo "[NO]"
MISSING_DEFS=1
- tools_remove "netsniff-ng"
+ HAVE_LIBNL=0
else
echo "[YES]"
+ # HAVE_LIBNL already set by check_libnl()
fi
}
@@ -634,6 +655,7 @@ gen_config_hdr()
local _version=""
local _have_libpcap=""
local _have_libgeoip=""
+ local _have_libnl=""
local _have_libz=""
local _have_hwts=""
local _have_tp3=""
@@ -647,6 +669,12 @@ gen_config_hdr()
_version="(none)"
fi
+ if [ "$HAVE_LIBNL" == "1" ] ; then
+ _have_libnl="#define HAVE_LIBNL 1"
+ else
+ _have_libnl="/* HAVE_LIBNL is not defined */"
+ fi
+
if [ "$HAVE_LIBPCAP" == "1" ] ; then
_have_libpcap="#define HAVE_TCPDUMP_LIKE_FILTER 1"
else
@@ -686,6 +714,7 @@ gen_config_hdr()
#define FILE_PUBKEY ".curvetun/pub.key"
#define FILE_USERNAM ".curvetun/username"
#define GITVERSION "$_version"
+$_have_libnl
$_have_libpcap
$_have_libgeoip
$_have_libz
@@ -752,6 +781,8 @@ if [ -s config.log ] ; then
echo " config.log for details."
fi
+echo "CONFIG_LIBNL=$HAVE_LIBNL" >> Config
+
if [ "$HAVE_LIBGEOIP" == "1" -a "$HAVE_LIBZ" == "1" ] ; then
echo "CONFIG_GEOIP=1" >> Config
else