2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 18:07:40 +00:00

acinclude: Use AC_SEARCH_LIBS for linking with dl.

DPDK uses dlopen to load plugins and we need to search for
library containing this function. But we should not do this
in a loop because 'AC_SEARCH_LIBS' could do this for us.
Also, 'AC_SEARCH_LIBS' prints user-visible messages that are
useful for debuging.
Also added the new 'checking' message and code normalized to
be more readable.

With this change we'll have following additional messages:

  checking for library containing dlopen... -ldl
  checking whether linking with dpdk works... yes

Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Ilya Maximets 2019-04-11 10:29:43 +03:00 committed by Ben Pfaff
parent f0d1ead8b1
commit e2f3751186

View File

@ -301,36 +301,28 @@ AC_DEFUN([OVS_CHECK_DPDK], [
], [[#include <rte_config.h>]]) ], [[#include <rte_config.h>]])
], [], [[#include <rte_config.h>]]) ], [], [[#include <rte_config.h>]])
# On some systems we have to add -ldl to link with dpdk # DPDK uses dlopen to load plugins.
# OVS_FIND_DEPENDENCY([dlopen], [dl], [libdl])
# This code, at first, tries to link without -ldl (""),
# then adds it and tries again.
# Before each attempt the search cache must be unset,
# otherwise autoconf will stick with the old result
DPDKLIB_FOUND=false AC_MSG_CHECKING([whether linking with dpdk works])
save_LIBS=$LIBS LIBS="$DPDK_LIB $LIBS"
for extras in "" "-ldl"; do
LIBS="$DPDK_LIB $extras $save_LIBS"
AC_LINK_IFELSE( AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <rte_config.h> [AC_LANG_PROGRAM([#include <rte_config.h>
#include <rte_eal.h>], #include <rte_eal.h>],
[int rte_argc; char ** rte_argv; [int rte_argc; char ** rte_argv;
rte_eal_init(rte_argc, rte_argv);])], rte_eal_init(rte_argc, rte_argv);])],
[DPDKLIB_FOUND=true]) [AC_MSG_RESULT([yes])
if $DPDKLIB_FOUND; then DPDKLIB_FOUND=true],
break [AC_MSG_RESULT([no])
fi if test "$DPDK_AUTO_DISCOVER" = "true"; then
done AC_MSG_ERROR(m4_normalize([
Could not find DPDK library in default search path, Use --with-dpdk
# If linking unsuccessful to specify the DPDK library installed in non-standard location]))
if test "$DPDKLIB_FOUND" = "false" ; then
if $DPDK_AUTO_DISCOVER; then
AC_MSG_ERROR([Could not find DPDK library in default search path, Use --with-dpdk to specify the DPDK library installed in non-standard location])
else else
AC_MSG_ERROR([Could not find DPDK libraries in $DPDK_LIB_DIR]) AC_MSG_ERROR([Could not find DPDK libraries in $DPDK_LIB_DIR])
fi fi
fi ])
CFLAGS="$ovs_save_CFLAGS" CFLAGS="$ovs_save_CFLAGS"
LDFLAGS="$ovs_save_LDFLAGS" LDFLAGS="$ovs_save_LDFLAGS"
if test "$DPDK_AUTO_DISCOVER" = "false"; then if test "$DPDK_AUTO_DISCOVER" = "false"; then