| 1 | # Copyright 1999-2005 Gentoo Foundation |
1 | # Copyright 1999-2005 Gentoo Foundation |
| 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.94 2005/10/09 22:28:35 flameeyes Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.95 2005/10/13 05:33:34 vapier Exp $ |
| 4 | |
4 | |
| 5 | |
5 | |
| 6 | # need access to emktemp() |
6 | # need access to emktemp() |
| 7 | inherit eutils toolchain-funcs multilib |
7 | inherit eutils toolchain-funcs multilib |
| 8 | |
8 | |
| … | |
… | |
| 310 | return 1 |
310 | return 1 |
| 311 | fi |
311 | fi |
| 312 | } |
312 | } |
| 313 | |
313 | |
| 314 | strip-unsupported-flags() { |
314 | strip-unsupported-flags() { |
| 315 | local NEW_CFLAGS NEW_CXXFLAGS |
315 | local x NEW_CFLAGS NEW_CXXFLAGS |
| 316 | |
316 | |
| 317 | for x in ${CFLAGS} ; do |
317 | for x in ${CFLAGS} ; do |
| 318 | NEW_CFLAGS="${NEW_CFLAGS} `test_flag ${x}`" |
318 | NEW_CFLAGS="${NEW_CFLAGS} $(test_flag ${x})" |
| 319 | done |
319 | done |
| 320 | for x in ${CXXFLAGS} ; do |
320 | for x in ${CXXFLAGS} ; do |
| 321 | NEW_CXXFLAGS="${NEW_CXXFLAGS} `test_flag ${x}`" |
321 | NEW_CXXFLAGS="${NEW_CXXFLAGS} $(test_flag ${x})" |
| 322 | done |
322 | done |
| 323 | |
323 | |
| 324 | export CFLAGS="${NEW_CFLAGS}" |
324 | export CFLAGS=${NEW_CFLAGS} |
| 325 | export CXXFLAGS="${NEW_CXXFLAGS}" |
325 | export CXXFLAGS=${NEW_CXXFLAGS} |
| 326 | } |
326 | } |
| 327 | |
327 | |
| 328 | get-flag() { |
328 | get-flag() { |
| 329 | local f findflag="$1" |
329 | local f findflag="$1" |
| 330 | |
330 | |
| … | |
… | |
| 412 | # please dont replace this function with test_flag in some future |
412 | # please dont replace this function with test_flag in some future |
| 413 | # clean-up! |
413 | # clean-up! |
| 414 | |
414 | |
| 415 | [ "$(tc-arch)" = "amd64" ] && has_multilib_profile && return 0 |
415 | [ "$(tc-arch)" = "amd64" ] && has_multilib_profile && return 0 |
| 416 | |
416 | |
| 417 | local temp="$(emktemp)" |
417 | local temp=$(emktemp) |
| 418 | echo "int main() { return(0); }" > ${temp}.c |
418 | echo "int main() { return(0); }" > "${temp}".c |
| 419 | MY_CC=$(tc-getCC) |
419 | MY_CC=$(tc-getCC) |
| 420 | ${MY_CC/ .*/} -m32 -o "$(emktemp)" ${temp}.c > /dev/null 2>&1 |
420 | ${MY_CC/ .*/} -m32 -o "$(emktemp)" "${temp}".c > /dev/null 2>&1 |
| 421 | local ret=$? |
421 | local ret=$? |
| 422 | rm -f ${temp}.c |
422 | rm -f "${temp}".c |
| 423 | [ "$ret" != "1" ] && return 0 |
423 | [ "$ret" != "1" ] && return 0 |
| 424 | return 1 |
424 | return 1 |
| 425 | } |
425 | } |
| 426 | |
426 | |
| 427 | replace-sparc64-flags() { |
427 | replace-sparc64-flags() { |