Merge branch 'collectd-5.5'
authorFlorian Forster <octo@collectd.org>
Thu, 11 Jun 2015 13:39:16 +0000 (14:39 +0100)
committerFlorian Forster <octo@collectd.org>
Thu, 11 Jun 2015 13:39:16 +0000 (14:39 +0100)
configure.ac
src/daemon/Makefile.am
src/swap.c

index 6b75c1c..f6fe57c 100644 (file)
@@ -113,7 +113,20 @@ if test "x$ac_system" = "xSolaris"
 then
        AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
        AC_DEFINE(_REENTRANT,               1, [Define to enable reentrancy interfaces.])
+
+       AC_MSG_CHECKING([whether compiler builds 64bit binaries])
+       AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
+                          #ifndef _LP64
+                          # error "Compiler not in 64bit mode."
+                          #endif
+                          ])],
+                          [AC_MSG_RESULT([yes])],
+                          [
+                           AC_MSG_RESULT([no])
+                           AC_MSG_NOTICE([Solaris detected. Please consider building a 64-bit binary.])
+                          ])
 fi
+
 if test "x$ac_system" = "xAIX"
 then
        AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.])
@@ -394,18 +407,6 @@ AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
 #endif
 ])
 
-if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
-then
-       hint_64=""
-       if test "x$GCC" = "xyes"
-       then
-               hint_64="CFLAGS='-m64'"
-       else
-               hint_64="CFLAGS='-xarch=v9'"
-       fi
-       AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
-fi
-
 # For load module
 # For the processes plugin
 # For users module
index 7f826e3..00a8fd7 100644 (file)
@@ -13,6 +13,30 @@ endif
 AM_CPPFLAGS += -DPLUGINDIR='"${pkglibdir}"'
 AM_CPPFLAGS += -DPKGDATADIR='"${pkgdatadir}"'
 
+# Link to these libraries..
+COMMON_LIBS =
+if BUILD_WITH_LIBRT
+COMMON_LIBS += -lrt
+endif
+if BUILD_WITH_LIBPOSIX4
+COMMON_LIBS += -lposix4
+endif
+if BUILD_WITH_LIBSOCKET
+COMMON_LIBS += -lsocket
+endif
+if BUILD_WITH_LIBRESOLV
+COMMON_LIBS += -lresolv
+endif
+if BUILD_WITH_LIBPTHREAD
+COMMON_LIBS += -lpthread
+endif
+if BUILD_WITH_LIBKSTAT
+COMMON_LIBS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+COMMON_LIBS += -ldevinfo
+endif
+
 AUTOMAKE_OPTIONS = subdir-objects
 
 sbin_PROGRAMS = collectd
@@ -48,35 +72,9 @@ collectd_SOURCES = collectd.c collectd.h \
 collectd_CPPFLAGS =  $(AM_CPPFLAGS) $(LTDLINCL)
 collectd_CFLAGS = $(AM_CFLAGS)
 collectd_LDFLAGS = -export-dynamic
-collectd_LDADD = libavltree.la libcommon.la libheap.la -lm
+collectd_LDADD = libavltree.la libcommon.la libheap.la -lm $(COMMON_LIBS)
 collectd_DEPENDENCIES =
 
-# Link to these libraries..
-if BUILD_WITH_LIBRT
-collectd_LDADD += -lrt
-endif
-if BUILD_WITH_LIBPOSIX4
-collectd_LDADD += -lposix4
-endif
-if BUILD_WITH_LIBSOCKET
-collectd_LDADD += -lsocket
-endif
-if BUILD_WITH_LIBRESOLV
-collectd_LDADD += -lresolv
-endif
-if BUILD_WITH_LIBPTHREAD
-collectd_LDADD += -lpthread
-endif
-if BUILD_WITH_LIBKSTAT
-collectd_LDADD += -lkstat
-endif
-if BUILD_WITH_LIBDEVINFO
-collectd_LDADD += -ldevinfo
-endif
-if BUILD_AIX
-collectd_LDFLAGS += -Wl,-bexpall,-brtllib
-endif
-
 # The daemon needs to call sg_init, so we need to link it against libstatgrab,
 # too. -octo
 if BUILD_WITH_LIBSTATGRAB
@@ -95,10 +93,10 @@ check_PROGRAMS = test_common test_utils_avltree test_utils_heap
 TESTS = test_common test_utils_avltree test_utils_heap
 
 test_common_SOURCES = common_test.c ../testing.h
-test_common_LDADD = libcommon.la libplugin_mock.la
+test_common_LDADD = libcommon.la libplugin_mock.la $(COMMON_LIBS)
 
 test_utils_avltree_SOURCES = utils_avltree_test.c ../testing.h
-test_utils_avltree_LDADD = libavltree.la
+test_utils_avltree_LDADD = libavltree.la $(COMMON_LIBS)
 
 test_utils_heap_SOURCES = utils_heap_test.c ../testing.h
-test_utils_heap_LDADD = libheap.la
+test_utils_heap_LDADD = libheap.la $(COMMON_LIBS)
index a8276c7..cfde4ea 100644 (file)
@@ -281,7 +281,8 @@ static int swap_read_separate (void) /* {{{ */
                if (total < used)
                        continue;
 
-               swap_submit_usage (path, used, total - used, NULL, NAN);
+               swap_submit_usage (path, used * 1024.0, (total - used) * 1024.0,
+                               NULL, NAN);
        }
 
        fclose (fh);
@@ -340,8 +341,9 @@ static int swap_read_combined (void) /* {{{ */
        if (swap_used < 0.0)
                return (EINVAL);
 
-       swap_submit_usage (NULL, swap_used, swap_free,
-                       isnan (swap_cached) ? NULL : "cached", swap_cached);
+       swap_submit_usage (NULL, swap_used * 1024.0, swap_free * 1024.0,
+                       isnan (swap_cached) ? NULL : "cached",
+                       isnan (swap_cached) ? NAN : swap_cached * 1024.0);
        return (0);
 } /* }}} int swap_read_combined */