collectd/collectd-new_libstatgrab.patch
Lars Vogdt 9761b086e4 Accepting request 349425 from home:oertel:branches:server:monitoring
- add patch collectd-new_libstatgrab.patch:
  fix build with recent libstatgrab (basically backport from git) 
- do not (build)require sensors on s390/s390x

OBS-URL: https://build.opensuse.org/request/show/349425
OBS-URL: https://build.opensuse.org/package/show/server:monitoring/collectd?expand=0&rev=129
2015-12-31 18:21:24 +00:00

64 lines
1.4 KiB
Diff

--- configure.ac
+++ configure.ac
@@ -4003,6 +4003,34 @@
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
@@ -4011,6 +4039,10 @@
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
# }}}
--- src/collectd.c
+++ src/collectd.c
@@ -288,7 +288,11 @@
#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);