| 1 | # Copyright 1999-2011 Gentoo Foundation |
1 | # Copyright 1999-2011 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.167 2012/01/14 09:10:54 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.168 2012/01/16 20:03:32 vapier Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: flag-o-matic.eclass |
5 | # @ECLASS: flag-o-matic.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # toolchain@gentoo.org |
7 | # toolchain@gentoo.org |
| 8 | # @BLURB: common functions to manipulate and query toolchain flags |
8 | # @BLURB: common functions to manipulate and query toolchain flags |
| … | |
… | |
| 345 | return 0 |
345 | return 0 |
| 346 | } |
346 | } |
| 347 | |
347 | |
| 348 | test-flag-PROG() { |
348 | test-flag-PROG() { |
| 349 | local comp=$1 |
349 | local comp=$1 |
| 350 | local flags="$2" |
350 | local flag=$2 |
| 351 | |
351 | |
| 352 | [[ -z ${comp} || -z ${flags} ]] && return 1 |
352 | [[ -z ${comp} || -z ${flag} ]] && return 1 |
| 353 | |
353 | |
| 354 | # use -c so we can test the assembler as well |
354 | # use -c so we can test the assembler as well |
| 355 | local PROG=$(tc-get${comp}) |
355 | local PROG=$(tc-get${comp}) |
| 356 | ${PROG} ${flags} -c -o /dev/null -xc /dev/null \ |
356 | ${PROG} "${flag}" -c -o /dev/null -xc /dev/null \ |
| 357 | > /dev/null 2>&1 |
357 | > /dev/null 2>&1 |
| 358 | } |
358 | } |
| 359 | |
359 | |
| 360 | # @FUNCTION: test-flag-CC |
360 | # @FUNCTION: test-flag-CC |
| 361 | # @USAGE: <flag> |
361 | # @USAGE: <flag> |