[Distutils] How to find out the default include path

Mats Wichmann mats@laplaza.org
Wed Oct 23 10:51:00 2002


At 01:54 PM 10/23/2002 +0200, M.-A. Lemburg wrote:
 >M.-A. Lemburg wrote:
 >> Is there a way to find out the default include path
 >> used by a compiler ? Does distutils have an API for
 >> this ?
 >>
 >> I scanned the code but couldn't find any hint.
 >
 >So far I found these defaults:
 >
 >Linux:
 >    libs:    /lib, /usr/lib
 >    headers: /usr/include

Depends on what you mean by "default" :-)

For any given Linux system, the linker will search
libraries in locations built in to the compilation
system (I think your list is correct there), plus
whatever's listed in /etc/ld.so.conf.  Sometimes
assisted or hampered by what's in /etc/ld.so.cache :-{

Headers are searched in /usr/local/include and
/usr/include, plus a compiler-private directory
(pathname determined by compiler version and
host details).

It's possible, if the compiler indeed is gcc,
to ask the compiler to tell you the path to
the "specs" file for that compiler which you can
then examine to obtain more details than you
wanted....(ahem, I've actually had to do this,
please don't ask why).