# 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:
has "${flag}" "${liuse[@]#[+-]}"
}
+# @FUNCTION: use_if_iuse
+# @USAGE: <flag>
+# @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: <USE flag> [true output] [false output] [true suffix] [false suffix]
# @DESCRIPTION:
# 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 <toolchain@gentoo.org>
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 && \
use multilib
}
-huse() {
- has $1 ${IUSE} || return 1
- use $1
-}
-
is_cxx() {
gcc-lang-supported 'c++' || return 1
! use nocxx
is_d() {
gcc-lang-supported d || return 1
- huse d
+ use_if_iuse d
}
is_f77() {
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() {