[Distutils] How to find out the default include path

M.-A. Lemburg mal@lemburg.com
Wed Oct 23 09:20:01 2002


Pearu Peterson wrote:
> On Wed, 23 Oct 2002, 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
> 
> 
> /lib is used by the system, python related stuff should never go
> there, not even look there.

Ok.

> Under Linux I would suggest the following defaults:
> 
> libs: /usr/local/lib, /opt/lib, /usr/lib
> headers: /usr/local/include, /opt/include, /usr/include

Thanks.

> If it matters, add also <sys.prefix>/lib, <sys.prefix>/include (some
> people install Python with --prefix=$HOME, for example).

Well, these paths are needed to find 3rd party libs to link
against, so I'd suspect that Python dirs are not necessary
on the default paths.

> Also, compilers may use their one include/lib directories, e.g. gcc uses
> <prefix>/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/
> <prefix>/include/g++-v3/

Right, but again, these probably don't contain the libs
I'm looking for in the search for 3rd party libs. Should have
mentioned that before:

The idea is to try the same lookups as the compiler does per
default when you don't pass in any -Ipath options. This is
needed for auto configuration since I have to check lib and
header versions (and sometimes even for naming conflicts)
in these files.

Thanks again,
-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
_______________________________________________________________________
eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
Python Consulting:                               http://www.egenix.com/
Python Software:                    http://www.egenix.com/files/python/