X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/7094894ebcbf3e7ea78a558c63045445488e346d..refs/pull/703/head:/configure.ac diff --git a/configure.ac b/configure.ac index d47b2fdc..2439aaa7 100644 --- a/configure.ac +++ b/configure.ac @@ -20,11 +20,18 @@ AC_CONFIG_SRCDIR(tcpdump.c) AC_CANONICAL_HOST AC_LBL_C_INIT_BEFORE_CC(V_INCLS) +# +# Try to enable as many C99 features as we can. +# At minimum, we want C++/C99-style // comments. +# AC_PROG_CC_C99 +if test "$ac_cv_prog_cc_c99" = "no"; then + AC_MSG_WARN([The C compiler does not support C99; there may be compiler errors]) +fi AC_LBL_C_INIT(V_CCOPT, V_INCLS) AC_LBL_C_INLINE -AC_CHECK_HEADERS(fcntl.h rpc/rpc.h rpc/rpcent.h) +AC_CHECK_HEADERS(fcntl.h rpc/rpc.h rpc/rpcent.h net/if.h) AC_CHECK_HEADERS(net/pfvar.h, , , [#include #include #include ]) @@ -145,7 +152,6 @@ AC_ARG_ENABLE(smb, enableval=yes) case "$enableval" in yes) AC_MSG_RESULT(yes) - AC_WARN([The SMB printer may have exploitable buffer overflows!!!]) AC_DEFINE(ENABLE_SMB, 1, [define if you want to build the possibly-buggy SMB printer]) LOCALSRC="print-smb.c smbutil.c $LOCALSRC" @@ -434,11 +440,12 @@ AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS) # # You are in a twisty little maze of UN*Xes, all different. # Some might not have ether_ntohost(). -# Some might have it, but not declare it in any header file. -# Some might have it, but declare it in . -# Some might have it, but declare it in -# (And some might have it but document it as something declared in -# , although appears to work.) +# Some might have it and declare it in . +# Some might have it and declare it in +# Some might have it and declare it in . +# Some might have it and declare it in . +# Some might have it and declare it in . +# Some might have it and not declare it in any header file. # # Before you is a C compiler. # @@ -470,33 +477,41 @@ AC_CHECK_FUNCS(ether_ntohost, [ if test "$ac_cv_func_ether_ntohost" = yes -a \ "$ac_cv_buggy_ether_ntohost" = "no"; then # - # OK, we have ether_ntohost(). Do we have ? + # OK, we have ether_ntohost(). Is it declared in ? # - AC_CHECK_HEADERS(netinet/if_ether.h, , , [ -#include -#include -#include -struct mbuf; -struct rtentry; -#include ]) - if test "$ac_cv_header_netinet_if_ether_h" = yes; then + # This test fails if we don't have or if we do + # but it doesn't declare ether_ntohost(). + # + AC_CHECK_DECL(ether_ntohost, + [ + AC_DEFINE(NET_ETHERNET_H_DECLARES_ETHER_NTOHOST,, + [Define to 1 if net/ethernet.h declares `ether_ntohost']) + ],, + [ +#include + ]) + # + # Did that succeed? + # + if test "$ac_cv_have_decl_ether_ntohost" != yes; then # - # Yes. Does it declare ether_ntohost()? + # No, how about , as on Linux? + # + # This test fails if we don't have + # or if we do but it doesn't declare ether_ntohost(). + # + # Unset ac_cv_have_decl_ether_ntohost so we don't + # treat the previous failure as a cached value and + # suppress the next test. # + unset ac_cv_have_decl_ether_ntohost AC_CHECK_DECL(ether_ntohost, [ - AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST,, - [Define to 1 if netinet/if_ether.h declares `ether_ntohost']) + AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST,, + [Define to 1 if netinet/ether.h declares `ether_ntohost']) ],, [ -#include -#include -#include -#include -struct mbuf; -struct rtentry; -#include -#include +#include ]) fi # @@ -504,53 +519,108 @@ struct rtentry; # if test "$ac_cv_have_decl_ether_ntohost" != yes; then # - # No, how about , as on Linux? + # No, how about , as on Solaris 10 + # and later? # - AC_CHECK_HEADERS(netinet/ether.h) - if test "$ac_cv_header_netinet_ether_h" = yes; then - # - # We have it - does it declare ether_ntohost()? - # Unset ac_cv_have_decl_ether_ntohost so we don't - # treat the previous failure as a cached value and - # suppress the next test. - # - unset ac_cv_have_decl_ether_ntohost - AC_CHECK_DECL(ether_ntohost, - [ - AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST,, - [Define to 1 if netinet/ether.h declares `ether_ntohost']) - ],, - [ -#include - ]) - fi + # This test fails if we don't have + # or if we do but it doesn't declare ether_ntohost(). + # + # Unset ac_cv_have_decl_ether_ntohost so we don't + # treat the previous failure as a cached value and + # suppress the next test. + # + unset ac_cv_have_decl_ether_ntohost + AC_CHECK_DECL(ether_ntohost, + [ + AC_DEFINE(SYS_ETHERNET_H_DECLARES_ETHER_NTOHOST,, + [Define to 1 if sys/ethernet.h declares `ether_ntohost']) + ],, + [ +#include + ]) fi # - # Is ether_ntohost() declared? + # Did that succeed? # if test "$ac_cv_have_decl_ether_ntohost" != yes; then # - # No, we'll have to declare it ourselves. - # Do we have "struct ether_addr"? + # No, how about , as in AIX? # - AC_CHECK_TYPES(struct ether_addr,,, + # This test fails if we don't have + # (if we have ether_ntohost(), we should have + # networking, and if we have networking, we should + # have ) or if we do but it doesn't + # declare ether_ntohost(). + # + # Unset ac_cv_have_decl_ether_ntohost so we don't + # treat the previous failure as a cached value and + # suppress the next test. + # + unset ac_cv_have_decl_ether_ntohost + AC_CHECK_DECL(ether_ntohost, + [ + AC_DEFINE(ARPA_INET_H_DECLARES_ETHER_NTOHOST,, + [Define to 1 if arpa/inet.h declares `ether_ntohost']) + ],, + [ +#include + ]) + fi + # + # Did that succeed? + # + if test "$ac_cv_have_decl_ether_ntohost" != yes; then + # + # No, how about ? + # On some platforms, it requires and + # , and we always include it with + # both of them, so test it with both of them. + # + # This test fails if we don't have + # and the headers we include before it, or if we do but + # doesn't declare ether_hostton(). + # + # Unset ac_cv_have_decl_ether_ntohost so we don't + # treat the previous failure as a cached value and + # suppress the next test. + # + unset ac_cv_have_decl_ether_ntohost + AC_CHECK_DECL(ether_ntohost, + [ + AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST,, + [Define to 1 if netinet/if_ether.h declares `ether_ntohost']) + ],, [ #include #include -#include -#include -struct mbuf; -struct rtentry; #include +#include #include ]) - AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 0, - [Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you -don't.]) - else + fi + # + # After all that, is ether_ntohost() declared? + # + if test "$ac_cv_have_decl_ether_ntohost" = yes; then + # + # Yes. + # AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 1, - [Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you -don't.]) + [Define to 1 if you have the declaration of `ether_ntohost']) + else + # + # No, we'll have to declare it ourselves. + # Do we have "struct ether_addr" if we include + # ? + # + AC_CHECK_TYPES(struct ether_addr,,, + [ + #include + #include + #include + #include + #include + ]) fi fi @@ -608,17 +678,6 @@ dnl so just define the HAVE_ value if it's there. dnl AC_CHECK_FUNCS(pcap_breakloop) -dnl -dnl Check for "pcap_dump_ftell()" and use a substitute version -dnl if it's not present. -dnl -AC_CHECK_FUNC(pcap_dump_ftell, - AC_DEFINE(HAVE_PCAP_DUMP_FTELL, 1, - [define if libpcap has pcap_dump_ftell()]), - [ - AC_LIBOBJ(pcap_dump_ftell) - ]) - # # Do we have the new open API? Check for pcap_create, and assume that, # if we do, we also have pcap_activate() and the other new routines @@ -673,6 +732,7 @@ if test $ac_cv_func_pcap_lib_version = "no" ; then fi AC_CHECK_FUNCS(pcap_setdirection pcap_set_immediate_mode pcap_dump_ftell64) AC_CHECK_FUNCS(pcap_open pcap_findalldevs_ex) +AC_REPLACE_FUNCS(pcap_dump_ftell) # # Check for special debugging functions @@ -824,19 +884,6 @@ AC_CHECK_TYPE([u_int64_t], , #include ]) -# -# Check for some headers introduced in later versions of libpcap -# and used by some printers. -# -# Those headers might use the {u_}intN_t types, so we must do this -# after we check for what's needed to get them defined. -# -savedcppflags="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS $V_INCLS" -AC_CHECK_HEADERS(pcap/bluetooth.h,,,[#include "netdissect-stdinc.h"]) -AC_CHECK_HEADERS(pcap/nflog.h,,,[#include "netdissect-stdinc.h"]) -CPPFLAGS="$savedcppflags" - AC_PROG_RANLIB AC_CHECK_TOOL([AR], [ar])