summaryrefslogtreecommitdiff
path: root/src/pal
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2017-05-10 18:32:42 +0200
committerGitHub <noreply@github.com>2017-05-10 18:32:42 +0200
commitb1247408c30dd4dc511e8a65adf8a4efb2776f10 (patch)
tree5f93e4a6eafe48aa6d9262498b71b7859607182b /src/pal
parentc78891ae1cc668a77377b2b0fb03c7e1a6894b29 (diff)
downloadcoreclr-b1247408c30dd4dc511e8a65adf8a4efb2776f10.tar.gz
coreclr-b1247408c30dd4dc511e8a65adf8a4efb2776f10.tar.bz2
coreclr-b1247408c30dd4dc511e8a65adf8a4efb2776f10.zip
Fix clang version detection in src/pal/tools/gen-buildsys-clang.sh (#11398)
The version detection that was added recently for the purpose of selecting optimization options for ARM builds was not working properly when the clang binary doesn't have version in its name. This resulted in syntax error being reported on OSX and some Linux distros: /Users/janvorli/git/coreclr/src/pal/tools/gen-buildsys-clang.sh: line 162: : /usr/bin/clang: syntax error: operand expected (error token is "/usr/bin/clang")
Diffstat (limited to 'src/pal')
-rwxr-xr-xsrc/pal/tools/gen-buildsys-clang.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pal/tools/gen-buildsys-clang.sh b/src/pal/tools/gen-buildsys-clang.sh
index 762a1996b9..944187786f 100755
--- a/src/pal/tools/gen-buildsys-clang.sh
+++ b/src/pal/tools/gen-buildsys-clang.sh
@@ -155,7 +155,7 @@ if [ "$build_arch" == "armel" ]; then
cmake_extra_defines="$cmake_extra_defines -DARM_SOFTFP=1"
fi
-clang_version=$(echo $CC | awk -F- '{ print $NF }')
+clang_version=$( $CC --version | head -1 | sed 's/[^0-9]*\([0-9]*\.[0-9]*\).*/\1/' )
# Use O1 option when the clang version is smaller than 3.9
# Otherwise use O3 option in release build
if [[ ( ${clang_version%.*} -eq 3 && ${clang_version#*.} -lt 9 ) &&