Build system

From collectd Wiki
Revision as of 05:34, 29 April 2011 by (talk) (autoconf)

Jump to: navigation, search

This page described collectd's build system, which is based on autoconf and automake.

Starting with Version 4.1 the dependency checking is done in the configure script with version 4.1. The plugins are automatically enabled or disabled, depending on whether their dependencies are met (or not) and the --enable-plugin argument can be used to force the plugin to be enabled or disabled.

Wow! That's a really neat awnesr!


The AC_PLUGIN macro (see above) sets a conditional to be used in src/, the input files for automake. There are multiple's, one in each directory. If you want to add your own plugin to src/, the on in that directory is the one you need to edit. The conditionals are named BUILD_PLUGIN_PLUGIN. Conditionals are similar to #ifdef preprocessor statements in C: They surround the block that defines the plugin so that it's only build if the conditional is true. A typical block looks like this:

foobar_la_SOURCES = foobar.c
foobar_la_LDFLAGS = -module -avoid-version
collectd_LDADD += "-dlopen"
collectd_DEPENDENCIES +=

Again, your best bet is to copy an existing block and adapt it to your needs.

Generating configure and

After you have made your changes you need to generate the configure-script and some's. This can be done by simply typing make if you already have a configure script (the generated Makefile will check if it needs to re-generate the auto{conf,make} stuff) or by running the script from the Git repository. After that you should be ready to go.