--- gcc-config.old 2003-04-05 08:03:30.000000000 -0500 +++ gcc-config 2003-04-07 10:54:04.000000000 -0400 @@ -98,7 +98,19 @@ } CC_COMP="" -REAL_CHOST="$(/usr/bin/python -c 'import portage; print portage.settings["CHOST"];')" + +get_real_chost() { + [ -n "$REAL_CHOST" ] && return 0 + + REAL_CHOST="$(/usr/bin/python -c 'import portage; + print portage.settings["CHOST"]' 2> /dev/null)" + + if [ -z "${REAL_CHOST}" ] + then + eerror "$0: Could not get portage CHOST!" + return 1 + fi +} switch_profile() { local MY_LDPATH="" @@ -132,6 +144,7 @@ # first in /etc/ld.so.conf, as the logical is that all # compilers for default CHOST will be used to compile stuff, # and thus we want all their lib paths in /etc/ld.so.conf ... + get_real_chost GCC_PROFILES="$(${FIND} /etc/env.d/gcc/ -name "${REAL_CHOST}-*")" GCC_PROFILES="${GCC_PROFILES/\/etc\/env.d\/gcc\/${CC_COMP}}" GCC_PROFILES="/etc/env.d/gcc/${CC_COMP} ${GCC_PROFILES}" @@ -381,11 +394,12 @@ exit 1 fi -# Chosen CHOST are not the same as the real CHOST according to make.conf, -# and --use-portage-chost option was given, so do nothing ... -if [ "${CHECK_CHOST}" = "yes" -a "${CC_COMP%-*}" != "${REAL_CHOST}" ] +if [ "${CHECK_CHOST}" = "yes" ] then - exit 0 + # Chosen CHOST are not the same as the real CHOST according to + # make.conf, and --use-portage-chost option was given, so do nothing + get_real_chost + [ "${CC_COMP%-*}" != "${REAL_CHOST}" ] && exit 0 fi eval ${DOIT}