Skip to content

Commit c1223b1

Browse files
ddiproiettoblp
authored andcommitted
acinclude.m4: dpdk: link with -ldl if necessary
On some systems libintel_dpdk.a fails to link with libopenvswitch unless -ldl is used. This should address the issue Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
1 parent 3a20810 commit c1223b1

1 file changed

Lines changed: 27 additions & 3 deletions

File tree

acinclude.m4

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,34 @@ AC_DEFUN([OVS_CHECK_DPDK], [
170170
171171
DPDK_INCLUDE=$RTE_SDK/include
172172
DPDK_LIB_DIR=$RTE_SDK/lib
173-
DPDK_LIBS="$DPDK_LIB_DIR/libintel_dpdk.a"
174173
175-
LIBS="$DPDK_LIBS $LIBS"
176-
CPPFLAGS="-I$DPDK_INCLUDE $CPPFLAGS"
174+
LDFLAGS="$LDFLAGS -L$DPDK_LIB_DIR"
175+
CFLAGS="$CFLAGS -I$DPDK_INCLUDE"
176+
177+
# On some systems we have to add -ldl to link with dpdk
178+
#
179+
# This code, at first, tries to link without -ldl (""),
180+
# then adds it and tries again.
181+
# Before each attempt the search cache must be unset,
182+
# otherwise autoconf will stick with the old result
183+
184+
found=false
185+
save_LIBS=$LIBS
186+
for extras in "" "-ldl"; do
187+
LIBS="-lintel_dpdk $extras $save_LIBS"
188+
AC_LINK_IFELSE(
189+
[AC_LANG_PROGRAM([#include <rte_config.h>
190+
#include <rte_eal.h>],
191+
[int rte_argc; char ** rte_argv;
192+
rte_eal_init(rte_argc, rte_argv);])],
193+
[found=true])
194+
if $found; then
195+
break
196+
fi
197+
done
198+
if $found; then :; else
199+
AC_MSG_ERROR([cannot link with dpdk])
200+
fi
177201
178202
AC_DEFINE([DPDK_NETDEV], [1], [System uses the DPDK module.])
179203
else

0 commit comments

Comments
 (0)