formatting changes in cpusleep
[collectd.git] / configure.ac
index 2a4d98d..8be837f 100644 (file)
@@ -735,6 +735,23 @@ AC_CHECK_HEADERS(net/pfvar.h,
 have_termios_h="no"
 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
 
+# For cpusleep plugin
+AC_CACHE_CHECK([whether clock_boottime and clock_monotonic are supported],
+                      [c_cv_have_clock_boottime_monotonic],
+                      AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[[[
+#include <time.h>
+]]],
+[[[
+ struct timespec b, m;
+ clock_gettime(CLOCK_BOOTTIME, &b );
+ clock_gettime(CLOCK_MONOTONIC, &m );
+]]]
+                      )],
+                      [c_cv_have_clock_boottime_monotonic="yes"],
+                      [c_cv_have_clock_boottime_monotonic="no"]))
+
+
 # For the turbostat plugin
 have_asm_msrindex_h="no"
 AC_CHECK_HEADERS(asm/msr-index.h, [have_asm_msrindex_h="yes"])
@@ -5491,7 +5508,6 @@ then
        plugin_contextswitch="yes"
        plugin_cpu="yes"
        plugin_cpufreq="yes"
-       plugin_cpusleep="yes"
        plugin_disk="yes"
        plugin_drbd="yes"
        plugin_entropy="yes"
@@ -5525,6 +5541,11 @@ then
        then
                plugin_turbostat="yes"
        fi
+       
+       if test "x$c_cv_have_clock_boottime_monotonic" = "xyes"
+       then
+               plugin_cpusleep="yes"
+       fi
 fi
 
 if test "x$ac_system" = "xOpenBSD"