forked from osmocom/wireshark
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>
This commit is contained in:
parent
69bfcbc67e
commit
d7ec2cbc38
138
acinclude.m4
138
acinclude.m4
|
@ -131,6 +131,9 @@ AC_DEFUN([AC_WIRESHARK_PCAP_BREAKLOOP_TRY_LINK],
|
||||||
#
|
#
|
||||||
AC_DEFUN([AC_WIRESHARK_PCAP_CHECK],
|
AC_DEFUN([AC_WIRESHARK_PCAP_CHECK],
|
||||||
[
|
[
|
||||||
|
AC_WIRESHARK_PUSH_FLAGS
|
||||||
|
ws_ac_save_LIBS="$LIBS"
|
||||||
|
|
||||||
if test -z "$pcap_dir"
|
if test -z "$pcap_dir"
|
||||||
then
|
then
|
||||||
# Pcap header checks
|
# 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
|
# Found it, and it's usable; use it to get the include flags
|
||||||
# for libpcap.
|
# 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
|
else
|
||||||
#
|
#
|
||||||
# Didn't find it; we have to look for libpcap ourselves.
|
# Didn't find it; we have to look for libpcap ourselves.
|
||||||
|
@ -196,7 +209,7 @@ AC_DEFUN([AC_WIRESHARK_PCAP_CHECK],
|
||||||
do
|
do
|
||||||
if test -d $pcap_dir ; then
|
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
|
||||||
CPPFLAGS="$CPPFLAGS -I$pcap_dir"
|
PCAP_CFLAGS="-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
|
||||||
|
@ -222,85 +235,79 @@ AC_DEFUN([AC_WIRESHARK_PCAP_CHECK],
|
||||||
# and/or linker will search that other directory before it
|
# and/or linker will search that other directory before it
|
||||||
# searches the specified directory.
|
# searches the specified directory.
|
||||||
#
|
#
|
||||||
CPPFLAGS="$CPPFLAGS -I$pcap_dir/include"
|
PCAP_CFLAGS="-I$pcap_dir/include"
|
||||||
AC_WIRESHARK_ADD_DASH_L(LDFLAGS, $pcap_dir/lib)
|
#
|
||||||
|
# XXX - This doesn't use AC_WIRESHARK_ADD_DASH_L
|
||||||
|
#
|
||||||
|
PCAP_LIBS="-L$pcap_dir/lib -lpcap"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CFLAGS="$PCAP_CFLAGS $CFLAGS"
|
||||||
|
LIBS="$PCAP_LIBS $LIBS"
|
||||||
|
|
||||||
# Pcap header check
|
# Pcap header check
|
||||||
AC_CHECK_HEADER(pcap.h,,
|
AC_CHECK_HEADER(pcap.h,
|
||||||
AC_MSG_ERROR([[Header file pcap.h not found; if you installed libpcap
|
[
|
||||||
|
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
|
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".
|
||||||
# We have pcap-config; we assume that means we have libpcap
|
# Also check for various additional libraries that libpcap might
|
||||||
# installed and that pcap-config will tell us whatever
|
# require.
|
||||||
# libraries libpcap needs.
|
#
|
||||||
#
|
AC_CHECK_LIB(pcap, pcap_open_live,
|
||||||
if test x$enable_static = xyes; then
|
[
|
||||||
PCAP_LIBS="`\"$PCAP_CONFIG\" --libs --static`"
|
],
|
||||||
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
|
||||||
#
|
AC_MSG_CHECKING([for pcap_open_live in -lpcap with $extras])
|
||||||
# Check to see if we find "pcap_open_live" in "-lpcap".
|
LIBS="-lpcap $extras $ac_save_LIBS"
|
||||||
# Also check for various additional libraries that libpcap might
|
#
|
||||||
# require.
|
# XXX - can't we use AC_CHECK_LIB here?
|
||||||
#
|
#
|
||||||
AC_CHECK_LIB(pcap, pcap_open_live,
|
AC_TRY_LINK(
|
||||||
[
|
[
|
||||||
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(
|
|
||||||
[
|
|
||||||
# include <pcap.h>
|
# include <pcap.h>
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
pcap_open_live(NULL, 0, 0, 0, NULL);
|
pcap_open_live(NULL, 0, 0, 0, NULL);
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
ac_wireshark_extras_found=yes
|
ac_wireshark_extras_found=yes
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
PCAP_LIBS="-lpcap $extras"
|
PCAP_LIBS="$PCAP_LIBS $extras"
|
||||||
AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
|
],
|
||||||
],
|
[
|
||||||
[
|
AC_MSG_RESULT([no])
|
||||||
AC_MSG_RESULT([no])
|
])
|
||||||
])
|
|
||||||
if test x$ac_wireshark_extras_found = xyes
|
if test x$ac_wireshark_extras_found = xyes
|
||||||
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
|
||||||
])
|
])
|
||||||
fi
|
AC_SUBST(PCAP_CFLAGS)
|
||||||
AC_SUBST(PCAP_LIBS)
|
AC_SUBST(PCAP_LIBS)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Check whether various variables and functions are defined by
|
# Check whether various variables and functions are defined by
|
||||||
# libpcap.
|
# libpcap.
|
||||||
#
|
#
|
||||||
ac_save_LIBS="$LIBS"
|
|
||||||
LIBS="$PCAP_LIBS $LIBS"
|
|
||||||
AC_CHECK_FUNCS(pcap_open_dead pcap_freecode)
|
AC_CHECK_FUNCS(pcap_open_dead pcap_freecode)
|
||||||
#
|
#
|
||||||
# pcap_breakloop may be present in the library but not declared
|
# 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)
|
AC_CHECK_FUNCS(bpf_image pcap_set_tstamp_precision pcap_set_tstamp_type)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LIBS="$ac_save_LIBS"
|
AC_WIRESHARK_POP_FLAGS
|
||||||
|
LIBS="$ws_ac_save_LIBS"
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_DEFUN([AC_WIRESHARK_PCAP_REMOTE_CHECK],
|
AC_DEFUN([AC_WIRESHARK_PCAP_REMOTE_CHECK],
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
include $(top_srcdir)/Makefile.am.inc
|
include $(top_srcdir)/Makefile.am.inc
|
||||||
|
|
||||||
AM_CPPFLAGS = $(INCLUDEDIRS) $(WS_CPPFLAGS) $(GLIB_CFLAGS)
|
AM_CPPFLAGS = $(INCLUDEDIRS) $(WS_CPPFLAGS) $(GLIB_CFLAGS) $(PCAP_CFLAGS)
|
||||||
|
|
||||||
noinst_LIBRARIES = libcapchild.a
|
noinst_LIBRARIES = libcapchild.a
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
|
|
||||||
include $(top_srcdir)/Makefile.am.inc
|
include $(top_srcdir)/Makefile.am.inc
|
||||||
|
|
||||||
AM_CPPFLAGS = $(INCLUDEDIRS) $(WS_CPPFLAGS) $(GLIB_CFLAGS) $(LIBNL_CFLAGS)
|
AM_CPPFLAGS = $(INCLUDEDIRS) $(WS_CPPFLAGS) $(GLIB_CFLAGS) $(PCAP_CFLAGS) \
|
||||||
|
$(LIBNL_CFLAGS)
|
||||||
|
|
||||||
noinst_LIBRARIES = libcaputils.a
|
noinst_LIBRARIES = libcaputils.a
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ SUBDIRS = compress crypt ftypes dfilter dissectors wmem $(wslua_dir)
|
||||||
DIST_SUBDIRS = $(SUBDIRS) $(wslua_dist_dir)
|
DIST_SUBDIRS = $(SUBDIRS) $(wslua_dist_dir)
|
||||||
|
|
||||||
AM_CPPFLAGS = $(INCLUDEDIRS) -I$(builddir)/wslua $(WS_CPPFLAGS) \
|
AM_CPPFLAGS = $(INCLUDEDIRS) -I$(builddir)/wslua $(WS_CPPFLAGS) \
|
||||||
$(GLIB_CFLAGS) $(LUA_CFLAGS) $(LIBGNUTLS_CFLAGS) \
|
$(GLIB_CFLAGS) $(PCAP_CFLAGS) $(LUA_CFLAGS) $(LIBGNUTLS_CFLAGS) \
|
||||||
$(LIBGCRYPT_CFLAGS) $(LIBSMI_CFLAGS) $(LIBGEOIP_CFLAGS) \
|
$(LIBGCRYPT_CFLAGS) $(LIBSMI_CFLAGS) $(LIBGEOIP_CFLAGS) \
|
||||||
$(LZ4_CFLAGS) $(KRB5_CFLAGS) $(SNAPPY_CFLAGS) $(LIBXML2_CFLAGS)
|
$(LZ4_CFLAGS) $(KRB5_CFLAGS) $(SNAPPY_CFLAGS) $(LIBXML2_CFLAGS)
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
include ../Makefile.am.inc
|
include ../Makefile.am.inc
|
||||||
|
|
||||||
AM_CPPFLAGS = $(INCLUDEDIRS) $(WS_CPPFLAGS) $(GLIB_CFLAGS)
|
AM_CPPFLAGS = $(INCLUDEDIRS) $(WS_CPPFLAGS) $(GLIB_CFLAGS) $(PCAP_CFLAGS)
|
||||||
|
|
||||||
MAINTAINERCLEANFILES = \
|
MAINTAINERCLEANFILES = \
|
||||||
Makefile.in
|
Makefile.in
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
include $(top_srcdir)/Makefile.am.inc
|
include $(top_srcdir)/Makefile.am.inc
|
||||||
|
|
||||||
AM_CPPFLAGS = $(INCLUDEDIRS) $(WS_CPPFLAGS) -DDOC_DIR=\"$(docdir)\" \
|
AM_CPPFLAGS = $(INCLUDEDIRS) $(WS_CPPFLAGS) -DDOC_DIR=\"$(docdir)\" \
|
||||||
$(GLIB_CFLAGS) $(LIBGCRYPT_CFLAGS) $(LIBGNUTLS_CFLAGS) $(PORTAUDIO_INCLUDES)
|
$(GLIB_CFLAGS) $(PCAP_CFLAGS) $(LIBGCRYPT_CFLAGS) $(LIBGNUTLS_CFLAGS) $(PORTAUDIO_INCLUDES)
|
||||||
|
|
||||||
noinst_LIBRARIES = libui.a libui_dirty.a
|
noinst_LIBRARIES = libui.a libui_dirty.a
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
|
|
||||||
include $(top_srcdir)/Makefile.am.inc
|
include $(top_srcdir)/Makefile.am.inc
|
||||||
|
|
||||||
AM_CPPFLAGS = $(INCLUDEDIRS) $(WS_CPPFLAGS) -DWS_BUILD_DLL $(GLIB_CFLAGS)
|
AM_CPPFLAGS = $(INCLUDEDIRS) $(WS_CPPFLAGS) -DWS_BUILD_DLL $(GLIB_CFLAGS) \
|
||||||
|
$(PCAP_CFLAGS)
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libwiretap_generated.la
|
noinst_LTLIBRARIES = libwiretap_generated.la
|
||||||
lib_LTLIBRARIES = libwiretap.la
|
lib_LTLIBRARIES = libwiretap.la
|
||||||
|
|
|
@ -26,7 +26,9 @@ AM_CPPFLAGS = $(INCLUDEDIRS) $(WS_CPPFLAGS) -DWS_BUILD_DLL \
|
||||||
-DEXTCAP_DIR=\"$(extcapdir)\" \
|
-DEXTCAP_DIR=\"$(extcapdir)\" \
|
||||||
-DPLUGIN_DIR=\"$(pkglibdir)/plugins\" \
|
-DPLUGIN_DIR=\"$(pkglibdir)/plugins\" \
|
||||||
-DJSMN_STRICT \
|
-DJSMN_STRICT \
|
||||||
$(GLIB_CFLAGS) $(LIBGCRYPT_CFLAGS) \
|
$(GLIB_CFLAGS) \
|
||||||
|
$(PCAP_CFLAGS) \
|
||||||
|
$(LIBGCRYPT_CFLAGS) \
|
||||||
$(LIBGNUTLS_CFLAGS)
|
$(LIBGNUTLS_CFLAGS)
|
||||||
|
|
||||||
# Optional headers for ABI checking
|
# Optional headers for ABI checking
|
||||||
|
|
Loading…
Reference in New Issue