|
@@ -0,0 +1,48 @@
|
|
|
|
+configure.in: use pkg-config for libpcap detection
|
|
|
|
+
|
|
|
|
+The detection of libpcap was based in ${prefix}, which doesn't make
|
|
|
|
+sense in a cross-compilation context and can cause host leakage into
|
|
|
|
+the target build.
|
|
|
|
+
|
|
|
|
+So instead, let's use pkg-config to detect libpcap, since it is anyway
|
|
|
|
+already use in this configure.in to detect libglib.
|
|
|
|
+
|
|
|
|
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
|
|
|
+
|
|
|
|
+Index: b/configure.in
|
|
|
|
+===================================================================
|
|
|
|
+--- a/configure.in
|
|
|
|
++++ b/configure.in
|
|
|
|
+@@ -75,25 +75,13 @@
|
|
|
|
+ fi
|
|
|
|
+ ;;
|
|
|
|
+ esac ],
|
|
|
|
+-[ if test -f ${prefix}/include/pcap.h; then
|
|
|
|
+- PCAP_CFLAGS="-I${prefix}/include"
|
|
|
|
+- PCAPLIB="-L${exec_prefix}/lib -lpcap"
|
|
|
|
+- elif test -f /usr/include/pcap/pcap.h; then
|
|
|
|
+- PCAP_CFLAGS="-I/usr/include/pcap"
|
|
|
|
+- PCAPLIB="-lpcap"
|
|
|
|
+- else
|
|
|
|
+- TMP=$LIBS
|
|
|
|
+- LIBS="-lpcap $LIBS"
|
|
|
|
+- AC_TRY_LINK([#include <pcap.h>], pcap_open_offline("",""),
|
|
|
|
+- LIBPCAP_FOUND=1,LIBPCAP_FOUND=0)
|
|
|
|
+- LIBS=$TMP
|
|
|
|
+- if test $LIBPCAP_FOUND = 1 ; then
|
|
|
|
+- PCAPLIB="-lpcap"
|
|
|
|
+- else
|
|
|
|
+- AC_ERROR(libpcap not found)
|
|
|
|
+- fi
|
|
|
|
+- fi
|
|
|
|
+- AC_MSG_RESULT(yes) ]
|
|
|
|
++[
|
|
|
|
++ PKG_PROG_PKG_CONFIG
|
|
|
|
++ PKG_CHECK_MODULES(LIBPCAP, libpcap)
|
|
|
|
++ AC_MSG_RESULT(yes)
|
|
|
|
++ PCAP_CFLAGS=${LIBPCAP_CFLAGS}
|
|
|
|
++ PCAPLIB=${LIBPCAP_LIBS}
|
|
|
|
++]
|
|
|
|
+ )
|
|
|
|
+ AC_SUBST(PCAP_CFLAGS)
|
|
|
|
+ AC_SUBST(PCAPLIB)
|