/[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.181 Revision 1.182
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2012 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.181 2012/11/11 20:00:57 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.182 2012/11/18 08:27:00 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
383 return 0 383 return 0
384} 384}
385 385
386test-flag-PROG() { 386test-flag-PROG() {
387 local comp=$1 387 local comp=$1
388 local flag=$2 388 local lang=$2
389 local flag=$3
389 390
390 [[ -z ${comp} || -z ${flag} ]] && return 1 391 [[ -z ${comp} || -z ${flag} ]] && return 1
391 392
392 # use -c so we can test the assembler as well 393 # use -c so we can test the assembler as well
393 local PROG=$(tc-get${comp}) 394 local PROG=$(tc-get${comp})
394 ${PROG} "${flag}" -c -o /dev/null -xc /dev/null \ 395 ${PROG} "${flag}" -c -o /dev/null -x${lang} /dev/null \
395 > /dev/null 2>&1 396 > /dev/null 2>&1
396} 397}
397 398
398# @FUNCTION: test-flag-CC 399# @FUNCTION: test-flag-CC
399# @USAGE: <flag> 400# @USAGE: <flag>
400# @DESCRIPTION: 401# @DESCRIPTION:
401# Returns shell true if <flag> is supported by the C compiler, else returns shell false. 402# Returns shell true if <flag> is supported by the C compiler, else returns shell false.
402test-flag-CC() { test-flag-PROG "CC" "$1"; } 403test-flag-CC() { test-flag-PROG "CC" c "$1"; }
403 404
404# @FUNCTION: test-flag-CXX 405# @FUNCTION: test-flag-CXX
405# @USAGE: <flag> 406# @USAGE: <flag>
406# @DESCRIPTION: 407# @DESCRIPTION:
407# Returns shell true if <flag> is supported by the C++ compiler, else returns shell false. 408# Returns shell true if <flag> is supported by the C++ compiler, else returns shell false.
408test-flag-CXX() { test-flag-PROG "CXX" "$1"; } 409test-flag-CXX() { test-flag-PROG "CXX" c++ "$1"; }
409 410
410# @FUNCTION: test-flag-F77 411# @FUNCTION: test-flag-F77
411# @USAGE: <flag> 412# @USAGE: <flag>
412# @DESCRIPTION: 413# @DESCRIPTION:
413# Returns shell true if <flag> is supported by the Fortran 77 compiler, else returns shell false. 414# Returns shell true if <flag> is supported by the Fortran 77 compiler, else returns shell false.
414test-flag-F77() { test-flag-PROG "F77" "$1"; } 415test-flag-F77() { test-flag-PROG "F77" f77 "$1"; }
415 416
416# @FUNCTION: test-flag-FC 417# @FUNCTION: test-flag-FC
417# @USAGE: <flag> 418# @USAGE: <flag>
418# @DESCRIPTION: 419# @DESCRIPTION:
419# Returns shell true if <flag> is supported by the Fortran 90 compiler, else returns shell false. 420# Returns shell true if <flag> is supported by the Fortran 90 compiler, else returns shell false.
420test-flag-FC() { test-flag-PROG "FC" "$1"; } 421test-flag-FC() { test-flag-PROG "FC" f95 "$1"; }
421 422
422test-flags-PROG() { 423test-flags-PROG() {
423 local comp=$1 424 local comp=$1
424 local flags 425 local flags
425 local x 426 local x

Legend:
Removed from v.1.181  
changed lines
  Added in v.1.182

  ViewVC Help
Powered by ViewVC 1.1.20