@@ -17,18 +17,29 @@ AS_VAR_APPEND([DPDK_PMDS], [--no-whole-archive])
# _ODP_DPDK_SET_LIBS
# --------------------
-# Set DPDK_LIBS/DPDK_LIBS_LT depending on DPDK setup
+# Set DPDK_LIBS/DPDK_LIBS_LT/DPDK_LIBS_LIBODP depending on DPDK setup
AC_DEFUN([_ODP_DPDK_SET_LIBS], [dnl
AS_IF([test "x$DPDK_SHARED" = "xyes"], [dnl
- DPDK_LIBS_LT=""
+ # applications don't need to be linked to anything, just rpath
+ DPDK_LIBS_LT="$DPDK_RPATH_LT"
+ # static linking flags will need -ldpdk
+ DPDK_LIBS="-Wl,--no-as-needed,-ldpdk,--as-needed,`echo $DPDK_LIBS | sed -e 's/ /,/g'`"
DPDK_LIBS="$DPDK_LDFLAGS $DPDK_RPATH $DPDK_LIBS"
+ # link libodp-linux with -ldpdk
+ DPDK_LIBS_LIBODP="$DPDK_LIBS"
], [dnl
ODP_DPDK_PMDS([$DPDK_PMD_PATH])
+ # build long list of libraries for applications, which should not be
+ # rearranged by libtool
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"
+ # static linking flags follow the suite
DPDK_LIBS="$DPDK_LDFLAGS $DPDK_PMDS $DPDK_LIBS"
+ # link libodp-linux with libtool linking flags
+ DPDK_LIBS_LIBODP="$DPDK_LIBS_LT"
])
AC_SUBST([DPDK_LIBS])
+AC_SUBST([DPDK_LIBS_LIBODP])
AC_SUBST([DPDK_LIBS_LT])
])
@@ -99,7 +110,6 @@ 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`"
@@ -115,10 +125,9 @@ AS_IF([test "x$1" = "xsystem"], [dnl
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_RPATH="-Wl,-rpath,$DPDK_LIB_PATH"
+ DPDK_RPATH_LT="-R$DPDK_LIB_PATH"
DPDK_SHARED=yes
- else
- DPDK_RPATH=
fi
])
_ODP_DPDK_CHECK([$DPDK_CPPFLAGS], [$DPDK_LDFLAGS], [$2], [$3])
@@ -272,7 +272,7 @@ endif
__LIB__libodp_linux_la_LIBADD = $(ATOMIC_LIBS)
__LIB__libodp_linux_la_LIBADD += $(OPENSSL_LIBS)
-__LIB__libodp_linux_la_LIBADD += $(DPDK_LIBS_LT)
+__LIB__libodp_linux_la_LIBADD += $(DPDK_LIBS_LIBODP)
__LIB__libodp_linux_la_LIBADD += $(PTHREAD_LIBS)
__LIB__libodp_linux_la_LIBADD += $(TIMER_LIBS)