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: Wed, 28 Sep 2005 06:16:07 +0200

On Tue, 2005-09-27 at 12:53 +0200, Harald Dunkel wrote:
> 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.
It's not weird at all.

autoconf sets CFLAGS/CXXFLAGS to "reasonable defaults", that's all. If
these defaults cause problems on your platforms, you have to override
them.

>  Are there any other flags the user has to
> reset to get the flags specified by the developer?
They are all documented and should even be mentioned in a configure
script's --help ("configure --help").

> 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.
Again, the flags autoconf sets are just arbitrary defaults. They are not
any better or worse than any other implicit or explicit defaults being
involved somewhere else.

> > 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).
Yes, you as a package developer, are supposed to let them pass through
unchanged, if a user specifies them.

However, if you don't like these defaults, technically, nothing prevents
you from changing them. Just add something like this near to the
beginnig of your configure.ac:
CFLAGS=${CFLAGS-""}
CXXFLAGS=${CXXFLAGS-""}

Ralf







reply via email to

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