From 7968c0ddec342632ecff40be022f3cca730a8648 Mon Sep 17 00:00:00 2001 From: Christian Ehrhardt Date: Wed, 16 Aug 2017 14:31:48 +0200 Subject: [PATCH] configure.ac: dpdk: use pkg-config To detect cflags and libs use the sometimes provided pkg-config for libdpdk. That avoids build errors on systems where special flags are needed and provided by dpdk via pkg-config, but not yet considered by the collectd build system. This closes #2399 Signed-off-by: Christian Ehrhardt --- Makefile.am | 4 ++-- configure.ac | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 0ef9e31d..6d286b3c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -784,7 +784,7 @@ pkglib_LTLIBRARIES += dpdkevents.la dpdkevents_la_SOURCES = src/dpdkevents.c src/utils_dpdk.c src/utils_dpdk.h dpdkevents_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBDPDK_CPPFLAGS) dpdkevents_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(LIBDPDK_LDFLAGS) -dpdkevents_la_LIBADD = -ldpdk +dpdkevents_la_LIBADD = $(LIBDPDK_LIBS) endif if BUILD_PLUGIN_DPDKSTAT @@ -792,7 +792,7 @@ pkglib_LTLIBRARIES += dpdkstat.la dpdkstat_la_SOURCES = src/dpdkstat.c src/utils_dpdk.c src/utils_dpdk.h dpdkstat_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBDPDK_CPPFLAGS) dpdkstat_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(LIBDPDK_LDFLAGS) -dpdkstat_la_LIBADD = -ldpdk +dpdkstat_la_LIBADD = $(LIBDPDK_LIBS) endif if BUILD_PLUGIN_DRBD diff --git a/configure.ac b/configure.ac index 62bea50e..cd777746 100644 --- a/configure.ac +++ b/configure.ac @@ -2350,6 +2350,7 @@ AC_SUBST(BUILD_WITH_LIBDBI_LIBS) # --with-libdpdk {{{ AC_ARG_VAR([LIBDPDK_CPPFLAGS], [Preprocessor flags for libdpdk]) AC_ARG_VAR([LIBDPDK_LDFLAGS], [Linker flags for libdpdk]) +AC_ARG_VAR([LIBDPDK_LIBS], [Libraries to link for libdpdk]) AC_ARG_WITH([libdpdk], [AS_HELP_STRING([--without-libdpdk], [Disable libdpdk.])], @@ -2358,8 +2359,20 @@ AC_ARG_WITH([libdpdk], ) if test "x$with_libdpdk" != "xno"; then + PKG_CHECK_MODULES([DPDK], [libdpdk]) if test "x$LIBDPDK_CPPFLAGS" = "x"; then - LIBDPDK_CPPFLAGS="-I/usr/include/dpdk" + if test "x$DPDK_CFLAGS" != "x"; then + LIBDPDK_CPPFLAGS="$DPDK_CFLAGS" + else + LIBDPDK_CPPFLAGS="-I/usr/include/dpdk" + fi + fi + if test "x$LIBDPDK_LIBS" = "x"; then + if test "x$DPDK_LIBS" != "x"; then + LIBDPDK_LIBS="$DPDK_LIBS" + else + LIBDPDK_LIBS="-ldpdk" + fi fi SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$LIBDPDK_CPPFLAGS $CPPFLAGS" -- 2.11.0