[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Finding "config.h" in VPATH builds
From: |
Ralf Wildenhues |
Subject: |
Re: Finding "config.h" in VPATH builds |
Date: |
Mon, 21 Sep 2009 19:34:23 +0200 |
User-agent: |
Mutt/1.5.20 (2009-08-09) |
* David Bruce wrote on Sun, Sep 20, 2009 at 12:43:54AM CEST:
> I have a project with all the source files in a src directory just
> below trunk, which is where the top level configure.ac and Makefile.am
> live. When I run configure, config.h is created at build/config.h.
> If I run configure from within trunk, make works successfully, but if
> I do a VPATH build I get errors because config.h is not located. If I
> change ' #include "config.h" ' to ' #include ../config.h" ', it works
> as either a VPATH build or an in-tree build. I'm not sure this is the
> right way to address this, however.
If you are using Automake, then _not_ using the option 'nostdinc' will
cause the right include paths to be added to preprocessor invocations,
so that
#include <config.h>
should work for both in-tree and VPATH builds. No need to add any other
include flags manually:
<http://www.gnu.org/software/automake/manual/html_node/Program-Variables.html>
(This is implemented internally with the DEFAULT_INCLUDES variable, as
John already explained.)
And BTW, if you are ever including paths to build and source tree
locations manually, that coincide when building in-tree, then you should
list the build tree path first, for consistent semantics, e.g.:
-I. -I$(srcdir)
Cheers,
Ralf