# HG changeset patch # User "Yann E. MORIN" # Date 1183802294 0 # Node ID 98baeb9289641448576dcb14b54974f74568da23 # Parent 1e215953f8756d1517af9ede2e594a762b71f9d0 Silence "which" being verbose in some distros. (eg. Mandriva's which spawns "foobar was not found in /bin:/usr/bin:...." directly on stderr) diff -r 1e215953f875 -r 98baeb928964 scripts/build/libc_glibc.sh --- a/scripts/build/libc_glibc.sh Fri Jul 06 18:07:04 2007 +0000 +++ b/scripts/build/libc_glibc.sh Sat Jul 07 09:58:14 2007 +0000 @@ -83,7 +83,7 @@ addons_config="${addons_config//linuxthreads/}" addons_config=`echo "${addons_config}" |sed -r -e 's/,+/,/g; s/^,+//; s/,+$//;'` - cross_cc=`which "${CT_TARGET}-gcc" || true` + cross_cc=`CT_Which "${CT_TARGET}-gcc"` CT_DoLog DEBUG "Using gcc for target: \"${cross_cc}\"" CT_DoLog DEBUG "Extra config passed : \"${addons_config}\"" @@ -225,7 +225,7 @@ esac;; esac - cross_cc=`which "${CT_TARGET}-gcc" || true` + cross_cc=`CT_Which "${CT_TARGET}-gcc"` CT_DoLog DEBUG "Using gcc for target : \"${cross_cc}\"" CT_DoLog DEBUG "Configuring with addons : \"`do_libc_add_ons_list ,`\"" CT_DoLog DEBUG "Extra config args passed: \"${extra_config}\"" @@ -323,7 +323,7 @@ ,y) extra_cc_args="${extra_cc_args} -mlittle-endian";; esac - cross_cc=`which "${CT_TARGET}-gcc" || true` + cross_cc=`CT_Which "${CT_TARGET}-gcc"` CT_DoLog DEBUG "Using gcc for target : \"${cross_cc}\"" CT_DoLog DEBUG "Configuring with addons : \"`do_libc_add_ons_list ,`\"" CT_DoLog DEBUG "Extra config args passed: \"${extra_config}\"" diff -r 1e215953f875 -r 98baeb928964 scripts/crosstool.sh --- a/scripts/crosstool.sh Fri Jul 06 18:07:04 2007 +0000 +++ b/scripts/crosstool.sh Sat Jul 07 09:58:14 2007 +0000 @@ -293,10 +293,11 @@ CT_DoLog DEBUG "Making build system tools available" mkdir -p "${CT_PREFIX_DIR}/bin" for tool in ar as dlltool gcc g++ gnatbind gnatmake ld nm ranlib strip windres objcopy objdump; do - if [ -n "`which ${tool}`" ]; then - ln -sfv "`which ${tool}`" "${CT_PREFIX_DIR}/bin/${CT_BUILD}-${tool}" - ln -sfv "`which ${tool}`" "${CT_PREFIX_DIR}/bin/${CT_UNIQ_BUILD}-${tool}" - ln -sfv "`which ${tool}`" "${CT_PREFIX_DIR}/bin/${CT_HOST}-${tool}" + tmp=`CT_Which ${tool}` + if [ -n "${tmp}" ]; then + ln -sfv "${tmp}" "${CT_PREFIX_DIR}/bin/${CT_BUILD}-${tool}" + ln -sfv "${tmp}" "${CT_PREFIX_DIR}/bin/${CT_UNIQ_BUILD}-${tool}" + ln -sfv "${tmp}" "${CT_PREFIX_DIR}/bin/${CT_HOST}-${tool}" fi |CT_DoLog DEBUG done diff -r 1e215953f875 -r 98baeb928964 scripts/functions --- a/scripts/functions Fri Jul 06 18:07:04 2007 +0000 +++ b/scripts/functions Sat Jul 07 09:58:14 2007 +0000 @@ -158,10 +158,18 @@ # Test the presence of a tool, or abort if not found # Usage: CT_HasOrAbort CT_HasOrAbort() { - CT_TestAndAbort "\"${1}\" not found and needed for successfull toolchain build." -z "`which \"${1}\"`" + CT_TestAndAbort "\"${1}\" not found and needed for successfull toolchain build." -z "`CT_Which \"${1}\"`" return 0 } +# Search a program: wrap "which" for those system where +# "which" verbosely says there is no match (Mdk are such +# suckers...) +# Usage: CT_Which +CT_Which() { + which "$1" 2>/dev/null || true +} + # Get current date with nanosecond precision # On those system not supporting nanosecond precision, faked with rounding down # to the highest entire second @@ -292,8 +300,8 @@ # Wrapper function to call one of curl or wget # Usage: CT_DoGetFile CT_DoGetFile() { - local _wget=`which wget` - local _curl=`which curl` + local _wget=`CT_Which wget` + local _curl=`CT_Which curl` case "${_wget},${_curl}" in ,) CT_DoError "Could find neither wget nor curl";; ,*) CT_DoGetFileCurl "$1" 2>&1 |CT_DoLog ALL;;