1configure.in: use pkg-config for libpcap detection 2 3The detection of libpcap was based in ${prefix}, which doesn't make 4sense in a cross-compilation context and can cause host leakage into 5the target build. 6 7So instead, let's use pkg-config to detect libpcap, since it is anyway 8already use in this configure.in to detect libglib. 9 10Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> 11 12Index: b/configure.in 13=================================================================== 14--- a/configure.in 15+++ b/configure.in 16@@ -75,25 +75,13 @@ 17 fi 18 ;; 19 esac ], 20-[ if test -f ${prefix}/include/pcap.h; then 21- PCAP_CFLAGS="-I${prefix}/include" 22- PCAPLIB="-L${exec_prefix}/lib -lpcap" 23- elif test -f /usr/include/pcap/pcap.h; then 24- PCAP_CFLAGS="-I/usr/include/pcap" 25- PCAPLIB="-lpcap" 26- else 27- TMP=$LIBS 28- LIBS="-lpcap $LIBS" 29- AC_TRY_LINK([#include <pcap.h>], pcap_open_offline("",""), 30- LIBPCAP_FOUND=1,LIBPCAP_FOUND=0) 31- LIBS=$TMP 32- if test $LIBPCAP_FOUND = 1 ; then 33- PCAPLIB="-lpcap" 34- else 35- AC_ERROR(libpcap not found) 36- fi 37- fi 38- AC_MSG_RESULT(yes) ] 39+[ 40+ PKG_PROG_PKG_CONFIG 41+ PKG_CHECK_MODULES(LIBPCAP, libpcap) 42+ AC_MSG_RESULT(yes) 43+ PCAP_CFLAGS=${LIBPCAP_CFLAGS} 44+ PCAPLIB=${LIBPCAP_LIBS} 45+] 46 ) 47 AC_SUBST(PCAP_CFLAGS) 48 AC_SUBST(PCAPLIB) 49