From: Florian Forster Date: Fri, 12 May 2017 09:18:52 +0000 (+0200) Subject: Merge branch 'collectd-5.7' X-Git-Tag: collectd-5.8.0~188 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=c88c2de1c9cd6795b30c34990a565d18b69221e7;p=collectd.git Merge branch 'collectd-5.7' --- c88c2de1c9cd6795b30c34990a565d18b69221e7 diff --cc configure.ac index 320572d0,feed0853..d4207ab6 --- a/configure.ac +++ b/configure.ac @@@ -1039,95 -1068,148 +1039,181 @@@ if test "x$GCC" = "xyes"; the fi # }}} Check for strptime + # Check for timegm {{{ + + # These checks need -Werror because implicit function declarations are only a + # warning ... + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror" + + AC_CACHE_CHECK([for timegm], + [c_cv_have_timegm], + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[[ + #if STRPTIME_NEEDS_STANDARDS + # ifndef _ISOC99_SOURCE + # define _ISOC99_SOURCE 1 + # endif + # ifndef _POSIX_C_SOURCE + # define _POSIX_C_SOURCE 200112L + # endif + # ifndef _XOPEN_SOURCE + # define _XOPEN_SOURCE 500 + # endif + #endif + #include + ]]], + [[[ + time_t t = timegm(&(struct tm){0}); + if (t == ((time_t) -1)) { + return 1; + } + ]]] + )], + [c_cv_have_timegm="yes"], + [c_cv_have_timegm="no"] + ) + ) + + if test "x$c_cv_have_timegm" != "xyes" + then + AC_CACHE_CHECK([for timegm with _BSD_SOURCE], + [c_cv_have_timegm_bsd], + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[[ + #if STRPTIME_NEEDS_STANDARDS + # ifndef _ISOC99_SOURCE + # define _ISOC99_SOURCE 1 + # endif + # ifndef _POSIX_C_SOURCE + # define _POSIX_C_SOURCE 200112L + # endif + # ifndef _XOPEN_SOURCE + # define _XOPEN_SOURCE 500 + # endif + #endif + #ifndef _BSD_SOURCE + # define _BSD_SOURCE 1 + #endif + #include + ]]], + [[[ + time_t t = timegm(&(struct tm){0}); + if (t == ((time_t) -1)) { + return 1; + } + ]]] + )], + [c_cv_have_timegm_bsd="yes" + c_cv_have_timegm="yes"], + [c_cv_have_timegm_bsd="no"] + ) + ) + fi + + if test "x$c_cv_have_timegm" = "xyes" + then + AC_DEFINE(HAVE_TIMEGM, 1, [Define if the timegm(3) function is available.]) + if test "x$c_cv_have_timegm_bsd" = "xyes" + then + AC_DEFINE(TIMEGM_NEEDS_BSD, 1, [Set to true if timegm is only exported in BSD mode.]) + fi + fi + + CFLAGS="$SAVE_CFLAGS" + # }}} Check for timegm + -AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"]) +AC_MSG_CHECKING([for sysctl kern.cp_times]) +if test -x /sbin/sysctl; then + /sbin/sysctl kern.cp_times >/dev/null 2>&1 + if test $? -eq 0; then + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_SYSCTL_KERN_CP_TIMES], [1], [Define if sysctl supports kern.cp_times]) + else + AC_MSG_RESULT([no]) + fi +else + AC_MSG_RESULT([no]) +fi + +AC_MSG_CHECKING([for sysctl kern.cp_time]) +if test -x /sbin/sysctl; then + /sbin/sysctl kern.cp_time >/dev/null 2>&1 + if test $? -eq 0 + then + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_SYSCTL_KERN_CP_TIME], [1], [Define if sysctl supports kern.cp_time]) + else + AC_MSG_RESULT([no]) + fi +else + AC_MSG_RESULT([no]) +fi + +AC_CHECK_FUNCS([swapctl], [have_swapctl="yes"], [have_swapctl="no"]) if test "x$have_swapctl" = "xyes"; then - AC_CACHE_CHECK([whether swapctl takes two arguments], - [c_cv_have_swapctl_two_args], - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( -[[[ -#if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64 -# undef _FILE_OFFSET_BITS -# undef _LARGEFILE64_SOURCE -#endif -#include -#include -#include -#include -]]], -[[[ -int num = swapctl(0, NULL); -]]] - )], - [c_cv_have_swapctl_two_args="yes"], - [c_cv_have_swapctl_two_args="no"] - ) - ) - AC_CACHE_CHECK([whether swapctl takes three arguments], - [c_cv_have_swapctl_three_args], - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( -[[[ -#if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64 -# undef _FILE_OFFSET_BITS -# undef _LARGEFILE64_SOURCE -#endif -#include -#include -#include -#include -]]], -[[[ -int num = swapctl(0, NULL, 0); -]]] - )], - [c_cv_have_swapctl_three_args="yes"], - [c_cv_have_swapctl_three_args="no"] - ) - ) + AC_CACHE_CHECK([whether swapctl takes two arguments], + [c_cv_have_swapctl_two_args], + [ + AC_COMPILE_IFELSE( + [ + AC_LANG_PROGRAM( + [[ + #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64 + # undef _FILE_OFFSET_BITS + # undef _LARGEFILE64_SOURCE + #endif + #include + #include + #include + #include + ]], + [[int num = swapctl(0, NULL);]] + ) + ], + [c_cv_have_swapctl_two_args="yes"], + [c_cv_have_swapctl_two_args="no"] + ) + ] + ) + + AC_CACHE_CHECK([whether swapctl takes three arguments], + [c_cv_have_swapctl_three_args], + [ + AC_COMPILE_IFELSE( + [ + AC_LANG_PROGRAM( + [[ + #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64 + # undef _FILE_OFFSET_BITS + # undef _LARGEFILE64_SOURCE + #endif + #include + #include + #include + #include + ]], + [[int num = swapctl(0, NULL, 0);]] + ) + ], + [c_cv_have_swapctl_three_args="yes"], + [c_cv_have_swapctl_three_args="no"] + ) + ] + ) fi + # Check for different versions of `swapctl' here.. if test "x$have_swapctl" = "xyes"; then - if test "x$c_cv_have_swapctl_two_args" = "xyes"; then - AC_DEFINE(HAVE_SWAPCTL_TWO_ARGS, 1, - [Define if the function swapctl exists and takes two arguments.]) - fi - if test "x$c_cv_have_swapctl_three_args" = "xyes"; then - AC_DEFINE(HAVE_SWAPCTL_THREE_ARGS, 1, - [Define if the function swapctl exists and takes three arguments.]) - fi + if test "x$c_cv_have_swapctl_two_args" = "xyes"; then + AC_DEFINE([HAVE_SWAPCTL_TWO_ARGS], [1], [Define if the function swapctl exists and takes two arguments.]) + fi + + if test "x$c_cv_have_swapctl_three_args" = "xyes"; then + AC_DEFINE([HAVE_SWAPCTL_THREE_ARGS], [1], [Define if the function swapctl exists and takes three arguments.]) + fi fi # Check for NAN