/[gentoo-x86]/eclass/flag-o-matic.eclass
Gentoo

Diff of /eclass/flag-o-matic.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.28 Revision 1.29
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.28 2003/10/26 00:40:52 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.29 2003/10/31 23:03:40 puggy Exp $
4# 4#
5# Author Bart Verwilst <verwilst@gentoo.org> 5# Author Bart Verwilst <verwilst@gentoo.org>
6 6
7ECLASS=flag-o-matic 7ECLASS=flag-o-matic
8INHERITED="$INHERITED $ECLASS" 8INHERITED="$INHERITED $ECLASS"
23# Matches only complete a flag 23# Matches only complete a flag
24# 24#
25#### strip-flags #### 25#### strip-flags ####
26# Strip C[XX]FLAGS of everything except known 26# Strip C[XX]FLAGS of everything except known
27# good options. 27# good options.
28#
29#### strip-unsupported-flags ####
30# Strip C[XX]FLAGS of any flags not supported by
31# installed version of gcc
28# 32#
29#### get-flag <flag> #### 33#### get-flag <flag> ####
30# Find and echo the value for a particular flag 34# Find and echo the value for a particular flag
31# 35#
32#### replace-sparc64-flags #### 36#### replace-sparc64-flags ####
176 180
177 export CFLAGS="${NEW_CFLAGS}" 181 export CFLAGS="${NEW_CFLAGS}"
178 export CXXFLAGS="${NEW_CXXFLAGS}" 182 export CXXFLAGS="${NEW_CXXFLAGS}"
179} 183}
180 184
185test_flag () {
186 if gcc -S -xc $1 -o /dev/null /dev/null >/dev/null 2>&1; then
187 echo "$1"
188 fi
189}
190
191strip-unsupported-flags() {
192 for x in ${CFLAGS}
193 do
194 NEW_CFLAGS=${NEW_CFLAGS}" ""`test_flag ${x}`"
195 done
196
197 for x in ${CXXFLAGS}
198 do
199 NEW_CXXFLAGS=${NEW_CXXFLAGS}" ""`test_flag ${x}`"
200 done
201
202 CFLAGS="${NEW_CFLAGS}"
203 CXXFLAGS="${NEW_CXXFLAGS}"
204}
205
181get-flag() { 206get-flag() {
182 local findflag="$1" 207 local findflag="$1"
183 for f in ${CFLAGS} ${CXXFLAGS} ; do 208 for f in ${CFLAGS} ${CXXFLAGS} ; do
184 if [ "${f/${findflag}}" != "${f}" ] ; then 209 if [ "${f/${findflag}}" != "${f}" ] ; then
185 echo "${f/-${findflag}=}" 210 echo "${f/-${findflag}=}"

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.29

  ViewVC Help
Powered by ViewVC 1.1.20