autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: debug builds with NO optimizations


From: Brian Dessent
Subject: Re: debug builds with NO optimizations
Date: Mon, 06 Feb 2006 16:25:04 -0800

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.

"-g -O2" is simply a default if CFLAGS is not already set.  It is by no
means set in stone, and in fact any package that insists on a particular
setting of CFLAGS is broken since this is meant to be a user-supplied
variable.  You are expected to set CFLAGS when configuring if you want
something else.  For example if you have a package and you want to build
it both optimized without debug information as well as a debug build:

$ mkdir build-release && cd build-release
$ CFLAGS="-g0 -O2" ../configure --prefix=/opt/foobar && make
$ cd ..
$ mkdir build-debug && cd build-debug
$ CFLAGS="-g -O0" ../configure --prefix=/opt/foobar && make

Brian




reply via email to

[Prev in Thread] Current Thread [Next in Thread]