diff options
author | Douglas Russel <puggy@gentoo.org> | 2003-10-31 23:03:40 +0000 |
---|---|---|
committer | Douglas Russel <puggy@gentoo.org> | 2003-10-31 23:03:40 +0000 |
commit | 32c52c520b55326e26b7ed1605686dad4e1fd619 (patch) | |
tree | a7c357d0b2a3e7eed360c0432bab902759fe7678 /eclass/flag-o-matic.eclass | |
parent | Added to ~ppc (diff) | |
download | gentoo-2-32c52c520b55326e26b7ed1605686dad4e1fd619.tar.gz gentoo-2-32c52c520b55326e26b7ed1605686dad4e1fd619.tar.bz2 gentoo-2-32c52c520b55326e26b7ed1605686dad4e1fd619.zip |
Added strip-unsupported-flags as per bug #26390
Diffstat (limited to 'eclass/flag-o-matic.eclass')
-rw-r--r-- | eclass/flag-o-matic.eclass | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass index 492df55e42d2..7bd80f3a4833 100644 --- a/eclass/flag-o-matic.eclass +++ b/eclass/flag-o-matic.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.28 2003/10/26 00:40:52 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.29 2003/10/31 23:03:40 puggy Exp $ # # Author Bart Verwilst <verwilst@gentoo.org> @@ -26,6 +26,10 @@ INHERITED="$INHERITED $ECLASS" # Strip C[XX]FLAGS of everything except known # good options. # +#### strip-unsupported-flags #### +# Strip C[XX]FLAGS of any flags not supported by +# installed version of gcc +# #### get-flag <flag> #### # Find and echo the value for a particular flag # @@ -178,6 +182,27 @@ strip-flags() { export CXXFLAGS="${NEW_CXXFLAGS}" } +test_flag () { + if gcc -S -xc $1 -o /dev/null /dev/null >/dev/null 2>&1; then + echo "$1" + fi +} + +strip-unsupported-flags() { + for x in ${CFLAGS} + do + NEW_CFLAGS=${NEW_CFLAGS}" ""`test_flag ${x}`" + done + + for x in ${CXXFLAGS} + do + NEW_CXXFLAGS=${NEW_CXXFLAGS}" ""`test_flag ${x}`" + done + + CFLAGS="${NEW_CFLAGS}" + CXXFLAGS="${NEW_CXXFLAGS}" +} + get-flag() { local findflag="$1" for f in ${CFLAGS} ${CXXFLAGS} ; do |