This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH to fix include paths


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]