add USE=zlib support with newer binutils
authorMike Frysinger <vapier@gentoo.org>
Tue, 29 Nov 2011 20:10:03 +0000 (20:10 +0000)
committerMike Frysinger <vapier@gentoo.org>
Tue, 29 Nov 2011 20:10:03 +0000 (20:10 +0000)
eclass/toolchain-binutils.eclass

index feb0288e4363e5795fa99be58e36c8e7cfecfb50..3a35bd3ec485df19c3a46276a20fda5e1f8014c4 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-binutils.eclass,v 1.102 2011/10/28 07:58:38 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-binutils.eclass,v 1.103 2011/11/29 20:10:03 vapier Exp $
 #
 # Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
 #
@@ -78,6 +78,9 @@ else
        LICENSE="|| ( GPL-2 LGPL-2 )"
 fi
 IUSE="nls multitarget multislot static-libs test vanilla"
+if version_is_at_least 2.19 ; then
+       IUSE+=" zlib"
+fi
 if use multislot ; then
        SLOT="${CTARGET}-${BVER}"
 elif is_cross ; then
@@ -87,6 +90,7 @@ else
 fi
 
 RDEPEND=">=sys-devel/binutils-config-1.9"
+in_iuse zlib && RDEPEND+=" zlib? ( sys-libs/zlib )"
 DEPEND="${RDEPEND}
        test? ( dev-util/dejagnu )
        nls? ( sys-devel/gettext )
@@ -199,6 +203,7 @@ toolchain-binutils_src_compile() {
 
        cd "${MY_BUILDDIR}"
        set --
+
        # enable gold if available (installed as ld.gold)
        if grep -q 'enable-gold=default' "${S}"/configure ; then
                set -- "$@" --enable-gold
@@ -211,16 +216,26 @@ toolchain-binutils_src_compile() {
        if grep -q -e '--enable-plugins' "${S}"/ld/configure ; then
                set -- "$@" --enable-plugins
        fi
+
        use nls \
                && set -- "$@" --without-included-gettext \
                || set -- "$@" --disable-nls
+
+       if in_iuse zlib ; then
+               # older versions did not have an explicit configure flag
+               export ac_cv_search_zlibVersion=$(usex zlib)
+               set -- "$@" $(use_with zlib)
+       fi
+
        use multitarget && set -- "$@" --enable-targets=all
        [[ -n ${CBUILD} ]] && set -- "$@" --build=${CBUILD}
        is_cross && set -- "$@" --with-sysroot=/usr/${CTARGET}
+
        # glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+
        # on everyone in alpha (for now), we'll just enable it when possible
        has_version ">=${CATEGORY}/glibc-2.5" && set -- "$@" --enable-secureplt
        has_version ">=sys-libs/glibc-2.5" && set -- "$@" --enable-secureplt
+
        set -- "$@" \
                --prefix=/usr \
                --host=${CHOST} \