ongrep

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

commit 286d20357c0ad314091a8609474f56fe69d93a6d
parent 6f217102bf3ba0ee936e66c31104ced8360b703d
Author: Jordan Ritter <jpr5@darkridge.com>
Date:   Tue, 27 Feb 2001 06:10:18 +0000

changed around order of ops, added --without-restart, changed multi-lib
logic yet again

Diffstat:
Mconfigure | 448++++++++++++++++++++++++++++++++++++++++++-------------------------------------
Mconfigure.in | 76++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------
2 files changed, 291 insertions(+), 233 deletions(-)

diff --git a/configure b/configure @@ -13,6 +13,8 @@ ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help --with-pcre use libnet build directory" +ac_help="$ac_help + --with-restart use libpcap restart func" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -571,7 +573,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:575: checking host system type" >&5 +echo "configure:577: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -592,7 +594,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:596: checking target system type" >&5 +echo "configure:598: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -610,7 +612,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:614: checking build system type" >&5 +echo "configure:616: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -636,7 +638,7 @@ test "$host_alias" != "$target_alias" && # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:640: checking for $ac_word" >&5 +echo "configure:642: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -666,7 +668,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:670: checking for $ac_word" >&5 +echo "configure:672: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -717,7 +719,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:721: checking for $ac_word" >&5 +echo "configure:723: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -749,7 +751,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:753: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:755: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -760,12 +762,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 764 "configure" +#line 766 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:769: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -791,12 +793,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:795: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:797: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:800: checking whether we are using GNU C" >&5 +echo "configure:802: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -805,7 +807,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:809: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:811: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -824,7 +826,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:828: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:830: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -860,7 +862,7 @@ echo $ac_n "checking for prefix by $ac_c" 1>&6 # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:864: checking for $ac_word" >&5 +echo "configure:866: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GCC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -898,9 +900,8 @@ fi fi - echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:904: checking how to run the C preprocessor" >&5 +echo "configure:905: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -915,13 +916,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 919 "configure" +#line 920 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:925: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:926: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -932,13 +933,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 936 "configure" +#line 937 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:942: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:943: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -949,13 +950,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 953 "configure" +#line 954 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:959: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:960: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -980,12 +981,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:984: checking for ANSI C header files" >&5 +echo "configure:985: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 989 "configure" +#line 990 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -993,7 +994,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:997: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:998: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1010,7 +1011,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1014 "configure" +#line 1015 "configure" #include "confdefs.h" #include <string.h> EOF @@ -1028,7 +1029,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1032 "configure" +#line 1033 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -1049,7 +1050,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 1053 "configure" +#line 1054 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1060,7 +1061,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1065: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1083,146 +1084,13 @@ EOF fi -ac_safe=`echo "strings.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for strings.h""... $ac_c" 1>&6 -echo "configure:1089: checking for strings.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1094 "configure" -#include "confdefs.h" -#include <strings.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1099: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - : -else - echo "$ac_t""no" 1>&6 -echo need strings header; exit -fi - -ac_safe=`echo "netinet/if_ether.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for netinet/if_ether.h""... $ac_c" 1>&6 -echo "configure:1123: checking for netinet/if_ether.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1128 "configure" -#include "confdefs.h" -#include <netinet/if_ether.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1133: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define HAVE_IF_ETHER_H 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi - - - -echo $ac_n "checking for a complete set of pcap headers""... $ac_c" 1>&6 -echo "configure:1160: checking for a complete set of pcap headers" >&5 -possible_dirs="`eval echo -n ${includedir}` \ - /usr/include /usr/include/pcap \ - /usr/local/include /usr/local/include/pcap \ - /usr/share/include /usr/share/include/pcap" -pcap_dir="" - -for dir in $possible_dirs ; do - if test -d $dir -a -r "$dir/pcap.h" -a \ - -r "$dir/net/bpf.h" ; then - if test -n "$pcap_dir" ; then - echo - echo; echo more than one set found in: - echo $pcap_dir - echo $dir - echo; echo please wipe out all unused pcap installations - exit - else - pcap_dir="$dir" - fi - fi -done - -if test -z "$pcap_dir" ; then - echo no; echo couldn\'t find a complete set of pcap headers - exit -else - - PCAP_INCLUDE="-I$pcap_dir" - echo found $pcap_dir - - echo $ac_n "checking for usable bpf.h""... $ac_c" 1>&6 -echo "configure:1192: checking for usable bpf.h" >&5 - if test -n "`grep DLT_RAW $pcap_dir/net/bpf.h`" ; then - echo yep - else - -echo nope -echo '***************************************************************' -echo an important define is missing from the bpf.h I found. this -echo probably means that your installation of pcap is outdated and -echo needs upgrading. I\'ll go ahead and add the define for you but -echo understand that matching certain types of packets may not -echo function properly. -echo '***************************************************************' -sleep 2 - -cat >> confdefs.h <<\EOF -#define DLT_RAW 12 -EOF - - - fi -fi - -pcap_prefix=`dirname $pcap_dir` -CFLAGS="-L$pcap_prefix/lib $CFLAGS" - - - echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1221: checking for working const" >&5 +echo "configure:1089: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1226 "configure" +#line 1094 "configure" #include "confdefs.h" int main() { @@ -1271,7 +1139,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:1275: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1143: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1292,12 +1160,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1296: checking for size_t" >&5 +echo "configure:1164: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1301 "configure" +#line 1169 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1325,12 +1193,12 @@ EOF fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1329: checking return type of signal handlers" >&5 +echo "configure:1197: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1334 "configure" +#line 1202 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -1347,7 +1215,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1351: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1219: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1368,19 +1236,19 @@ EOF # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:1372: checking for working alloca.h" >&5 +echo "configure:1240: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1377 "configure" +#line 1245 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:1384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1252: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -1401,12 +1269,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:1405: checking for alloca" >&5 +echo "configure:1273: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1410 "configure" +#line 1278 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -1434,7 +1302,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:1438: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -1466,12 +1334,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:1470: checking whether alloca needs Cray hooks" >&5 +echo "configure:1338: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1475 "configure" +#line 1343 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -1496,12 +1364,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1500: checking for $ac_func" >&5 +echo "configure:1368: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1505 "configure" +#line 1373 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1524,7 +1392,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1551,7 +1419,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:1555: checking stack direction for C alloca" >&5 +echo "configure:1423: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1559,7 +1427,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 1563 "configure" +#line 1431 "configure" #include "confdefs.h" find_stack_direction () { @@ -1578,7 +1446,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:1582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -1600,6 +1468,138 @@ EOF fi +ac_safe=`echo "strings.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for strings.h""... $ac_c" 1>&6 +echo "configure:1474: checking for strings.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1479 "configure" +#include "confdefs.h" +#include <strings.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1484: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +echo need strings header; exit +fi + +ac_safe=`echo "netinet/if_ether.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for netinet/if_ether.h""... $ac_c" 1>&6 +echo "configure:1508: checking for netinet/if_ether.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1513 "configure" +#include "confdefs.h" +#include <netinet/if_ether.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1518: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_IF_ETHER_H 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + + + +echo $ac_n "checking for a complete set of pcap headers""... $ac_c" 1>&6 +echo "configure:1545: checking for a complete set of pcap headers" >&5 +possible_dirs="`eval echo -n ${includedir}` \ + /usr/include /usr/include/pcap \ + /usr/local/include /usr/local/include/pcap \ + /usr/share/include /usr/share/include/pcap" +pcap_dir="" + +for dir in $possible_dirs ; do + if test -d $dir -a -r "$dir/pcap.h" -a \ + -r "$dir/net/bpf.h" ; then + if test -n "$pcap_dir" -a "$pcap_dir" != "$dir"; then + echo + echo; echo more than one set found in: + echo $pcap_dir + echo $dir + echo; echo please wipe out all unused pcap installations + exit + else + pcap_dir="$dir" + fi + fi +done + +if test -z "$pcap_dir" ; then + echo no; echo couldn\'t find a complete set of pcap headers + exit +else + echo found $pcap_dir + + PCAP_INCLUDE="-I$pcap_dir" + PCAP_LINK="-L`dirname $pcap_dir`/lib" + + + + + echo $ac_n "checking for usable bpf.h""... $ac_c" 1>&6 +echo "configure:1581: checking for usable bpf.h" >&5 + if test -n "`grep DLT_RAW $pcap_dir/net/bpf.h`" ; then + echo yep + else + +echo nope +echo '***************************************************************' +echo an important define is missing from the bpf.h I found. this +echo probably means that your installation of pcap is outdated and +echo needs upgrading. I\'ll go ahead and add the define for you but +echo understand that matching certain types of packets may not +echo function properly. +echo '***************************************************************' +sleep 3 + +cat >> confdefs.h <<\EOF +#define DLT_RAW 12 +EOF + + + fi +fi + # Check whether --with-pcre or --without-pcre was given. if test "${with_pcre+set}" = set; then @@ -1625,6 +1625,7 @@ fi + cat >> confdefs.h <<\EOF #define _BSD_SOURCE 1 EOF @@ -1643,9 +1644,9 @@ EOF echo $ac_n "checking for a dumb udphdr declaration""... $ac_c" 1>&6 -echo "configure:1647: checking for a dumb udphdr declaration" >&5 +echo "configure:1648: checking for a dumb udphdr declaration" >&5 cat > conftest.$ac_ext <<EOF -#line 1649 "configure" +#line 1650 "configure" #include "confdefs.h" int main() { @@ -1664,7 +1665,7 @@ unsigned short bar = foo.uh_sport; ; return 0; } EOF -if { (eval echo configure:1668: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1669: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo nope else @@ -1695,7 +1696,7 @@ EOF echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:1699: checking for socket in -lsocket" >&5 +echo "configure:1700: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1703,7 +1704,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <<EOF -#line 1707 "configure" +#line 1708 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1714,7 +1715,7 @@ int main() { socket() ; return 0; } EOF -if { (eval echo configure:1718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1743,7 +1744,7 @@ echo no socket in -lsocket\?; exit fi echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:1747: checking for gethostbyname in -lnsl" >&5 +echo "configure:1748: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1751,7 +1752,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <<EOF -#line 1755 "configure" +#line 1756 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1762,7 +1763,7 @@ int main() { gethostbyname() ; return 0; } EOF -if { (eval echo configure:1766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1828,7 +1829,7 @@ esac echo $ac_n "checking for pcap_open_live in -lpcap""... $ac_c" 1>&6 -echo "configure:1832: checking for pcap_open_live in -lpcap" >&5 +echo "configure:1833: checking for pcap_open_live in -lpcap" >&5 ac_lib_var=`echo pcap'_'pcap_open_live | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1836,7 +1837,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpcap $LIBS" cat > conftest.$ac_ext <<EOF -#line 1840 "configure" +#line 1841 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1847,7 +1848,7 @@ int main() { pcap_open_live() ; return 0; } EOF -if { (eval echo configure:1851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1876,8 +1877,35 @@ echo need pcap lib; exit fi -echo $ac_n "checking for pcap_restart in -lpcap""... $ac_c" 1>&6 -echo "configure:1881: checking for pcap_restart in -lpcap" >&5 + +# Check whether --with-restart or --without-restart was given. +if test "${with_restart+set}" = set; then + withval="$with_restart" + + if test "$withval" = "yes"; then + cat >> confdefs.h <<\EOF +#define NEED_RESTART 1 +EOF + + need_restart="yes" + else + need_restart="no" + fi + +else + + cat >> confdefs.h <<\EOF +#define NEED_RESTART 1 +EOF + + need_restart="yes" + +fi + + +if test "$need_restart" = "yes" ; then + echo $ac_n "checking for pcap_restart in -lpcap""... $ac_c" 1>&6 +echo "configure:1909: checking for pcap_restart in -lpcap" >&5 ac_lib_var=`echo pcap'_'pcap_restart | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1885,7 +1913,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpcap $LIBS" cat > conftest.$ac_ext <<EOF -#line 1889 "configure" +#line 1917 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1896,7 +1924,7 @@ int main() { pcap_restart() ; return 0; } EOF -if { (eval echo configure:1900: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1918,7 +1946,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for pcap_yyrestart in -lpcap""... $ac_c" 1>&6 -echo "configure:1922: checking for pcap_yyrestart in -lpcap" >&5 +echo "configure:1950: checking for pcap_yyrestart in -lpcap" >&5 ac_lib_var=`echo pcap'_'pcap_yyrestart | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1926,7 +1954,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpcap $LIBS" cat > conftest.$ac_ext <<EOF -#line 1930 "configure" +#line 1958 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1937,7 +1965,7 @@ int main() { pcap_yyrestart() ; return 0; } EOF -if { (eval echo configure:1941: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1959,7 +1987,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for yyrestart in -lpcap""... $ac_c" 1>&6 -echo "configure:1963: checking for yyrestart in -lpcap" >&5 +echo "configure:1991: checking for yyrestart in -lpcap" >&5 ac_lib_var=`echo pcap'_'yyrestart | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1967,7 +1995,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpcap $LIBS" cat > conftest.$ac_ext <<EOF -#line 1971 "configure" +#line 1999 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1978,7 +2006,7 @@ int main() { yyrestart() ; return 0; } EOF -if { (eval echo configure:1982: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2010: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2000,14 +2028,15 @@ EOF else echo "$ac_t""no" 1>&6 echo no yacc restart func found - echo perhaps libpcap wasn\'t compiled with bison/flex\? - exit + echo perhaps libpcap wasn\'t compiled with bison/flex\? + exit fi fi fi +fi trap '' 1 2 15 @@ -2172,8 +2201,9 @@ s%@build_os@%$build_os%g s%@CC@%$CC%g s%@GCC@%$GCC%g s%@CPP@%$CPP%g -s%@PCAP_INCLUDE@%$PCAP_INCLUDE%g s%@ALLOCA@%$ALLOCA%g +s%@PCAP_INCLUDE@%$PCAP_INCLUDE%g +s%@PCAP_LINK@%$PCAP_LINK%g s%@REGEX_TARGET@%$REGEX_TARGET%g s%@REGEX_OBJS@%$REGEX_OBJS%g s%@EXTRA_LIBS@%$EXTRA_LIBS%g diff --git a/configure.in b/configure.in @@ -1,7 +1,7 @@ dnl dnl $Id$ dnl -dnl Copyright (c) 2000 Jordan Ritter <jpr5@darkridge.com> +dnl Copyright (c) 2001 Jordan Ritter <jpr5@darkridge.com> dnl dnl Please refer to the COPYRIGHT file for more information. @@ -12,12 +12,19 @@ AC_CANONICAL_SYSTEM AC_PROG_CC AC_PREFIX(gcc) - AC_HEADER_STDC +AC_C_CONST +AC_TYPE_SIZE_T +AC_TYPE_SIGNAL +AC_FUNC_ALLOCA + AC_CHECK_HEADER(strings.h,,echo need strings header; exit) AC_CHECK_HEADER(netinet/if_ether.h,AC_DEFINE(HAVE_IF_ETHER_H,1),) +dnl +dnl Find ourselves some usable pcap headers. +dnl AC_MSG_CHECKING(for a complete set of pcap headers) possible_dirs="`eval echo -n ${includedir}` \ /usr/include /usr/include/pcap \ @@ -28,7 +35,7 @@ pcap_dir="" for dir in $possible_dirs ; do if test -d $dir -a -r "$dir/pcap.h" -a \ -r "$dir/net/bpf.h" ; then - if test -n "$pcap_dir" ; then + if test -n "$pcap_dir" -a "$pcap_dir" != "$dir"; then echo echo; echo more than one set found in: echo $pcap_dir @@ -45,9 +52,13 @@ if test -z "$pcap_dir" ; then echo no; echo couldn\'t find a complete set of pcap headers exit else - AC_SUBST(PCAP_INCLUDE) - PCAP_INCLUDE="-I$pcap_dir" echo found $pcap_dir + + PCAP_INCLUDE="-I$pcap_dir" + PCAP_LINK="-L`dirname $pcap_dir`/lib" + + AC_SUBST(PCAP_INCLUDE) + AC_SUBST(PCAP_LINK) AC_MSG_CHECKING(for usable bpf.h) if test -n "`grep DLT_RAW $pcap_dir/net/bpf.h`" ; then @@ -62,25 +73,13 @@ echo needs upgrading. I\'ll go ahead and add the define for you but echo understand that matching certain types of packets may not echo function properly. echo '***************************************************************' -sleep 2 +sleep 3 AC_DEFINE(DLT_RAW, 12) fi fi -pcap_prefix=`dirname $pcap_dir` -CFLAGS="-L$pcap_prefix/lib $CFLAGS" - -dnl gcc reports -R as unknown option.. -dnl LDFLAGS="-R$pcap_prefix/lib $LDFLAGS" - - -AC_C_CONST -AC_TYPE_SIZE_T -AC_TYPE_SIGNAL -AC_FUNC_ALLOCA - dnl dnl pcre library compatibility stuff @@ -102,6 +101,7 @@ AC_ARG_WITH(pcre, AC_SUBST(REGEX_TARGET) AC_SUBST(REGEX_OBJS) + dnl dnl OS-specific options dnl @@ -175,12 +175,40 @@ esac AC_CHECK_LIB(pcap, pcap_open_live,,echo need pcap lib; exit) -AC_CHECK_LIB(pcap, pcap_restart, AC_DEFINE(PCAP_RESTART,pcap_restart), - AC_CHECK_LIB(pcap, pcap_yyrestart, AC_DEFINE(PCAP_RESTART,pcap_yyrestart), - AC_CHECK_LIB(pcap, yyrestart, AC_DEFINE(PCAP_RESTART,yyrestart), - echo no yacc restart func found - echo perhaps libpcap wasn\'t compiled with bison/flex\? - exit))) + +dnl +dnl Here's where we should check to see if we require the use of a +dnl PCAP_RESTART function. Should run a test program that calls +dnl pcap_compile() twice and checks the exit value, or something. For +dnl now, just let the user the flag itself, until I come up with a +dnl working methodology. +dnl +AC_ARG_WITH(restart, +[ --with-restart use libpcap restart func], +[ + if test "$withval" = "yes"; then + AC_DEFINE(NEED_RESTART) + need_restart="yes" + else + need_restart="no" + fi +], +[ + AC_DEFINE(NEED_RESTART) + need_restart="yes" +]) + +dnl +dnl Now find the function in the lib.. +dnl +if test "$need_restart" = "yes" ; then + AC_CHECK_LIB(pcap, pcap_restart, AC_DEFINE(PCAP_RESTART,pcap_restart), + AC_CHECK_LIB(pcap, pcap_yyrestart, AC_DEFINE(PCAP_RESTART,pcap_yyrestart), + AC_CHECK_LIB(pcap, yyrestart, AC_DEFINE(PCAP_RESTART,yyrestart), + echo no yacc restart func found + echo perhaps libpcap wasn\'t compiled with bison/flex\? + exit))) +fi AC_OUTPUT(Makefile)