aboutsummaryrefslogtreecommitdiffstats
path: root/acinclude.m4
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2017-08-31 14:39:30 +0100
committerJoão Valverde <j@v6e.pt>2017-09-24 12:58:06 +0000
commitd7ec2cbc38dc12b27bae3d043ae93aafe94caf91 (patch)
tree68fd702b56ecf6042287195ca0b9df5c57bd529f /acinclude.m4
parent69bfcbc67ece916630d212a9cc094694182df4f6 (diff)
downloadwireshark-d7ec2cbc38dc12b27bae3d043ae93aafe94caf91.tar.gz
wireshark-d7ec2cbc38dc12b27bae3d043ae93aafe94caf91.tar.bz2
wireshark-d7ec2cbc38dc12b27bae3d043ae93aafe94caf91.zip
autotools: Use package flags to configure libpcap
Change-Id: Icd64014b597a8e60d2aff9d180c441c6ffccff26 Reviewed-on: https://code.wireshark.org/review/23329 Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m4138
1 files changed, 73 insertions, 65 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 79064539c9..a5d9642364 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -131,6 +131,9 @@ AC_DEFUN([AC_WIRESHARK_PCAP_BREAKLOOP_TRY_LINK],
#
AC_DEFUN([AC_WIRESHARK_PCAP_CHECK],
[
+ AC_WIRESHARK_PUSH_FLAGS
+ ws_ac_save_LIBS="$LIBS"
+
if test -z "$pcap_dir"
then
# Pcap header checks
@@ -174,7 +177,17 @@ AC_DEFUN([AC_WIRESHARK_PCAP_CHECK],
# Found it, and it's usable; use it to get the include flags
# for libpcap.
#
- CPPFLAGS="$CPPFLAGS `\"$PCAP_CONFIG\" --cflags`"
+ PCAP_CFLAGS=`\"$PCAP_CONFIG\" --cflags`
+ #
+ # 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
else
#
# Didn't find it; we have to look for libpcap ourselves.
@@ -196,7 +209,7 @@ AC_DEFUN([AC_WIRESHARK_PCAP_CHECK],
do
if test -d $pcap_dir ; then
if test x$pcap_dir != x/usr/include -a x$pcap_dir != x/usr/local/include ; then
- CPPFLAGS="$CPPFLAGS -I$pcap_dir"
+ PCAP_CFLAGS="-I$pcap_dir"
fi
found_pcap_dir=" $found_pcap_dir -I$pcap_dir"
break
@@ -222,85 +235,79 @@ AC_DEFUN([AC_WIRESHARK_PCAP_CHECK],
# and/or linker will search that other directory before it
# searches the specified directory.
#
- CPPFLAGS="$CPPFLAGS -I$pcap_dir/include"
- AC_WIRESHARK_ADD_DASH_L(LDFLAGS, $pcap_dir/lib)
+ PCAP_CFLAGS="-I$pcap_dir/include"
+ #
+ # XXX - This doesn't use AC_WIRESHARK_ADD_DASH_L
+ #
+ PCAP_LIBS="-L$pcap_dir/lib -lpcap"
fi
+ CFLAGS="$PCAP_CFLAGS $CFLAGS"
+ LIBS="$PCAP_LIBS $LIBS"
+
# Pcap header check
- AC_CHECK_HEADER(pcap.h,,
- AC_MSG_ERROR([[Header file pcap.h not found; if you installed libpcap
+ AC_CHECK_HEADER(pcap.h,
+ [
+ AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
+ ],
+ [
+ AC_MSG_ERROR([[Header file pcap.h not found; if you installed libpcap
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?]]))
+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
- # 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])
- LIBS="-lpcap $extras $ac_save_LIBS"
- #
- # XXX - can't we use AC_CHECK_LIB here?
- #
- AC_TRY_LINK(
- [
+ #
+ # 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,
+ [
+ ],
+ [
+ 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])
+ LIBS="-lpcap $extras $ac_save_LIBS"
+ #
+ # XXX - can't we use AC_CHECK_LIB here?
+ #
+ AC_TRY_LINK(
+ [
# include <pcap.h>
- ],
- [
+ ],
+ [
pcap_open_live(NULL, 0, 0, 0, NULL);
- ],
- [
- ac_wireshark_extras_found=yes
- AC_MSG_RESULT([yes])
- PCAP_LIBS="-lpcap $extras"
- AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
- ],
- [
- AC_MSG_RESULT([no])
- ])
+ ],
+ [
+ ac_wireshark_extras_found=yes
+ AC_MSG_RESULT([yes])
+ PCAP_LIBS="$PCAP_LIBS $extras"
+ ],
+ [
+ AC_MSG_RESULT([no])
+ ])
if test x$ac_wireshark_extras_found = xyes
then
- break
+ break
fi
- done
- if test x$ac_wireshark_extras_found = xno
- then
- AC_MSG_ERROR([Can't link with library libpcap.])
- fi
- LIBS=$ac_save_LIBS
- ])
- fi
+ done
+ if test x$ac_wireshark_extras_found = xno
+ then
+ AC_MSG_ERROR([Can't link with library libpcap.])
+ fi
+ LIBS=$ac_save_LIBS
+ ])
+ AC_SUBST(PCAP_CFLAGS)
AC_SUBST(PCAP_LIBS)
#
# Check whether various variables and functions are defined by
# libpcap.
#
- ac_save_LIBS="$LIBS"
- LIBS="$PCAP_LIBS $LIBS"
AC_CHECK_FUNCS(pcap_open_dead pcap_freecode)
#
# pcap_breakloop may be present in the library but not declared
@@ -413,7 +420,8 @@ install a newer version of the header file.])
AC_CHECK_FUNCS(bpf_image pcap_set_tstamp_precision pcap_set_tstamp_type)
fi
- LIBS="$ac_save_LIBS"
+ AC_WIRESHARK_POP_FLAGS
+ LIBS="$ws_ac_save_LIBS"
])
AC_DEFUN([AC_WIRESHARK_PCAP_REMOTE_CHECK],