On Sat, 2011-01-22 at 11:16 +0100, Ralf Corsepius wrote:
> On 01/22/2011 03:50 AM, Sergio Belkin wrote:
> > I answer myself: RTMF :)
> >
> > "If using the GNU C compiler, set shell variable GCC to βyesβ. If
> > output variable CFLAGS was not already set, set it to -g -O2 for the
> > GNU C compiler (-O2 on systems where GCC does not accept -g), or -g
> > for other compilers. If your package does not like this default, then
> > it is acceptable to insert the line β: ${CFLAGS=""}β after AC_INIT and
> > before AC_PROG_CC to select an empty default instead. "
>
> That's only half of the story ("-O2 -g is gcc-specific").
>
> CXXFLAGS needs to stay overridable from the configure command-line
> (configure CXXFLAGS="..." and from the envirionment
> (CXXFLAGS="..." configure).
A lot of packages seem to do this
cflags_save="$CFLAGS"
AC_PROG_CC
CFLAGS="$cflags_save"
and ditto for CXXFLAGS, CPPFLAGS as appropriate. Doesn't seem to cause
problems, although pathalogically, if you had a C compiler that required
an flag to work at all, then it would break that case.
This allows CFLAGS from the environment through bug suppresses the -O2
-g from the macro (in the case I use it, there is a separate --debug
option which adds -g back in if the other libraries are built to work
with it).
Richard
_______________________________________________
Autoconf mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/autoconf