Skip to content

Commit

Permalink
Only set HAVE_LIBPCAP if we have both the libraries and header files F…
Browse files Browse the repository at this point in the history
…ixes #2245
  • Loading branch information
arr2036 committed Jun 11, 2018
1 parent d302aca commit 1694580
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
10 changes: 4 additions & 6 deletions configure
Expand Up @@ -2425,6 +2425,8 @@ ac_config_headers="$ac_config_headers src/include/autoconf.h"
RADIUSD_MAJOR_VERSION=`cat VERSION | cut -f1 -d.`
RADIUSD_MINOR_VERSION=`cat VERSION | cut -f2 -d.`
Expand Down Expand Up @@ -6888,10 +6890,6 @@ if test "x$ac_cv_lib_pcap_pcap_open_live" != "xyes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pcap library not found, silently disabling the RADIUS sniffer, and ARP listener. Use --with-pcap-lib-dir=<path>." >&5
$as_echo "$as_me: WARNING: pcap library not found, silently disabling the RADIUS sniffer, and ARP listener. Use --with-pcap-lib-dir=<path>." >&2;}
else
$as_echo "#define HAVE_LIBPCAP 1" >>confdefs.h
for ac_func in \
pcap_fopen_offline \
pcap_dump_fopen \
Expand Down Expand Up @@ -9168,9 +9166,9 @@ fi
smart_prefix=
if test "x$ac_cv_header_pcap_h" = "xyes"; then
if test "x$ac_cv_header_pcap_h" = "xyes" && test "x$ac_cv_lib_pcap_pcap_open_live" = "xyes"; then
$as_echo "#define HAVE_PCAP_H 1" >>confdefs.h
$as_echo "#define HAVE_LIBPCAP 1" >>confdefs.h
Expand Down
8 changes: 2 additions & 6 deletions configure.ac
Expand Up @@ -883,10 +883,6 @@ FR_SMART_CHECK_LIB(pcap, pcap_open_live)
if test "x$ac_cv_lib_pcap_pcap_open_live" != "xyes"; then
AC_MSG_WARN([pcap library not found, silently disabling the RADIUS sniffer, and ARP listener. Use --with-pcap-lib-dir=<path>.])
else
AC_DEFINE(HAVE_LIBPCAP, 1,
[Define to 1 if you have the `pcap' library (-lpcap).]
)

AC_CHECK_FUNCS(\
pcap_fopen_offline \
pcap_dump_fopen \
Expand Down Expand Up @@ -1248,8 +1244,8 @@ else
dnl #
smart_try_dir="$pcap_include_dir"
FR_SMART_CHECK_INCLUDE([pcap.h])
if test "x$ac_cv_header_pcap_h" = "xyes"; then
AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
if test "x$ac_cv_header_pcap_h" = "xyes" && test "x$ac_cv_lib_pcap_pcap_open_live" = "xyes"; then
AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the `pcap' library (-lpcap) and header file <pcap.h>.])
AC_SUBST(PCAP_LIBS)
AC_SUBST(PCAP_LDFLAGS)
else
Expand Down
12 changes: 5 additions & 7 deletions src/include/autoconf.h.in
Expand Up @@ -60,9 +60,6 @@
/* Define to 1 if you have the <sys/capability.h> header file. */
#undef HAVE_CAPABILITY_H

/* Define to 1 if you have the <linux/if_packet.h> header file. */
#undef HAVE_LINUX_IF_PACKET_H

/* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME

Expand Down Expand Up @@ -221,7 +218,8 @@
/* Define to 1 if you have the `nsl' library (-lnsl). */
#undef HAVE_LIBNSL

/* Define to 1 if you have the `pcap' library (-lpcap). */
/* Define to 1 if you have the `pcap' library (-lpcap) and header file
<pcap.h>. */
#undef HAVE_LIBPCAP

/* Define if you have a readline compatible library */
Expand All @@ -242,6 +240,9 @@
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H

/* Define to 1 if you have the <linux/if_packet.h> header file. */
#undef HAVE_LINUX_IF_PACKET_H

/* Define to 1 if you have the `localtime_r' function. */
#undef HAVE_LOCALTIME_R

Expand Down Expand Up @@ -320,9 +321,6 @@
/* Define to 1 if you have the `pcap_fopen_offline' function. */
#undef HAVE_PCAP_FOPEN_OFFLINE

/* Define to 1 if you have the <pcap.h> header file. */
#undef HAVE_PCAP_H

/* define this if we have libpcre */
#undef HAVE_PCRE

Expand Down

0 comments on commit 1694580

Please sign in to comment.