This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH to fix include paths
- To: Per Bothner <per at bothner dot com>
- Subject: Re: PATCH to fix include paths
- From: Zack Weinberg <zack at codesourcery dot com>
- Date: Thu, 20 Sep 2001 18:42:21 -0700
- Cc: gcc-patches at gcc dot gnu dot org, Neil Booth <neil at daikokuya dot demon dot co dot uk>
- References: <200109140712.f8E7Ch610200@eureka.bothner.com>
On Fri, Sep 14, 2001 at 12:12:43AM -0700, Per Bothner wrote:
> Gcc's use of includedir is rather strange to say the least:
> * $prefix/include is not searched. As this is where various other
> GNU packages install their headers, this is must be fixed.
Apologies for not responding to this earlier. I meant to but then I
got sick and forgot about it.
> The main effective change is to add a new directory to be searched:
> PREFIX_INCLUDE_DIR, defined from $prefix/include. However this is
> only added when $prefix is neither "/usr" nor "/usr/local", since
> in those cases it would be redundant. Thus there should be no
> effective change with either the default $prefix, or when gcc is
> installed in /usr as in making a system distribution; only when
> gcc is installed in a non-default location.
This has been reported a few times as a bug, and I'm glad to see
you've fixed it. I like the patch with only one caveat:
> @@ -1974,7 +1975,8 @@ PREPROCESSOR_DEFINES = \
> -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
> -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_alias)\" \
> -DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \
> - -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
> + -DLOCAL_INCLUDE_DIR=\"$(local_includedir)\" \
> + `test '(' "$(prefix)" != "/usr" ')' -a '(' "$(prefix)" != "/usr/local" ')' && echo -DPREFIX_INCLUDE_DIR=\"$(includedir)\"` \
> -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
> -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\"
I would prefer that you avoid introducing more messy embedded shell
hackery into the Makefile. I'm also concerned that this may force
recompilations if someone builds with one setting of $(prefix) and
installs with a different setting. This is commonly done e.g. when
constructing packages for later installation by some system utility.
(Of course, a lot of these substitution variables already contain
$(prefix) and it hasn't caused problems yet, but let's not tempt
Fate.)
Instead, please establish a new @-substitution in configure.in which
is either the empty string or -DPREFIX_INCLUDE_DIR=\"$(includedir)\",
and use that in PREPROCESSOR_DEFINES.
Note that test A -a B is not reliable. Use test A && test B.
zw