Message101578
configure.in uses AC_PROG_CC, extract of the autoconf manual:
(http://www.delorie.com/gnu/docs/autoconf/autoconf_64.html)
If using the GNU C compiler, set shell variable GCC to `yes'. If output variable CFLAGS was not already set, set it to `-g -O2' for the GNU C compiler (`-O2' on systems where GCC does not accept `-g'), or `-g' for other compilers.
Python does already set the optimization level in its OPT variable: for gcc, it uses -O3 by default, and not -O option (in this case, gcc disables all optimisations, it's like -O0) if --with-pydebug is used.
Because of AC_PROG_CC, Python is compiled with -O2 even if --with-pydebug is used, which is bad because it's harder to debug an optimized program: most variable are unavailable (gcc prints "<optimized out>").
Another problem is that AC_PROG_CC eats user CFLAGS. It's not possible to specify: ./configure CFLAGS="myflags".
On the autoconf mailing list, I saw a simple "trick":
Save CFLAGS before you call AC_PROG_CC, and restore it after,
if you don't want "-g -O2".
Attached patch implements that. Results:
* ./configure: CFLAGS=$(BASECFLAGS) $(OPT) $(EXTRA_CFLAGS)
* ./configure --with-pdebug CFLAGS="-O0": CFLAGS=$(BASECFLAGS) -O0 $(OPT) $(EXTRA_CFLAGS)
It works :-) |
|
Date |
User |
Action |
Args |
2010-03-23 12:14:08 | vstinner | set | recipients:
+ vstinner |
2010-03-23 12:14:07 | vstinner | set | messageid: <1269346447.99.0.323336928566.issue8211@psf.upfronthosting.co.za> |
2010-03-23 12:14:06 | vstinner | link | issue8211 messages |
2010-03-23 12:14:05 | vstinner | create | |
|