From 5d39765730629a03c773a99198bc86d3535b3a9b Mon Sep 17 00:00:00 2001 From: david Date: Sat, 24 Sep 2011 06:35:38 +0000 Subject: [PATCH] Check that pcap_get_selectable_fd is declared in PCAP_IS_SUITABLE. On AIX this test was passing even though this error happened on compiling: netutil.cc: In function 'int my_pcap_get_selectable_fd(pcap_t*)': netutil.cc:870:34: error: 'pcap_get_selectable_fd' was not declared in this scope --- acinclude.m4 | 6 +++++- configure | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index 3133a1219..c73004a24 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -74,8 +74,12 @@ int main() { #endif return 0; } + ], [ + AC_CHECK_DECL([pcap_get_selectable_fd], + [AC_MSG_RESULT(yes); $1], + [AC_MSG_RESULT(no -- pcap_get_selectable_fd not declared); $2], + [[#include ]]) ], - [AC_MSG_RESULT(yes); $1], [AC_MSG_RESULT(no -- BPF_TIMEOUT BIOCSRTIMEOUT bug (64-bit OS X)); $2]) ], [AC_MSG_RESULT(no); $2], diff --git a/configure b/configure index 38a5d8627..682b42dd9 100755 --- a/configure +++ b/configure @@ -1847,6 +1847,45 @@ $as_echo "$ac_res" >&6; } } # ac_fn_c_check_header_compile +# ac_fn_c_check_decl LINENO SYMBOL VAR +# ------------------------------------ +# Tests whether SYMBOL is declared, setting cache variable VAR accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5 +$as_echo_n "checking whether $2 is declared... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $2 + (void) $2; +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_decl + # ac_fn_cxx_try_run LINENO # ------------------------ # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes @@ -6221,8 +6260,18 @@ int main() { _ACEOF if ac_fn_c_try_run "$LINENO"; then : + + ac_fn_c_check_decl "$LINENO" "pcap_get_selectable_fd" "ac_cv_have_decl_pcap_get_selectable_fd" "#include +" +if test "x$ac_cv_have_decl_pcap_get_selectable_fd" = x""yes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; }; have_libpcap=yes +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no -- pcap_get_selectable_fd not declared" >&5 +$as_echo "no -- pcap_get_selectable_fd not declared" >&6; }; have_libpcap=no +fi + + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no -- BPF_TIMEOUT BIOCSRTIMEOUT bug (64-bit OS X)" >&5 $as_echo "no -- BPF_TIMEOUT BIOCSRTIMEOUT bug (64-bit OS X)" >&6; }; have_libpcap=no