Bug 1265627 - Prettify the MSVC version. r?ted draft
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 19 Apr 2016 16:03:07 +0900
changeset 353149 912c754719142aa1b7276a181cd087777ada1224
parent 353148 9df8208f5b20820d305f179f63009b03ffc3e4b9
child 518824 d7e14f30ebf2420aed4bc2c0b1fdb354a2b96332
push id15882
push userbmo:mh+mozilla@glandium.org
push dateTue, 19 Apr 2016 08:29:52 +0000
reviewersted
bugs1265627
milestone48.0a1
Bug 1265627 - Prettify the MSVC version. r?ted
build/moz.configure/toolchain.configure
js/src/old-configure.in
old-configure.in
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -253,27 +253,37 @@ def get_compiler_info(compiler, language
     data = {}
     for line in result.splitlines():
         if line.startswith('%'):
             k, _, v = line.partition(' ')
             k = k.lstrip('%')
             data[k] = v.replace(' ', '')
             log.debug('%s = %s', k, data[k])
 
-    type = data.get('COMPILER')
-    if not type:
+    try:
+        type = CompilerType(data['COMPILER'])
+    except:
         raise FatalCheckError(
             'Unknown compiler or compiler not supported.')
 
     cplusplus = int(data.get('cplusplus', '0L').rstrip('L'))
     stdc_version = int(data.get('STDC_VERSION', '0L').rstrip('L'))
 
+    version = data.get('VERSION')
+    if version and type in ('msvc', 'clang-cl'):
+        msc_ver = version
+        version = msc_ver[0:2]
+        if len(msc_ver) > 2:
+            version += '.' + msc_ver[2:4]
+        if len(msc_ver) > 4:
+            version += '.' + msc_ver[4:]
+
     return namespace(
-        type=CompilerType(type),
-        version=data.get('VERSION'),
+        type=type,
+        version=version,
         language='C++' if cplusplus else 'C',
         language_version=cplusplus if cplusplus else stdc_version,
     )
 
 
 @imports(_from='mozbuild.shellutil', _import='quote')
 def check_compiler(compiler, language):
     info = get_compiler_info(compiler, language)
@@ -304,17 +314,17 @@ def check_compiler(compiler, language):
     # Note: this is a strict version check because we used to always add
     # -std=gnu++11.
     if info.language == 'C++' and info.language_version != 201103:
         if info.type in ('clang-cl', 'clang', 'gcc'):
             append_flag('-std=gnu++11')
 
     # We force clang-cl to emulate Visual C++ 2013 Update 3 with fallback to
     # cl.exe.
-    if info.type == 'clang-cl' and info.version != '180030723':
+    if info.type == 'clang-cl' and info.version != '18.00.30723':
         # Those flags are direct clang-cl flags that don't need -Xclang, add
         # them directly.
         flags.append('-fms-compatibility-version=18.00.30723')
         flags.append('-fallback')
 
     return info.type, info.version, flags
 
 
@@ -506,18 +516,18 @@ def compiler(language, host_or_target, c
 
         # If you want to bump the version check here search for
         # __cpp_static_assert above, and see the associated comment.
         if type == 'clang' and not version:
             raise FatalCheckError(
                 'Only clang/llvm 3.4 or newer is supported.')
 
         if type == 'msvc':
-            if version < '180030723' or (version > '19' and
-                                         version < '190023506'):
+            ver = Version(version)
+            if ver < '18.00.30723' or (ver > '19' and ver < '19.00.23506'):
                 raise FatalCheckError(
                     'This version (%s) of the MSVC compiler is not '
                     'supported.\n'
                     'You must install Visual C++ 2013 Update 3, Visual '
                     'C++ 2015 Update 1, or newer in order to build.\n'
                     'See https://developer.mozilla.org/en/'
                     'Windows_Build_Prerequisites' % version)
 
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -221,17 +221,17 @@ case "$target" in
             [ unsigned *test = new unsigned(42); ],,
             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
         AC_LANG_RESTORE
 
         changequote(,)
         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
         changequote([,])
 
-        _MSC_VER=`echo ${CC_VERSION} | cut -c 1-4`
+        _MSC_VER=`echo ${CC_VERSION} | cut -c 1-2,4-5`
 
         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
         AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
         AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
 
         case "$CC_VERSION" in
         18*)
             _CC_SUITE=12
--- a/old-configure.in
+++ b/old-configure.in
@@ -342,17 +342,17 @@ case "$target" in
             [ unsigned *test = new unsigned(42); ],,
             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
         AC_LANG_RESTORE
 
         changequote(,)
         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
         changequote([,])
 
-        _MSC_VER=`echo ${CC_VERSION} | cut -c 1-4`
+        _MSC_VER=`echo ${CC_VERSION} | cut -c 1-2,4-5`
 
         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
         AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
         AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
 
         case "$CC_VERSION" in
         18*)
             _CC_SUITE=12
@@ -1518,17 +1518,17 @@ case "$target" in
         dnl optimization/PGO case. I think it's probably a compiler bug,
         dnl but we work around it here.
         PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
         dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
         dnl Probably also a compiler bug, but what can you do?
         PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE $cgthreads"
         LDFLAGS="$LDFLAGS -DYNAMICBASE"
         RCFLAGS="-nologo"
-        if test "$CC_VERSION" = "180031101"; then
+        if test "$CC_VERSION" = "18.00.31101"; then
             dnl Use MaxILKSize as a workaround for LNK1248 in VS2013update4
             dnl See https://connect.microsoft.com/VisualStudio/feedback/details/1044914/fatal-error-lnk1248
             LDFLAGS="$LDFLAGS -MaxILKSize:0x7FF00000"
         fi
         dnl Minimum reqiurement of Gecko is VS2010 or later which supports
         dnl both SSSE3 and SSE4.1.
         HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
         HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1