From 5965d188e63ce63b04bd9d7d559ca7cba51c1d37 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 26 Oct 2011 23:27:16 +0000 Subject: [PATCH] pull out huse() from toolchain.eclass and into use_if_iuse() in eutils.eclass as this is generally useful --- eclass/eutils.eclass | 13 ++++++++++++- eclass/toolchain.eclass | 25 ++++++++++--------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass index ac6f6849490b..96d562baee8f 100644 --- a/eclass/eutils.eclass +++ b/eclass/eutils.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.366 2011/09/30 16:51:01 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.367 2011/10/26 23:27:16 vapier Exp $ # @ECLASS: eutils.eclass # @MAINTAINER: @@ -2047,6 +2047,17 @@ in_iuse() { has "${flag}" "${liuse[@]#[+-]}" } +# @FUNCTION: use_if_iuse +# @USAGE: +# @DESCRIPTION: +# Return true if the given flag is in USE and IUSE. +# +# Note that this function should not be used in the global scope. +use_if_iuse() { + in_iuse $1 || return 1 + use $1 +} + # @FUNCTION: usex # @USAGE: [true output] [false output] [true suffix] [false suffix] # @DESCRIPTION: diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index e8ef0778fde4..5d1686ff26ce 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.474 2011/10/26 18:54:07 zorry Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.475 2011/10/26 23:27:16 vapier Exp $ # # Maintainer: Toolchain Ninjas @@ -764,9 +764,9 @@ toolchain_pkg_setup() { unset GCC_SPECS if use nocxx ; then - huse go && ewarn 'Go requires a C++ compiler, disabled due to USE="nocxx"' - huse objc++ && ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="nocxx"' - huse gcj && ewarn 'GCJ requires a C++ compiler, disabled due to USE="nocxx"' + use_if_iuse go && ewarn 'Go requires a C++ compiler, disabled due to USE="nocxx"' + use_if_iuse objc++ && ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="nocxx"' + use_if_iuse gcj && ewarn 'GCJ requires a C++ compiler, disabled due to USE="nocxx"' fi want_libssp && libc_has_ssp && \ @@ -2348,11 +2348,6 @@ is_multilib() { use multilib } -huse() { - has $1 ${IUSE} || return 1 - use $1 -} - is_cxx() { gcc-lang-supported 'c++' || return 1 ! use nocxx @@ -2360,7 +2355,7 @@ is_cxx() { is_d() { gcc-lang-supported d || return 1 - huse d + use_if_iuse d } is_f77() { @@ -2380,26 +2375,26 @@ is_fortran() { is_gcj() { gcc-lang-supported java || return 1 - ! use nocxx && huse gcj + ! use nocxx && use_if_iuse gcj } is_go() { gcc-lang-supported go || return 1 - ! use nocxx && huse go + ! use nocxx && use_if_iuse go } is_libffi() { - huse libffi + use_if_iuse libffi } is_objc() { gcc-lang-supported objc || return 1 - huse objc + use_if_iuse objc } is_objcxx() { gcc-lang-supported 'obj-c++' || return 1 - ! use nocxx && huse objc++ + ! use nocxx && use_if_iuse objc++ } is_ada() { -- 2.26.2