forked from osmocom/wireshark
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:
parent
291b01f853
commit
923b8ae800
120
acinclude.m4
120
acinclude.m4
|
@ -290,40 +290,54 @@ AC_DEFUN([AC_WIRESHARK_PCAP_CHECK],
|
||||||
# XXX need to set a var AC_CHECK_HEADER(pcap.h,,)
|
# XXX need to set a var AC_CHECK_HEADER(pcap.h,,)
|
||||||
|
|
||||||
#
|
#
|
||||||
# The user didn't specify a directory in which libpcap resides;
|
# The user didn't specify a directory in which libpcap resides.
|
||||||
# we assume that the current library search path will work,
|
# First, look for a pcap-config script.
|
||||||
# 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"
|
|
||||||
# subdirectory, and we also check "$prefix/include" - and
|
|
||||||
# "$prefix/include/pcap", in case $prefix is set to
|
|
||||||
# "/usr/include" or "/usr/local/include".
|
|
||||||
#
|
#
|
||||||
# XXX - should we just add "$prefix/include" to the include
|
AC_PATH_PROG(PCAP_CONFIG, pcap-config)
|
||||||
# search path and "$prefix/lib" to the library search path?
|
if test -n "$PCAP_CONFIG" ; then
|
||||||
#
|
#
|
||||||
AC_MSG_CHECKING(for extraneous pcap header directories)
|
# Found - use it to get the include flags for
|
||||||
found_pcap_dir=""
|
# libpcap.
|
||||||
pcap_dir_list="/usr/include/pcap $prefix/include/pcap $prefix/include"
|
#
|
||||||
if test "x$ac_cv_enable_usr_local" = "xyes" ; then
|
CFLAGS="$CFLAGS `\"$PCAP_CONFIG\" --cflags`"
|
||||||
pcap_dir_list="$pcap_dir_list /usr/local/include/pcap"
|
CPPFLAGS="$CPPFLAGS `\"$PCAP_CONFIG\" --cflags`"
|
||||||
fi
|
else
|
||||||
for pcap_dir in $pcap_dir_list
|
#
|
||||||
do
|
# Didn't find it; we have to look for libpcap ourselves.
|
||||||
if test -d $pcap_dir ; then
|
# 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"
|
||||||
|
# subdirectory, and we also check "$prefix/include" - and
|
||||||
|
# "$prefix/include/pcap", in case $prefix is set to
|
||||||
|
# "/usr/include" or "/usr/local/include".
|
||||||
|
#
|
||||||
|
# XXX - should we just add "$prefix/include" to the include
|
||||||
|
# search path and "$prefix/lib" to the library search path?
|
||||||
|
#
|
||||||
|
AC_MSG_CHECKING(for extraneous pcap header directories)
|
||||||
|
found_pcap_dir=""
|
||||||
|
pcap_dir_list="/usr/include/pcap $prefix/include/pcap $prefix/include"
|
||||||
|
if test "x$ac_cv_enable_usr_local" = "xyes" ; then
|
||||||
|
pcap_dir_list="$pcap_dir_list /usr/local/include/pcap"
|
||||||
|
fi
|
||||||
|
for pcap_dir in $pcap_dir_list
|
||||||
|
do
|
||||||
|
if test -d $pcap_dir ; then
|
||||||
if test x$pcap_dir != x/usr/include -a x$pcap_dir != x/usr/local/include ; then
|
if test x$pcap_dir != x/usr/include -a x$pcap_dir != x/usr/local/include ; then
|
||||||
CFLAGS="$CFLAGS -I$pcap_dir"
|
CFLAGS="$CFLAGS -I$pcap_dir"
|
||||||
CPPFLAGS="$CPPFLAGS -I$pcap_dir"
|
CPPFLAGS="$CPPFLAGS -I$pcap_dir"
|
||||||
fi
|
fi
|
||||||
found_pcap_dir=" $found_pcap_dir -I$pcap_dir"
|
found_pcap_dir=" $found_pcap_dir -I$pcap_dir"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if test "$found_pcap_dir" != "" ; then
|
if test "$found_pcap_dir" != "" ; then
|
||||||
AC_MSG_RESULT(found --$found_pcap_dir added to CFLAGS)
|
AC_MSG_RESULT(found --$found_pcap_dir added to CFLAGS)
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT(not found)
|
AC_MSG_RESULT(not found)
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
#
|
#
|
||||||
|
@ -350,20 +364,33 @@ 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,
|
binary package of libpcap, is there also a developer's package of libpcap,
|
||||||
and did you also install that package?]]))
|
and did you also install that package?]]))
|
||||||
|
|
||||||
#
|
if test -n "$PCAP_CONFIG" ; then
|
||||||
# Check to see if we find "pcap_open_live" in "-lpcap".
|
#
|
||||||
# Also check for various additional libraries that libpcap might
|
# We have pcap-config; we assume that means we have libpcap
|
||||||
# require.
|
# installed and that pcap-config will tell us whatever
|
||||||
#
|
# libraries libpcap needs.
|
||||||
AC_CHECK_LIB(pcap, pcap_open_live,
|
#
|
||||||
[
|
if test x$enable_static = xyes; then
|
||||||
PCAP_LIBS=-lpcap
|
PCAP_LIBS="`\"$PCAP_CONFIG\" --libs --static`"
|
||||||
AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
|
else
|
||||||
], [
|
PCAP_LIBS="`\"$PCAP_CONFIG\" --libs`"
|
||||||
ac_wireshark_extras_found=no
|
fi
|
||||||
ac_save_LIBS="$LIBS"
|
AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
|
||||||
for extras in "-lcfg -lodm" "-lpfring"
|
else
|
||||||
do
|
#
|
||||||
|
# Check to see if we find "pcap_open_live" in "-lpcap".
|
||||||
|
# Also check for various additional libraries that libpcap might
|
||||||
|
# require.
|
||||||
|
#
|
||||||
|
AC_CHECK_LIB(pcap, pcap_open_live,
|
||||||
|
[
|
||||||
|
PCAP_LIBS=-lpcap
|
||||||
|
AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
|
||||||
|
], [
|
||||||
|
ac_wireshark_extras_found=no
|
||||||
|
ac_save_LIBS="$LIBS"
|
||||||
|
for extras in "-lcfg -lodm" "-lpfring"
|
||||||
|
do
|
||||||
AC_MSG_CHECKING([for pcap_open_live in -lpcap with $extras])
|
AC_MSG_CHECKING([for pcap_open_live in -lpcap with $extras])
|
||||||
LIBS="-lpcap $extras"
|
LIBS="-lpcap $extras"
|
||||||
#
|
#
|
||||||
|
@ -389,13 +416,14 @@ and did you also install that package?]]))
|
||||||
then
|
then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if test x$ac_wireshark_extras_found = xno
|
if test x$ac_wireshark_extras_found = xno
|
||||||
then
|
then
|
||||||
AC_MSG_ERROR([Can't link with library libpcap.])
|
AC_MSG_ERROR([Can't link with library libpcap.])
|
||||||
fi
|
fi
|
||||||
LIBS=$ac_save_LIBS
|
LIBS=$ac_save_LIBS
|
||||||
], $SOCKET_LIBS $NSL_LIBS)
|
], $SOCKET_LIBS $NSL_LIBS)
|
||||||
|
fi
|
||||||
AC_SUBST(PCAP_LIBS)
|
AC_SUBST(PCAP_LIBS)
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue