1 | # Copyright 1999-2003 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2003 Gentoo Technologies, Inc. |
2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.23 2003/07/18 20:11:22 tester Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.24 2003/07/22 12:48:11 aliz Exp $ |
4 | # |
4 | # |
5 | # Author Bart Verwilst <verwilst@gentoo.org> |
5 | # Author Bart Verwilst <verwilst@gentoo.org> |
6 | |
6 | |
7 | ECLASS=flag-o-matic |
7 | ECLASS=flag-o-matic |
8 | INHERITED="$INHERITED $ECLASS" |
8 | INHERITED="$INHERITED $ECLASS" |
… | |
… | |
43 | esac |
43 | esac |
44 | |
44 | |
45 | # C[XX]FLAGS that we are think is ok, but needs testing |
45 | # C[XX]FLAGS that we are think is ok, but needs testing |
46 | # NOTE: currently -Os have issues with gcc3 and K6* arch's |
46 | # NOTE: currently -Os have issues with gcc3 and K6* arch's |
47 | UNSTABLE_FLAGS="-Os -O3 -freorder-blocks -fprefetch-loop-arrays" |
47 | UNSTABLE_FLAGS="-Os -O3 -freorder-blocks -fprefetch-loop-arrays" |
|
|
48 | |
|
|
49 | filter-mfpmath() { |
|
|
50 | for a in $CFLAGS; do |
|
|
51 | if [ "${a:0:8}" == "-mfpmath" ]; then |
|
|
52 | orig_mfpmath=$a |
|
|
53 | fi |
|
|
54 | done |
|
|
55 | |
|
|
56 | mfpmath="$( echo $orig_mfpmath | awk -F '=' '{print $2}' | tr "," " " )" |
|
|
57 | for b in $@; do |
|
|
58 | mfpmath="${mfpmath/$b}" |
|
|
59 | done |
|
|
60 | |
|
|
61 | if [ -z "${mfpmath/ }" ]; then |
|
|
62 | filter-flags "$orig_mfpmath" |
|
|
63 | else |
|
|
64 | new_mfpmath="-mfpmath=$( echo $mfpmath | sed -e "s/ /,/g" -e "s/,,/,/g" )" |
|
|
65 | replace-flags "$orig_mfpmath" "$new_mfpmath" |
|
|
66 | fi |
|
|
67 | } |
48 | |
68 | |
49 | filter-flags() { |
69 | filter-flags() { |
50 | # we do this fancy spacing stuff so as to not filter |
70 | # we do this fancy spacing stuff so as to not filter |
51 | # out part of a flag ... we want flag atoms ! :D |
71 | # out part of a flag ... we want flag atoms ! :D |
52 | export CFLAGS=" ${CFLAGS} " |
72 | export CFLAGS=" ${CFLAGS} " |