John Calcote wrote:
Generally, when I build with the DEBUG macro defined, it's because I want to step through a portion of my code with the debugger. However, I've noticed that using AC_PROG_CC sets CFLAGS to "-g -O2" on GCC - and tries to use similar options on other compilers. I really like the use of this macro because it also attempts to put the compiler into standard C mode - which has no standard mechnism, so it really belongs in the macro. I also completely subscribe to the "symbols on all builds" philosophy, so I too would recommend enabling -g-like functionality on all possible compilers for all possible build configurations. What I _don't_ agree with is automatically tacking in a -O2 * who thought that would be a good idea? What we really need is a macro that enables optimization levels (such as -Ox), or completely disables them. Then we can use our various debug flags to enable/disable them conditionally, as maintainer/programmer configuration dictates. My question: Anyone know of a good idiom for managing optimization flags - including disabling the obligatory -O2 placed in CFLAGS by AC_PROG_CC?
I run into this all the time but never bothered to sit down and think of a permanent solution. I always wind up editing the relevant Makefiles and changing
CFLAGS=-g -O2 ... to OPT=-g -O2 CFLAGS=$(OPT) ... and running with "make OPT=-g" when I want a pure debug build. -- -- Howard Chu Chief Architect, Symas Corp. http://www.symas.com Director, Highland Sun http://highlandsun.com/hyc OpenLDAP Core Team http://www.openldap.org/project/ _______________________________________________ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf