@@ -1,7 +1,7 @@
TESTS_ENVIRONMENT = EXEEXT=${EXEEXT}
LIB = $(top_builddir)/lib
-LDADD = $(LIB)/libodp-linux.la $(LIB)/libodphelper.la $(DPDK_PMDS)
+LDADD = $(LIB)/libodp-linux.la $(LIB)/libodphelper.la $(DPDK_LIBS_LT)
AM_CFLAGS = \
-I$(srcdir) \
-I$(top_srcdir)/example \
@@ -1,22 +1,38 @@
# ODP_DPDK_PMDS(DPDK_DRIVER_PATH)
# -------------------------------
-# Build a list of DPDK PMD drivers in DPDK_PMDS variable
+# Build a list of DPDK PMD drivers in DPDK_PMDS variable.
+# Updated DPDK_LIBS to include dependencies.
AC_DEFUN([ODP_DPDK_PMDS], [dnl
-AS_VAR_SET([DPDK_PMDS], [-Wl,--whole-archive,])
+AS_VAR_SET([DPDK_PMDS], ["-Wl,--whole-archive,"])
for filename in "$1"/librte_pmd_*.a; do
cur_driver=`basename "$filename" .a | sed -e 's/^lib//'`
-# rte_pmd_nfp has external dependencies which break linking
-if test "$cur_driver" = "rte_pmd_nfp"; then
- echo "skip linking rte_pmd_nfp"
-else
- AS_VAR_APPEND([DPDK_PMDS], [-l$cur_driver,])
-fi
+AS_VAR_APPEND([DPDK_PMDS], [-l$cur_driver,])
+AS_CASE([$cur_driver],
+ [rte_pmd_nfp], [AS_VAR_APPEND([DPDK_LIBS], [" -lm"])],
+ [rte_pmd_pcap], [AS_VAR_APPEND([DPDK_LIBS], [" -lpcap"])],
+ [rte_pmd_openssl], [AS_VAR_APPEND([DPDK_LIBS], [" -lcrypto"])])
done
AS_VAR_APPEND([DPDK_PMDS], [--no-whole-archive])
-AC_SUBST([DPDK_PMDS])
])
-# _ODP_DPDK_CHECK_LIB(LDFLAGS, [LIBS], [EXTRA_LIBS])
+# _ODP_DPDK_SET_LIBS
+# --------------------
+# Set DPDK_LIBS/DPDK_LIBS_LT depending on DPDK setup
+AC_DEFUN([_ODP_DPDK_SET_LIBS], [dnl
+AS_IF([test "x$DPDK_SHARED" = "xyes"], [dnl
+ DPDK_LIBS_LT=""
+ DPDK_LIBS="$DPDK_LDFLAGS $DPDK_RPATH $DPDK_LIBS"
+], [dnl
+ ODP_DPDK_PMDS([$DPDK_PMD_PATH])
+ DPDK_LIBS_LT="`echo $DPDK_LIBS | sed -e 's/^/-Wc,/' -e 's/ /,/g'`"
+ DPDK_LIBS_LT="$DPDK_LDFLAGS $DPDK_PMDS $DPDK_LIBS_LT $DPDK_LIBS"
+ DPDK_LIBS="$DPDK_LDFLAGS $DPDK_PMDS $DPDK_LIBS"
+])
+AC_SUBST([DPDK_LIBS])
+AC_SUBST([DPDK_LIBS_LT])
+])
+
+# _ODP_DPDK_CHECK_LIB(LDFLAGS, [LIBS])
# ----------------------------------
# Check if one can use -ldpdk with provided set of libs
AC_DEFUN([_ODP_DPDK_CHECK_LIB], [dnl
@@ -31,7 +47,7 @@ LIBS="$LIBS -ldpdk $2"
AC_MSG_CHECKING([for rte_eal_init in -ldpdk $2])
AC_LINK_IFELSE([AC_LANG_CALL([], [rte_eal_init])],
[AC_MSG_RESULT([yes])
- DPDK_LIBS="$1 -ldpdk $3 $2"],
+ DPDK_LIBS="-ldpdk $2"],
[AC_MSG_RESULT([no])])
##########################################################################
@@ -41,10 +57,10 @@ LDFLAGS=$OLD_LDFLAGS
LIBS=$OLD_LIBS
])
-# ODP_DPDK_CHECK(CPPFLAGS, LDFLAGS, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
-# -----------------------------------------------------------------------
+# _ODP_DPDK_CHECK(CPPFLAGS, LDFLAGS, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
+# ------------------------------------------------------------------------
# Check for DPDK availability
-AC_DEFUN([ODP_DPDK_CHECK], [dnl
+AC_DEFUN([_ODP_DPDK_CHECK], [dnl
##########################################################################
# Save and set temporary compilation flags
##########################################################################
@@ -59,13 +75,14 @@ AC_CHECK_HEADERS([rte_config.h], [],
DPDK_LIBS=""
_ODP_DPDK_CHECK_LIB([$2])
AS_IF([test "x$DPDK_LIBS" = "x"],
- [_ODP_DPDK_CHECK_LIB([$2], [-ldl -lpthread], [-lm])])
+ [_ODP_DPDK_CHECK_LIB([$2], [-ldl -lpthread])])
AS_IF([test "x$DPDK_LIBS" = "x"],
- [_ODP_DPDK_CHECK_LIB([$2], [-ldl -lpthread -lnuma], [-lm])])
+ [_ODP_DPDK_CHECK_LIB([$2], [-ldl -lpthread -lnuma])])
AS_IF([test "x$DPDK_LIBS" = "x"],
[dpdk_check_ok=no])
AS_IF([test "x$dpdk_check_ok" != "xno"],
- [AC_SUBST([DPDK_LIBS])
+ [_ODP_DPDK_SET_LIBS
+ AC_SUBST([DPDK_CPPFLAGS])
m4_default([$3], [:])],
[m4_default([$4], [:])])
@@ -74,3 +91,35 @@ AS_IF([test "x$dpdk_check_ok" != "xno"],
##########################################################################
CPPFLAGS=$OLD_CPPFLAGS
])
+
+# ODP_DPDK(DPDK_PATH, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# -----------------------------------------------------------------------
+# Check for DPDK availability
+AC_DEFUN([ODP_DPDK], [dnl
+AS_IF([test "x$1" = "xsystem"], [dnl
+ 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"])`
+], [dnl
+ DPDK_CPPFLAGS="-isystem $1/include"
+ DPDK_LIB_PATH="$1/lib"
+ DPDK_LDFLAGS="-L$DPDK_LIB_PATH"
+ DPDK_PMD_PATH="$DPDK_LIB_PATH"
+ if test -r "$DPDK_LIB_PATH"/libdpdk.so ; then
+ DPDK_RPATH="-R$DPDK_LIB_PATH"
+ DPDK_SHARED=yes
+ else
+ DPDK_RPATH=
+ fi
+])
+_ODP_DPDK_CHECK([$DPDK_CPPFLAGS], [$DPDK_LDFLAGS], [$2], [$3])
+])
@@ -305,7 +305,7 @@ endif
__LIB__libodp_linux_la_LIBADD = $(ATOMIC_LIBS)
__LIB__libodp_linux_la_LIBADD += $(OPENSSL_LIBS)
-__LIB__libodp_linux_la_LIBADD += $(DPDK_LIBS) $(DPDK_PMDS)
+__LIB__libodp_linux_la_LIBADD += $(DPDK_LIBS_LT)
__LIB__libodp_linux_la_LIBADD += $(PTHREAD_LIBS)
__LIB__libodp_linux_la_LIBADD += $(TIMER_LIBS)
@@ -7,5 +7,5 @@ Name: libodp-linux
Description: The ODP packet processing engine
Version: @PKGCONFIG_VERSION@
Libs: -L${libdir} -lodp-linux
-Libs.private: @OPENSSL_STATIC_LIBS@ @DPDK_PMDS@ @DPDK_LIBS@ @PCAP_LIBS@ @PTHREAD_LIBS@ @TIMER_LIBS@ -lpthread @ATOMIC_LIBS@
+Libs.private: @OPENSSL_STATIC_LIBS@ @DPDK_LIBS@ @PCAP_LIBS@ @PTHREAD_LIBS@ @TIMER_LIBS@ -lpthread @ATOMIC_LIBS@
Cflags: -I${includedir}
@@ -13,17 +13,6 @@ 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"])
-
##########################################################################
# Enable zero-copy DPDK pktio
##########################################################################
@@ -42,22 +31,13 @@ AC_ARG_ENABLE([dpdk-zero-copy],
##########################################################################
if test x$pktio_dpdk_support = xyes
then
- ODP_DPDK_CHECK([$DPDK_CPPFLAGS], [$DPDK_LDFLAGS], [],
- [AC_MSG_FAILURE([can't find DPDK])])
-
- ODP_DPDK_PMDS([$DPDK_PMD_PATH])
+ ODP_DPDK([$DPDK_PATH], [],
+ [AC_MSG_FAILURE([can't find DPDK])])
AC_DEFINE([ODP_PKTIO_DPDK], [1],
[Define to 1 to enable DPDK packet I/O support])
AC_DEFINE_UNQUOTED([ODP_DPDK_ZERO_COPY], [$zero_copy],
[Define to 1 to enable DPDK zero copy support])
-
- if test -r "$DPDK_PMD_PATH/librte_pmd_pcap.a" &&
- ! test -r "$DPDK_PMD_PATH/librte_pmd_pcap.so" ; then
- DPDK_LIBS="$DPDK_LIBS -lpcap"
- fi
- AC_SUBST([DPDK_CPPFLAGS])
- AC_SUBST([DPDK_LIBS])
else
pktio_dpdk_support=no
fi
@@ -11,7 +11,7 @@ LIBTHRMASK_COMMON = $(COMMON_DIR)/libthrmask_common.la
#in the following line, the libs using the symbols should come before
#the libs containing them! The includer is given a chance to add things
#before libodp by setting PRELDADD before the inclusion.
-LDADD = $(PRELDADD) $(LIBODP) $(DPDK_PMDS)
+LDADD = $(PRELDADD) $(LIBODP) $(DPDK_LIBS_LT)
PRELDADD =
INCFLAGS = \