autoconf
[Top][All Lists]
Advanced

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

Re: configure sets CFLAGS or how to disable default CFLAGS='-g -O2' fo


From: Chris Pickett
Subject: Re: configure sets CFLAGS or how to disable default CFLAGS='-g -O2' for gcc?
Date: Tue, 4 Apr 2006 12:12:49 -0400 (EDT)
User-agent: SquirrelMail/1.5.1 [CVS]

On Tue, April 4, 2006 11:13 am, Ralf Corsepius wrote:
> The problem is portability.
>
>
> The "-g -O2" autoconf uses is nothing but a default, which is known to
> be safe on the majority of platforms and therefore is likely to be safe as
> a compromise between "optimization" and "non-optimization".
>
> Anything else is beyond autoconf's scope and beyond your knowledge.

[...]

> In short: You have opened a can of worms, you'd better avoid.

Ok, two things.  First, the Automake manual does describe in some detail
setting CFLAGS (and CPPFLAGS, and so on); see the FAQ entry at the end
about the ordering differences.  If there is a difference between Autoconf
and Automake for specifying different lists of CFLAGS that makes Automake
better for it, I'm failing to see what it is (in particular, because I
want to avoid repetition).  If there is no difference then it appears by
your arguments that the documentation and even support for AM_CFLAGS,
AM_CPPFLAGS, etc. is broken.

Second, how am I actually meant to deal with this situation:

1) I want one set of CFLAGS for all builds that specifies a lot of strictness
2) I want one set of additional CFLAGS for debugging/profiling builds
3) I want one set of additional CFLAGS for optimized/release builds
4) I am willing to change the sets by hand depending on compiler+compiler
version detected; it will be gcc in most if not all cases; I'm also
willing to force compiler upgrades on others.
5) I'd like configure to let me choose between debugging and optimization
(I'll give this up if there is some other easy way).

I'd like to listen to your advice, since obviously you know way more about
this than I do, but if the answer is "hand-craft your own portable
CFLAGS-setting system for use with configure" then basically I'm going to
abuse Autoconf/Automake because it's the least painful way I see of doing
it.  And I thought I was being *good* by not clobbering the environment
CFLAGS!

I guess what's so surprising to me is that in practice I've rarely
encountered an Autotools project that doesn't try to mess with CFLAGS in
some way.  No, I don't have the same breadth of experience as you folk.

Cheers, and thanks,
Chris





reply via email to

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