From: Guy Harris Date: Mon, 19 May 2014 17:56:52 +0000 (-0700) Subject: Check for pcap_free_datalinks(). X-Git-Tag: tcpdump-4.6.0~20 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/125e5bc5cab2aba24062e2cd68c23eb7549fbea3 Check for pcap_free_datalinks(). Fixes GitHub issue #390. Also, if all we do when checking for a function is set a HAVE_XXX AC_CHECK_FUNC, as AC_CHECK_FUNCS will set the #define for you. --- diff --git a/aclocal.m4 b/aclocal.m4 index fb0a6627..74fe833c 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -615,14 +615,15 @@ reproduce this problem ourselves.]) dnl if they're not present. dnl AC_CHECK_FUNC(pcap_list_datalinks, - AC_DEFINE(HAVE_PCAP_LIST_DATALINKS, 1, - [define if libpcap has pcap_list_datalinks()]), + [ + AC_DEFINE(HAVE_PCAP_LIST_DATALINKS, 1, + [define if libpcap has pcap_list_datalinks()]) + AC_CHECK_FUNCS(pcap_free_datalinks) + ], [ AC_LIBOBJ(datalinks) ]) - AC_CHECK_FUNC(pcap_set_datalink, - AC_DEFINE(HAVE_PCAP_SET_DATALINK, 1, - [define if libpcap has pcap_set_datalink()])) + AC_CHECK_FUNCS(pcap_set_datalink) AC_CHECK_FUNC(pcap_datalink_name_to_val, [ AC_DEFINE(HAVE_PCAP_DATALINK_NAME_TO_VAL, 1, @@ -648,6 +649,7 @@ reproduce this problem ourselves.]) 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()]), diff --git a/config.h.in b/config.h.in index 7ac47c0d..d7f37c6a 100644 --- a/config.h.in +++ b/config.h.in @@ -100,6 +100,9 @@ /* Define to 1 if you have the `pcap_findalldevs' function. */ #undef HAVE_PCAP_FINDALLDEVS +/* Define to 1 if you have the `pcap_free_datalinks' function. */ +#undef HAVE_PCAP_FREE_DATALINKS + /* Define to 1 if the system has the type `pcap_if_t'. */ #undef HAVE_PCAP_IF_T @@ -115,7 +118,7 @@ /* Define to 1 if you have the `pcap_setdirection' function. */ #undef HAVE_PCAP_SETDIRECTION -/* define if libpcap has pcap_set_datalink() */ +/* Define to 1 if you have the `pcap_set_datalink' function. */ #undef HAVE_PCAP_SET_DATALINK /* Define to 1 if you have the `pcap_set_tstamp_type' function. */ diff --git a/configure b/configure index 559c8731..c8f9590c 100755 --- a/configure +++ b/configure @@ -6079,8 +6079,21 @@ fi ac_fn_c_check_func "$LINENO" "pcap_list_datalinks" "ac_cv_func_pcap_list_datalinks" if test "x$ac_cv_func_pcap_list_datalinks" = xyes; then : + $as_echo "#define HAVE_PCAP_LIST_DATALINKS 1" >>confdefs.h + for ac_func in pcap_free_datalinks +do : + ac_fn_c_check_func "$LINENO" "pcap_free_datalinks" "ac_cv_func_pcap_free_datalinks" +if test "x$ac_cv_func_pcap_free_datalinks" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PCAP_FREE_DATALINKS 1 +_ACEOF + +fi +done + + else case " $LIBOBJS " in @@ -6092,12 +6105,16 @@ esac fi - ac_fn_c_check_func "$LINENO" "pcap_set_datalink" "ac_cv_func_pcap_set_datalink" + for ac_func in pcap_set_datalink +do : + ac_fn_c_check_func "$LINENO" "pcap_set_datalink" "ac_cv_func_pcap_set_datalink" if test "x$ac_cv_func_pcap_set_datalink" = xyes; then : - -$as_echo "#define HAVE_PCAP_SET_DATALINK 1" >>confdefs.h + cat >>confdefs.h <<_ACEOF +#define HAVE_PCAP_SET_DATALINK 1 +_ACEOF fi +done ac_fn_c_check_func "$LINENO" "pcap_datalink_name_to_val" "ac_cv_func_pcap_datalink_name_to_val" if test "x$ac_cv_func_pcap_datalink_name_to_val" = xyes; then : @@ -6146,7 +6163,7 @@ fi done - ac_fn_c_check_func "$LINENO" "pcap_dump_ftell" "ac_cv_func_pcap_dump_ftell" + ac_fn_c_check_func "$LINENO" "pcap_dump_ftell" "ac_cv_func_pcap_dump_ftell" if test "x$ac_cv_func_pcap_dump_ftell" = xyes; then : $as_echo "#define HAVE_PCAP_DUMP_FTELL 1" >>confdefs.h