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-