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: Ralf Corsepius
Subject: Re: Force -O0 flags, inhibit the default -O2 flags
Date: Mon, 26 Sep 2005 12:45:53 +0200

On Sun, 2005-09-25 at 08:03 +0200, Harald Dunkel wrote:
> Brian wrote:
> > I have a need to force three files to not be optimized. I've followed the
> > instructions in the manual for setting them up in their own library, and
> > then using LIBADD to combine it with the original library.
> > 
> > If I use AM_CXXFLAGS, the -O0 is superceded by a -O2. The same occurs if I
> > use libx_la_CXXFLAGS. I am not allowed to override CXXFLAGS (and don't want
> > to).
> > 
> > Makefile.am <http://Makefile.am> sample (one or the other):
> > 
> > 
> >    - libx_la_CXXFLAGS = -O0
> >    - AM_CXXFLAGS = -O0
> > 
> 
> 
> According to the documentation AM_CXXFLAGS is ignored for
> building libx.la, if you set libx_la_CXXFLAGS. The problem is
> that something is defining CXXFLAGS. The manual says that
> this variable is reserved to be set by the user on the command
> line (AFAIR). CXXFLAGS has a higher priority than both
> AM_CXXFLAGS and libx_la_CXXFLAGS, i.e. whatever in autoconf/
> automake is defining CXXFLAGS, it overrides the variables set
> by the writer of Makefile.am. I doubt that this is reasonable.
> 
> IMHO autoconf/automake should predefine AM_CXXFLAGS instead.
> CXXFLAGS should be empty. (Actually I would be glad if
> automake would not set any variable to '-g -O2'.)
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.

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.

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).

Ralf






reply via email to

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