[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Finding "config.h" in VPATH builds

From: David Bruce
Subject: Finding "config.h" in VPATH builds
Date: Sat, 19 Sep 2009 17:43:54 -0500

I have a project with all the source files in a src directory just
below trunk, which is where the top level and
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.

>From the Autoconf manual:

"To provide for VPATH builds, remember to pass the C compiler a -I.
option (or -I..; whichever directory contains config.h). Even if you
use ‘#include "config.h"’, the preprocessor searches only the
directory of the currently read file, i.e., the source directory, not
the build directory.
With the appropriate -I option, you can use ‘#include <config.h>’.
Actually, it's a good habit to use it, because in the rare case when
the source directory contains another config.h, the build directory
should be searched first."

This seems to say that I need to pass a "-I.." option, because
config.h is located at ../config.h relative to the source files.

My question is how should I best do this?  I have tried adding "-I.."
to  AM_CPPFLAGS in src/, but it does not appear to work.

(I might add that the project built fine using #include "config.h" as
either VPATH or in-tree until a lot of code got added by several
contributors over the summer, and I can't seem to track down the
change that broke the VPATH builds.)

Thanks for any help,

David Bruce

reply via email to

[Prev in Thread] Current Thread [Next in Thread]