autoconf
[Top][All Lists]
Advanced

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

Re: debug builds with NO optimizations


From: Ralf Wildenhues
Subject: Re: debug builds with NO optimizations
Date: Tue, 7 Feb 2006 07:08:37 +0100
User-agent: Mutt/1.5.9i

* Brian Dessent wrote on Tue, Feb 07, 2006 at 05:09:19AM CET:
> Harlan Stenn wrote:
> 
> > That didn't used to be the case, as I remember from the docs.
> > 
> > I do remember (perhaps incorrectly) that the difference was apparent
> > when running "config.status --recheck".
> 
> I am sure there is more to it that I am not aware of.  Otherwise, there
> would be no controversy.

It's exactly that: assignments passed as arguments to `configure' can
easily be recorded; environment variables can't.

> Maybe someone who actually knows something
> about autoconf can say for sure.  But from what I can tell for setting
> CFLAGS, CXXFLAGS, LDFLAGS, and so on, either way of doing it should
> record the choice equally in generated files.

Well, yes, Autoconf had to go the compromise and detect *these* flags
also when they were in the environment.  But it only does so for a few
common variables.  You have to declare a variable as `precious' if you,
the developer, want another variable recorded; see
  info Autoconf 'Setting Output Variables'

You, the user, can still force variable assignments to be recorded even
for non-precious variables by putting them on the configure command
line:
   ../source/configure FOO=bar

So the bottom line is that you should always use this new notation if
dealing with Autoconf 2.50+ generated scripts.

> There is also the the issue of overriding during make, such as "make
> CFLAGS=-O2" which from what I can tell sometimes works and sometimes is
> a bad idea.

It works with GNU make.  Some but not all other make implementations
need something like
  CFLAGS=-O2 make -e

to override the setting of CFLAGS that is already in the Makefile.
This is potentially dangerous: the rest of the environment may slip
into the build process, too.

> It also depends on your platform's make since I think there
> are differences in how these kind of overrides are handled.  But that
> would be another route to try if you wanted to change the build without
> reconfiguring and without making separate build directories.

I usually have a full debugging tree lying around for software that I
debug (i.e., one with `../source/configure CFLAGS=-g CXXFLAGS=-g').

If I casually debug in a large tree, I
  make clean
the interesting sub tree and
  make CFLAGS=-g  (GNU make)   or   CFLAGS=-g make -e   (some others)
it again to disable optimization.

Cheers,
Ralf




reply via email to

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