Added ASLR info to README
[collectd.git] / configure.ac
index c69842c..5b7a950 100644 (file)
@@ -1621,18 +1621,32 @@ AC_CHECK_LIB(resolv, res_search,
 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
 
 dnl Check for HAL (hardware abstraction library)
-with_libhal="yes"
-AC_CHECK_LIB(hal,libhal_device_property_exists,
-            [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
-            [with_libhal="no"])
-if test "x$with_libhal" = "xyes"; then
-       if test "x$PKG_CONFIG" != "x"; then
-               BUILD_WITH_LIBHAL_CFLAGS="`$PKG_CONFIG --cflags hal`"
-               BUILD_WITH_LIBHAL_LIBS="`$PKG_CONFIG --libs hal`"
-               AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
-               AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
-       fi
-fi
+with_libhal="no"
+PKG_CHECK_MODULES([HAL], [hal],
+  [
+    SAVE_LIBS="$LIBS"
+    LIBS="$HAL_LIBS $LIBS"
+    AC_CHECK_LIB([hal], [libhal_device_property_exists],
+      [
+        SAVE_CPPFLAGS="$CPPFLAGS"
+        CPPFLAGS="$HAL_CFLAGS $CPPFLAGS"
+        AC_CHECK_HEADERS([libhal.h],
+        [
+          with_libhal="yes"
+          BUILD_WITH_LIBHAL_CFLAGS="$HAL_CFLAGS"
+          BUILD_WITH_LIBHAL_LIBS="$HAL_LIBS"
+        ])
+        CPPFLAGS="$SAVE_CPPFLAGS"
+      ],
+      [ : ]
+    )
+    LIBS="$SAVE_LIBS"
+  ],
+  [ : ]
+)
+AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
+AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
+
 
 SAVE_LIBS="$LIBS"
 AC_CHECK_LIB([pthread],
@@ -2397,6 +2411,84 @@ then
 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"
+       then
+               with_dpdk_path="$withval"
+               with_libdpdk="yes"
+       else
+               if test "x$withval" = "xno"
+               then
+                       with_libdpdk="no (disabled)"
+               fi
+       fi
+], [with_libdpdk="no"])
+
+if test "x$with_libdpdk" = "xyes"
+then
+       RTE_BUILD="$with_dpdk_path"
+       DPDK_INCLUDE="$RTE_BUILD/include"
+       AC_CHECK_FILE([$DPDK_INCLUDE/rte_config.h], [LOCAL_DPDK_INSTALL=true],
+               [AC_CHECK_FILE([$DPDK_INCLUDE/dpdk/rte_config.h],
+               [DPDK_INCLUDE=$DPDK_INCLUDE/dpdk], [])])
+       DPDK_LIB_DIR="$RTE_BUILD/lib"
+       DPDK_EXTRA_LIB=""
+
+       SAVE_CFLAGS="$CFLAGS"
+       SAVE_LDFLAGS="$LDFLAGS"
+       CFLAGS="$CFLAGS -mavx -I$DPDK_INCLUDE"
+       if test "x$LOCAL_DPDK_INSTALL" != "xtrue"
+        then
+            LDFLAGS="$LDFLAGS -L$DPDK_LIB_DIR"
+        fi
+       FOUND_DPDK=false
+       SAVE_LIBS="$LIBS"
+       LIBS="$DPDK_LIB $LIBS"
+       AC_CHECK_LIB(dpdk, rte_eal_init,
+                     [FOUND_DPDK=true],
+                     [AC_MSG_ERROR([did not find dpdk libs ])])
+
+       CFLAGS="$SAVE_CFLAGS"
+       LDFLAGS="$SAVE_LDFLAGS"
+       LIBS="$SAVE_LIBS"
+       if test "x$FOUND_DPDK" != "xtrue"
+        then
+           AC_MSG_ERROR([cannot link with dpdk in $DPDK_LIB_DIR])
+       fi
+       BUILD_WITH_DPDK_CFLAGS=""
+       AC_MSG_NOTICE([Checking for avx instructions])
+       AC_RUN_IFELSE(
+               [AC_LANG_PROGRAM(
+[[
+#include <immintrin.h>
+]],
+[[
+__m128i zero = _mm_setzero_si128();
+]]
+       )],
+               [HAVE_AVX=true], [HAVE_AVX=false])
+       if test "x$HAVE_AVX" = "xtrue"
+       then
+               BUILD_WITH_DPDK_CFLAGS="-mavx "
+               AC_MSG_NOTICE([avx instructions supported])
+       fi
+
+       BUILD_WITH_DPDK_CFLAGS+="-fPIC -I$DPDK_INCLUDE"
+       if test "x$LOCAL_DPDK_INSTALL" != "xtrue"
+        then
+               BUILD_WITH_DPDK_LDFLAGS="-Wl,--no-as-needed"
+       else
+               BUILD_WITH_DPDK_LDFLAGS="-L$DPDK_LIB_DIR -Wl,--no-as-needed"
+        fi
+       BUILD_WITH_DPDK_LIBS="-Wl,-ldpdk"
+       AC_SUBST(BUILD_WITH_DPDK_CFLAGS)
+       AC_SUBST(BUILD_WITH_DPDK_LDFLAGS)
+       AC_SUBST(BUILD_WITH_DPDK_LIBS)
+fi
+# }}}
+
 # --with-java {{{
 with_java_home="$JAVA_HOME"
 if test "x$with_java_home" = "x"
@@ -5542,6 +5634,7 @@ plugin_curl_xml="no"
 plugin_df="no"
 plugin_disk="no"
 plugin_drbd="no"
+plugin_dpdk="no"
 plugin_entropy="no"
 plugin_ethstat="no"
 plugin_fhcount="no"
@@ -5960,6 +6053,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([drbd],                [$plugin_drbd],            [DRBD statistics])
 AC_PLUGIN([email],               [yes],                     [EMail statistics])
 AC_PLUGIN([entropy],             [$plugin_entropy],         [Entropy statistics])
@@ -6285,6 +6379,7 @@ 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])
@@ -6368,6 +6463,7 @@ AC_MSG_RESULT([    curl  . . . . . . . . $enable_curl])
 AC_MSG_RESULT([    curl_json . . . . . . $enable_curl_json])
 AC_MSG_RESULT([    curl_xml  . . . . . . $enable_curl_xml])
 AC_MSG_RESULT([    dbi . . . . . . . . . $enable_dbi])
+    dpdkstat . . . . . . .$enable_dpdkstat
 AC_MSG_RESULT([    df  . . . . . . . . . $enable_df])
 AC_MSG_RESULT([    disk  . . . . . . . . $enable_disk])
 AC_MSG_RESULT([    dns . . . . . . . . . $enable_dns])