summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ec0e109)
raw | patch | inline | side by side (parent: ec0e109)
author | Vincent Bernat <vincent@bernat.im> | |
Fri, 7 Nov 2014 22:46:45 +0000 (23:46 +0100) | ||
committer | Vincent Bernat <Vincent.Bernat@exoscale.ch> | |
Wed, 12 Nov 2014 12:20:11 +0000 (13:20 +0100) |
In those versions, `sg_init()` need to be invoked with an additional
argument. The need for such an argument is detected at configure-time.
Fixes: #445
argument. The need for such an argument is detected at configure-time.
Fixes: #445
configure.ac | patch | blob | history | |
src/daemon/collectd.c | patch | blob | history |
diff --git a/configure.ac b/configure.ac
index a00eebb1b6a95aee838e8848e96ca7a3983f2af5..35f8946450bd69aebe5164efa451cf5f32a6e8d2 100644 (file)
--- a/configure.ac
+++ b/configure.ac
LDFLAGS="$SAVE_LDFLAGS"
fi
+if test "x$with_libstatgrab" = "xyes"
+then
+ SAVE_CFLAGS="$CFLAGS"
+ SAVE_LDFLAGS="$LDFLAGS"
+
+ CFLAGS="$CFLAGS $with_libstatgrab_cflags"
+ LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
+
+ AC_CACHE_CHECK([if sg_init() requires an argument],
+ [c_cv_have_libstatgrab_init_arg],
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(
+[[[
+#include <stdio.h>
+#include <statgrab.h>
+]]],
+[[[
+ if (sg_init()) return 0;
+]]]
+ )],
+ [c_cv_have_libstatgrab_init_arg="no"],
+ [c_cv_have_libstatgrab_init_arg="yes"]
+ )
+ )
+
+ CFLAGS="$SAVE_CFLAGS"
+ LDFLAGS="$SAVE_LDFLAGS"
+fi
+
AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
if test "x$with_libstatgrab" = "xyes"
then
BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
+ if test "x$c_cv_have_libstatgrab_init_arg" = "xyes"
+ then
+ AC_DEFINE(HAVE_LIBSTATGRAB_INIT_ARG, 1, [Define to 1 if sg_init does require an argument])
+ fi
fi
# }}}
diff --git a/src/daemon/collectd.c b/src/daemon/collectd.c
index 2e2d821aade194873c923ceabcf8951291d0dc69..8c4d6e66e12a19a6442ce50e4f5012070d4081a3 100644 (file)
--- a/src/daemon/collectd.c
+++ b/src/daemon/collectd.c
#endif
#if HAVE_LIBSTATGRAB
- if (sg_init ())
+ if (sg_init (
+# if HAVE_LIBSTATGRAB_INIT_ARG
+ 0
+# endif
+ ))
{
ERROR ("sg_init: %s", sg_str_error (sg_get_error ()));
return (-1);