Skip to content

Commit 72483f5

Browse files
committed
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)
2 parents 2533a85 + 7131e6f commit 72483f5

File tree

1 file changed

+38
-23
lines changed

1 file changed

+38
-23
lines changed

configure

+38-23
Original file line numberDiff line numberDiff line change
@@ -988,29 +988,44 @@ if [ ! -z "$CFG_ENABLE_CLANG" ]
988988
then
989989
case "$CC" in
990990
(''|*clang)
991-
CFG_CLANG_VERSION=$($CFG_CC \
992-
--version \
993-
| grep version \
994-
| sed 's/.*\(version .*\)/\1/; s/.*based on \(LLVM .*\))/\1/' \
995-
| cut -d ' ' -f 2)
996-
997-
case $CFG_CLANG_VERSION in
998-
(3.2* | 3.3* | 3.4* | 3.5* | 3.6* | 3.7*)
999-
step_msg "found ok version of CLANG: $CFG_CLANG_VERSION"
1000-
if [ -z "$CC" ]
1001-
then
1002-
CFG_CC="clang"
1003-
CFG_CXX="clang++"
1004-
fi
1005-
;;
1006-
(*)
1007-
err "bad CLANG version: $CFG_CLANG_VERSION, need >=3.0svn"
1008-
;;
1009-
esac
1010-
;;
1011-
(*)
1012-
msg "skipping CFG_ENABLE_CLANG version check; provided CC=$CC"
1013-
;;
991+
CFG_CLANG_REPORTED_VERSION=$($CFG_CC --version | grep version)
992+
993+
if [[ $CFG_CLANG_REPORTED_VERSION == *"(based on LLVM "* ]]
994+
then
995+
CFG_CLANG_VERSION=$(echo $CFG_CLANG_REPORTED_VERSION | sed 's/.*(based on LLVM \(.*\))/\1/')
996+
elif [[ $CFG_CLANG_REPORTED_VERSION == "Apple LLVM"* ]]
997+
then
998+
CFG_OSX_CLANG_VERSION=$(echo $CFG_CLANG_REPORTED_VERSION | sed 's/.*version \(.*\) .*/\1/')
999+
else
1000+
CFG_CLANG_VERSION=$(echo $CFG_CLANG_REPORTED_VERSION | sed 's/.*version \(.*\) .*/\1/')
1001+
fi
1002+
1003+
if [ ! -z "$CFG_OSX_CLANG_VERSION" ]
1004+
then
1005+
case $CFG_OSX_CLANG_VERSION in
1006+
(7.0*)
1007+
step_msg "found ok version of APPLE CLANG: $CFG_OSX_CLANG_VERSION"
1008+
;;
1009+
(*)
1010+
err "bad APPLE CLANG version: $CFG_OSX_CLANG_VERSION, need >=7.0"
1011+
;;
1012+
esac
1013+
else
1014+
case $CFG_CLANG_VERSION in
1015+
(3.2* | 3.3* | 3.4* | 3.5* | 3.6* | 3.7*)
1016+
step_msg "found ok version of CLANG: $CFG_CLANG_VERSION"
1017+
;;
1018+
(*)
1019+
err "bad CLANG version: $CFG_CLANG_VERSION, need >=3.0svn"
1020+
;;
1021+
esac
1022+
fi
1023+
1024+
if [ -z "$CC" ]
1025+
then
1026+
CFG_CC="clang"
1027+
CFG_CXX="clang++"
1028+
fi
10141029
esac
10151030
fi
10161031

0 commit comments

Comments
 (0)