configure.ac: run dpdk build tests only if pkgconfig fails
authorLuca Boccassi <bluca@debian.org>
Mon, 3 Dec 2018 15:56:13 +0000 (15:56 +0000)
committerPavel Rochnyack <pavel2000@ngs.ru>
Thu, 6 Dec 2018 17:05:19 +0000 (00:05 +0700)
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.

Signed-off-by: Luca Boccassi <bluca@debian.org>
configure.ac

index 3c32cef..d93b51b 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
 
 # }}}