autoconf
[Top][All Lists]
Advanced

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

Re: Get rid of `-g' in CXXFLAGS


From: Guido Draheim
Subject: Re: Get rid of `-g' in CXXFLAGS
Date: Sat, 02 Aug 2003 08:54:32 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030313



Braden McDaniel wrote:
On Fri, 2003-08-01 at 23:44, Harlan Stenn wrote:

It's not that hard to get rid of a flag.

nCFLAGS=
for i in $CFLAGS
do
  case "$i" in
    -g) ;;
    *) nCFLAGS="$nCFLAGS $i" ;;
  esac
done
CFLAGS=nCFLAGS


That will also purge -g if it was added explicitly by the user.



WTF *aaaaaaaaaaaaaaaaarrrrrrgh* did anyone try the excercise? Anyone?

Okay, since it seems not to be the case these days to follow advise,
here is the breakdown of it:

IF you write `configure "CXXFLAGS="` THEN
   you will see that "-g -O2" was _not_ added as default to C(XX)FLAGS

WHAT do we learn from it? Those defaults are only applied when the
user did _not_ explicitly set some flags at configure time.

What leads that to? It *IS* possible to change the behavior of the
AC_PROG_(CC|CXX) macro by making sure the C(XX)FLAGS are *set* before.

How to do that? Before implanting the AC_PROG_(CC|CXX) macro into
the configure.ac script, write something like

test ".$CXXFLAGS" = "." && CXXFLAGS=""

Note however that also the default of "-O2" for gcc is being
spilled as well. So you may need to add that later on. If you
need an example to copy&paste, use this:

test ".$CFLAGS" = "." && CFLAGS=""
AC_PROG_CC
test ".$CFLAGS" = "." && test "$GCC" = "yes" && CFLAGS="-O3"

end of thread.
-- guido                                http://AC-Archive.sf.net
GCS/E/S/P C++/++++$ ULHS L++w- N++@ d(+-) s+a- r+@>+++ y++ 5++X-





reply via email to

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