automake
[Top][All Lists]
Advanced

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

Re: Why I can not overwrite CXXFLAGS values?


From: Ralf Wildenhues
Subject: Re: Why I can not overwrite CXXFLAGS values?
Date: Sat, 14 Jun 2008 11:07:36 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hello Steven,

* Steven Woody wrote on Sat, Jun 07, 2008 at 04:01:06PM CEST:
> On Sat, Jun 7, 2008 at 3:38 PM, Ralf Wildenhues <address@hidden> wrote:
> 
> > That said, you can
> >  CXXFLAGS =
> >  AM_CXXFLAGS = $(CXXFLAGS)
> >  xxx_CXXFLAGS = -O0
> 
> Set AM_ and xxx_ both?  Manual said, only one of them will be used.

Yes, that is right.  For the sources of xxx, xxx_CXXFLAGS will be used.
For all sources in this Makefile.am which do not have per-target flags,
AM_CXXFLAGS will be used.  I figured you might have other sources in
that file that wanted no special treatment.

> > Alternatively, you can modify $CXXFLAGS within configure.ac; find out
> > whether CXXFLAGS was set by the user _before_ AC_PROG_CXX, and if it
> > wasn't, you can default it to your liking.
> 
> How?  Thanks.

Example:

if test x"${CXXFLAGS+set}" = xset; then
  # the user set CXXFLAGS; don't override it.
  flags_were_set=true
else
  flags_were_set=false
fi

# This macro will set suitable CXXFLAGS (-g if possible, additionally
# -O2 if using g++), if CXXFLAGS were not set by the user.
AC_PROG_CXX

if $flags_were_set; then
  ...
else
  ...
fi

A similar scheme comes up here regularly.

Cheers,
Ralf




reply via email to

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