[collectd] [PATCH] Let configure bail out on missing dependencies

Bruno Prémont bonbons at linux-vserver.org
Sun Oct 5 14:09:08 CEST 2008


The patch below adds check in AC_PLUGIN() that verifies if the
dependencies are met for any enabled plugin.

In case some dependency is missing (default is disabled and enabled
is selected) configure will fail after dumping summary so all
dependency issues are visible in a single configure pass.

A later addition would be to list requirements (dependencies, OS/Kernel
restrictions) for all plugins in an easily accessible location (e.g.
INSTALL file)


---
--- collectd-4.5.0/configure.in	2008-09-05 10:53:08.000000000 +0200
+++ collectd-4.5.0-new/configure.in	2008-10-05 13:59:24.030892180 +0200
@@ -2477,9 +2477,12 @@ AC_DEFUN(
 	     enable_plugin="no"
      fi
     ])
-    if test "x$enable_plugin" = "xyes"
+    if test "x$enable_plugin" = "xyes" && test "x$2" = "xyes"
     then
 	    AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
+    else
+    	    dependency_error="yes"
+	    test "x$enable_plugin" = "xyes" && enable_plugin="failed (missing dependency)"
     fi
     AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
     enable_$1="$enable_plugin"
@@ -2493,6 +2496,7 @@ AC_COLLECTD([debug],     [enable],  [fea
 AC_COLLECTD([daemon],    [disable], [feature], [daemon mode])
 AC_COLLECTD([getifaddrs],[enable],  [feature], [getifaddrs under Linux])
 
+dependency_error="no"
 plugin_ascent="no"
 plugin_battery="no"
 plugin_cpu="no"
@@ -2910,3 +2914,7 @@ Configuration:
     xmms  . . . . . . . . $enable_xmms
 
 EOF
+
+if test "x$dependency_error" = "xyes"; then
+	AC_MSG_ERROR("Some plugins are missing dependencies - see above summary for details")
+fi



More information about the collectd mailing list