[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_CONFIG_HEADERS
From: |
Ralf Wildenhues |
Subject: |
Re: AC_CONFIG_HEADERS |
Date: |
Thu, 3 Feb 2011 21:06:56 +0100 |
User-agent: |
Mutt/1.5.20 (2010-08-04) |
Hi Jeff,
* Jeff Squyres wrote on Thu, Feb 03, 2011 at 04:30:24PM CET:
> We recently got bitten by what appears to be undocumented behavior in
> AC_CONFIG_HEADERS (meaning that I couldn't find this behavior
> described in the docs; I might well have missed it...?). It seems
> that AM's version of AC_CONFIG_HEADERS automatically adds a -I to the
> generated file in the build tree.
Well, not completely undocumented, but quite hidden and misplaced in
info Automake "Program Variables":
Automake already provides some `-I' options automatically, in a
separate variable that is also passed to every compilation that
invokes the C preprocessor. In particular it generates `-I.',
`-I$(srcdir)', and a `-I' pointing to the directory holding
`config.h' (if you've used `AC_CONFIG_HEADERS' or
`AM_CONFIG_HEADER'). You can disable the default `-I' options
using the `nostdinc' option.
[...]
> The problem came recently when we added some other files in
> include/hwloc/*.h. One of them had the same name as a system header
> file -- something like this:
>
> include/hwloc.h
> include/hwloc/config.h <-- generated
> include/hwloc/conflicting-name.h <-- /usr/include/conflicting-name.h
> also exists
>
> Some of the source files in our project have #include
> "conflicting-name.h" -- intending to get the system version. But
> since Automake hard-codes -I$(top_builddir)/include/hwloc into
> Makefile.in, our source files are picking up
> include/hwloc/conflicting-name.h, not the system version. Changing
> the source files to #include <conflicting-name.h> doesn't seem to
> help. And since the value is hard-coded in Makefile.in, we can't add
> any m4/shell scripting in configure.ac to filter that -I value out.
> I see the "nostdinc" Automake flag to inhibit adding all -I's, but
> that seems like a bit of overkill for our needs. We *do* want the
> -I's for the AH-generated file, but not for any others. Is there a
> way to do that? Or is there another way to inhibit specific -I's?
Well, currently the only way to work around this is for you to use
the nostdinc option and put
AC_SUBST([DEFAULT_INCLUDES], ['-I. -I$(srcdir) $(top_builddir)/include'])
in configure.ac.
We might want to consider adding options stdinc-ah stdinc-nohdr or so
for generating only include paths for autoheader-generated headers plus
the first two, or the first two only, respectively. (Each with VPATH
simplification I suppose.)
Thanks,
Ralf