On Wed, Jan 27, 2010 at 6:58 PM, Floris Bruynooghe <floris.bruynooghe@gmail.com> wrote:
On Wed, Jan 27, 2010 at 10:57:37AM +0900, David Cournapeau wrote:
On Wed, Jan 27, 2010 at 2:30 AM, Torsten Mohr <tmohr@s.netic.de> wrote:
What is the preferred way to make this information available to the compiler so i can use code like #ifdef HOST_posix?
Use a config.h, like autoconf does. Distutils does not make it for you, and plugging the necessary code in distutils to do it is a PITA, but that's doable.
Basically, you need to extend the distutils config command, and goes from there:
Neat, I didn't know that command existed.
class MyConfig(config): def check_headers(self, headers=None):
Why do you define this yourself?
That was just meant as an illustrative purpose - I do not recommend to code things as is :) Note that in practice, this is actually difficult to use for non trivial stuff, because the MyConfig class runs in a difference context than the setup call.
Also, does anyone have an idea why config.check_func() and CCompiler.has_function() basically seem to be doing the same?
Those kind of redundancies are common in distutils - often, they have some small differences in how build directories are set, or things like that, although I was not aware of this redundancy (I avoid CCompiler functions like the plague in numpy.distutils extensions, because their behavior is very platform specific, especially between MS compiler and Unix ones, where the attributes are not the same). David