Suggestion for --with-local-prefix configure option

David Mazieres dm@reeducation-labor.lcs.mit.edu
Tue Mar 16 10:14:00 GMT 1999


The gcc/egcs --with-local-prefix configure argument seems to confuse a
lot of people, and the default generally seems wrong if --prefix is
something other than /usr/local.  --with-local-prefix specifies a
directory to search before the gcc-specific include files in
.../gcc-lib/...  Currently the option always defaults to /usr/local,
regardless of --prefix.  I argue that this default is wrong for most
cases.


Case 1:  The compiler is configured with --prefix=/usr.  In this case,
the compiler is being configured to be bundled with an operating
system or replace the bundled compiler.  In this case, the default for
--with-local-prefix should be NONE.

Having /usr/bin/cc search for include files in /usr/local/include by
default has a number of disadvantages.  First of all, having
/usr/local/include in the default include path isn't even all that
useful anyway if /usr/local/lib isn't in the default library search
path.  I've seen autoconf'ed packages search for a package just by
checking for headers.  These programs fail to link because configure
doesn't realize that -L/usr/local/lib was needed.  If local header
files are in fact available by default, then at lesat libraries should
be too.

Second of all, having /usr/local/include in the default include path
can potentially complicate life for anyone actually doing development
work on the operating system.  If I am working on parts of the
operating system (e.g. tools in /usr/bin) and they compile and work
with /usr/bin/cc, it would be nice to know I can commit the changes.
If /usr/local/include is always searched however, I never know if my
code only works because I happen to have a file /usr/local/include
that wasn't bundled with the operating system.


Case 2:  The compiler is being configured with a prefix other than
/usr or /usr/local.  For example, --prefix=/usr/local/egcs.  Here
again, searching /usr/local/include can be harmful.

I've seen sites where for example, someone installed one version of
gcc in /usr/local and one in /usr/local/gcc-2.8.1, without specifying
a local prefix.  These compilers worked for C code and so people
believed the installation was correct.  However,
/usr/local/gcc-2.8.1/c++ ended up getting the wrong g++ include files.
Any C++ code that included header files like <typeinfo> failed to
compile.


Conclusion:  I propose that the defaults for --with-local-prefix be
changed.  In the case that --prefix is /usr, the local-prefix should
be NONE.  In other cases it should be the same as prefix.

Reactions?  Please CC me on any replies, as I am not on the mailing
list.

Thanks,
David


More information about the Gcc mailing list