Bug 1160125 - Fixed MSVC version detection when CC is set to a wrapper
authorJacek Caban <jacek@codeweavers.com>
Mon, 18 May 2015 11:54:33 -0700
changeset 4633 c4194dc04aa5eb5bc4f34e9a02b48cb5c0c14f1d
parent 4632 2f45c6fd036e8db3a7f5eaf392e1b89d23914881
child 4634 cfda142e3c2b51075ec74464816f96028bfd1d44
push id170
push userwtc@google.com
push dateMon, 18 May 2015 18:54:51 +0000
bugs1160125
Bug 1160125 - Fixed MSVC version detection when CC is set to a wrapper (like sccache). r=ted
configure
configure.in
--- a/configure
+++ b/configure
@@ -7120,17 +7120,21 @@ tools are selected during the Xcode/Deve
         OBJ_SUFFIX=obj
         LIB_SUFFIX=lib
         DLL_SUFFIX=dll
 
         # Determine compiler version
 
         _MSVC_VER_FILTER='s|.* \([0-9]\+\.[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?\).*|\1|p'
 
-        CC_VERSION=`"${CC}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
+        CC_VERSION=`${CC} -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
+        if test -z "$CC_VERSION"; then
+            as_fn_error $? "Could not determine MSC version." "$LINENO" 5
+        fi
+
         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $1 }'`
         _CC_MINOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $2 }'`
         _CC_RELEASE=`echo ${CC_VERSION} | awk -F\. '{ print $3 }'`
         _CC_BUILD=`echo ${CC_VERSION} | awk -F\. '{ print $4 }'`
         MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
 
         if test "$_CC_MAJOR_VERSION" -eq "14"; then
                                             if test $_CC_RELEASE -gt 50727; then
--- a/configure.in
+++ b/configure.in
@@ -1931,17 +1931,21 @@ tools are selected during the Xcode/Deve
         OBJ_SUFFIX=obj
         LIB_SUFFIX=lib
         DLL_SUFFIX=dll
 
         # Determine compiler version
         changequote(,)
         _MSVC_VER_FILTER='s|.* \([0-9]\+\.[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?\).*|\1|p'
         changequote([,])
-        CC_VERSION=`"${CC}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
+        CC_VERSION=`${CC} -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
+        if test -z "$CC_VERSION"; then
+            AC_MSG_ERROR([Could not determine MSC version.])
+        fi
+
         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $1 }'`
         _CC_MINOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $2 }'`
         _CC_RELEASE=`echo ${CC_VERSION} | awk -F\. '{ print $3 }'`
         _CC_BUILD=`echo ${CC_VERSION} | awk -F\. '{ print $4 }'`
         MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
 
         if test "$_CC_MAJOR_VERSION" -eq "14"; then
            dnl -DYNAMICBASE is only supported on VC8SP1 or newer,