[collectd] [PATCH] Allow out-of-tree builds

Dan Fandrich dan at coneharvesters.com
Mon Feb 4 23:16:00 CET 2013


On Sun, Feb 03, 2013 at 01:17:24PM +0100, Florian Forster wrote:
> > +AM_CPPFLAGS += -I$(top_builddir)/src/libcollectdclient/collectd
> 
> Since binaries using the library need to get linked to it, and not all
> binaries are, I think I'd rather add this to the binary specific CPP
> flags, i.e.:
>
> collectd{_nagios,ctl,_tg}_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/src/libcollectdclient/collectd

That makes perfect sense.

> I was wondering why we don't run into the same problem with the
> autogenerated "src/config.h". I believe the reason is the
> AC_CONFIG_HEADERS() macro which, I believe, adds $(top_builddir)/src to
> the include list. 

That sounds like a reasonable assumption. It does look like it's happening
automatically.

> My attempts to solving this problem using this macro
> failed, however, because it seems that the semantic of
> AC_CONFIG_HEADERS() and AC_CONFIG_FILES() differ quite dramatically: The
> former doesn't expand the @FOO@ placeholders, making the macro unusable
> for the use-case of "lcc_features.h".
> 
> "It seems", because I fail to parse the documentation. It reads:
> 
> "Make AC_OUTPUT create the file(s) in the blank-or-newline-separated
> list header containing C preprocessor #define statements, and replace
> ‘@DEFS@’ in generated files with -DHAVE_CONFIG_H instead of the value of
> DEFS."
> 
> Do you happen to have an idea if I'm doing something wrong here? I think
> adding the builddir to the include paths is probably going to be the
> easiest and most straight forward solution and I'll do that for now.

If your hypothesis is correct, then I don't see another way. It's automake
that's doing this, not autoconf, which means that it must be treating
some macros specially. If it doesn't give AC_CONFIG_FILES this special
treatment, then that path will have to be added manually. Which I don't
think is an ugly solution.

>>> Dan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 308 bytes
Desc: not available
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20130204/f20e8a83/attachment.pgp>


More information about the collectd mailing list