Tuesday 30 May 2006 07:41 skrev Graham Murray:
> > Besides, by looking at the terminal while merging packages, you will
> > soon notice, that lot's of packages add their very own CFLAGS to your
> > default ones. For example mplayer or xine-lib was compiled with '-O3' on
> > my system, allthough i have '-O2' in my CFLAGS. (As far as i know, "gcc
> > -O3 -O2" == "gcc -O3").
>
> Where packages do this, should they not filter out the appropriate
> flags from the user's CFLAGS and substitute their flags rather than
> having both flags on the command line?

Not in this particular case. xine-lib is a good example. src_compile() 
contains the following in the ebuild (and more):

if [[ $(tc-arch) == "x86" ]]; then
        filter-flags -fforce-addr
        filter-flags -momit-leaf-frame-pointer
        is-flag -O? || append-flags -O2
fi

On an x86 architecture it filters out -fforce-addr 
and -momit-leaf-frame-pointer. If the CFLAGS contain any optimizations it 
just appends -O2 yielding that -O2 will be used as stated by Christian 
Limberg. In 'man gcc' you find the following statement:

"If you use multiple -O options, with or without level numbers, the last such 
option is the one that is effective."

So this is completely legal.

And I very much doubt that there are any ebuilds in the portage tree that 
enforces -O3 or higher...

-- 
Bo Andresen

Attachment: pgpOKLCaIKAJa.pgp
Description: PGP signature

Reply via email to