New submission from STINNER Victor <victor.stin...@haypocalc.com>: 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 :-) ---------- components: Build files: configure_cflags.patch keywords: patch messages: 101578 nosy: haypo severity: normal status: open title: configure: ignore AC_PROG_CC hardcoded CFLAGS versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2 Added file: http://bugs.python.org/file16628/configure_cflags.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8211> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com