This is the mail archive of the gcc@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: GCC 2.95 does not look in /usr/local/include


I believe that there is a subtle difference between a `make bootstrap'
and simply typing `make'.  A gcc built with `make bootstrap' correctly
looks in `/usr/local/include' (even if configured with `--prefix=/usr').
But if you try to build gcc by simply typing `make' in the toplevel
directory (and configured with `--prefix=/usr') you end up with a gcc
that uses `/usr/include' for LOCAL_INCLUDE_DIR, and therefore does not
search /usr/local/include by default.

Now why is this?

The gcc Makefile (see gcc/Makefile.in) contains the line

   # Directory in which to put localized header files. On the systems with
   # gcc as the native cc, `local_prefix' may not be `prefix' which is
   # `/usr'.
   # NOTE: local_prefix *should not* default from prefix.
   local_prefix = @local_prefix@

and further down

   includedir = $(local_prefix)/include

configure substitutes @local_prefix@ with whatever the user passes
with --with-local-prefix, which is /usr/local by default.  This means
that includedir (which is used as LOCAL_INCLUDE_DIR) would be
/usr/local/include by default.

However, the toplevel Makefile uses the standard meaning for
`includedir', and defines it as

   includedir = $(prefix)/include

which is /usr/include if one configures with `--prefix=/usr'.

Now when the toplevel makefile invokes make for the gcc subdirectory,
it passes most configurable variables as arguments on the command
line.  Among them is `includedir', which overrides the definition of
that variable in the gcc Makefile.  By the way, this means that real
bad things can happen since LOCAL_INCLUDE_DIR is searched before
GCC_INCLUDE_DIR.

But why does `make bootstrap' produce correct results?  Look again at
the gcc Makefile.  The bootstrap target does a couple of makes,
without passing all the configuration variables.  So when the various
stages are built, the definition of includedir is not overridden and
we get a gcc that correctly searches /usr/local/include.

IMHO the correct solution for this problem is to rename includedir to
localincludedir (in the gcc Makefile only of course).  Even though the
recommended way of building gcc via `make bootstrap' works correctly.  

Indeed HJ's patch has nothing to do with this problem!

Mark


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