diff auto/cc/msvc @ 6397:78f8ac479735

Win32: simplified and improved handling of MSVC versions. Now we always set NGX_CC_NAME to "msvc", and additionally test compiler version as reported by "cl" in auto/cc/msvc (the same version is also available via the _MSC_VER define). In particular, this approach allows to properly check for C99 variadic macros support, which previously was not used with MSVC versions not explicitly recognized. Now unneeded wildcards in NGX_CC_NAME tests for msvc removed accordingly, as well as unused wildcards for owc and icc.
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 13 Feb 2016 06:47:34 +0300
parents 85dea406e18f
children b7b7f3a0cc28
line wrap: on
line diff
--- a/auto/cc/msvc
+++ b/auto/cc/msvc
@@ -3,9 +3,24 @@
 # Copyright (C) Nginx, Inc.
 
 
-# MSVC 6.0 SP2
-# MSVC Toolkit 2003 (7.1)
-# MSVC 2005 Express Edition SP1 (8.0)
+# MSVC 6.0 SP2                            cl 12.00
+# MSVC Toolkit 2003 (7.1)                 cl 13.10
+# MSVC 2005 Express Edition SP1 (8.0)     cl 14.00
+# MSVC 2008 Express Edition (9.0)         cl 15.00
+# MSVC 2010 (10.0)                        cl 16.00
+# MSVC 2015 (14.0)                        cl 19.00
+
+
+NGX_MSVC_VER=`$NGX_WINE $CC 2>&1 | grep 'Compiler Version' 2>&1 \
+                                 | sed -e 's/^.* Version \(.*\)/\1/'`
+
+echo " + cl version: $NGX_MSVC_VER"
+
+have=NGX_COMPILER value="\"cl $NGX_MSVC_VER\"" . auto/define
+
+
+ngx_msvc_ver=`echo $NGX_MSVC_VER | sed -e 's/^\([0-9]*\).*/\1/'`
+
 
 # optimizations
 
@@ -90,17 +105,17 @@ CORE_LIBS="$CORE_LIBS kernel32.lib user3
 #CORE_LINK="$CORE_LINK -subsystem:windows -entry:mainCRTStartup"
 
 # debug
-# msvc8 under Wine issues
-#     Program database manager mismatch; please check your installation
-if [ $NGX_CC_NAME != msvc8 ]; then
+# msvc under Wine issues
+# C1902: Program database manager mismatch; please check your installation
+if [ -z "$NGX_WINE" ]; then
    CFLAGS="$CFLAGS -Zi"
    CORE_LINK="$CORE_LINK -debug"
 fi
 
 
 # MSVC 2005 supports C99 variadic macros
-if [ $NGX_CC_NAME = msvc8 ]; then
-   have=NGX_HAVE_C99_VARIADIC_MACROS . auto/have
+if [ "$ngx_msvc_ver" -ge 14 ]; then
+    have=NGX_HAVE_C99_VARIADIC_MACROS . auto/have
 fi