[netsniff-ng] [PATCH 1/2] build: configure: Add support for '--prefix=PREFIX' option

2016-08-18 Thread Vadim Kochan
Add new --prefix=PREFIX configure commandline option to specify
installation directory for binaries.

Add additional check in 'Cmds' file if --prefix was specified
from 'configure' script, in that case required installation path
components will be created automatically as it is done for
'make PREFIX=...' option.

Signed-off-by: Vadim Kochan 
---
 Cmds  |  7 ++-
 configure | 20 
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/Cmds b/Cmds
index 7167e0c..159939e 100644
--- a/Cmds
+++ b/Cmds
@@ -29,7 +29,12 @@ ifeq ("$(origin PREFIX)", "command line")
   INSTX = echo -e "  INST\t$(1)" && install -d $(2) && \
install -C $(1) $(2)/$(shell basename $(1))
 else
-  INSTX = echo -e "  INST\t$(1)" && install -C $(1) $(2)/$(shell basename $(1))
+  ifeq ("$(origin PREFIX)", "file")
+INSTX = echo -e "  INST\t$(1)" && install -d $(2) && \
+ install -C $(1) $(2)/$(shell basename $(1))
+  else
+INSTX = echo -e "  INST\t$(1)" && install -C $(1) $(2)/$(shell basename 
$(1))
+  endif
 endif
 
 MKDIR = echo -e  "  MKDIR\t$(1)" && mkdir -p $(1)
diff --git a/configure b/configure
index 4a5b7e3..db9727c 100755
--- a/configure
+++ b/configure
@@ -24,12 +24,24 @@ DISABLE_GEOIP=0
 DISABLE_ZLIB=0
 ENABLE_DEBUG=0
 
+PREFIX="/usr/local"
+HAVE_PREFIX=0
+
 usage()
 {
echo "Usage: ./configure [OPTION]... [VAR=VALUE]..."
echo ""
echo "  -h, --help   Display this help and exit"
echo ""
+   echo "Installation directories:"
+   echo "  --prefix=PREFIX  install architecture-independent files in 
PREFIX"
+   echo "   [$PREFIX]"
+   echo ""
+   echo "By default, \`make install' will install all the files in"
+   echo "\`$PREFIX/bin', \`$PREFIX/lib' etc.  You can specify"
+   echo "an installation prefix other than \`$PREFIX' using \`--prefix',"
+   echo "for instance \`--prefix=\$HOME'."
+   echo ""
echo "Optional Features:"
echo "  --disable-libnl  Disable libnl support"
echo "  --disable-geoip  Disable geoip support"
@@ -48,6 +60,10 @@ while [ $# -gt 0 ] ; do
-h|--help)
usage
;;
+   --prefix=*)
+   PREFIX="${1#*=}"
+   HAVE_PREFIX=1
+   ;;
--disable-libnl)
DISABLE_LIBNL=1
;;
@@ -794,6 +810,10 @@ else
echo "CONFIG_GEOIP=0" >> Config
 fi
 
+if [ "$HAVE_PREFIX" == "1" ] ; then
+   echo "PREFIX=$PREFIX" >> Config
+fi
+
 echo "CONFIG_DEBUG=$ENABLE_DEBUG" >> 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.


[netsniff-ng] [PATCH 2/2] build: configure: Add support for '--sysconfdir=PREFIX' option

2016-08-18 Thread Vadim Kochan
Add new '--sysconfdir=PREFIX' option to control installation of
config files, files will be installed into PREFIX/etc path.

Signed-off-by: Vadim Kochan 
---
 configure | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/configure b/configure
index db9727c..139483a 100755
--- a/configure
+++ b/configure
@@ -27,6 +27,8 @@ ENABLE_DEBUG=0
 PREFIX="/usr/local"
 HAVE_PREFIX=0
 
+SYSCONF_DIR=""
+
 usage()
 {
echo "Usage: ./configure [OPTION]... [VAR=VALUE]..."
@@ -42,6 +44,11 @@ usage()
echo "an installation prefix other than \`$PREFIX' using \`--prefix',"
echo "for instance \`--prefix=\$HOME'."
echo ""
+   echo "For better control, use the options below."
+   echo ""
+   echo "Fine tuning of the installation directories:"
+   echo "  --sysconfdir=DIR read-only single-machine data [PREFIX/etc]"
+   echo ""
echo "Optional Features:"
echo "  --disable-libnl  Disable libnl support"
echo "  --disable-geoip  Disable geoip support"
@@ -64,6 +71,9 @@ while [ $# -gt 0 ] ; do
PREFIX="${1#*=}"
HAVE_PREFIX=1
;;
+   --sysconfdir=*)
+   SYSCONF_DIR="${1#*=}"
+   ;;
--disable-libnl)
DISABLE_LIBNL=1
;;
@@ -814,6 +824,10 @@ if [ "$HAVE_PREFIX" == "1" ] ; then
echo "PREFIX=$PREFIX" >> Config
 fi
 
+if [ ! -z $SYSCONF_DIR ] ; then
+   echo "ETCDIR=$SYSCONF_DIR" >> Config
+fi
+
 echo "CONFIG_DEBUG=$ENABLE_DEBUG" >> 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.