Check for a pcap-config script (as provided by libpcap 1.x) and, if we

find it, use it to determine where to find libpcap and what additional
libraries it requires.

svn path=/trunk/; revision=28653
This commit is contained in:
Guy Harris 2009-06-08 02:12:23 +00:00
parent 291b01f853
commit 923b8ae800
1 changed files with 74 additions and 46 deletions

View File

@ -290,8 +290,21 @@ AC_DEFUN([AC_WIRESHARK_PCAP_CHECK],
# XXX need to set a var AC_CHECK_HEADER(pcap.h,,)
#
# The user didn't specify a directory in which libpcap resides;
# we assume that the current library search path will work,
# The user didn't specify a directory in which libpcap resides.
# First, look for a pcap-config script.
#
AC_PATH_PROG(PCAP_CONFIG, pcap-config)
if test -n "$PCAP_CONFIG" ; then
#
# Found - use it to get the include flags for
# libpcap.
#
CFLAGS="$CFLAGS `\"$PCAP_CONFIG\" --cflags`"
CPPFLAGS="$CPPFLAGS `\"$PCAP_CONFIG\" --cflags`"
else
#
# Didn't find it; we have to look for libpcap ourselves.
# We assume that the current library search path will work,
# but we may have to look for the header in a "pcap"
# subdirectory of "/usr/include" or "/usr/local/include",
# as some systems apparently put "pcap.h" in a "pcap"
@ -325,6 +338,7 @@ AC_DEFUN([AC_WIRESHARK_PCAP_CHECK],
else
AC_MSG_RESULT(not found)
fi
fi
else
#
# The user specified a directory in which libpcap resides,
@ -350,6 +364,19 @@ from source, did you also do \"make install-incl\", and if you installed a
binary package of libpcap, is there also a developer's package of libpcap,
and did you also install that package?]]))
if test -n "$PCAP_CONFIG" ; then
#
# We have pcap-config; we assume that means we have libpcap
# installed and that pcap-config will tell us whatever
# libraries libpcap needs.
#
if test x$enable_static = xyes; then
PCAP_LIBS="`\"$PCAP_CONFIG\" --libs --static`"
else
PCAP_LIBS="`\"$PCAP_CONFIG\" --libs`"
fi
AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
else
#
# Check to see if we find "pcap_open_live" in "-lpcap".
# Also check for various additional libraries that libpcap might
@ -396,6 +423,7 @@ and did you also install that package?]]))
fi
LIBS=$ac_save_LIBS
], $SOCKET_LIBS $NSL_LIBS)
fi
AC_SUBST(PCAP_LIBS)
#