summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2016-08-04 11:13:42 +0200
committerTobias Klauser <tklauser@distanz.ch>2016-08-04 11:13:42 +0200
commite6b7339a68ce57244117e2470f87ff581520cfc7 (patch)
tree159f2c034dbe89425069ca158f457a90ec31f1c7
parent820e85f9f29513860092a02599efa529c00a1089 (diff)
build: configure: Use command line options to disable optional libraries
Make the configure script accept command line options similar to the autotools generated configure. Implement --disable-geoip and --disable-zlib and use the to replace the respective DISABLE_* variables introduced in 0349b93a6689a ("build: configure: Allow to disable support for libgeoip and zlib"). Also update INSTALL and the travis CI configuration accordingly. Based on previous work by Vadim Kochan. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r--.travis.yml6
-rw-r--r--INSTALL13
-rwxr-xr-xconfigure41
3 files changed, 50 insertions, 10 deletions
diff --git a/.travis.yml b/.travis.yml
index 3c66eed..fb7dd31 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -31,6 +31,6 @@ addons:
script:
- CC=$CC ./configure && make CC=$CC
- - CC=$CC DISABLE_GEOIP=1 ./configure && make clean && make CC=$CC
- - CC=$CC DISABLE_ZLIB=1 ./configure && make clean && make CC=$CC
- - CC=$CC DISABLE_GEOIP=1 DISABLE_ZLIB=1 ./configure && make clean && make CC=$CC
+ - 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
diff --git a/INSTALL b/INSTALL
index 79ccfd2..60c294b 100644
--- a/INSTALL
+++ b/INSTALL
@@ -72,15 +72,18 @@ The installation (deinstallation) process is fairly simple:
(# make uninstall)
-The configure script can be influenced by setting certain environment
-variables, e.g. CC or CROSS_COMPILE.
+The configure script can be influenced by setting certain command line
+options and environment variables (e.g. CC or CROSS_COMPILE). To get a list
+of all supported options and variables use:
+
+ $ ./configure --help
The use of the optional libGeoIP and libz libraries can be explicitely
-disabled by setting the corresponding variables for the configure
+disabled by using the corresponding command line option for the configure
script:
- $ DISABLE_GEOIP=1 ./configure
- $ DISABLE_ZLIB=1 ./configure
+ $ ./configure --disable-geoip
+ $ ./configure --disable-zlib
In order to remove all build files from the source tree:
diff --git a/configure b/configure
index 105b1ec..c7ba9a0 100755
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
#!/bin/bash
# This isn't a configure generated by autoconf!
# netsniff-ng build system
-# Copyright 2013-2015 Tobias Klauser <tklauser@distanz.ch>
+# Copyright 2013-2016 Tobias Klauser <tklauser@distanz.ch>
# Copyright 2013 Daniel Borkmann <borkmann@gnumaniacs.org>
# Subject to the GNU GPL, version 2.
@@ -18,7 +18,44 @@ HAVE_LIBGEOIP=0
HAVE_LIBZ=0
HAVE_TPACKET3=0
-# use "CROSS_COMPILE=<prefix> SYSROOT=<path> ./configure && make" for cross compilation
+DISABLE_GEOIP=0
+DISABLE_ZLIB=0
+
+usage()
+{
+ echo "Usage: ./configure [OPTION]... [VAR=VALUE]..."
+ echo ""
+ echo " -h, --help Display this help and exit"
+ echo ""
+ echo "Optional Features:"
+ echo " --disable-geoip Disable geoip support"
+ echo " --disable-zlib Disable zlib support"
+ echo ""
+ echo "Some influential environment variables:"
+ echo " CC C compiler command"
+ echo " CROSS_COMPILE C cross-compiler prefix"
+
+ exit 0
+}
+
+while [ $# -gt 0 ] ; do
+ case "$1" in
+ -h|--help)
+ usage
+ ;;
+ --disable-geoip)
+ DISABLE_GEOIP=1
+ ;;
+ --disable-zlib)
+ DISABLE_ZLIB=1
+ ;;
+ *)
+ echo "[!] Unrecognized option: '$1'. Try './configure --help' for more information"
+ exit 1
+ ;;
+ esac
+ shift
+done
[ -z "$CC" ] && CC="${CROSS_COMPILE}gcc"
[ -z "$LD" ] && LD="${CROSS_COMPILE}gcc"