Hello,

I am trying to figure a way to make gcc list all the directories in which it searches for libraries (by default with no -Ldir option supplied) - the so called link path or library search path.

What I want is something similar to the way gcc searches for include directories:

`gcc -print-prog-name=cc1` -v

or

cpp -v

since include is more of a preprocessor stuff.

The best I could do was to use gcc with the -print-search-dirs option but although I obtain a listing of what it appears to lib directories, I am confused:
1) it lists, among other things stuff like:
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../../../x86_64-linux-gnu/lib/
which I don't know how to interpret it or say what it means. Here is the full output:
Code:
install: /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/
programs: =/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../../../x86_64-linux-gnu/bin/x86_64-linux-gnu/4.5.2/:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../../../x86_64-linux-gnu/bin/
libraries: =/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../../../x86_64-linux-gnu/lib/x86_64-linux-gnu/4.5.2/:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../../../x86_64-linux-gnu/lib/:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../x86_64-linux-gnu/4.5.2/:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../:/lib/x86_64-linux-gnu/4.5.2/:/lib/:/usr/lib/x86_64-linux-gnu/4.5.2/:/usr/lib/:/usr/lib/x86_64-linux-gnu/x86_64-linux-gnu/4.5.2/:/usr/lib/x86_64-linux-gnu/
pts@hal9000:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2$ gcc -print-search-dirs
2) shouldn't /usr/local/lib be present in the output given by -print-search-dirs option?

I've searched through the ld options also but couldn't find anything useful.