| 1 | # Copyright 1999-2004 Gentoo Foundation |
1 | # Copyright 1999-2004 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.73 2004/10/13 14:11:52 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.74 2004/10/21 07:40:47 kugelfang 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" |
| … | |
… | |
| 10 | # Please leave ${IUSE} in this until portage .51 is stable, otherwise |
10 | # Please leave ${IUSE} in this until portage .51 is stable, otherwise |
| 11 | # IUSE gets clobbered. |
11 | # IUSE gets clobbered. |
| 12 | IUSE="${IUSE} debug" |
12 | IUSE="${IUSE} debug" |
| 13 | |
13 | |
| 14 | # need access to emktemp() |
14 | # need access to emktemp() |
| 15 | inherit eutils |
15 | inherit eutils toolchain-funcs |
| 16 | |
16 | |
| 17 | # |
17 | # |
| 18 | #### filter-flags <flags> #### |
18 | #### filter-flags <flags> #### |
| 19 | # Remove particular flags from C[XX]FLAGS |
19 | # Remove particular flags from C[XX]FLAGS |
| 20 | # Matches only complete flags |
20 | # Matches only complete flags |
| … | |
… | |
| 348 | # actually -WORKS-. non-multilib gcc will take both -m32 and -m64! |
348 | # actually -WORKS-. non-multilib gcc will take both -m32 and -m64! |
| 349 | # please dont replace this function with test_flag in some future |
349 | # please dont replace this function with test_flag in some future |
| 350 | # clean-up! |
350 | # clean-up! |
| 351 | local temp="$(emktemp)" |
351 | local temp="$(emktemp)" |
| 352 | echo "int main() { return(0); }" > ${temp}.c |
352 | echo "int main() { return(0); }" > ${temp}.c |
|
|
353 | MY_CC=$(tc-getCC) |
| 353 | ${CC/ .*/} -m64 -o "$(emktemp)" ${temp}.c > /dev/null 2>&1 |
354 | ${MY_CC/ .*/} -m64 -o "$(emktemp)" ${temp}.c > /dev/null 2>&1 |
| 354 | local ret=$? |
355 | local ret=$? |
| 355 | rm -f ${temp}.c |
356 | rm -f ${temp}.c |
| 356 | [ "$ret" != "1" ] && return 0 |
357 | [ "$ret" != "1" ] && return 0 |
| 357 | return 1 |
358 | return 1 |
| 358 | } |
359 | } |
| … | |
… | |
| 362 | # actually -WORKS-. non-multilib gcc will take both -m32 and -m64! |
363 | # actually -WORKS-. non-multilib gcc will take both -m32 and -m64! |
| 363 | # please dont replace this function with test_flag in some future |
364 | # please dont replace this function with test_flag in some future |
| 364 | # clean-up! |
365 | # clean-up! |
| 365 | local temp="$(emktemp)" |
366 | local temp="$(emktemp)" |
| 366 | echo "int main() { return(0); }" > ${temp}.c |
367 | echo "int main() { return(0); }" > ${temp}.c |
|
|
368 | MY_CC=$(tc-getCC) |
| 367 | ${CC/ .*/} -m32 -o "$(emktemp)" ${temp}.c > /dev/null 2>&1 |
369 | ${MY_CC/ .*/} -m32 -o "$(emktemp)" ${temp}.c > /dev/null 2>&1 |
| 368 | local ret=$? |
370 | local ret=$? |
| 369 | rm -f ${temp}.c |
371 | rm -f ${temp}.c |
| 370 | [ "$ret" != "1" ] && return 0 |
372 | [ "$ret" != "1" ] && return 0 |
| 371 | return 1 |
373 | return 1 |
| 372 | } |
374 | } |