How to find out about system paths?

Michael Meissner meissner@cygnus.com
Mon Dec 11 22:45:00 GMT 2000


On Mon, Dec 11, 2000 at 09:20:09PM -0800, Stephen C. Biggs wrote:
> I have seen this question addressed in the Usenet group a few times 
> with not a reply.  I'll try here.
> 
> I see all over the documentation about "default system paths" that 
> gcc uses and that you can modify them with -isystem, and a myriad 
> of other options.
> 
> My question is: how do you see what your local version has already 
> defined... AND how hard is it to define it system-wide?  I would like 
> to be able to have /usr/local/include come before /usr/include and 
> the "fixedheader" directory... also /usr/local/lib before /lib,

In terms of seeing what the search order is, the -print-search-dirs option will
tell you the locations gcc looks for programs and libraries:

--> gcc -print-search-dirs
install: /usr/cygnus/gcc-2.95.2/lib/gcc-lib/i686-linux/2.95.2/
programs: /usr/cygnus/gcc-2.95.2/lib/gcc-lib/i686-linux/2.95.2/:/usr/cygnus/gcc-2.95.2/lib/gcc-lib/i686-linux/:/usr/lib/gcc/i686-linux/2.95.2/:/usr/lib/gcc/i686-linux/:/usr/cygnus/gcc-2.95.2/i686-linux/bin/i686-linux/2.95.2/:/usr/cygnus/gcc-2.95.2/i686-linux/bin/
libraries: /usr/cygnus/gcc-2.95.2/lib/gcc-lib/i686-linux/2.95.2/:/usr/lib/gcc/i686-linux/2.95.2/:/usr/cygnus/gcc-2.95.2/i686-linux/lib/i686-linux/2.95.2/:/usr/cygnus/gcc-2.95.2/i686-linux/lib/:/usr/cygnus/gcc-2.95.2/lib/i686-linux/2.95.2/:/usr/cygnus/gcc-2.95.2/lib/:/lib/i686-linux/2.95.2/:/lib/:/usr/lib/i686-linux/2.95.2/:/usr/lib/

> something along the lines of:
> $something_include$=/usr/local/include:/usr/include
> 
> etc... since I would rather not have to pass this through every 
> makefile...
> 
> Please forgive the newbie question.

The simplest way is to make your own gcc shell script that invokes the real gcc
with any options you specify and then passing the other options, and put it in
your PATH environment variable before the location where the real gcc is stored
such as /usr/local/bin or /usr/bin.

-- 
Michael Meissner, Red Hat, Inc.
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work:	  meissner@redhat.com		phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org	fax:   +1 978-692-4482


More information about the Gcc mailing list