Skip to content

Commit

Permalink
Fix configure --enable-* logic
Browse files Browse the repository at this point in the history
There were a few places where I handled flag processing wrong, treating
"specified" vs. "unspecified" wrongly as "enabled" vs. "disabled".
  • Loading branch information
jpr5 committed Sep 7, 2017
1 parent c67909d commit eb9a5e5
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 32 deletions.
48 changes: 30 additions & 18 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -1302,9 +1302,9 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-dropprivs disable privilege dropping logic
--enable-ipv6 enable IPv6 (and ICMPv6) support
--enable-pcap-restart enable BPF lexer restart bugfix for older versions of PCAP
--enable-pcre use PCRE instead of GNU regex
--enable-tcpkill enable connection killing support
--enable-pcap-restart enable BPF lexer restart bugfix for older versions of PCAP (default off)
--enable-pcre use PCRE instead of GNU regex (default GNU)
--enable-tcpkill enable connection killing support (default off)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
Expand Down Expand Up @@ -3394,28 +3394,38 @@ fi
# Check whether --enable-pcap-restart was given.
if test "${enable_pcap_restart+set}" = set; then :
enableval=$enable_pcap_restart;
USE_PCAP_RESTART="1"
use_pcap_restart="$enableval"
else
USE_PCAP_RESTART="0"
use_pcap_restart="no"
fi
if test $use_pcap_restart = yes; then
USE_PCAP_RESTART="1"
else
USE_PCAP_RESTART="0"
fi
REGEX_DIR=''
REGEX_OBJS=''
# Check whether --enable-pcre was given.
if test "${enable_pcre+set}" = set; then :
enableval=$enable_pcre;
enableval=$enable_pcre; use_pcre="$enableval"
else
use_pcre="no"
fi
if test use_pcre = yes; then
USE_PCRE="1"
EXTRA_LIBS="$EXTRA_LIBS -lpcre"
else
USE_PCRE="0"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
Expand All @@ -3431,14 +3441,12 @@ $as_echo "" >&6; }
( cd $REGEX_DIR && ./configure )
EXTRA_INCLUDES="$EXTRA_INCLUDES -I$REGEX_DIR"
fi
# Check whether --enable-tcpkill was given.
if test "${enable_tcpkill+set}" = set; then :
enableval=$enable_tcpkill;
Expand Down Expand Up @@ -3489,20 +3497,24 @@ else
echo !!! error: tcpkill feature enabled but no libnet found; exit
fi
use_tcpkill="$enableval"
else
use_tcpkill="no"
fi
if test $use_tcpkill = yes; then
USE_TCPKILL="1"
EXTRA_OBJS="$EXTRA_OBJS tcpkill.o"
EXTRA_DEFINES="$EXTRA_DEFINES $(libnet-config --defines)"
EXTRA_LIBS="$EXTRA_LIBS $(libnet-config --libs)"
else
USE_TCPKILL="0"
fi
# Check whether --with-pcap-includes was given.
if test "${with_pcap_includes+set}" = set; then :
withval=$with_pcap_includes; PCAP_DIR=$withval
Expand Down Expand Up @@ -4127,11 +4139,11 @@ $as_echo "CONFIG: BPF filter lexer restart enabled (using $PCAP_RESTART_FUNC)" >
fi
if test "$USE_IPv6" = "1"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: CONFIG: IPV6 support enabled" >&5
$as_echo "CONFIG: IPV6 support enabled" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: CONFIG: IPv6 support enabled" >&5
$as_echo "CONFIG: IPv6 support enabled" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: CONFIG: IPV6 support disabled" >&5
$as_echo "CONFIG: IPV6 support disabled" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: CONFIG: IPv6 support disabled" >&5
$as_echo "CONFIG: IPv6 support disabled" >&6; }
fi
if test "$USE_DROPPRIVS" = "1"; then
Expand Down
40 changes: 26 additions & 14 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,20 @@ dnl [1] https://github.com/jpr5/ngrep/issues/2
dnl

AC_ARG_ENABLE(pcap-restart,
[ --enable-pcap-restart enable BPF lexer restart bugfix for older versions of PCAP],
[ --enable-pcap-restart enable BPF lexer restart bugfix for older versions of PCAP (default off)],
[
USE_PCAP_RESTART="1"
use_pcap_restart="$enableval"
],
[
USE_PCAP_RESTART="0"
use_pcap_restart="no"
])

if test $use_pcap_restart = yes; then
USE_PCAP_RESTART="1"
else
USE_PCAP_RESTART="0"
fi


dnl
dnl Configure the regular expression library.
Expand All @@ -136,12 +142,14 @@ REGEX_DIR=''
REGEX_OBJS=''

AC_ARG_ENABLE(pcre,
[ --enable-pcre use PCRE instead of GNU regex],
[
[ --enable-pcre use PCRE instead of GNU regex (default GNU)],
[ use_pcre="$enableval" ],
[ use_pcre="no" ])

if test use_pcre = yes; then
USE_PCRE="1"
EXTRA_LIBS="$EXTRA_LIBS -lpcre"
],
[
else
USE_PCRE="0"

AC_MSG_RESULT
Expand All @@ -154,7 +162,7 @@ AC_ARG_ENABLE(pcre,
( cd $REGEX_DIR && ./configure )

EXTRA_INCLUDES="$EXTRA_INCLUDES -I$REGEX_DIR"
])
fi

AC_SUBST(REGEX_DIR)
AC_SUBST(REGEX_OBJS)
Expand All @@ -164,17 +172,21 @@ dnl tcpkill/libnet support (from Debian patch)
dnl

AC_ARG_ENABLE(tcpkill,
[ --enable-tcpkill enable connection killing support],
[ --enable-tcpkill enable connection killing support (default off)],
[
AC_CHECK_LIB(net, libnet_init_packet,,echo !!! error: tcpkill feature enabled but no libnet found; exit)
use_tcpkill="$enableval"
],
[ use_tcpkill="no" ])

if test $use_tcpkill = yes; then
USE_TCPKILL="1"
EXTRA_OBJS="$EXTRA_OBJS tcpkill.o"
EXTRA_DEFINES="$EXTRA_DEFINES $(libnet-config --defines)"
EXTRA_LIBS="$EXTRA_LIBS $(libnet-config --libs)"
],
[
else
USE_TCPKILL="0"
])
fi


AC_ARG_WITH(pcap-includes,
Expand Down Expand Up @@ -488,9 +500,9 @@ if test "$USE_PCAP_RESTART" = "1"; then
fi

if test "$USE_IPv6" = "1"; then
AC_MSG_RESULT(CONFIG: IPV6 support enabled)
AC_MSG_RESULT(CONFIG: IPv6 support enabled)
else
AC_MSG_RESULT(CONFIG: IPV6 support disabled)
AC_MSG_RESULT(CONFIG: IPv6 support disabled)
fi

if test "$USE_DROPPRIVS" = "1"; then
Expand Down

0 comments on commit eb9a5e5

Please sign in to comment.