Index: gcc-config-1.3.13 =================================================================== RCS file: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/files/gcc-config-1.3.13,v retrieving revision 1.3 diff -u -b -B -r1.3 gcc-config-1.3.13 --- gcc-config-1.3.13 8 Jan 2006 09:52:45 -0000 1.3 +++ gcc-config-1.3.13 11 Mar 2006 11:07:30 -0000 @@ -61,6 +61,30 @@ return 0 } +# files_exist (both :-separated) +# Return 0 if all are found in at least one of +# Return 1 if one or more cannot be found in any +files_exist() { + local paths files pathn filen ok old_IFS + paths=$1 + files=$2 + old_IFS="${IFS}" + export IFS=":" + for filen in ${files}; do + if [[ ${filen:0:1} == "/" ]]; then + [[ -f ${filen} ]] && ok=0 || ok=1 + else + ok=1 + for pathn in ${paths}; do + [[ -f ${pathn}/${filen} ]] && ok=0 && break + done + [[ ${ok} == 1 ]] && break + fi + done + export IFS="${old_IFS}" + return ${ok} +} + cmd_setup() { # Sourcing /etc/env.d/gcc/${CC_COMP} is going to mess up # PATH among things... @@ -201,7 +225,9 @@ ${AWK} '!/^(STDCXX_INCDIR|LDPATH|CC|CXX|CTARGET|GCCBITS|GCC_SPECS)=/ {print $0}' \ "${GCC_ENV_D}/${CC_COMP}" > "${ENV_D}/05gcc" echo "LDPATH=\"${MY_LDPATH}\"" >> "${ENV_D}/05gcc" - if [[ -n ${GCC_SPECS} ]] && [[ -e ${ROOT}/${GCC_SPECS} ]] ; then + # Verify all GCC_SPECS files exist either as full paths or relative + # to an LDPATH entry + if [[ -n ${GCC_SPECS} ]] && files_exist ${MY_LDPATH} ${GCC_SPECS} ; then echo "GCC_SPECS=\"${GCC_SPECS}\"" >> "${ENV_D}/05gcc" else # People need to rebuild their gcc or setting GCC_SPECS to