# DP: - Disable some biarch libraries for biarch builds. # DP: - Fix multilib builds on kernels which don't support all multilibs. Index: b/src/config-ml.in =================================================================== --- a/src/config-ml.in +++ b/src/config-ml.in @@ -467,6 +467,25 @@ ;; esac +if [ -z "$biarch_multidir_names" ]; then + biarch_multidir_names="libiberty libstdc++-v3 libgfortran libmudflap libssp libffi libobjc libgomp" + echo "WARNING: biarch_multidir_names is unset. Use default value:" + echo " $biarch_multidir_names" +fi +ml_srcbase=`basename $ml_realsrcdir` +old_multidirs="${multidirs}" +multidirs="" +for x in ${old_multidirs}; do + case " $x " in + " 32 "|" n32 "|" x32 "|" 64 "|" hf "|" sf ") + case "$biarch_multidir_names" in + *"$ml_srcbase"*) multidirs="${multidirs} ${x}" ;; + esac + ;; + *) multidirs="${multidirs} ${x}" ;; + esac +done + # Remove extraneous blanks from multidirs. # Tests like `if [ -n "$multidirs" ]' require it. multidirs=`echo "$multidirs" | sed -e 's/^[ ][ ]*//' -e 's/[ ][ ]*$//' -e 's/[ ][ ]*/ /g'` @@ -654,6 +673,35 @@ for ml_dir in ${multidirs}; do + # a native build fails if the running kernel doesn't support the multilib + # variant; force cross compilation for these cases. + ml_host_arg= + case "${host}" in + i[34567]86-*-linux*) + case "${ml_dir}" in + 64) ml_host_arg="--host=x86_64-linux-gnu";; + x32) ml_host_arg="--host=x86_64-linux-gnux32";; + esac + ;; + powerpc-*-linux*) + case "${ml_dir}" in + 64) ml_host_arg="--host=powerpc64-linux-gnu" + esac + ;; + s390-*-linux*) + case "${ml_dir}" in + 64) ml_host_arg="--host=s390x-linux-gnu" + esac + ;; + x86_64-*-linux*) + case "${ml_dir}" in + x32) ml_host_arg="--host=x86_64-linux-gnux32" + esac + esac + if [ -n "${ml_host_arg}" ]; then + ml_host_arg="${ml_host_arg} --with-default-host-alias=${host_alias}" + fi + if [ "${ml_verbose}" = --verbose ]; then echo "Running configure in multilib subdir ${ml_dir}" echo "pwd: `${PWDCMD-pwd}`" @@ -858,9 +906,20 @@ fi fi + ml_configure_args= + for arg in ${ac_configure_args} + do + case $arg in + *CC=*) ml_configure_args=${ml_config_env} ;; + *CXX=*) ml_configure_args=${ml_config_env} ;; + *GCJ=*) ml_configure_args=${ml_config_env} ;; + *) ;; + esac + done + if eval ${ml_config_env} ${ml_config_shell} ${ml_recprog} \ --with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \ - ${ac_configure_args} ${ml_config_env} ${ml_srcdiroption} ; then + ${ac_configure_args} ${ml_configure_args} ${ml_host_arg} ${ml_srcdiroption} ; then true else exit 1 Index: b/src/libstdc++-v3/include/Makefile.am =================================================================== --- a/src/libstdc++-v3/include/Makefile.am +++ b/src/libstdc++-v3/include/Makefile.am @@ -821,8 +821,9 @@ endif host_srcdir = ${glibcxx_srcdir}/$(OS_INC_SRCDIR) -host_builddir = ./${host_alias}/bits -host_installdir = ${gxx_include_dir}/${host_alias}$(MULTISUBDIR)/bits +default_host_alias = @default_host_alias@ +host_builddir = ./${default_host_alias}/bits +host_installdir = ${gxx_include_dir}/${default_host_alias}$(MULTISUBDIR)/bits host_headers = \ ${host_srcdir}/ctype_base.h \ ${host_srcdir}/ctype_inline.h \ @@ -1042,6 +1043,7 @@ stamp-${host_alias}: @-mkdir -p ${host_builddir} + @test ${default_host_alias} = ${host_alias} || ln -sf ${default_host_alias} ${host_alias} @$(STAMP) stamp-${host_alias} # Host includes static. Index: b/src/libstdc++-v3/include/Makefile.in =================================================================== --- a/src/libstdc++-v3/include/Makefile.in +++ b/src/libstdc++-v3/include/Makefile.in @@ -1066,8 +1066,9 @@ # For --enable-cheaders=c_std @GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE@c_compatibility_headers_extra = ${c_compatibility_headers} host_srcdir = ${glibcxx_srcdir}/$(OS_INC_SRCDIR) -host_builddir = ./${host_alias}/bits -host_installdir = ${gxx_include_dir}/${host_alias}$(MULTISUBDIR)/bits +default_host_alias = @default_host_alias@ +host_builddir = ./${default_host_alias}/bits +host_installdir = ${gxx_include_dir}/${default_host_alias}$(MULTISUBDIR)/bits host_headers = \ ${host_srcdir}/ctype_base.h \ ${host_srcdir}/ctype_inline.h \ @@ -1445,6 +1446,7 @@ stamp-${host_alias}: @-mkdir -p ${host_builddir} + @test ${default_host_alias} = ${host_alias} || ln -sf ${default_host_alias} ${host_alias} @$(STAMP) stamp-${host_alias} # Host includes static. Index: b/src/libstdc++-v3/configure.ac =================================================================== --- a/src/libstdc++-v3/configure.ac +++ b/src/libstdc++-v3/configure.ac @@ -447,6 +447,16 @@ multilib_arg= fi +AC_ARG_WITH(default-host-alias, +[AS_HELP_STRING([--with-default-host-alias=TRIPLET], + [specifies host triplet used for the default multilib build])], +[case "${withval}" in +yes) AC_MSG_ERROR(bad value ${withval} given for default host triplet) ;; +no) default_host_alias='${host_alias}' ;; +*) default_host_alias=${withval} ;; +esac],[default_host_alias='${host_alias}']) +AC_SUBST(default_host_alias) + # Export all the install information. GLIBCXX_EXPORT_INSTALL_INFO