ongrep

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

commit 08487fcaa62fe56570582ddec91a439eadcc51c7
parent baa352b526d31cbde1d4655bd2782164fd6fd6d9
Author: Jordan Ritter <jpr5@darkridge.com>
Date:   Mon, 17 Nov 2003 16:21:59 +0000

updated with good feedback from gentoo bug/guys. should solve the autoconf
weirdness/change in behaviour between versions of gcc by fixing a long-
standing bug in the autoconf logic that never manifested before because
previous versions of gcc didn't care.

Diffstat:
Mconfigure | 41++++++++++++++++++++---------------------
Mconfigure.in | 4++--
2 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/configure b/configure @@ -1769,8 +1769,6 @@ echo "configure:1769: checking for a dumb udphdr declaration" >&5 cat > conftest.$ac_ext <<EOF #line 1771 "configure" #include "confdefs.h" - -int main() { #ifndef __FAVOR_BSD #define __FAVOR_BSD #endif @@ -1783,12 +1781,13 @@ int main() { #include <netinet/udp.h> +int main() { struct udphdr foo; unsigned short bar = foo.uh_sport; ; return 0; } EOF -if { (eval echo configure:1792: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1791: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo nope else @@ -1819,7 +1818,7 @@ EOF echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:1823: checking for socket in -lsocket" >&5 +echo "configure:1822: 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 @@ -1827,7 +1826,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <<EOF -#line 1831 "configure" +#line 1830 "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 @@ -1838,7 +1837,7 @@ int main() { socket() ; return 0; } EOF -if { (eval echo configure:1842: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1841: \"$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 @@ -1867,7 +1866,7 @@ echo no socket in -lsocket\?; exit fi echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:1871: checking for gethostbyname in -lnsl" >&5 +echo "configure:1870: 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 @@ -1875,7 +1874,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <<EOF -#line 1879 "configure" +#line 1878 "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 @@ -1886,7 +1885,7 @@ int main() { gethostbyname() ; return 0; } EOF -if { (eval echo configure:1890: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1889: \"$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 @@ -1970,7 +1969,7 @@ esac echo $ac_n "checking for pcap_open_live in -lpcap""... $ac_c" 1>&6 -echo "configure:1974: checking for pcap_open_live in -lpcap" >&5 +echo "configure:1973: 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 @@ -1978,7 +1977,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpcap $LIBS" cat > conftest.$ac_ext <<EOF -#line 1982 "configure" +#line 1981 "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 @@ -1989,7 +1988,7 @@ int main() { pcap_open_live() ; return 0; } EOF -if { (eval echo configure:1993: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1992: \"$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 @@ -2046,7 +2045,7 @@ fi if test "$need_restart" = "yes" ; then echo $ac_n "checking for pcap_restart in -lpcap""... $ac_c" 1>&6 -echo "configure:2050: checking for pcap_restart in -lpcap" >&5 +echo "configure:2049: 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 @@ -2054,7 +2053,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpcap $LIBS" cat > conftest.$ac_ext <<EOF -#line 2058 "configure" +#line 2057 "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 @@ -2065,7 +2064,7 @@ int main() { pcap_restart() ; return 0; } EOF -if { (eval echo configure:2069: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2068: \"$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 @@ -2087,7 +2086,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for pcap_yyrestart in -lpcap""... $ac_c" 1>&6 -echo "configure:2091: checking for pcap_yyrestart in -lpcap" >&5 +echo "configure:2090: 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 @@ -2095,7 +2094,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpcap $LIBS" cat > conftest.$ac_ext <<EOF -#line 2099 "configure" +#line 2098 "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 @@ -2106,7 +2105,7 @@ int main() { pcap_yyrestart() ; return 0; } EOF -if { (eval echo configure:2110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2109: \"$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 @@ -2128,7 +2127,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for yyrestart in -lpcap""... $ac_c" 1>&6 -echo "configure:2132: checking for yyrestart in -lpcap" >&5 +echo "configure:2131: 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 @@ -2136,7 +2135,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpcap $LIBS" cat > conftest.$ac_ext <<EOF -#line 2140 "configure" +#line 2139 "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 @@ -2147,7 +2146,7 @@ int main() { yyrestart() ; return 0; } EOF -if { (eval echo configure:2151: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2150: \"$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 diff --git a/configure.in b/configure.in @@ -182,7 +182,7 @@ case "$target_os" in AC_DEFINE(LINUX) AC_MSG_CHECKING(for a dumb udphdr declaration) - AC_TRY_COMPILE(, + AC_TRY_COMPILE( #ifndef __FAVOR_BSD #define __FAVOR_BSD #endif @@ -194,7 +194,7 @@ case "$target_os" in #undef _GNU_SOURCE #include <netinet/udp.h> - +, struct udphdr foo; unsigned short bar = foo.uh_sport; ,