Added configuration for autotools
authorChad Malfait <cmalfait@yahoo.com>
Sat, 6 Apr 2013 04:56:29 +0000 (22:56 -0600)
committerChad Malfait <cmalfait@yahoo.com>
Sat, 6 Apr 2013 04:56:29 +0000 (22:56 -0600)
configure.in
src/Makefile.am
src/collectd.conf.in

index e2110b5..6a48e4e 100644 (file)
@@ -2153,6 +2153,58 @@ AC_SUBST(JAVA_LIBS)
 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
 # }}}
 
+# --with-liblvm2app {{{
+with_liblvm2app_cppflags=""
+with_liblvm2app_ldflags=""
+AC_ARG_WITH(liblvm2app, [AS_HELP_STRING([--with-liblvm2app@<:@=PREFIX@:>@], [Path to liblvm2app.])],
+[
+        if test "x$withval" != "xno" && test "x$withval" != "xyes"
+        then
+                with_liblvm2app_cppflags="-I$withval/include"
+                with_liblvm2app_ldflags="-L$withval/lib"
+                with_liblvm2app="yes"
+        else
+                with_liblvm2app="$withval"
+        fi
+],
+[
+        with_liblvm2app="yes"
+])
+if test "x$with_liblvm2app" = "xyes"
+then
+        SAVE_CPPFLAGS="$CPPFLAGS"
+        CPPFLAGS="$CPPFLAGS $with_liblvm2app_cppflags"
+
+        AC_CHECK_HEADERS(lvm2app.h, [with_liblvm2app="yes"], [with_liblvm2app="no (lvm2app.h not found)"])
+
+        CPPFLAGS="$SAVE_CPPFLAGS"
+fi
+
+if test "x$with_liblvm2app" = "xyes"
+then
+        SAVE_CPPFLAGS="$CPPFLAGS"
+        SAVE_LDFLAGS="$LDFLAGS"
+        CPPFLAGS="$CPPFLAGS $with_liblvm2app_cppflags"
+        LDFLAGS="$LDFLAGS $with_liblvm2app_ldflags"
+
+        AC_CHECK_LIB(liblvm2app, lvm_init[with_liblvm2app="yes"], [with_liblvm2app="no (Symbol 'lvm_init' not found)"])
+
+        CPPFLAGS="$SAVE_CPPFLAGS"
+        LDFLAGS="$SAVE_LDFLAGS"
+fi
+if test "x$with_liblvm2app" = "xyes"
+then
+        BUILD_WITH_LIBLVM2APP_CPPFLAGS="$with_liblvm2app_cppflags"
+        BUILD_WITH_LIBLVM2APP_LDFLAGS="$with_liblvm2app_ldflags"
+        BUILD_WITH_LIBLVM2APP_LIBS="-llvm2app"
+        AC_SUBST(BUILD_WITH_LIBLVM2APP_CPPFLAGS)
+        AC_SUBST(BUILD_WITH_LIBLVM2APP_LDFLAGS)
+        AC_SUBST(BUILD_WITH_LIBLVM2APP_LIBS)
+        AC_DEFINE(HAVE_LIBLVM2APP, 1, [Define if liblvm2app is present and usable.])
+fi
+AM_CONDITIONAL(BUILD_WITH_LIBLVM2APP, test "x$with_liblvm2app" = "xyes")
+# }}}
+
 # --with-libmemcached {{{
 with_libmemcached_cppflags=""
 with_libmemcached_ldflags=""
@@ -4612,6 +4664,7 @@ plugin_thermal="no"
 plugin_users="no"
 plugin_uptime="no"
 plugin_vmem="no"
+plugin_volume="no"
 plugin_vserver="no"
 plugin_wireless="no"
 plugin_zfs_arc="no"
@@ -4641,6 +4694,7 @@ then
        plugin_thermal="yes"
        plugin_uptime="yes"
        plugin_vmem="yes"
+       plugin_volume="yes"
        plugin_vserver="yes"
        plugin_wireless="yes"
 
@@ -4994,6 +5048,7 @@ AC_PLUGIN([users],       [$plugin_users],      [User statistics])
 AC_PLUGIN([uuid],        [yes],                [UUID as hostname plugin])
 AC_PLUGIN([varnish],     [$with_libvarnish],   [Varnish cache statistics])
 AC_PLUGIN([vmem],        [$plugin_vmem],       [Virtual memory statistics])
+AC_PLUGIN([volume],      [$with_liblvm2app],   [Volume statistics])
 AC_PLUGIN([vserver],     [$plugin_vserver],    [Linux VServer statistics])
 AC_PLUGIN([wireless],    [$plugin_wireless],   [Wireless statistics])
 AC_PLUGIN([write_graphite], [yes],             [Graphite / Carbon output plugin])
@@ -5329,6 +5384,7 @@ Configuration:
     uuid  . . . . . . . . $enable_uuid
     varnish . . . . . . . $enable_varnish
     vmem  . . . . . . . . $enable_vmem
+    volume  . . . . . . . $enable_volume
     vserver . . . . . . . $enable_vserver
     wireless  . . . . . . $enable_wireless
     write_graphite  . . . $enable_write_graphite
index 34012a7..0f28478 100644 (file)
@@ -1290,6 +1290,15 @@ collectd_LDADD += "-dlopen" vmem.la
 collectd_DEPENDENCIES += vmem.la
 endif
 
+if BUILD_PLUGIN_VOLUME
+pkglib_LTLIBRARIES += volume.la
+volume_la_SOURCES = volume.c
+volume_la_LDFLAGS = -module -avoid-version
+volume_la_LIBADD = -llvm2app
+collectd_LDADD += "-dlopen" volume.la
+collectd_DEPENDENCIES += volume.la
+endif
+
 if BUILD_PLUGIN_VSERVER
 pkglib_LTLIBRARIES += vserver.la
 vserver_la_SOURCES = vserver.c
index 5af1568..ecc45c9 100644 (file)
 #@BUILD_PLUGIN_VARNISH_TRUE@LoadPlugin varnish
 #@BUILD_PLUGIN_VMEM_TRUE@LoadPlugin vmem
 #@BUILD_PLUGIN_VSERVER_TRUE@LoadPlugin vserver
+#@BUILD_PLUGIN_VOLUME_TRUE@LoadPlugin volume
 #@BUILD_PLUGIN_WIRELESS_TRUE@LoadPlugin wireless
 #@BUILD_PLUGIN_WRITE_GRAPHITE_TRUE@LoadPlugin write_graphite
 #@BUILD_PLUGIN_WRITE_HTTP_TRUE@LoadPlugin write_http