# Copyright 1999-2015 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_configure.eblit,v 1.7 2015/05/30 05:29:28 vapier Exp $ dump_toolchain_settings() { echo einfo "$*" local v for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC LD {AS,C,CPP,CXX,LD}FLAGS ; do einfo " $(printf '%15s' ${v}:) ${!v}" done # The glibc configure script doesn't properly use LDFLAGS all the time. export CC="$(tc-getCC ${CTARGET}) ${LDFLAGS}" einfo " $(printf '%15s' 'Manual CC:') ${CC}" echo } glibc_do_configure() { # Glibc does not work with gold (for various reasons) #269274. tc-ld-disable-gold dump_toolchain_settings "Configuring glibc for $1" local myconf=() # set addons pushd "${S}" > /dev/null local addons=$(echo */configure | sed \ -e 's:/configure::g' \ -e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \ -e 's: \+$::' \ -e 's! !,!g' \ -e 's!^!,!' \ -e '/^,\*$/d') [[ -d ports ]] && addons+=",ports" popd > /dev/null myconf+=( $(use_enable hardened stackguard-randomization) ) if has_version ' "${T}"/test.c if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die mkdir -p sunrpc cp $(which rpcgen) sunrpc/cross-rpcgen || die touch -t 202001010101 sunrpc/cross-rpcgen || die fi fi } toolchain-glibc_headers_configure() { export ABI=default local builddir=$(builddir "headers") mkdir -p "${builddir}" cd "${builddir}" # if we don't have a compiler yet, we cant really test it now ... # hopefully they don't affect header geneation, so let's hope for # the best here ... local v vars=( ac_cv_header_cpuid_h=yes libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes libc_cv_asm_cfi_directives=yes libc_cv_broken_visibility_attribute=no libc_cv_c_cleanup=yes libc_cv_forced_unwind=yes libc_cv_gcc___thread=yes libc_cv_mlong_double_128=yes libc_cv_mlong_double_128ibm=yes libc_cv_ppc_machine=yes libc_cv_ppc_rel16=yes libc_cv_predef_{fortify_source,stack_protector}=no libc_cv_visibility_attribute=yes libc_cv_z_combreloc=yes libc_cv_z_execstack=yes libc_cv_z_initfirst=yes libc_cv_z_nodelete=yes libc_cv_z_nodlopen=yes libc_cv_z_relro=yes libc_mips_abi=${ABI} libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard) ) einfo "Forcing cached settings:" for v in "${vars[@]}" ; do einfo " ${v}" export ${v} done # Blow away some random CC settings that screw things up. #550192 if [[ -d ${S}/sysdeps/mips ]]; then pushd "${S}"/sysdeps/mips >/dev/null sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die popd >/dev/null fi local myconf=() myconf+=( --disable-sanity-checks --enable-hacker-mode --without-cvs --disable-werror --enable-bind-now --build=${CBUILD_OPT:-${CBUILD}} --host=${CTARGET_OPT:-${CTARGET}} --with-headers=$(alt_build_headers) --prefix=/usr ${EXTRA_ECONF} ) local addons [[ -d ${S}/ports ]] && addons+=",ports" # Newer versions require nptl, so there is no addon for it. version_is_at_least 2.20 || addons+=",nptl" myconf+=( --enable-add-ons="${addons#,}" ) # Nothing is compiled here which would affect the headers for the target. # So forcing CC/CFLAGS is sane. set -- "${S}"/configure "${myconf[@]}" echo "$@" CC="$(tc-getBUILD_CC)" \ CFLAGS="-O1 -pipe" \ CPPFLAGS="-U_FORTIFY_SOURCE" \ LDFLAGS="" \ "$@" || die "failed to configure glibc" } toolchain-glibc_src_configure() { if just_headers ; then toolchain-glibc_headers_configure else want_linuxthreads && glibc_do_configure linuxthreads want_nptl && glibc_do_configure nptl fi } eblit-glibc-src_configure() { foreach_abi toolchain-glibc_src_configure }