0001-Detect-libpcap-dependencies-using-pkg-config.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. From 194ec61843b9598ce90873c812b817c4b96e2e0d Mon Sep 17 00:00:00 2001
  2. From: Baruch Siach <baruch@tkos.co.il>
  3. Date: Thu, 2 Sep 2021 12:56:00 +0300
  4. Subject: [PATCH] Detect libpcap dependencies using pkg-config
  5. When building statically the link command line must include all
  6. dependencies of all libraries. libpcap can optionally depend on libnl.
  7. mausezahn can't build statically in this case.
  8. Use pkg-config in configure and in the link command to construct the
  9. library flags we need to link with libpcap.
  10. Signed-off-by: Baruch Siach <baruch@tkos.co.il>
  11. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
  12. ---
  13. Upstream status: commit 194ec61843b9598ce90873c812b817c4b96e2e0d
  14. configure | 4 +++-
  15. mausezahn/Makefile | 2 +-
  16. 2 files changed, 4 insertions(+), 2 deletions(-)
  17. diff --git a/configure b/configure
  18. index 510826a798f5..598ae2433a7a 100755
  19. --- a/configure
  20. +++ b/configure
  21. @@ -588,7 +588,9 @@ int main(void)
  22. }
  23. EOF
  24. - $CC -o $TMPDIR/pcaptest $TMPDIR/pcaptest.c -lpcap >> config.log 2>&1
  25. + $CC -o $TMPDIR/pcaptest $TMPDIR/pcaptest.c \
  26. + $($PKG_CONFIG --libs libpcap 2>> config.log) \
  27. + >> config.log 2>&1
  28. if [ ! -x $TMPDIR/pcaptest ] ; then
  29. echo "[NO]"
  30. echo "CONFIG_LIBPCAP=0" >> Config
  31. diff --git a/mausezahn/Makefile b/mausezahn/Makefile
  32. index ca16b6579583..9544565355cc 100644
  33. --- a/mausezahn/Makefile
  34. +++ b/mausezahn/Makefile
  35. @@ -1,6 +1,6 @@
  36. mausezahn-libs = -lcli \
  37. -lnet \
  38. - -lpcap \
  39. + $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --libs libpcap 2> /dev/null ) \
  40. -lrt \
  41. -lpthread \
  42. -lm
  43. --
  44. 2.33.0