aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2022-03-24 15:47:56 -0700
committerGuy Harris <gharris@sonic.net>2022-03-24 16:12:24 -0700
commitf945b9350f05846479f74d75de5c70a01d92ccb6 (patch)
tree3bc3f3c56be674beaaf2c2d280b6545def2fef53
parentb4eb8c47f67ae65f31a03628333bcf35c81616ab (diff)
downloadlibpcap-f945b9350f05846479f74d75de5c70a01d92ccb6.tar.gz
Allow the path in which DPDK is installed to be specified.
For autotools, if --with-dpdk={path} was specified, prepend {PATH}/pkgconfig to PKG_CONFIG_PATH before running pkg-config, and restore PKG_CONFIG_PATH afterwards. For CMake, if dpdk_ROOT is defined, prepend ${dpdk_ROOT}/pkgconfig to PKG_CONFIG_PATH before running pkg-config, and restore PKG_CONFIG_PATH afterwards. Fix some typoes in comments while we're at it. (cherry picked from commit 0a51499d12afc9f54d1d0690881873766bf9db02)
-rw-r--r--CMakeLists.txt1
-rw-r--r--cmake/Modules/Finddpdk.cmake13
-rwxr-xr-xconfigure11
-rw-r--r--configure.ac11
4 files changed, 32 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index da19e22a..6c5f08dc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -185,6 +185,7 @@ if(WIN32)
option(USE_STATIC_RT "Use static Runtime" ON)
endif(WIN32)
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
+set(dpdk_ROOT "" CACHE PATH "Path to directory with include and lib subdirectories for DPDK")
if(WIN32)
set(Packet_ROOT "" CACHE PATH "Path to directory with include and lib subdirectories for packet.dll")
set(AirPcap_ROOT "" CACHE PATH "Path to directory with include and lib subdirectories for airpcap.dll")
diff --git a/cmake/Modules/Finddpdk.cmake b/cmake/Modules/Finddpdk.cmake
index 9eb8d1f6..d245fa0e 100644
--- a/cmake/Modules/Finddpdk.cmake
+++ b/cmake/Modules/Finddpdk.cmake
@@ -10,11 +10,11 @@
# We only try to find DPDK using pkg-config; DPDK is *SO*
# complicated - DPDK 19.02, for example, has about 117(!)
# libraries, and the precise set of libraries required has
-# changed ver time - so attempting to guess which libraries
+# changed over time - so attempting to guess which libraries
# you need, and hardcoding that in an attempt to find the
# libraries without DPDK, rather than relying on DPDK to
# tell you, with a .pc file, what libraries are needed,
-# is *EXTREELY* fragile and has caused some bug reports,
+# is *EXTREMELY* fragile and has caused some bug reports,
# so we're just not going to do it.
#
# If that causes a problem, the only thing we will do is
@@ -24,8 +24,17 @@
# as pkg-config with *ALL* versions of DPDK that provide a
# libdpdk.pc file).
#
+# If dpdk_ROOT is set, add ${dpdk_ROOT}/pkgconfig
+# to PKG_CONFIG_PATH, so we look for the .pc file there,
+# first.
+#
if(PKG_CONFIG_FOUND)
+ set(save_PKG_CONFIG_PATH $ENV{PKG_CONFIG_PATH})
+ if(dpdk_ROOT)
+ set(ENV{PKG_CONFIG_PATH} "${dpdk_ROOT}/pkgconfig:$ENV{PKG_CONFIG_PATH}")
+ endif()
pkg_check_modules(dpdk QUIET libdpdk)
+ set(ENV{PKG_CONFIG_PATH} "${save_PKG_CONFIG_PATH}")
endif()
mark_as_advanced(dpdk_INCLUDE_DIRS ${dpdk_LIBRARIES})
diff --git a/configure b/configure
index 2dc3ab9c..13256df7 100755
--- a/configure
+++ b/configure
@@ -11940,7 +11940,7 @@ if test "$want_dpdk" != no; then
# you need, and hardcoding that in an attempt to find the
# libraries without DPDK, rather than relying on DPDK to
# tell you, with a .pc file, what libraries are needed,
- # is *EXTREELY* fragile and has caused some bug reports,
+ # is *EXTREMELY* fragile and has caused some bug reports,
# so we're just not going to do it.
#
# If that causes a problem, the only thing we will do is
@@ -11950,6 +11950,14 @@ if test "$want_dpdk" != no; then
# as pkg-config with *ALL* versions of DPDK that provide a
# libdpdk.pc file).
#
+ # If --with-dpdk={path} was specified, add {path}/pkgconfig
+ # to PKG_CONFIG_PATH, so we look for the .pc file there,
+ # first.
+ #
+ save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
+ if test -n "$dpdk_dir"; then
+ PKG_CONFIG_PATH="$dpdk_dir:$PKG_CONFIG_PATH"
+ fi
pkg_failed=no
@@ -12065,6 +12073,7 @@ $as_echo "not found" >&6; }
fi
+ PKG_CONFIG_PATH="$save_PKG_CONFIG_PATH"
#
# Did we find DPDK?
diff --git a/configure.ac b/configure.ac
index 8daf6e65..f394a3cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2534,7 +2534,7 @@ if test "$want_dpdk" != no; then
# you need, and hardcoding that in an attempt to find the
# libraries without DPDK, rather than relying on DPDK to
# tell you, with a .pc file, what libraries are needed,
- # is *EXTREELY* fragile and has caused some bug reports,
+ # is *EXTREMELY* fragile and has caused some bug reports,
# so we're just not going to do it.
#
# If that causes a problem, the only thing we will do is
@@ -2544,10 +2544,19 @@ if test "$want_dpdk" != no; then
# as pkg-config with *ALL* versions of DPDK that provide a
# libdpdk.pc file).
#
+ # If --with-dpdk={path} was specified, add {path}/pkgconfig
+ # to PKG_CONFIG_PATH, so we look for the .pc file there,
+ # first.
+ #
+ save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
+ if test -n "$dpdk_dir"; then
+ PKG_CONFIG_PATH="$dpdk_dir:$PKG_CONFIG_PATH"
+ fi
PKG_CHECK_MODULES(DPDK, libdpdk,
[
found_dpdk=yes
])
+ PKG_CONFIG_PATH="$save_PKG_CONFIG_PATH"
#
# Did we find DPDK?