 <p>From my poking around, it doesn't look like there's much you can do. You might have luck using <code>autoconf</code> to generate <code>setup.py</code>, or you could use <code>automake</code> and <code>libtool</code> and do the whole thing with autofoo. Automake provides a macro <code>AM_PATH_PYTHON</code> that sets a whole pile of useful variables and gives the following example for declaring an extension module:</p> <pre><code>pyexec_LTLIBRARIES = quaternion.la quaternion_la_SOURCES = quaternion.c support.c support.h quaternion_la_LDFLAGS = -avoid-version -module </code></pre>