do not use -ldpdk for configure check
authorLuca Boccassi <bluca@debian.org>
Sat, 6 Apr 2019 12:21:09 +0000 (13:21 +0100)
committerChris Hofstaedtler <zeha@debian.org>
Sat, 6 Apr 2019 12:21:09 +0000 (13:21 +0100)
Origin: https://github.com/collectd/collectd/commit/b29454cdf22a197924d35bb2da0840df9cbd65f6
Forwarded: https://github.com/collectd/collectd/pull/3015

The AC_CHECK_LIB test runs unconditionally, and fails with DPDK 18.11
when built with Meson as there is no longer a libdpdk.so linker script,
but only a pkg-config file, so -ldpdk (which is what AC_CHECK_LIB runs)
fails.
Use AC_LINK_IFELSE instead, with compiler and linker flags set
appropriately.

Gbp-Pq: Name dpdk_configure_check.patch

configure.ac

index 9ddb1c7baf31019269736845512c3524f7bbf94d..5e1625a0e065e1d2425529fcf1954323920ff44b 100644 (file)
@@ -2380,13 +2380,30 @@ if test "x$with_libdpdk" != "xno"; then
 fi
 
 if test "x$with_libdpdk" = "xyes"; then
+  SAVE_LIBS="$LIBS"
+  LIBS="$LIBDPDK_LIBS $LIBS"
   SAVE_LDFLAGS="$LDFLAGS"
   LDFLAGS="$LIBDPDK_LDFLAGS $LDFLAGS"
-  AC_CHECK_LIB([dpdk], [rte_eal_init],
+  SAVE_CPPFLAGS="$CPPFLAGS"
+  CPPFLAGS="$LIBDPDK_CPPFLAGS $CPPFLAGS"
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$LIBDPDK_CFLAGS $CFLAGS"
+  AC_LINK_IFELSE(
+    [
+      AC_LANG_PROGRAM(
+        [[
+          #include <rte_eal.h>
+        ]],
+        [[return rte_eal_init(0, NULL);]]
+      )
+    ],
     [with_libdpdk="yes"],
     [with_libdpdk="no (symbol 'rte_eal_init' not found)"]
   )
+  LIBS="$SAVE_LIBS"
   LDFLAGS="$SAVE_LDFLAGS"
+  CPPFLAGS="$SAVE_CPPFLAGS"
+  CFLAGS="$SAVE_CFLAGS"
 fi
 
 # }}}