[Distutils] Autoconf in Python

M.-A. Lemburg mal@lemburg.com
Wed, 21 Jun 2000 09:38:02 +0200

Greg Ward wrote:
> Those of you who follow python-checkins closely probably already know
> this, but for the rest of you I think this will be news:
> I now have a working demonstration of the long-mythical, frequently
> procrastinated, "Autoconf-in-Python"!  Marc-Andre, you were right -- it
> wasn't too bad.  I think I probably spent more time combing the Autoconf
> docs for inspiration, and figuring out how to sensibly translate
> Autoconf's byzantine shell/M4 interface into sensible OO Python, than I
> did actually coding it.

Great :-)
> [...]
> Also, I had to add a 'preprocess()' method to the CCompiler interface,
> which is currently only implemented in UnixCCompiler.  Thus, the
> preprocessor-depending "config" methods ('try_cpp()', 'search_cpp()',
> 'check_header()') will die horribly on Windows and Mac OS.  Please take
> a look at the 'preprocess()' docstring and let me know if it can be
> implemented portably, or if the interface will have to change.
> Oh, Unix wizards: currently I just do "cc -E filename.c -o filename.i"
> to run the preprocessor.  Works with GCC, and ISTR that SGI's compiler
> supports "-E" too.  Anyone know how widely spread this convention is?
> Should I implement some heuristics to figure out whether to use "cc -E"
> or "/lib/cpp"?  What other options are there?

Uhm, why not simply compile the whole thing instead of
just running the preprocessor ? (I think that's how autoconf
does it too)

This would have the advantage of being portable and wouldn't
rely on some commonly used command line flag (note that the
C preprocessor is usually also reachable directly, e.g. on
Linux its /usr/bin/cpp).

Marc-Andre Lemburg
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/