Detect Clang availability on Mac based on the SDK, not the OS X version

Since we use the Clang from Xcode's toolchain now, the OS version is
not relevant.

In practice this means we will use clang for Xcode 4.2 and up, which
means it's possible to use clang also on Mac OS 10.6 (Snow Leopard),
where Xcode 4.3 is not available.

Change-Id: I9817e237cdd82d10b93aaaa3c90e35767cdca751
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Tor Arne Vestbø 2013-02-27 15:06:29 +01:00 committed by The Qt Project
parent 0ec541c9ad
commit 36a5873fac
1 changed files with 18 additions and 13 deletions

23
configure vendored
View File

@ -2445,18 +2445,23 @@ if [ -z "$PLATFORM" ]; then
PLATFORM_NOTES= PLATFORM_NOTES=
case "$UNAME_SYSTEM:$UNAME_RELEASE" in case "$UNAME_SYSTEM:$UNAME_RELEASE" in
Darwin:*) Darwin:*)
OSX_VERSION=`uname -r | cut -d. -f1` # Select compiler. Use g++ unless we find a usable Clang version. Note that
# Select compiler. Use g++ unless we find a usable Clang version # we are checking the "Apple" clang/LLVM version number, not the actual
PLATFORM=macx-g++ # clang/LLVM version number that the Apple version was based on. We look
if [ "$OSX_VERSION" -ge 12 ]; then # for Apple clang version 3.0 or higher, which was branched off LLVM 3.0
# We're on Mountain Lion or above. Use Clang. Don't advertise gcc. # from SVN, and first included in Xcode 4.2. Also note that we do not care
PLATFORM=macx-clang # about the OS version, since we're not using the clang version that comes
elif [ "$OSX_VERSION" -eq 11 ]; then # with the system. We use 'xcrun' to check the clang version that's part of
# We're on Lion. Check if we have a supported Clang version # the Xcode installation.
if [ "$(clang -v 2>&1 | grep -Po '(?<=version )[\d]')" -ge 3 ]; then if [ "$(xcrun -sdk macosx clang -v 2>&1 | sed -n 's/.*version \([0-9]\).*/\1/p')" -ge 3 ]; then
PLATFORM=macx-clang PLATFORM=macx-clang
# Advertise g++ as an alternative on Lion and below
if [ "$(uname -r | cut -d. -f1)" -le 11 ]; then
PLATFORM_NOTES="\n - Also available for Mac OS X: macx-g++\n" PLATFORM_NOTES="\n - Also available for Mac OS X: macx-g++\n"
fi fi
else
PLATFORM=macx-g++
fi fi
;; ;;
AIX:*) AIX:*)