/[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.98 Revision 1.99
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.98 2005/12/09 18:40:11 fmccor Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.99 2005/12/09 20:43:41 azarah Exp $
4 4
5 5
6# need access to emktemp() 6# need access to emktemp()
7inherit eutils toolchain-funcs multilib 7inherit eutils toolchain-funcs multilib
8 8
311test-flag-CC() { test-flag-PROG "CC" "$1"; } 311test-flag-CC() { test-flag-PROG "CC" "$1"; }
312 312
313# Returns true if C++ compiler support given flag 313# Returns true if C++ compiler support given flag
314test-flag-CXX() { test-flag-PROG "CXX" "$1"; } 314test-flag-CXX() { test-flag-PROG "CXX" "$1"; }
315 315
316test-flags() { 316test-flags-PROG() {
317 local comp=$1
318 local flags
317 local x 319 local x
320
321 shift
322
323 [[ -z ${comp} ]] && \
324 return 1
318 325
319 for x in "$@" ; do 326 for x in "$@" ; do
320 test-flag-CC "${x}" || return 1 327 test-flag-${comp} "${x}" && flags="${flags} ${x}"
321 done 328 done
322 329
323 echo "$@" 330 echo "${flags}"
324 331
325 return 0 332 # Just bail if we dont have any flags
333 [[ -n ${flags} ]]
326} 334}
335
336# Returns (echo's) the given flags supported by the C compiler
337test-flags-CC() { test-flags-PROG "CC" "$@"; }
338
339# Returns (echo's) the given flags supported by the C++ compiler
340test-flags-CXX() { test-flags-PROG "CXX" "$@"; }
341
342# Short-hand that should hopefully work for both C and C++ compiler, but
343# its really only present due to the append-flags() abortion.
344test-flags() { test-flags-CC "$@"; }
327 345
328# Depriciated, use test-flags() 346# Depriciated, use test-flags()
329test_flag() { 347test_flag() {
330 addwrite "/dev/stderr" 348 addwrite "/dev/stderr"
331 ewarn "test_flag: deprecated, please use test-flags()!" >/dev/stderr 349 ewarn "test_flag: deprecated, please use test-flags()!" >/dev/stderr
332 350
333 test-flags "$@" 351 test-flags-CC "$@"
334} 352}
335 353
336test_version_info() { 354test_version_info() {
337 if [[ $($(tc-getCC) --version 2>&1) == *$1* ]]; then 355 if [[ $($(tc-getCC) --version 2>&1) == *$1* ]]; then
338 return 0 356 return 0

Legend:
Removed from v.1.98  
changed lines
  Added in v.1.99

  ViewVC Help
Powered by ViewVC 1.1.20