ongrep

A cleaned up fork of ngrep for OpenBSD
git clone git://git.sgregoratto.me/ongrep
Log | Files | Refs | README | LICENSE

commit eb9a5e515f2f6a2974ccd5d321c99354f7128d3b
parent c67909d977b2129155c526b9a91514ed56e1f7aa
Author: Jordan Ritter <jpr5@darkridge.com>
Date:   Thu,  7 Sep 2017 13:28:27 -0700

Fix configure --enable-* logic

There were a few places where I handled flag processing wrong, treating
"specified" vs. "unspecified" wrongly as "enabled" vs. "disabled".

Diffstat:
Mconfigure | 48++++++++++++++++++++++++++++++------------------
Mconfigure.in | 40++++++++++++++++++++++++++--------------
2 files changed, 56 insertions(+), 32 deletions(-)

diff --git a/configure b/configure @@ -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] @@ -3394,15 +3394,21 @@ 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='' @@ -3410,12 +3416,16 @@ 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 @@ -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; @@ -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 @@ -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 diff --git a/configure.in b/configure.in @@ -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. @@ -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 @@ -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) @@ -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, @@ -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