0001-libpcap-use-pkg-config.patch 1.3 KB

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