mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-27 12:03:44 +08:00
If we're using a local libpcap library, check for a local pcap-config
script and, if we find it, query it to see what additional libraries are needed to link with that library. If we're not, check for a system pcap-config script and, if we find it, query it to see what C compiler flags and linker flags are needed to build with that library.
This commit is contained in:
parent
68fcda9beb
commit
018e7fe40d
99
aclocal.m4
vendored
99
aclocal.m4
vendored
@ -254,43 +254,60 @@ AC_DEFUN(AC_LBL_LIBPCAP,
|
||||
done
|
||||
if test $libpcap = FAIL ; then
|
||||
AC_MSG_RESULT(not found)
|
||||
AC_CHECK_LIB(pcap, main, libpcap="-lpcap")
|
||||
if test $libpcap = FAIL ; then
|
||||
AC_MSG_ERROR(see the INSTALL doc for more info)
|
||||
fi
|
||||
dnl
|
||||
dnl Some versions of Red Hat Linux put "pcap.h" in
|
||||
dnl "/usr/include/pcap"; had the LBL folks done so,
|
||||
dnl that would have been a good idea, but for
|
||||
dnl the Red Hat folks to do so just breaks source
|
||||
dnl compatibility with other systems.
|
||||
dnl
|
||||
dnl We work around this by assuming that, as we didn't
|
||||
dnl find a local libpcap, libpcap is in /usr/lib or
|
||||
dnl /usr/local/lib and that the corresponding header
|
||||
dnl file is under one of those directories; if we don't
|
||||
dnl find it in either of those directories, we check to
|
||||
dnl see if it's in a "pcap" subdirectory of them and,
|
||||
dnl if so, add that subdirectory to the "-I" list.
|
||||
dnl
|
||||
dnl (We now also put pcap.h in /usr/include/pcap, but we
|
||||
dnl leave behind a /usr/include/pcap.h that includes it,
|
||||
dnl so you can still just include <pcap.h>.)
|
||||
dnl
|
||||
AC_MSG_CHECKING(for extraneous pcap header directories)
|
||||
if test \( ! -r /usr/local/include/pcap.h \) -a \
|
||||
\( ! -r /usr/include/pcap.h \); then
|
||||
if test -r /usr/local/include/pcap/pcap.h; then
|
||||
d="/usr/local/include/pcap"
|
||||
elif test -r /usr/include/pcap/pcap.h; then
|
||||
d="/usr/include/pcap"
|
||||
fi
|
||||
fi
|
||||
if test -z "$d" ; then
|
||||
AC_MSG_RESULT(not found)
|
||||
|
||||
#
|
||||
# Look for pcap-config.
|
||||
#
|
||||
AC_PATH_PROG(PCAP_CONFIG, pcap-config)
|
||||
if test -n "$PCAP_CONFIG" ; then
|
||||
#
|
||||
# Found - use it to get the include flags for
|
||||
# libpcap and the flags to link with libpcap.
|
||||
#
|
||||
$2="`\"$PCAP_CONFIG\" --cflags` $$2"
|
||||
libpcap="`\"$PCAP_CONFIG\" --libs`"
|
||||
else
|
||||
$2="-I$d $$2"
|
||||
AC_MSG_RESULT(found -- -I$d added)
|
||||
#
|
||||
# Not found; look for pcap.
|
||||
#
|
||||
AC_CHECK_LIB(pcap, main, libpcap="-lpcap")
|
||||
if test $libpcap = FAIL ; then
|
||||
AC_MSG_ERROR(see the INSTALL doc for more info)
|
||||
fi
|
||||
dnl
|
||||
dnl Some versions of Red Hat Linux put "pcap.h" in
|
||||
dnl "/usr/include/pcap"; had the LBL folks done so,
|
||||
dnl that would have been a good idea, but for
|
||||
dnl the Red Hat folks to do so just breaks source
|
||||
dnl compatibility with other systems.
|
||||
dnl
|
||||
dnl We work around this by assuming that, as we didn't
|
||||
dnl find a local libpcap, libpcap is in /usr/lib or
|
||||
dnl /usr/local/lib and that the corresponding header
|
||||
dnl file is under one of those directories; if we don't
|
||||
dnl find it in either of those directories, we check to
|
||||
dnl see if it's in a "pcap" subdirectory of them and,
|
||||
dnl if so, add that subdirectory to the "-I" list.
|
||||
dnl
|
||||
dnl (We now also put pcap.h in /usr/include/pcap, but we
|
||||
dnl leave behind a /usr/include/pcap.h that includes it,
|
||||
dnl so you can still just include <pcap.h>.)
|
||||
dnl
|
||||
AC_MSG_CHECKING(for extraneous pcap header directories)
|
||||
if test \( ! -r /usr/local/include/pcap.h \) -a \
|
||||
\( ! -r /usr/include/pcap.h \); then
|
||||
if test -r /usr/local/include/pcap/pcap.h; then
|
||||
d="/usr/local/include/pcap"
|
||||
elif test -r /usr/include/pcap/pcap.h; then
|
||||
d="/usr/include/pcap"
|
||||
fi
|
||||
fi
|
||||
if test -z "$d" ; then
|
||||
AC_MSG_RESULT(not found)
|
||||
else
|
||||
$2="-I$d $$2"
|
||||
AC_MSG_RESULT(found -- -I$d added)
|
||||
fi
|
||||
fi
|
||||
else
|
||||
$1=$libpcap
|
||||
@ -304,6 +321,16 @@ AC_DEFUN(AC_LBL_LIBPCAP,
|
||||
AC_MSG_ERROR(cannot find pcap.h, see INSTALL)
|
||||
fi
|
||||
AC_MSG_RESULT($libpcap)
|
||||
AC_PATH_PROG(PCAP_CONFIG, pcap-config,, $d)
|
||||
if test "$PCAP_CONFIG"; then
|
||||
#
|
||||
# The libpcap directory has a pcap-config script.
|
||||
# Use it to get any additioal libraries needed
|
||||
# to link with the libpcap archive library in
|
||||
# that directory
|
||||
#
|
||||
libpcap="$libpcap `\"$PCAP_CONFIG\" --additional-libs --static`"
|
||||
fi
|
||||
fi
|
||||
LIBS="$libpcap $LIBS"
|
||||
case "$host_os" in
|
||||
|
143
configure
vendored
143
configure
vendored
@ -671,6 +671,7 @@ CPP
|
||||
GREP
|
||||
EGREP
|
||||
LIBOBJS
|
||||
PCAP_CONFIG
|
||||
RANLIB
|
||||
V_CCOPT
|
||||
V_DEFS
|
||||
@ -9315,7 +9316,62 @@ echo $ECHO_N "checking for local pcap library... $ECHO_C" >&6; }
|
||||
if test $libpcap = FAIL ; then
|
||||
{ echo "$as_me:$LINENO: result: not found" >&5
|
||||
echo "${ECHO_T}not found" >&6; }
|
||||
{ echo "$as_me:$LINENO: checking for main in -lpcap" >&5
|
||||
|
||||
#
|
||||
# Look for pcap-config.
|
||||
#
|
||||
# Extract the first word of "pcap-config", so it can be a program name with args.
|
||||
set dummy pcap-config; ac_word=$2
|
||||
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_path_PCAP_CONFIG+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
case $PCAP_CONFIG in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
ac_cv_path_PCAP_CONFIG="$PCAP_CONFIG" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
ac_cv_path_PCAP_CONFIG="$as_dir/$ac_word$ac_exec_ext"
|
||||
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
PCAP_CONFIG=$ac_cv_path_PCAP_CONFIG
|
||||
if test -n "$PCAP_CONFIG"; then
|
||||
{ echo "$as_me:$LINENO: result: $PCAP_CONFIG" >&5
|
||||
echo "${ECHO_T}$PCAP_CONFIG" >&6; }
|
||||
else
|
||||
{ echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
if test -n "$PCAP_CONFIG" ; then
|
||||
#
|
||||
# Found - use it to get the include flags for
|
||||
# libpcap and the flags to link with libpcap.
|
||||
#
|
||||
V_INCLS="`\"$PCAP_CONFIG\" --cflags` $V_INCLS"
|
||||
libpcap="`\"$PCAP_CONFIG\" --libs`"
|
||||
else
|
||||
#
|
||||
# Not found; look for pcap.
|
||||
#
|
||||
{ echo "$as_me:$LINENO: checking for main in -lpcap" >&5
|
||||
echo $ECHO_N "checking for main in -lpcap... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_lib_pcap_main+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
@ -9374,28 +9430,29 @@ if test $ac_cv_lib_pcap_main = yes; then
|
||||
libpcap="-lpcap"
|
||||
fi
|
||||
|
||||
if test $libpcap = FAIL ; then
|
||||
if test $libpcap = FAIL ; then
|
||||
{ { echo "$as_me:$LINENO: error: see the INSTALL doc for more info" >&5
|
||||
echo "$as_me: error: see the INSTALL doc for more info" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: checking for extraneous pcap header directories" >&5
|
||||
echo $ECHO_N "checking for extraneous pcap header directories... $ECHO_C" >&6; }
|
||||
if test \( ! -r /usr/local/include/pcap.h \) -a \
|
||||
\( ! -r /usr/include/pcap.h \); then
|
||||
if test -r /usr/local/include/pcap/pcap.h; then
|
||||
d="/usr/local/include/pcap"
|
||||
elif test -r /usr/include/pcap/pcap.h; then
|
||||
d="/usr/include/pcap"
|
||||
fi
|
||||
fi
|
||||
if test -z "$d" ; then
|
||||
{ echo "$as_me:$LINENO: result: not found" >&5
|
||||
{ echo "$as_me:$LINENO: checking for extraneous pcap header directories" >&5
|
||||
echo $ECHO_N "checking for extraneous pcap header directories... $ECHO_C" >&6; }
|
||||
if test \( ! -r /usr/local/include/pcap.h \) -a \
|
||||
\( ! -r /usr/include/pcap.h \); then
|
||||
if test -r /usr/local/include/pcap/pcap.h; then
|
||||
d="/usr/local/include/pcap"
|
||||
elif test -r /usr/include/pcap/pcap.h; then
|
||||
d="/usr/include/pcap"
|
||||
fi
|
||||
fi
|
||||
if test -z "$d" ; then
|
||||
{ echo "$as_me:$LINENO: result: not found" >&5
|
||||
echo "${ECHO_T}not found" >&6; }
|
||||
else
|
||||
V_INCLS="-I$d $V_INCLS"
|
||||
{ echo "$as_me:$LINENO: result: found -- -I$d added" >&5
|
||||
else
|
||||
V_INCLS="-I$d $V_INCLS"
|
||||
{ echo "$as_me:$LINENO: result: found -- -I$d added" >&5
|
||||
echo "${ECHO_T}found -- -I$d added" >&6; }
|
||||
fi
|
||||
fi
|
||||
else
|
||||
V_PCAPDEP=$libpcap
|
||||
@ -9412,6 +9469,55 @@ echo "$as_me: error: cannot find pcap.h" >&2;}
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: result: $libpcap" >&5
|
||||
echo "${ECHO_T}$libpcap" >&6; }
|
||||
# Extract the first word of "pcap-config", so it can be a program name with args.
|
||||
set dummy pcap-config; ac_word=$2
|
||||
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_path_PCAP_CONFIG+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
case $PCAP_CONFIG in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
ac_cv_path_PCAP_CONFIG="$PCAP_CONFIG" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $d
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
ac_cv_path_PCAP_CONFIG="$as_dir/$ac_word$ac_exec_ext"
|
||||
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
PCAP_CONFIG=$ac_cv_path_PCAP_CONFIG
|
||||
if test -n "$PCAP_CONFIG"; then
|
||||
{ echo "$as_me:$LINENO: result: $PCAP_CONFIG" >&5
|
||||
echo "${ECHO_T}$PCAP_CONFIG" >&6; }
|
||||
else
|
||||
{ echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
if test "$PCAP_CONFIG"; then
|
||||
#
|
||||
# The libpcap directory has a pcap-config script.
|
||||
# Use it to get any additioal libraries needed
|
||||
# to link with the libpcap archive library in
|
||||
# that directory
|
||||
#
|
||||
libpcap="$libpcap `\"$PCAP_CONFIG\" --additional-libs --static`"
|
||||
fi
|
||||
fi
|
||||
LIBS="$libpcap $LIBS"
|
||||
case "$host_os" in
|
||||
@ -14600,6 +14706,7 @@ CPP!$CPP$ac_delim
|
||||
GREP!$GREP$ac_delim
|
||||
EGREP!$EGREP$ac_delim
|
||||
LIBOBJS!$LIBOBJS$ac_delim
|
||||
PCAP_CONFIG!$PCAP_CONFIG$ac_delim
|
||||
RANLIB!$RANLIB$ac_delim
|
||||
V_CCOPT!$V_CCOPT$ac_delim
|
||||
V_DEFS!$V_DEFS$ac_delim
|
||||
@ -14615,7 +14722,7 @@ INSTALL_DATA!$INSTALL_DATA$ac_delim
|
||||
LTLIBOBJS!$LTLIBOBJS$ac_delim
|
||||
_ACEOF
|
||||
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 70; then
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 71; then
|
||||
break
|
||||
elif $ac_last_try; then
|
||||
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
|
||||
|
Loading…
Reference in New Issue
Block a user