configure.in (ngrep-1_45) | : | configure.in (ngrep-1_47) | ||
---|---|---|---|---|
dnl | dnl | |||
dnl $Id$ | dnl Copyright (c) 2017 Jordan Ritter <jpr5@darkridge.com> | |||
dnl | ||||
dnl Copyright (c) 2001 Jordan Ritter <jpr5@darkridge.com> | ||||
dnl | dnl | |||
dnl Please refer to the LICENSE file for more information. | dnl Please refer to the LICENSE file for more information. | |||
dnl | dnl | |||
dnl NOTE: configure.in requires autoconf 2.57 or more recent. | dnl NOTE: configure.in requires autoconf 2.57 or more recent. | |||
AC_INIT(ngrep.c) | AC_INIT(ngrep.c) | |||
echo | AC_MSG_RESULT | |||
echo 'Configuring System ...' | AC_MSG_RESULT(Configuring System ...) | |||
echo | AC_MSG_RESULT | |||
AC_CANONICAL_SYSTEM | AC_CANONICAL_SYSTEM | |||
AC_PROG_CC | AC_PROG_CC | |||
AC_HEADER_STDC | AC_HEADER_STDC | |||
AC_PREFIX_DEFAULT(/usr/local) | AC_PREFIX_DEFAULT(/usr/local) | |||
if test -n "`which tcpdump 2> /dev/null`"; then | if test -n "`which tcpdump 2> /dev/null`"; then | |||
AC_PREFIX_PROGRAM(tcpdump) | AC_PREFIX_PROGRAM(tcpdump) | |||
fi | fi | |||
dnl | ||||
dnl The following are globals that we tack on to the associated | ||||
dnl variables in the makefile. They get AC_SUBST'd at the end. | ||||
dnl | ||||
EXTRA_DEFINES="" | EXTRA_DEFINES="" | |||
EXTRA_INCLUDES="" | EXTRA_INCLUDES="" | |||
EXTRA_LDFLAGS="" | ||||
EXTRA_OBJS="" | ||||
EXTRA_LIBS="" | EXTRA_LIBS="" | |||
dnl | dnl | |||
dnl Define the arguments that we accept. | dnl Define the arguments that we accept. Parse them first. | |||
dnl | dnl | |||
dnl | dnl | |||
dnl For libpcap's that don't need the restart function called for | ||||
dnl multiple lexer passes, allow them to turn it off here. This option | ||||
dnl exists solely to address a very rude email from the maintainer | ||||
dnl indicating that it shouldn't be called directly (and of course he | ||||
dnl was wrong because this is still needed). | ||||
dnl | ||||
AC_ARG_ENABLE(pcap-restart, | ||||
[ --disable-pcap-restart disable libpcap restart in parser], | ||||
[ | ||||
use_pcap_restart="$enableval" | ||||
], | ||||
[ | ||||
use_pcap_restart="yes" | ||||
]) | ||||
if test $use_pcap_restart = yes; then | ||||
USE_PCAP_RESTART="1" | ||||
else | ||||
USE_PCAP_RESTART="0" | ||||
fi | ||||
dnl | ||||
dnl Allow user to specify alternate ``nobody'' user. | dnl Allow user to specify alternate ``nobody'' user. | |||
dnl | dnl | |||
AC_ARG_WITH(dropprivs-user, | AC_ARG_WITH(dropprivs-user, | |||
[ --with-dropprivs-user[=user] use different user for dropprivs], | [ --with-dropprivs-user[=user] use different user for dropprivs], | |||
[ | [ | |||
DROPPRIVS_USER="$withval" | DROPPRIVS_USER="$withval" | |||
], | ], | |||
[ | [ | |||
DROPPRIVS_USER="nobody" | DROPPRIVS_USER="nobody" | |||
]) | ]) | |||
dnl | dnl | |||
dnl Enable or disable the drop privileges logic. | dnl Enable or disable the drop privileges logic. | |||
dnl | dnl | |||
skipping to change at line 113 | skipping to change at line 85 | |||
use_ipv6="no" | use_ipv6="no" | |||
]) | ]) | |||
if test $use_ipv6 = yes; then | if test $use_ipv6 = yes; then | |||
USE_IPv6="1" | USE_IPv6="1" | |||
else | else | |||
USE_IPv6="0" | USE_IPv6="0" | |||
fi | fi | |||
dnl | dnl | |||
dnl Configure the regular expression library. | dnl PCAP BPF filter expression lexer bugfix | |||
dnl | ||||
dnl Typically ngrep is invoked with a (optional) search string plus a BPF | ||||
dnl filter. However, ngrep doesn't semantically understand BPF filter terms | ||||
dnl itself, so it assumes the first non-option parameter is the search string, | ||||
dnl and attempts to compile the remainder as the BPF filter expression. If the | ||||
dnl compilation fails, it probably means that no search string was specified, so | ||||
dnl it restarts the BPF filter expression lexer and attempts to compile the | ||||
dnl entire non-option parameter string as the expression. If that fails, then | ||||
dnl the specified BPF filter expression is definitely bogus and ngrep errors | ||||
dnl out. | ||||
dnl | ||||
dnl I favored this approach because it made invocation simpler & more fluid. In | ||||
dnl order to make it work however, I had to solve for a bug in older versions of | ||||
dnl libpcap where the library would segfault if the BPF filter compilation | ||||
dnl function was invoked more than once. The workaround turned out to be a | ||||
dnl simple invocation of the lexer's restart function in between compilation | ||||
dnl invocations, however that function wasn't normally exposed in the header | ||||
dnl since it was an internal built-in of whatever grammar lexer libpcap had | ||||
dnl compiled with (bison/yacc/etc). | ||||
dnl | ||||
dnl The default behavior has long been to restart the lexer (keeping invocation | ||||
dnl simpler) and provide a compile-time option to disable the mechanism, if | ||||
dnl anyone cared to. Based on a more recent bug report however[1], it seems | ||||
dnl that the newer libpcap breaks when the lexer restart function is called. | ||||
dnl So, given the choice between old platforms working by default (always call | ||||
dnl restart/allow disablement at compile-time) vs. newer platforms working by | ||||
dnl default (never call restart/allow enablement at compile-time), the default | ||||
dnl behavior now is to do the latter. | ||||
dnl | ||||
dnl For versions of libpcap that require restart function invocation in between | ||||
dnl multiple lexer passes, allow them to enable it here. | ||||
dnl | ||||
dnl [1] https://github.com/jpr5/ngrep/issues/2 | ||||
dnl | dnl | |||
AC_ARG_ENABLE(pcre, | AC_ARG_ENABLE(pcap-restart, | |||
[ --enable-pcre use PCRE instead of GNU regex], | [ --enable-pcap-restart enable BPF lexer restart bugfix for older versions of | |||
PCAP (default off)], | ||||
[ | [ | |||
use_pcre="$enableval" | use_pcap_restart="$enableval" | |||
], | ], | |||
[ | [ | |||
use_pcre="no" | use_pcap_restart="no" | |||
]) | ]) | |||
if test $use_pcre = yes; then | if test $use_pcap_restart = yes; then | |||
USE_PCAP_RESTART="1" | ||||
else | ||||
USE_PCAP_RESTART="0" | ||||
fi | ||||
dnl | ||||
dnl Configure the regular expression library. | ||||
dnl | ||||
REGEX_DIR='' | ||||
REGEX_OBJS='' | ||||
echo | AC_ARG_ENABLE(pcre, | |||
echo 'Configuring Perl-Compatible Regular Expression (PCRE) library ...' | [ --enable-pcre use PCRE instead of GNU regex (default GNU)], | |||
echo | [ use_pcre="$enableval" ], | |||
[ use_pcre="no" ]) | ||||
REGEX_DIR='pcre-5.0' | if test use_pcre = yes; then | |||
REGEX_OBJS="$REGEX_DIR/pcre.o $REGEX_DIR/study.o" | ||||
USE_PCRE="1" | USE_PCRE="1" | |||
EXTRA_LIBS="$EXTRA_LIBS -lpcre" | ||||
else | else | |||
USE_PCRE="0" | ||||
echo | AC_MSG_RESULT | |||
echo 'Configuring GNU Regular Expression library ...' | AC_MSG_RESULT(Configuring GNU Regular Expression library ...) | |||
echo | AC_MSG_RESULT | |||
REGEX_DIR='regex-0.12' | REGEX_DIR='regex-0.12' | |||
REGEX_OBJS="$REGEX_DIR/regex.o" | REGEX_OBJS="$REGEX_DIR/regex.o" | |||
USE_PCRE="0" | ||||
fi | ( cd $REGEX_DIR && ./configure ) | |||
( cd $REGEX_DIR && ./configure ) | EXTRA_INCLUDES="$EXTRA_INCLUDES -I$REGEX_DIR" | |||
fi | ||||
AC_SUBST(REGEX_DIR) | AC_SUBST(REGEX_DIR) | |||
AC_SUBST(REGEX_OBJS) | AC_SUBST(REGEX_OBJS) | |||
echo | ||||
echo 'Configuring Network Grep (ngrep) ...' | ||||
echo | ||||
dnl | dnl | |||
dnl OS-specific options | dnl tcpkill/libnet support (from Debian patch) | |||
dnl | dnl | |||
STRIPFLAG="-s" | AC_ARG_ENABLE(tcpkill, | |||
HAVE_DUMB_UDPHDR="0" | [ --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" ]) | ||||
case "$target_os" in | 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 | ||||
*linux*) | AC_ARG_ENABLE(vlan-hack, | |||
AC_SUBST(OS, LINUX) | [ --disable-vlan-hack disable automatic inclusion of VLAN frames (default o | |||
n)], | ||||
[use_vlan_hack="$enableval"], | ||||
[use_vlan_hack="yes"]) | ||||
AC_MSG_CHECKING(for a broken redhat glibc udphdr declaration) | if test $use_vlan_hack = yes; then | |||
AC_TRY_COMPILE([ | USE_VLAN_HACK="1" | |||
#ifndef __FAVOR_BSD | else | |||
#define __FAVOR_BSD | USE_VLAN_HACK="0" | |||
#endif | fi | |||
#ifndef _BSD_SOURCE | AC_ARG_WITH(pcap-includes, | |||
#define _BSD_SOURCE 1 | [ --with-pcap-includes=dir specify the pcap include directory], | |||
#endif | [PCAP_DIR=$withval], | |||
[ | ||||
PCAP_DIR="`eval echo -n ${includedir}` \ | ||||
/usr/include /usr/include/pcap \ | ||||
/usr/local/include /usr/local/include/pcap \ | ||||
/opt/local/include /opt/local/include/pcap \ | ||||
/usr/share/include /usr/share/include/pcap" | ||||
]) | ||||
#undef _GNU_SOURCE | AC_MSG_RESULT | |||
AC_MSG_RESULT(Configuring Network Grep ...) | ||||
AC_MSG_RESULT | ||||
#include <netinet/udp.h> | dnl | |||
],[ | dnl OS-specific options | |||
struct udphdr foo; | dnl | |||
unsigned short bar = foo.source; | ||||
], | ||||
HAVE_DUMB_UDPHDR="1" && echo "yes", | ||||
HAVE_DUMB_UDPHDR="0" && echo "no") | ||||
;; | STRIPFLAG="-s" | |||
*bsd*) | case "$target_os" in | |||
AC_SUBST(OS, BSD) | ||||
if test "$USE_PCAP_RESTART" = "0"; then | *linux*) | |||
AC_SUBST(OS, LINUX) | ||||
AC_MSG_WARN( | ;; | |||
Your OS ($target_os) may have an old libpcap installation. | ||||
If the resulting ngrep binary segfaults when a BPF filter is specified | ||||
without an ngrep match string then you should reconfigure ngrep with | ||||
the option ``--disable-pcap-restart''. | ||||
) | ||||
sleep 3 | ||||
fi | *bsd*) | |||
AC_SUBST(OS, BSD) | ||||
;; | ;; | |||
*solaris*) | *solaris*) | |||
AC_SUBST(OS, SOLARIS) | AC_SUBST(OS, SOLARIS) | |||
AC_CHECK_LIB(socket, socket,, | AC_CHECK_LIB(socket, socket,, | |||
echo no socket in -lsocket\?; exit) | [AC_MSG_ERROR(no socket in -lsocket)]) | |||
AC_CHECK_LIB(nsl, gethostbyname,, | AC_CHECK_LIB(nsl, gethostbyname,, | |||
echo no gethostbyname in -lnsl\?; exit) | [AC_MSG_ERROR(no gethostbyname in -lnsl)]) | |||
EXTRA_LIBS="$EXTRA_LIBS -lnsl -lsocket" | EXTRA_LIBS="$EXTRA_LIBS -lnsl -lsocket" | |||
;; | ;; | |||
*osf*) | *osf*) | |||
AC_SUBST(OS, OSF1) | AC_SUBST(OS, OSF1) | |||
EXTRA_DEFINES="$EXTRA_DEFINES -D__STDC__=2" | EXTRA_DEFINES="$EXTRA_DEFINES -D__STDC__=2" | |||
;; | ;; | |||
*hpux11*) | *hpux11*) | |||
AC_SUBST(OS, BSD) | AC_SUBST(OS, BSD) | |||
;; | ;; | |||
*aix*) | *aix*) | |||
AC_SUBST(OS, AIX) | AC_SUBST(OS, AIX) | |||
;; | ;; | |||
*darwin*) | *darwin*) | |||
AC_SUBST(OS, MACOSX) | AC_SUBST(OS, MACOSX) | |||
STRIPFLAG="" | STRIPFLAG="" | |||
;; | ;; | |||
*) | *) | |||
AC_SUBST(OS, UNKNOWN_OS) | AC_SUBST(OS, UNKNOWN_OS) | |||
AC_MSG_WARN( | AC_MSG_WARN( | |||
Your OS ($target_os) is not supported yet. | Your OS ($target_os) is not supported yet. | |||
Try playing with the build host and target options. | Try playing with the build host and target options. | |||
) | ) | |||
sleep 3 | sleep 3 | |||
;; | ;; | |||
esac | esac | |||
AC_SUBST(STRIPFLAG) | AC_SUBST(STRIPFLAG) | |||
EXTRA_DEFINES="$EXTRA_DEFINES -D_BSD_SOURCE=1 -D__FAVOR_BSD=1" | EXTRA_DEFINES="$EXTRA_DEFINES -D_BSD_SOURCE=1 -D__FAVOR_BSD=1" | |||
dnl | dnl | |||
dnl First find some usable PCAP headers. | dnl Quick Background: | |||
dnl | ||||
dnl A long time ago, the libpcap team decided to change the functionality split | ||||
dnl and installation location of their header files. Consequently, installing | ||||
dnl the prior version's headers, followed by the newer version's, would result | ||||
dnl in two sets of different but similarly-named headers. This broke a lot of | ||||
dnl packages, since most developers just included <pcap.h> in their programs. | ||||
dnl Many (including ngrep) addressed the problem by detecting this condition and | ||||
dnl alerting the user to fix it manually. Eventually the libpcap team decided | ||||
dnl to add back in the top-level pcap.h, presumably to rectify the hassle. | ||||
dnl | ||||
dnl On modern Linux distros, checking for this condition likely doesn't matter | ||||
dnl anymore. However, ngrep targets a much broader range of (older) OSes, so | ||||
dnl it's still a possibility. The re-addition of a top-level pcap.h confounds | ||||
dnl the old header presence check, so I've updated it to search for the version, | ||||
dnl PCAP_VERSION_MAJOR. Maybe I'll delete it in another 5 years. ;-) | ||||
dnl | dnl | |||
AC_MSG_CHECKING(for a complete set of pcap headers) | AC_MSG_CHECKING(for a complete set of pcap headers) | |||
possible_dirs="`eval echo -n ${includedir}` \ | pcap_base="" | |||
/usr/include /usr/include/pcap \ | for dir in $PCAP_DIR ; do | |||
/usr/local/include /usr/local/include/pcap \ | if test -d $dir -a -r "$dir/pcap.h"; then | |||
/usr/share/include /usr/share/include/pcap" | ||||
AC_ARG_WITH(pcap-includes, | AC_EGREP_HEADER([PCAP_VERSION_MAJOR], [$dir/pcap.h], [found=$dir], [found | |||
[ --with-pcap-includes specify the pcap include directory], | =""]) | |||
[PCAP_DIR=$withval], | ||||
[PCAP_DIR=$possible_dirs]) | ||||
pcap_dir="" | if test -n "$found" -a "$found" != "$pcap_base"; then | |||
for dir in $PCAP_DIR ; do | AC_MSG_RESULT | |||
if test -d $dir -a -r "$dir/pcap.h" ; then | AC_MSG_RESULT | |||
if test -n "$pcap_dir" -a "$pcap_dir" != "$dir"; then | AC_MSG_RESULT(more than one set found in:) | |||
echo | AC_MSG_RESULT( $pcap_base) | |||
echo; echo more than one set found in: | AC_MSG_RESULT( $found) | |||
echo $pcap_dir | AC_MSG_RESULT | |||
echo $dir | AC_MSG_ERROR(please wipe out all unused pcap installations) | |||
echo; echo please wipe out all unused pcap installations | ||||
exit | ||||
else | else | |||
pcap_dir="$dir" | pcap_base="$dir" | |||
fi | fi | |||
fi | fi | |||
done | done | |||
if test -z "$pcap_dir" ; then | if test -z "$pcap_base" ; then | |||
echo no; echo !!! couldn\'t find a complete set of pcap headers | AC_MSG_RESULT(no) | |||
exit | AC_MSG_ERROR(could not find a complete set of pcap headers) | |||
else | else | |||
echo found $pcap_dir | AC_MSG_RESULT(found $pcap_base) | |||
EXTRA_INCLUDES="$EXTRA_INCLUDES -I$pcap_base" | ||||
dnl Best-effort; newer ld warns on missing dirs. | ||||
DIR="`dirname $pcap_base`/lib" | ||||
if test -d $DIR; then | ||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$DIR" | ||||
fi | ||||
fi | ||||
PCAP_INCLUDE="-I$pcap_dir" | dnl | |||
PCAP_LINK="-L`dirname $pcap_dir`/lib" | dnl Check for a working PCAP library we can link against.. | |||
dnl | ||||
AC_CHECK_LIB(pcap, pcap_open_live,,[AC_MSG_ERROR(a viable pcap lib is required)] | ||||
) | ||||
dnl | ||||
dnl And the PCAP restart function. | ||||
dnl | ||||
AC_SUBST(PCAP_INCLUDE) | if test "$USE_PCAP_RESTART" = "1"; then | |||
AC_SUBST(PCAP_LINK) | PCAP_RESTART_FUNC="unused" | |||
for func in pcap_restart pcap_yyrestart yyrestart; do | ||||
AC_CHECK_LIB(pcap, $func, found="$func") | ||||
if test -n "$found"; then | ||||
USE_PCAP_RESTART="1" | ||||
PCAP_RESTART_FUNC="$found" | ||||
break | ||||
fi | ||||
done | ||||
if test "$PCAP_RESTART_FUNC" = "unused"; then | ||||
AC_MSG_ERROR(BPF lexer restart fix requested, but no restart function fo | ||||
und) | ||||
fi | ||||
fi | fi | |||
dnl | dnl | |||
dnl Next figure out which bpf header file to look at. | dnl Next figure out which bpf header file to look at. | |||
dnl | dnl | |||
AC_MSG_CHECKING(for BPF include path) | AC_MSG_CHECKING(for BPF include path) | |||
BPF=`/usr/bin/perl -ne '/include\s+<(.*bpf\.h)>/ && print "$1\n"' $pcap_dir/pcap | BPF=`/usr/bin/perl -ne '/include\s+<(.*bpf\.h)>/ && print "$1\n"' $pcap_base/pca | |||
.h` | p.h` | |||
echo $BPF | AC_MSG_RESULT($BPF) | |||
dnl | dnl | |||
dnl Check for DLT_* types that might not have existed in older | dnl Check for DLT_* types that might not have existed in older | |||
dnl libpcap's | dnl libpcap's | |||
dnl | dnl | |||
present="" | present="" | |||
AC_MSG_CHECKING(for DLT_LINUX_SLL in bpf.h) | AC_MSG_CHECKING(for DLT_LINUX_SLL in $BPF) | |||
AC_EGREP_CPP(yes, | AC_EGREP_CPP(yes, | |||
[ | [ | |||
#include <$BPF> | #include <$BPF> | |||
#ifdef DLT_LINUX_SLL | #ifdef DLT_LINUX_SLL | |||
yes | yes | |||
#endif | #endif | |||
], | ], | |||
[HAVE_DLT_LINUX_SLL="1" && echo yes], [HAVE_DLT_LINUX_SLL="0" && echo no]) | [HAVE_DLT_LINUX_SLL="1" && AC_MSG_RESULT(yes)], [HAVE_DLT_LINUX_SLL="0" && AC_MS G_RESULT(no)]) | |||
present="" | present="" | |||
AC_MSG_CHECKING(for DLT_LOOP in bpf.h) | AC_MSG_CHECKING(for DLT_LOOP in $BPF) | |||
AC_EGREP_CPP(yes, | AC_EGREP_CPP(yes, | |||
[ | [ | |||
#include <$BPF> | #include <$BPF> | |||
#ifdef DLT_LOOP | #ifdef DLT_LOOP | |||
yes | yes | |||
#endif | #endif | |||
], | ], | |||
[HAVE_DLT_LOOP="1" && echo yes], [HAVE_DLT_LOOP="0" && echo no]) | [HAVE_DLT_LOOP="1" && AC_MSG_RESULT(yes)], [HAVE_DLT_LOOP="0" && AC_MSG_RESULT(n o)]) | |||
present="" | present="" | |||
AC_MSG_CHECKING(for DLT_IEEE802_11 in bpf.h) | AC_MSG_CHECKING(for DLT_IEEE802_11 in $BPF) | |||
AC_EGREP_CPP(yes, | AC_EGREP_CPP(yes, | |||
[ | [ | |||
#include <$BPF> | #include <$BPF> | |||
#ifdef DLT_IEEE802_11 | #ifdef DLT_IEEE802_11 | |||
yes | yes | |||
#endif | #endif | |||
], | ], | |||
[HAVE_DLT_IEEE802_11="1" && echo yes], [HAVE_DLT_IEEE802_11="0" && echo no]) | [HAVE_DLT_IEEE802_11="1" && AC_MSG_RESULT(yes)], [HAVE_DLT_IEEE802_11="0" && AC_ MSG_RESULT(no)]) | |||
present="" | present="" | |||
AC_MSG_CHECKING(for DLT_IEEE802_11_RADIO in bpf.h) | AC_MSG_CHECKING(for DLT_IEEE802_11_RADIO in $BPF) | |||
AC_EGREP_CPP(yes, | AC_EGREP_CPP(yes, | |||
[ | [ | |||
#include <$BPF> | #include <$BPF> | |||
#ifdef DLT_IEEE802_11_RADIO | #ifdef DLT_IEEE802_11_RADIO | |||
yes | yes | |||
#endif | #endif | |||
], | ], | |||
[HAVE_DLT_IEEE802_11_RADIO="1" && echo yes], [HAVE_DLT_IEEE802_11_RADIO="0" && e cho no]) | [HAVE_DLT_IEEE802_11_RADIO="1" && AC_MSG_RESULT(yes)], [HAVE_DLT_IEEE802_11_RADI O="0" && AC_MSG_RESULT(no)]) | |||
present="" | present="" | |||
AC_MSG_CHECKING(for DLT_RAW in bpf.h) | AC_MSG_CHECKING(for DLT_RAW in $BPF) | |||
AC_EGREP_CPP(yes, | AC_EGREP_CPP(yes, | |||
[ | [ | |||
#include <$BPF> | #include <$BPF> | |||
#ifdef DLT_RAW | #ifdef DLT_RAW | |||
yes | yes | |||
#endif | #endif | |||
], | ], | |||
[HAVE_DLT_RAW="1" && echo yes], [HAVE_DLT_RAW="0" && echo no]) | [HAVE_DLT_RAW="1" && AC_MSG_RESULT(yes)], [HAVE_DLT_RAW="0" && AC_MSG_RESULT(no) | |||
]) | ||||
present="" | ||||
AC_MSG_CHECKING(for DLT_PFLOG in $BPF) | ||||
AC_EGREP_CPP(yes, | ||||
[ | ||||
#include <$BPF> | ||||
#ifdef DLT_PFLOG | ||||
yes | ||||
#endif | ||||
], | ||||
[HAVE_DLT_PFLOG="1" && AC_MSG_RESULT(yes)], [HAVE_DLT_PFLOG="0" && AC_MSG_RESULT | ||||
(no)]) | ||||
present="" | ||||
AC_MSG_CHECKING(for DLT_IPNET in $BPF) | ||||
AC_EGREP_CPP(yes, | ||||
[ | ||||
#include <$BPF> | ||||
#ifdef DLT_IPNET | ||||
yes | ||||
#endif | ||||
], | ||||
[HAVE_DLT_IPNET="1" && AC_MSG_RESULT(yes)], [HAVE_DLT_IPNET="0" && AC_MSG_RESULT | ||||
(no)]) | ||||
dnl | dnl | |||
dnl Now that we're past the OS-specific stuff, which could have | dnl Now that we're past the OS-specific stuff, which could have | |||
dnl modified our USE_* and other defines, define them all now. | dnl modified our USE_* and other defines, define them all now. | |||
dnl | dnl | |||
AC_DEFINE_UNQUOTED(USE_PCAP_RESTART, $USE_PCAP_RESTART, [wheth | AC_DEFINE_UNQUOTED(USE_PCAP_RESTART, $USE_PCAP_RESTART, [wheth | |||
er to call pcap_restart() before subsequent invocations of pcap_compile() (defau | er to call the BPF lexer restart function between multiple BPF filter compilatio | |||
lt yes)]) | n attempts (default no)]) | |||
AC_DEFINE_UNQUOTED(PCAP_RESTART_FUNC, $PCAP_RESTART_FUNC, [routi | ||||
ne used for restarting the BPF lexer]) | ||||
AC_DEFINE_UNQUOTED(USE_PCRE, $USE_PCRE, [wheth er to use PCRE (default GNU Regex)]) | AC_DEFINE_UNQUOTED(USE_PCRE, $USE_PCRE, [wheth er to use PCRE (default GNU Regex)]) | |||
AC_DEFINE_UNQUOTED(USE_IPv6, $USE_IPv6, [wheth er to use IPv6 (default off)]) | AC_DEFINE_UNQUOTED(USE_IPv6, $USE_IPv6, [wheth er to use IPv6 (default off)]) | |||
AC_DEFINE_UNQUOTED(USE_TCPKILL, $USE_TCPKILL, [wheth | ||||
er to enable tcpkill functionality (default off)]) | ||||
AC_DEFINE_UNQUOTED(USE_VLAN_HACK, $USE_VLAN_HACK, [wheth | ||||
er to automatically include VLAN frames (default on)]) | ||||
AC_DEFINE_UNQUOTED(USE_DROPPRIVS, $USE_DROPPRIVS, [wheth er to use privileges dropping (default yes)]) | AC_DEFINE_UNQUOTED(USE_DROPPRIVS, $USE_DROPPRIVS, [wheth er to use privileges dropping (default yes)]) | |||
AC_DEFINE_UNQUOTED(DROPPRIVS_USER, "$DROPPRIVS_USER", [pseud o-user for running ngrep (default "nobody")]) | AC_DEFINE_UNQUOTED(DROPPRIVS_USER, "$DROPPRIVS_USER", [pseud o-user for running ngrep (default "nobody")]) | |||
AC_DEFINE_UNQUOTED(HAVE_DUMB_UDPHDR, $HAVE_DUMB_UDPHDR, [wheth | ||||
er to accommodate broken redhat-glibc udphdr declaration (default no)]) | ||||
AC_DEFINE_UNQUOTED(HAVE_DLT_RAW, $HAVE_DLT_RAW, [prese nce of DLT_RAW in bpf.h]) | AC_DEFINE_UNQUOTED(HAVE_DLT_RAW, $HAVE_DLT_RAW, [prese nce of DLT_RAW in bpf.h]) | |||
AC_DEFINE_UNQUOTED(HAVE_DLT_PFLOG, $HAVE_DLT_PFLOG, [prese nce of DLT_PFLOG in $BPF]) | ||||
AC_DEFINE_UNQUOTED(HAVE_DLT_IEEE802_11, $HAVE_DLT_IEEE802_11, [prese nce of DLT_IEEE802_11 in bpf.h]) | AC_DEFINE_UNQUOTED(HAVE_DLT_IEEE802_11, $HAVE_DLT_IEEE802_11, [prese nce of DLT_IEEE802_11 in bpf.h]) | |||
AC_DEFINE_UNQUOTED(HAVE_DLT_IEEE802_11_RADIO, $HAVE_DLT_IEEE802_11_RADIO, [prese nce of DLT_IEEE802_11_RADIO in bpf.h]) | AC_DEFINE_UNQUOTED(HAVE_DLT_IEEE802_11_RADIO, $HAVE_DLT_IEEE802_11_RADIO, [prese nce of DLT_IEEE802_11_RADIO in bpf.h]) | |||
AC_DEFINE_UNQUOTED(HAVE_DLT_LOOP, $HAVE_DLT_LOOP, [prese nce of DLT_LOOP in bpf.h]) | AC_DEFINE_UNQUOTED(HAVE_DLT_LOOP, $HAVE_DLT_LOOP, [prese nce of DLT_LOOP in bpf.h]) | |||
AC_DEFINE_UNQUOTED(HAVE_DLT_LINUX_SLL, $HAVE_DLT_LINUX_SLL, [prese nce of DLT_LINUX_SLL in bpf.h]) | AC_DEFINE_UNQUOTED(HAVE_DLT_LINUX_SLL, $HAVE_DLT_LINUX_SLL, [prese nce of DLT_LINUX_SLL in bpf.h]) | |||
AC_DEFINE_UNQUOTED(HAVE_DLT_IPNET, $HAVE_DLT_IPNET, [prese nce of DLT_IPNET in bpf.h]) | ||||
dnl | dnl | |||
dnl And the PCAP library.. | dnl Merge our global tack-ons with autoconf's. | |||
dnl | ||||
AC_CHECK_LIB(pcap, pcap_open_live,,echo need pcap lib; exit) | ||||
dnl | ||||
dnl And the PCAP restart function.. | ||||
dnl | ||||
pcap_restart_func="" | ||||
if test "$use_pcap_restart" = "yes" ; then | ||||
AC_CHECK_LIB(pcap, pcap_restart, pcap_restart_func="pcap_restart", | ||||
AC_CHECK_LIB(pcap, pcap_yyrestart, pcap_restart_func="pcap_yyrestart", | ||||
AC_CHECK_LIB(pcap, yyrestart, pcap_restart_func="yyrestart", | ||||
echo no yacc restart func found | ||||
echo perhaps libpcap wasn\'t compiled with bison/flex\? | ||||
exit))) | ||||
fi | ||||
if test -z "$pcap_restart_func"; then | ||||
pcap_restart_func="unused" | ||||
fi | ||||
AC_DEFINE_UNQUOTED(PCAP_RESTART_FUNC, $pcap_restart_func, [routine used for rest | ||||
arting the PCAP lexer]) | ||||
dnl | ||||
dnl AC_SUBST in the tack-on globals.. | ||||
dnl | dnl | |||
AC_SUBST(EXTRA_DEFINES) | AC_SUBST(EXTRA_DEFINES) | |||
AC_SUBST(EXTRA_INCLUDES) | AC_SUBST(EXTRA_INCLUDES) | |||
AC_SUBST(EXTRA_LDFLAGS) | ||||
AC_SUBST(EXTRA_OBJS) | ||||
AC_SUBST(EXTRA_LIBS) | AC_SUBST(EXTRA_LIBS) | |||
dnl | dnl | |||
dnl Emit configuration messages about any flags specified. | dnl Emit configuration messages about any flags specified. | |||
dnl | dnl | |||
echo | AC_MSG_RESULT | |||
if test "$HAVE_DUMB_UDPHDR" = "1"; then | if test "$USE_PCAP_RESTART" = "1"; then | |||
echo "CONFIG: support for broken redhat glibc udphdr enabled" | AC_MSG_RESULT([CONFIG: BPF filter lexer restart enabled (using $PCAP_RESTART | |||
fi | _FUNC)]) | |||
if test "$USE_PCAP_RESTART" = "0"; then | ||||
echo "CONFIG: pcap restart logic disabled" | ||||
fi | fi | |||
if test "$USE_IPv6" = "1"; then | if test "$USE_IPv6" = "1"; then | |||
echo "CONFIG: ipv6 support enabled" | AC_MSG_RESULT(CONFIG: IPv6 support enabled) | |||
else | else | |||
echo "CONFIG: ipv6 support disabled" | AC_MSG_RESULT(CONFIG: IPv6 support disabled) | |||
fi | fi | |||
if test "$USE_DROPPRIVS" = "1"; then | if test "$USE_DROPPRIVS" = "1"; then | |||
echo "CONFIG: privilege dropping enabled, using \"$DROPPRIVS_USER\"" | AC_MSG_RESULT([CONFIG: privilege dropping enabled (using $DROPPRIVS_USER)]) | |||
else | else | |||
echo "CONFIG: privilege dropping disabled" | AC_MSG_RESULT(CONFIG: privilege dropping DISABLED) | |||
fi | fi | |||
if test "$USE_PCRE" = "1"; then | if test "$USE_PCRE" = "1"; then | |||
echo "CONFIG: using PCRE regex library" | AC_MSG_RESULT(CONFIG: using PCRE regex library) | |||
else | ||||
AC_MSG_RESULT(CONFIG: using GNU regex library) | ||||
fi | ||||
if test "$USE_TCPKILL" = "1"; then | ||||
AC_MSG_RESULT(CONFIG: tcpkill feature enabled) | ||||
else | ||||
AC_MSG_RESULT(CONFIG: tcpkill feature disabled) | ||||
fi | ||||
if test "$USE_VLAN_HACK" = "1"; then | ||||
AC_MSG_RESULT(CONFIG: automatically including VLAN frames) | ||||
else | else | |||
echo "CONFIG: using GNU regex library" | AC_MSG_RESULT(CONFIG: NOT automatically including VLAN frames) | |||
fi | fi | |||
dnl | dnl | |||
dnl And we're done. | dnl And we're done. ALL YOUR BASE. Don't forget. | |||
dnl | dnl | |||
echo | AC_MSG_RESULT | |||
AC_CONFIG_HEADERS(config.h) | AC_CONFIG_HEADERS(config.h) | |||
AC_CONFIG_FILES(Makefile) | AC_CONFIG_FILES(Makefile) | |||
AC_OUTPUT | AC_OUTPUT | |||
End of changes. 91 change blocks. | ||||
204 lines changed or deleted | 289 lines changed or added |