From 7f8557fb17c58a093bf54bd17e965b9181bba772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20H=C3=B6tzel?= Date: Fri, 6 Jan 2017 01:15:49 +0100 Subject: Use POSIX "command" instead of non-standard "which" (#8823) GNU which might not be installed on a minimal GNU/Linux installation. Refs #6994 and #7025. --- src/pal/tools/gen-buildsys-clang.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/pal/tools/gen-buildsys-clang.sh') diff --git a/src/pal/tools/gen-buildsys-clang.sh b/src/pal/tools/gen-buildsys-clang.sh index 3386c5d64c..5d4d4c8920 100755 --- a/src/pal/tools/gen-buildsys-clang.sh +++ b/src/pal/tools/gen-buildsys-clang.sh @@ -18,18 +18,18 @@ then fi # Set up the environment to be used for building with clang. -if which "clang-$2.$3" > /dev/null 2>&1 +if command -v "clang-$2.$3" > /dev/null then - export CC="$(which clang-$2.$3)" - export CXX="$(which clang++-$2.$3)" -elif which "clang$2$3" > /dev/null 2>&1 + export CC="$(command -v clang-$2.$3)" + export CXX="$(command -v clang++-$2.$3)" +elif command -v "clang$2$3" > /dev/null then - export CC="$(which clang$2$3)" - export CXX="$(which clang++$2$3)" -elif which clang > /dev/null 2>&1 + export CC="$(command -v clang$2$3)" + export CXX="$(command -v clang++$2$3)" +elif command -v clang > /dev/null then - export CC="$(which clang)" - export CXX="$(which clang++)" + export CC="$(command -v clang)" + export CXX="$(command -v clang++)" else echo "Unable to find Clang Compiler" exit 1 @@ -97,12 +97,12 @@ else desired_llvm_version="-$desired_llvm_major_version.$desired_llvm_minor_version" fi locate_llvm_exec() { - if which "$llvm_prefix$1$desired_llvm_version" > /dev/null 2>&1 + if command -v "$llvm_prefix$1$desired_llvm_version" > /dev/null 2>&1 then - echo "$(which $llvm_prefix$1$desired_llvm_version)" - elif which "$llvm_prefix$1" > /dev/null 2>&1 + echo "$(command -v $llvm_prefix$1$desired_llvm_version)" + elif command -v "$llvm_prefix$1" > /dev/null 2>&1 then - echo "$(which $llvm_prefix$1)" + echo "$(command -v $llvm_prefix$1)" else exit 1 fi -- cgit v1.2.3