mirror of
https://github.com/nginx/nginx.git
synced 2024-11-27 23:49:00 +08:00
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.
This commit is contained in:
parent
822fc91b09
commit
4cfd9ba3c1
31
auto/cc/msvc
31
auto/cc/msvc
@ -3,9 +3,24 @@
|
|||||||
# Copyright (C) Nginx, Inc.
|
# Copyright (C) Nginx, Inc.
|
||||||
|
|
||||||
|
|
||||||
# MSVC 6.0 SP2
|
# MSVC 6.0 SP2 cl 12.00
|
||||||
# MSVC Toolkit 2003 (7.1)
|
# MSVC Toolkit 2003 (7.1) cl 13.10
|
||||||
# MSVC 2005 Express Edition SP1 (8.0)
|
# 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
|
# optimizations
|
||||||
|
|
||||||
@ -90,17 +105,17 @@ CORE_LIBS="$CORE_LIBS kernel32.lib user32.lib"
|
|||||||
#CORE_LINK="$CORE_LINK -subsystem:windows -entry:mainCRTStartup"
|
#CORE_LINK="$CORE_LINK -subsystem:windows -entry:mainCRTStartup"
|
||||||
|
|
||||||
# debug
|
# debug
|
||||||
# msvc8 under Wine issues
|
# msvc under Wine issues
|
||||||
# Program database manager mismatch; please check your installation
|
# C1902: Program database manager mismatch; please check your installation
|
||||||
if [ $NGX_CC_NAME != msvc8 ]; then
|
if [ -z "$NGX_WINE" ]; then
|
||||||
CFLAGS="$CFLAGS -Zi"
|
CFLAGS="$CFLAGS -Zi"
|
||||||
CORE_LINK="$CORE_LINK -debug"
|
CORE_LINK="$CORE_LINK -debug"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# MSVC 2005 supports C99 variadic macros
|
# MSVC 2005 supports C99 variadic macros
|
||||||
if [ $NGX_CC_NAME = msvc8 ]; then
|
if [ "$ngx_msvc_ver" -ge 14 ]; then
|
||||||
have=NGX_HAVE_C99_VARIADIC_MACROS . auto/have
|
have=NGX_HAVE_C99_VARIADIC_MACROS . auto/have
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
27
auto/cc/name
27
auto/cc/name
@ -25,31 +25,8 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
if [ "$CC" = cl ]; then
|
if [ "$CC" = cl ]; then
|
||||||
if `$NGX_WINE $CC -v 2>&1 \
|
NGX_CC_NAME=msvc
|
||||||
| grep '^Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16' \
|
echo " + using Microsoft Visual C++ compiler"
|
||||||
>/dev/null 2>&1`; then
|
|
||||||
|
|
||||||
NGX_CC_NAME=msvc10
|
|
||||||
echo " + using Microsoft Visual C++ 10 compiler"
|
|
||||||
|
|
||||||
elif `$NGX_WINE $CC -v 2>&1 \
|
|
||||||
| grep '^Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14' \
|
|
||||||
>/dev/null 2>&1`; then
|
|
||||||
|
|
||||||
NGX_CC_NAME=msvc8
|
|
||||||
echo " + using Microsoft Visual C++ 8 compiler"
|
|
||||||
|
|
||||||
elif `$NGX_WINE $CC -v 2>&1 \
|
|
||||||
| grep '^Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13' \
|
|
||||||
>/dev/null 2>&1`; then
|
|
||||||
|
|
||||||
NGX_CC_NAME=msvc7
|
|
||||||
echo " + using Microsoft Visual C++ 7 compiler"
|
|
||||||
|
|
||||||
else
|
|
||||||
NGX_CC_NAME=msvc
|
|
||||||
echo " + using Microsoft Visual C++ compiler"
|
|
||||||
fi
|
|
||||||
|
|
||||||
elif [ "$CC" = wcl386 ]; then
|
elif [ "$CC" = wcl386 ]; then
|
||||||
NGX_CC_NAME=owc
|
NGX_CC_NAME=owc
|
||||||
|
@ -20,12 +20,12 @@ if [ $MD5 != NONE ]; then
|
|||||||
|
|
||||||
case "$NGX_CC_NAME" in
|
case "$NGX_CC_NAME" in
|
||||||
|
|
||||||
msvc* | owc* | bcc)
|
msvc | owc | bcc)
|
||||||
LINK_DEPS="$LINK_DEPS $MD5/md5.lib"
|
LINK_DEPS="$LINK_DEPS $MD5/md5.lib"
|
||||||
CORE_LIBS="$CORE_LIBS $MD5/md5.lib"
|
CORE_LIBS="$CORE_LIBS $MD5/md5.lib"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
icc*)
|
icc)
|
||||||
LINK_DEPS="$LINK_DEPS $MD5/libmd5.a"
|
LINK_DEPS="$LINK_DEPS $MD5/libmd5.a"
|
||||||
|
|
||||||
# to allow -ipo optimization we link with the *.o but not library
|
# to allow -ipo optimization we link with the *.o but not library
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
|
|
||||||
case "$NGX_CC_NAME" in
|
case "$NGX_CC_NAME" in
|
||||||
|
|
||||||
msvc*)
|
msvc)
|
||||||
ngx_makefile=makefile.msvc
|
ngx_makefile=makefile.msvc
|
||||||
ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC MD5_ASM=$MD5_ASM"
|
ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC MD5_ASM=$MD5_ASM"
|
||||||
ngx_md5="MD5=\"$MD5\""
|
ngx_md5="MD5=\"$MD5\""
|
||||||
;;
|
;;
|
||||||
|
|
||||||
owc*)
|
owc)
|
||||||
ngx_makefile=makefile.owc
|
ngx_makefile=makefile.owc
|
||||||
ngx_opt="CPU_OPT=\"$CPU_OPT\""
|
ngx_opt="CPU_OPT=\"$CPU_OPT\""
|
||||||
ngx_md5=`echo MD5=\"$MD5\" | sed -e "s/\//$ngx_regex_dirsep/g"`
|
ngx_md5=`echo MD5=\"$MD5\" | sed -e "s/\//$ngx_regex_dirsep/g"`
|
||||||
|
@ -8,7 +8,7 @@ if [ $PCRE != NONE ]; then
|
|||||||
|
|
||||||
case "$NGX_CC_NAME" in
|
case "$NGX_CC_NAME" in
|
||||||
|
|
||||||
msvc* | owc* | bcc)
|
msvc | owc | bcc)
|
||||||
have=NGX_PCRE . auto/have
|
have=NGX_PCRE . auto/have
|
||||||
have=PCRE_STATIC . auto/have
|
have=PCRE_STATIC . auto/have
|
||||||
CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
|
CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
|
||||||
@ -16,7 +16,7 @@ if [ $PCRE != NONE ]; then
|
|||||||
CORE_LIBS="$CORE_LIBS $PCRE/pcre.lib"
|
CORE_LIBS="$CORE_LIBS $PCRE/pcre.lib"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
icc* )
|
icc)
|
||||||
have=NGX_PCRE . auto/have
|
have=NGX_PCRE . auto/have
|
||||||
CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
|
CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
|
||||||
|
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
|
|
||||||
case "$NGX_CC_NAME" in
|
case "$NGX_CC_NAME" in
|
||||||
|
|
||||||
msvc*)
|
msvc)
|
||||||
ngx_makefile=makefile.msvc
|
ngx_makefile=makefile.msvc
|
||||||
ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC"
|
ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC"
|
||||||
ngx_pcre="PCRE=\"$PCRE\""
|
ngx_pcre="PCRE=\"$PCRE\""
|
||||||
;;
|
;;
|
||||||
|
|
||||||
owc*)
|
owc)
|
||||||
ngx_makefile=makefile.owc
|
ngx_makefile=makefile.owc
|
||||||
ngx_opt="CPU_OPT=\"$CPU_OPT\""
|
ngx_opt="CPU_OPT=\"$CPU_OPT\""
|
||||||
ngx_pcre=`echo PCRE=\"$PCRE\" | sed -e "s/\//$ngx_regex_dirsep/g"`
|
ngx_pcre=`echo PCRE=\"$PCRE\" | sed -e "s/\//$ngx_regex_dirsep/g"`
|
||||||
|
@ -10,12 +10,12 @@ if [ $SHA1 != NONE ]; then
|
|||||||
|
|
||||||
case "$NGX_CC_NAME" in
|
case "$NGX_CC_NAME" in
|
||||||
|
|
||||||
msvc* | owc* | bcc)
|
msvc | owc | bcc)
|
||||||
LINK_DEPS="$LINK_DEPS $SHA1/sha1.lib"
|
LINK_DEPS="$LINK_DEPS $SHA1/sha1.lib"
|
||||||
CORE_LIBS="$CORE_LIBS $SHA1/sha1.lib"
|
CORE_LIBS="$CORE_LIBS $SHA1/sha1.lib"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
icc*)
|
icc)
|
||||||
LINK_DEPS="$LINK_DEPS $SHA1/libsha.a"
|
LINK_DEPS="$LINK_DEPS $SHA1/libsha.a"
|
||||||
|
|
||||||
# to allow -ipo optimization we link with the *.o but not library
|
# to allow -ipo optimization we link with the *.o but not library
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
|
|
||||||
case "$NGX_CC_NAME" in
|
case "$NGX_CC_NAME" in
|
||||||
|
|
||||||
msvc*)
|
msvc)
|
||||||
ngx_makefile=makefile.msvc
|
ngx_makefile=makefile.msvc
|
||||||
ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC SHA1_ASM=$SHA1_ASM"
|
ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC SHA1_ASM=$SHA1_ASM"
|
||||||
ngx_sha1="SHA1=\"$SHA1\""
|
ngx_sha1="SHA1=\"$SHA1\""
|
||||||
;;
|
;;
|
||||||
|
|
||||||
owc*)
|
owc)
|
||||||
ngx_makefile=makefile.owc
|
ngx_makefile=makefile.owc
|
||||||
ngx_opt="CPU_OPT=\"$CPU_OPT\""
|
ngx_opt="CPU_OPT=\"$CPU_OPT\""
|
||||||
ngx_sha1=`echo SHA1=\"$SHA1\" | sed -e "s/\//$ngx_regex_dirsep/g"`
|
ngx_sha1=`echo SHA1=\"$SHA1\" | sed -e "s/\//$ngx_regex_dirsep/g"`
|
||||||
|
@ -8,13 +8,13 @@ if [ $ZLIB != NONE ]; then
|
|||||||
|
|
||||||
case "$NGX_CC_NAME" in
|
case "$NGX_CC_NAME" in
|
||||||
|
|
||||||
msvc* | owc* | bcc)
|
msvc | owc | bcc)
|
||||||
have=NGX_ZLIB . auto/have
|
have=NGX_ZLIB . auto/have
|
||||||
LINK_DEPS="$LINK_DEPS $ZLIB/zlib.lib"
|
LINK_DEPS="$LINK_DEPS $ZLIB/zlib.lib"
|
||||||
CORE_LIBS="$CORE_LIBS $ZLIB/zlib.lib"
|
CORE_LIBS="$CORE_LIBS $ZLIB/zlib.lib"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
icc*)
|
icc)
|
||||||
have=NGX_ZLIB . auto/have
|
have=NGX_ZLIB . auto/have
|
||||||
LINK_DEPS="$LINK_DEPS $ZLIB/libz.a"
|
LINK_DEPS="$LINK_DEPS $ZLIB/libz.a"
|
||||||
|
|
||||||
|
@ -5,14 +5,14 @@
|
|||||||
|
|
||||||
case "$NGX_CC_NAME" in
|
case "$NGX_CC_NAME" in
|
||||||
|
|
||||||
msvc*)
|
msvc)
|
||||||
ngx_makefile=makefile.msvc
|
ngx_makefile=makefile.msvc
|
||||||
ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC"
|
ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC"
|
||||||
ngx_zlib="ZLIB=\"$ZLIB\""
|
ngx_zlib="ZLIB=\"$ZLIB\""
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
owc*)
|
owc)
|
||||||
ngx_makefile=makefile.owc
|
ngx_makefile=makefile.owc
|
||||||
ngx_opt="CPU_OPT=\"$CPU_OPT\""
|
ngx_opt="CPU_OPT=\"$CPU_OPT\""
|
||||||
ngx_zlib=`echo ZLIB=\"$ZLIB\" | sed -e "s/\//$ngx_regex_dirsep/g"`
|
ngx_zlib=`echo ZLIB=\"$ZLIB\" | sed -e "s/\//$ngx_regex_dirsep/g"`
|
||||||
|
Loading…
Reference in New Issue
Block a user