autoconf
[Top][All Lists]
Advanced

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

Re: why not #include "config.h"?


From: Patrick Welche
Subject: Re: why not #include "config.h"?
Date: Tue, 22 Sep 2009 14:02:28 +0100
User-agent: Mutt/1.5.20 (2009-06-29)

On Tue, Sep 22, 2009 at 10:49:58AM +0200, Steffen Dettmer wrote:
> I hope I don't ask a FAQ. If so, an URL would be appreciated.
> 
> I've read here that someone could (should?) write
>   #include <config.h>
> specifying a system header instead of the IMHO correct
>   #include "config.h"
> 
> As far as I know the difference is that in the first version
> system directories are searched but user directories in the
> second.
> 
> Is this a kind of trick for something?
> Is is guaranteed that all compilers search the user path after
> the system path if the file was not found?

I think this is the relevant part of the autoconf info file:

4.9 Configuration Header Files
==============================
...
   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.


Cheers,

Patrick




reply via email to

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