Silence "which" being verbose in some distros. (eg. Mandriva's which spawns "foobar was not found in /bin:/usr/bin:...." directly on stderr)
1.1 --- a/scripts/build/libc_glibc.sh Fri Jul 06 18:07:04 2007 +0000
1.2 +++ b/scripts/build/libc_glibc.sh Sat Jul 07 09:58:14 2007 +0000
1.3 @@ -83,7 +83,7 @@
1.4 addons_config="${addons_config//linuxthreads/}"
1.5 addons_config=`echo "${addons_config}" |sed -r -e 's/,+/,/g; s/^,+//; s/,+$//;'`
1.6
1.7 - cross_cc=`which "${CT_TARGET}-gcc" || true`
1.8 + cross_cc=`CT_Which "${CT_TARGET}-gcc"`
1.9 CT_DoLog DEBUG "Using gcc for target: \"${cross_cc}\""
1.10 CT_DoLog DEBUG "Extra config passed : \"${addons_config}\""
1.11
1.12 @@ -225,7 +225,7 @@
1.13 esac;;
1.14 esac
1.15
1.16 - cross_cc=`which "${CT_TARGET}-gcc" || true`
1.17 + cross_cc=`CT_Which "${CT_TARGET}-gcc"`
1.18 CT_DoLog DEBUG "Using gcc for target : \"${cross_cc}\""
1.19 CT_DoLog DEBUG "Configuring with addons : \"`do_libc_add_ons_list ,`\""
1.20 CT_DoLog DEBUG "Extra config args passed: \"${extra_config}\""
1.21 @@ -323,7 +323,7 @@
1.22 ,y) extra_cc_args="${extra_cc_args} -mlittle-endian";;
1.23 esac
1.24
1.25 - cross_cc=`which "${CT_TARGET}-gcc" || true`
1.26 + cross_cc=`CT_Which "${CT_TARGET}-gcc"`
1.27 CT_DoLog DEBUG "Using gcc for target : \"${cross_cc}\""
1.28 CT_DoLog DEBUG "Configuring with addons : \"`do_libc_add_ons_list ,`\""
1.29 CT_DoLog DEBUG "Extra config args passed: \"${extra_config}\""
2.1 --- a/scripts/crosstool.sh Fri Jul 06 18:07:04 2007 +0000
2.2 +++ b/scripts/crosstool.sh Sat Jul 07 09:58:14 2007 +0000
2.3 @@ -293,10 +293,11 @@
2.4 CT_DoLog DEBUG "Making build system tools available"
2.5 mkdir -p "${CT_PREFIX_DIR}/bin"
2.6 for tool in ar as dlltool gcc g++ gnatbind gnatmake ld nm ranlib strip windres objcopy objdump; do
2.7 - if [ -n "`which ${tool}`" ]; then
2.8 - ln -sfv "`which ${tool}`" "${CT_PREFIX_DIR}/bin/${CT_BUILD}-${tool}"
2.9 - ln -sfv "`which ${tool}`" "${CT_PREFIX_DIR}/bin/${CT_UNIQ_BUILD}-${tool}"
2.10 - ln -sfv "`which ${tool}`" "${CT_PREFIX_DIR}/bin/${CT_HOST}-${tool}"
2.11 + tmp=`CT_Which ${tool}`
2.12 + if [ -n "${tmp}" ]; then
2.13 + ln -sfv "${tmp}" "${CT_PREFIX_DIR}/bin/${CT_BUILD}-${tool}"
2.14 + ln -sfv "${tmp}" "${CT_PREFIX_DIR}/bin/${CT_UNIQ_BUILD}-${tool}"
2.15 + ln -sfv "${tmp}" "${CT_PREFIX_DIR}/bin/${CT_HOST}-${tool}"
2.16 fi |CT_DoLog DEBUG
2.17 done
2.18
3.1 --- a/scripts/functions Fri Jul 06 18:07:04 2007 +0000
3.2 +++ b/scripts/functions Sat Jul 07 09:58:14 2007 +0000
3.3 @@ -158,10 +158,18 @@
3.4 # Test the presence of a tool, or abort if not found
3.5 # Usage: CT_HasOrAbort <tool>
3.6 CT_HasOrAbort() {
3.7 - CT_TestAndAbort "\"${1}\" not found and needed for successfull toolchain build." -z "`which \"${1}\"`"
3.8 + CT_TestAndAbort "\"${1}\" not found and needed for successfull toolchain build." -z "`CT_Which \"${1}\"`"
3.9 return 0
3.10 }
3.11
3.12 +# Search a program: wrap "which" for those system where
3.13 +# "which" verbosely says there is no match (Mdk are such
3.14 +# suckers...)
3.15 +# Usage: CT_Which <filename>
3.16 +CT_Which() {
3.17 + which "$1" 2>/dev/null || true
3.18 +}
3.19 +
3.20 # Get current date with nanosecond precision
3.21 # On those system not supporting nanosecond precision, faked with rounding down
3.22 # to the highest entire second
3.23 @@ -292,8 +300,8 @@
3.24 # Wrapper function to call one of curl or wget
3.25 # Usage: CT_DoGetFile <URL>
3.26 CT_DoGetFile() {
3.27 - local _wget=`which wget`
3.28 - local _curl=`which curl`
3.29 + local _wget=`CT_Which wget`
3.30 + local _curl=`CT_Which curl`
3.31 case "${_wget},${_curl}" in
3.32 ,) CT_DoError "Could find neither wget nor curl";;
3.33 ,*) CT_DoGetFileCurl "$1" 2>&1 |CT_DoLog ALL;;