author | Florian Forster <octo@collectd.org> | |
Fri, 12 May 2017 09:18:52 +0000 (11:18 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Fri, 12 May 2017 09:22:13 +0000 (11:22 +0200) |
1 | 2 | |||
---|---|---|---|---|
configure.ac | patch | | diff1 | | diff2 | | blob | history |
src/bind.c | patch | | diff1 | | diff2 | | blob | history |
src/collectd.conf.pod | patch | | diff1 | | diff2 | | blob | history |
diff --cc configure.ac
index 320572d0c0e58b026f904b902305460e26452965,feed08538de15a5cbfd0721f3ac293b765b38a92..d4207ab6b239e45a830c88d190394b3cb372f2be
--- 1/configure.ac
--- 2/configure.ac
+++ b/configure.ac
fi
# }}} Check for strptime
-AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
+ # 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.h>
+ ]]],
+ [[[
+ 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.h>
+ ]]],
+ [[[
+ 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_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 <sys/stat.h>
-#include <sys/param.h>
-#include <sys/swap.h>
-#include <unistd.h>
-]]],
-[[[
-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 <sys/stat.h>
-#include <sys/param.h>
-#include <sys/swap.h>
-#include <unistd.h>
-]]],
-[[[
-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 <sys/stat.h>
+ #include <sys/param.h>
+ #include <sys/swap.h>
+ #include <unistd.h>
+ ]],
+ [[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 <sys/stat.h>
+ #include <sys/param.h>
+ #include <sys/swap.h>
+ #include <unistd.h>
+ ]],
+ [[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
diff --cc src/bind.c
Simple merge
diff --cc src/collectd.conf.pod
Simple merge