--- old/qtbase/mkspecs/features/mac/sdk.prf	2018-02-08 10:24:48.000000000 -0800
+++ new/qtbase/mkspecs/features/mac/sdk.prf	2018-03-23 10:38:56.000000000 -0700
@@ -8,21 +8,21 @@
 defineReplace(xcodeSDKInfo) {
     info = $$1
     equals(info, "Path"): \
-        info = --show-sdk-path
+        infoarg = --show-sdk-path
     equals(info, "PlatformPath"): \
-        info = --show-sdk-platform-path
+        infoarg = --show-sdk-platform-path
     equals(info, "SDKVersion"): \
-        info = --show-sdk-version
+        infoarg = --show-sdk-version
     sdk = $$2
     isEmpty(sdk): \
         sdk = $$QMAKE_MAC_SDK
 
     isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}) {
-        QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcrun --sdk $$sdk $$info 2>/dev/null")
+        QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcrun --sdk $$sdk $$infoarg 2>/dev/null")
         # --show-sdk-platform-path won't work for Command Line Tools; this is fine
         # only used by the XCTest backend to testlib
-        isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}):if(!isEmpty(QMAKE_XCODEBUILD_PATH)|!equals(info, "--show-sdk-platform-path")): \
-            error("Could not resolve SDK $$info for \'$$sdk\'")
+        isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}):if(!isEmpty(QMAKE_XCODEBUILD_PATH)|!equals(infoarg, "--show-sdk-platform-path")): \
+            error("Could not resolve SDK $$info for \'$$sdk\' using $$infoarg")
         cache(QMAKE_MAC_SDK.$${sdk}.$${info}, set stash, QMAKE_MAC_SDK.$${sdk}.$${info})
     }

--- old/qtbase/configure	2018-02-08 10:24:48.000000000 -0800
+++ new/qtbase/configure	2018-03-23 05:42:29.000000000 -0700
@@ -232,8 +232,13 @@
 
     sdk=$(getSingleQMakeVariable "QMAKE_MAC_SDK" "$1")
     if [ -z "$sdk" ]; then echo "QMAKE_MAC_SDK must be set when building on Mac" >&2; exit 1; fi
-    sysroot=$(/usr/bin/xcrun --sdk $sdk --show-sdk-path 2>/dev/null)
-    if [ -z "$sysroot" ]; then echo "Failed to resolve SDK path for '$sdk'" >&2; exit 1; fi
+    sysroot=$(getSingleQMakeVariable "QMAKE_MAC_SDK_PATH" "$1")
+
+    echo "sysroot pre-configured as $sysroot";
+    if [ -z "$sysroot" ]; then
+       sysroot=$(/usr/bin/xcrun --sdk $sdk --show-sdk-path 2>/dev/null)
+       if [ -z "$sysroot" ]; then echo "Failed to resolve SDK path for '$sdk'" >&2; exit 1; fi
+    fi
 
     case "$sdk" in
         macosx*)


