automake
[Top][All Lists]
Advanced

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

Re: Force -O0 flags, inhibit the default -O2 flags


From: Harald Dunkel
Subject: Re: Force -O0 flags, inhibit the default -O2 flags
Date: Tue, 27 Sep 2005 12:53:03 +0200
User-agent: Debian Thunderbird 1.0.2 (X11/20050402)

Ralf Corsepius wrote:
> 
> Nope. You don't seem to have understood how things are working:
> 
> AM_CFLAGS/AM_CXXFLAGS are supposed to take flags having been specified
> by a package's developer.
> 

Understood.

> CFLAGS/CXXFLAGS are suppoed to take flags having been specified by a
> package's installer. Here, "-g -O2" are just "sufficiently reasonable
> defaults", a package installer is supposed to override.
> 

So the user has to write

        make CFLAGS= CXXFLAGS= install

to get the default flags (AM_CXXFLAGS, etc.) provided by the developer?
Sorry, but this is weird. Are there any other flags the user has to
reset to get the flags specified by the developer? Actually the
developer doesn't know, because maybe the next version of autoconf
redefines even more variables that he thought he had set savely in his
Makefile.am. And surely the user doesn't know, either.

IMHO it is not the job of configure to make any assumptions about the
compiler flags the user would like to set. This assumption should be
done by the developer, if he wants to. So my suggestion for autoconf/
automake is still to predefine AM_CXXFLAGS instead of CXXFLAGS.
AM_CXXFLAGS could be overriden by the developer either in configure.ac
or in Makefile.am.

> Now if you really want to hard-code "-O0" (Something rarely useful, it
> indicates the code having real problems), you can either resort to
> per_file flags (lib_X_*) or have to process CFLAGS/CXXFLAGS somewhere
> (either inside of configure.ac or  Makefile.ams).
> 

According to the documentation you (as a developer) are not allowed to
set CFLAGS/CXXFLAGS (Automake manual, 2.5, or GNU Coding Standards).
Setting lib_X_CXXFLAGS is just a special case for AM_CXXFLAGS.

Usually you set -O0 in case of a buggy optimizer, or if the optimization
takes too much time with just a minimum speed/size improvement, etc.
A developer using Automake would have to put

        if AVOID_BUGGY_OPTIMIZER
        AM_CXXFLAGS=-O0
        endif

into his Makefile.am. Unfortunately it is overriden by configure on
behalf of the user.


Regards

Harri




reply via email to

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