diff mbox series

[v1,6/8] linux-gen: dpdk: simplify linking with shared libdpdk

Message ID 1514685607-28718-7-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [v1,1/8] helper: link against libpthread and libodp-linux | expand

Commit Message

Github ODP bot Dec. 31, 2017, 2 a.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


There is no need to pass PMDs when linking with shared DPDK library.
Just pass -ldpdk which will pick up all PMDS dynamically.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 377 (lumag:misc-fixes)
 ** https://github.com/Linaro/odp/pull/377
 ** Patch: https://github.com/Linaro/odp/pull/377.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 0de89276a60782272cef8b93fc3dcb647cfc52fb
 **/
 platform/linux-generic/m4/odp_dpdk.m4 | 37 ++++++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/m4/odp_dpdk.m4 b/platform/linux-generic/m4/odp_dpdk.m4
index 471bbcd51..2b31c58ab 100644
--- a/platform/linux-generic/m4/odp_dpdk.m4
+++ b/platform/linux-generic/m4/odp_dpdk.m4
@@ -13,16 +13,29 @@  AC_ARG_WITH([dpdk-path],
     [DPDK_PATH="$withval"
      pktio_dpdk_support=yes],[])
 
-AS_IF([test "x$DPDK_PATH" = "xsystem"],
-      [DPDK_CPPFLAGS="-isystem/usr/include/dpdk"
-       DPDK_LDFLAGS=""
-       DPDK_PMD_PATH="`$CC --print-file-name=librte_pmd_null.a`"
-       DPDK_PMD_PATH="`dirname "$DPDK_PMD_PATH"`"
-       AS_IF([test "x$DPDK_PMD_PATH" = "x"],
-	     [AC_MSG_FAILURE([Could not locate system DPDK PMD directory])])],
-      [DPDK_CPPFLAGS="-isystem $DPDK_PATH/include"
-       DPDK_LDFLAGS="-L$DPDK_PATH/lib"
-       DPDK_PMD_PATH="$DPDK_PATH/lib"])
+if test "x$DPDK_PATH" = "xsystem"; then
+    DPDK_CPPFLAGS="-isystem/usr/include/dpdk"
+    DPDK_LDFLAGS=""
+    DPDK_RPATH=""
+    DPDK_LIB_PATH="`$CC --print-file-name=libdpdk.so`"
+    if test "x$DPDK_LIB_PATH" = "x" ; then
+	DPDK_LIB_PATH="`$CC --print-file-name=libdpdk.a`"
+    else
+	DPDK_SHARED=yes
+    fi
+    AS_IF([test "x$DPDK_LIB_PATH" = "x"],
+	  [AC_MSG_FAILURE([Could not locate system DPDK library directory])])
+    DPDK_PMD_PATH=`AS_DIRNAME(["$DPDK_PMD_PATH"])`
+else
+    DPDK_CPPFLAGS="-isystem $DPDK_PATH/include"
+    DPDK_LIB_PATH="$DPDK_PATH/lib"
+    DPDK_LDFLAGS="-L$DPDK_LIB_PATH"
+    DPDK_RPATH="-R$DPDK_LIB_PATH"
+    DPDK_PMD_PATH="$DPDK_LIB_PATH"
+    if test -r "$DPDK_LIB_PATH"/libdpdk.so ; then
+	DPDK_SHARED=yes
+    fi
+fi
 
 ##########################################################################
 # Enable zero-copy DPDK pktio
@@ -45,7 +58,9 @@  then
     ODP_DPDK_CHECK([$DPDK_CPPFLAGS], [$DPDK_LDFLAGS], [],
                    [AC_MSG_FAILURE([can't find DPDK])])
 
-    ODP_DPDK_PMDS([$DPDK_PMD_PATH])
+    if test x$DPDK_SHARED != xyes ; then
+	ODP_DPDK_PMDS([$DPDK_PMD_PATH])
+    fi
 
     AC_DEFINE([ODP_PKTIO_DPDK], [1],
 	      [Define to 1 to enable DPDK packet I/O support])