[Distutils] Is there a good way to change compiler options yet?

Damon Fasching fasching@design.lbl.gov
Thu Aug 15 03:46:55 2002


Hi,

This topic has come up before...but the thread from April 2001 may no
longer be authoritative (though it is consistent with Greg's comments in
unixccompiler.py), and Albert's posting from April 2002 did not get a
response, so here it is again.  Is there a way to override the default 
compiler options used by distutils when building a C extension module...or 
should I try Marc's hack from April 2001?

I've tried a couple of things.  To turn off debug I tried making a
setup.cfg with

[build]
debug=0

but -g is still passed to the compiler...failure. (What should those lines
do in the .cfg file if not turn off debug info?)

Even if this had helped, it would not have helped twiddle the opt level,
which I also would like to do, because there is no --blah option to build
corresponding to optimization.  Sooo, to turn off optimization, I tried
adding a

extra_compile_args=["-O0"]

directive to my setup Extension command.  That, unfortunately, did not
remove the original optimization option which distutils was giving to the
compiler.  It did, however, add a -O0 to the end of the compile command.

This suggests a possible very simple solution, unless I am completely
missing something, which is likely the case...

How about having distutils pass NO default arguments to the compiler?
Then, extra_compile_args could be used to define whatever options are
desired.

Thanks for your wisdom,
 Damon

---------

May the lights in The Land of Plenty
  shine on the Truth some day		L Cohen