about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-07-13 22:14:50 +0000
committerbors <bors@rust-lang.org>2015-07-13 22:14:50 +0000
commit72483f58e355c6ec9016cbaba4d9b8d3adbd3867 (patch)
tree499db9e4df940e6f841784da2eedf7401ac03275
parent2533a85be4584a47818d4f381f29bbd6294e0fb0 (diff)
parent7131e6f378af212b86e6bc0ddbc632c3f2e5d255 (diff)
downloadrust-72483f58e355c6ec9016cbaba4d9b8d3adbd3867.tar.gz
rust-72483f58e355c6ec9016cbaba4d9b8d3adbd3867.zip
Auto merge of #27006 - ryanp-me:apple-llvm, r=brson
Since Apple LLVM no longer reports which version of LLVM it's based off (starting with 7.0.0), I believe it's time to start checking Apple LLVM versions directly.

The changes in this pull request update the `configure` script to check "Apple LLVM" versions independently if no "based off" version can be found. If a "based off" version is included, however, it will be preferred.

(This is a less hacky version of #26653)
-rwxr-xr-xconfigure61
1 files changed, 38 insertions, 23 deletions
diff --git a/configure b/configure
index 1d3611f88f0..9be2f9b91f0 100755
--- a/configure
+++ b/configure
@@ -988,29 +988,44 @@ if [ ! -z "$CFG_ENABLE_CLANG" ]
 then
     case "$CC" in
         (''|*clang)
-        CFG_CLANG_VERSION=$($CFG_CC \
-            --version \
-            | grep version \
-            | sed 's/.*\(version .*\)/\1/; s/.*based on \(LLVM .*\))/\1/' \
-            | cut -d ' ' -f 2)
-
-        case $CFG_CLANG_VERSION in
-            (3.2* | 3.3* | 3.4* | 3.5* | 3.6* | 3.7*)
-            step_msg "found ok version of CLANG: $CFG_CLANG_VERSION"
-            if [ -z "$CC" ]
-            then
-                CFG_CC="clang"
-                CFG_CXX="clang++"
-            fi
-            ;;
-            (*)
-            err "bad CLANG version: $CFG_CLANG_VERSION, need >=3.0svn"
-            ;;
-        esac
-        ;;
-        (*)
-        msg "skipping CFG_ENABLE_CLANG version check; provided CC=$CC"
-        ;;
+        CFG_CLANG_REPORTED_VERSION=$($CFG_CC --version | grep version)
+
+        if [[ $CFG_CLANG_REPORTED_VERSION == *"(based on LLVM "* ]]
+        then
+            CFG_CLANG_VERSION=$(echo $CFG_CLANG_REPORTED_VERSION | sed 's/.*(based on LLVM \(.*\))/\1/')
+        elif [[ $CFG_CLANG_REPORTED_VERSION == "Apple LLVM"* ]]
+        then
+            CFG_OSX_CLANG_VERSION=$(echo $CFG_CLANG_REPORTED_VERSION | sed 's/.*version \(.*\) .*/\1/')
+        else
+            CFG_CLANG_VERSION=$(echo $CFG_CLANG_REPORTED_VERSION | sed 's/.*version \(.*\) .*/\1/')
+        fi
+
+        if [ ! -z "$CFG_OSX_CLANG_VERSION" ]
+        then
+            case $CFG_OSX_CLANG_VERSION in
+                (7.0*)
+                step_msg "found ok version of APPLE CLANG: $CFG_OSX_CLANG_VERSION"
+                ;;
+                (*)
+                err "bad APPLE CLANG version: $CFG_OSX_CLANG_VERSION, need >=7.0"
+                ;;
+            esac
+        else
+            case $CFG_CLANG_VERSION in
+                (3.2* | 3.3* | 3.4* | 3.5* | 3.6* | 3.7*)
+                step_msg "found ok version of CLANG: $CFG_CLANG_VERSION"
+                ;;
+                (*)
+                err "bad CLANG version: $CFG_CLANG_VERSION, need >=3.0svn"
+                ;;
+            esac
+        fi
+
+        if [ -z "$CC" ]
+        then
+            CFG_CC="clang"
+            CFG_CXX="clang++"
+        fi
     esac
 fi