dpdkstat: cleanup of code
[collectd.git] / configure.ac
index c661c56..ba3687a 100644 (file)
@@ -2414,36 +2414,32 @@ fi
 # --with-libdpdk {{{
 AC_ARG_WITH(libdpdk, [AS_HELP_STRING([--with-libdpdk@<:@=PREFIX@:>@], [Path to the DPDK build directory.])],
 [
-  if test "x$withval" != "xno" && test "x$withval" != "xyes"
+       if test "x$withval" != "xno" && test "x$withval" != "xyes"
        then
                with_dpdk_path="$withval"
-               with_dpdk="yes"
+               with_libdpdk="yes"
        else
                if test "x$withval" = "xno"
                then
-                       with_dpdk="no (disabled)"
+                       with_libdpdk="no (disabled)"
                fi
        fi
-], [with_dpdk="yes"])
+], [with_libdpdk="no"])
 
-if test "x$with_dpdk" = "xyes"
+if test "x$with_libdpdk" = "xyes"
 then
        RTE_BUILD="$with_dpdk_path"
        DPDK_INCLUDE="$RTE_BUILD/include/dpdk"
        DPDK_LIB_DIR="$RTE_BUILD/lib"
        DPDK_LIB="-ldpdk"
-       DPDK_EXTRA_LIB="-ldl -lpthread -lrt -lm"
 
        SAVE_CFLAGS="$CFLAGS"
        SAVE_LDFLAGS="$LDFLAGS"
        LDFLAGS="$LDFLAGS -L$DPDK_LIB_DIR"
-       CFLAGS="$CFLAGS -I$DPDK_INCLUDE -fpic"
+       CFLAGS="$CFLAGS -I$DPDK_INCLUDE"
        FOUND_DPDK=false
        SAVE_LIBS="$LIBS"
-       LIBS="$LIBS $DPDK_LIB $DPDK_EXTRA_LIB"
-       AC_CHECK_LIB(dpdk, rte_eal_init,
-                     [with_libdpdk="yes"],
-                     [with_libdpdk="DPDK not found"])
+       LIBS="$LIBS $DPDK_LIB"
        AC_LINK_IFELSE(
                [AC_LANG_PROGRAM(
 [[
@@ -2457,20 +2453,20 @@ rte_eal_init(rte_argc, rte_argv);
 ]]
        )],
                [FOUND_DPDK=true])
-       if $FOUND_DPDK; then :; else
-                AC_MSG_ERROR([cannot link with dpdk])
-       fi
-       DPDK_LDFLAGS="-ldpdk"
        CFLAGS="$SAVE_CFLAGS"
        LDFLAGS="$SAVE_LDFLAGS"
        LIBS="$SAVE_LIBS"
-       BUILD_WITH_DPDK_CFLAGS="-I$DPDK_INCLUDE -fPIC"
+       if test "x$FOUND_DPDK" != "xtrue"
+        then
+           AC_MSG_ERROR([cannot link with dpdk])
+       fi
+       DPDK_LDFLAGS="-ldpdk"
+       BUILD_WITH_DPDK_CFLAGS="-I$DPDK_INCLUDE"
        BUILD_WITH_DPDK_LDFLAGS="-L$DPDK_LIB_DIR"
-       BUILD_WITH_DPDK_LIBS="$DPDK_LDFLAGS -ldl -lpthread -lrt -lm"
+       BUILD_WITH_DPDK_LIBS="$DPDK_LDFLAGS"
        AC_SUBST(BUILD_WITH_DPDK_CFLAGS)
        AC_SUBST(BUILD_WITH_DPDK_LDFLAGS)
        AC_SUBST(BUILD_WITH_DPDK_LIBS)
-       AC_DEFINE_UNQUOTED(DPDK, [1], [System uses DPDK.])
 fi
 # }}}
 
@@ -6038,7 +6034,7 @@ AC_PLUGIN([dbi],                 [$with_libdbi],            [General database st
 AC_PLUGIN([df],                  [$plugin_df],              [Filesystem usage statistics])
 AC_PLUGIN([disk],                [$plugin_disk],            [Disk usage statistics])
 AC_PLUGIN([dns],                 [$with_libpcap],           [DNS traffic analysis])
-AC_PLUGIN([dpdkstat],    [$with_libdpdk],      [Stats & Status from DPDK])
+AC_PLUGIN([dpdkstat],            [$with_libdpdk],           [Stats & Status from DPDK])
 AC_PLUGIN([drbd],                [$plugin_drbd],            [DRBD statistics])
 AC_PLUGIN([email],               [yes],                     [EMail statistics])
 AC_PLUGIN([entropy],             [$plugin_entropy],         [Entropy statistics])
@@ -6358,13 +6354,13 @@ AC_MSG_RESULT([    PROTOC  . . . . . . . $PROTOC])
 AC_MSG_RESULT([    YACC  . . . . . . . . $YACC])
 AC_MSG_RESULT([    YFLAGS  . . . . . . . $YFLAGS])
 AC_MSG_RESULT()
-    dpdk  . . . . . . . . $with_libdpdk
 AC_MSG_RESULT([  Libraries:])
 AC_MSG_RESULT([    intel mic . . . . . . $with_mic])
 AC_MSG_RESULT([    libaquaero5 . . . . . $with_libaquaero5])
 AC_MSG_RESULT([    libatasmart . . . . . $with_libatasmart])
 AC_MSG_RESULT([    libcurl . . . . . . . $with_libcurl])
 AC_MSG_RESULT([    libdbi  . . . . . . . $with_libdbi])
+    libdpdk . . . . . . . $with_libdpdk
 AC_MSG_RESULT([    libesmtp  . . . . . . $with_libesmtp])
 AC_MSG_RESULT([    libganglia  . . . . . $with_libganglia])
 AC_MSG_RESULT([    libgcrypt . . . . . . $with_libgcrypt])