Review variable CC
Initially inauto/options
Initialized in the script:
CC=${CC:-gcc}
1 C compiler feature
The compiler for Windows is calledMSVC
Other platforms are collectively calledC Compiler
.
1.1 obtain compiler Parameters
This script is not complex.NGX_PLATFORM
Variable to determine whether it iswin32
(The variable is inauto/options
). If yes, then:
ngx_feature="C compiler"ngx_feature_name=ngx_feature_run=yesngx_feature_incs=ngx_feature_path=ngx_feature_libs=ngx_feature_test=. auto/feature
Where,ngx_feature
Variable isC compiler
And initialize other feature-related variables before referencing them.auto/feature
Script.
1.2 exit if the compiler cannot be found.
ngx_found
Indicates whether the compiler exists and determinesngx_found
If the variable isno
(The variable is inauto/feature
In the script), then:
echoecho $0: error: C compiler $CC is not foundechoexit 1
That is, if the compiler does not exist, exit the automatic script.
2. Set the name 2.1 msvc based on different Compilers
if `$NGX_WINE $CC -v 2>&1 | grep ‘^Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16‘ >/dev/null 2>&1`; then NGX_CC_NAME=msvc10 echo " + using Microsoft Visual C++ 10 compiler"else if `$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"else if `$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"fififi
2.2 owc
elseif [ "$CC" = wcl386 ]; then NGX_CC_NAME=owc echo " + using Open Watcom C compiler"
2.3 BCC
elseif [ "$CC" = bcc32 ]; then NGX_CC_NAME=bcc echo " + using Borland C++ compiler"
2.4 gcc
elseif `$CC -v 2>&1 | grep ‘gcc version‘ >/dev/null 2>&1`; then NGX_CC_NAME=gcc echo " + using GNU C compiler"
2.5 ICC
elseif `$CC -V 2>&1 | grep ‘^Intel(R) C‘ >/dev/null 2>&1`; then NGX_CC_NAME=icc echo " + using Intel C++ compiler"
2.6 sunc
elseif `$CC -V 2>&1 | grep ‘Sun C‘ >/dev/null 2>&1`; then NGX_CC_NAME=sunc echo " + using Sun C compiler"
2.7 ccc
elseif `$CC -V 2>&1 | grep ‘^Compaq C‘ >/dev/null 2>&1`; then NGX_CC_NAME=ccc echo " + using Compaq C compiler"
2.8 ACC
elseif `$CC -V 2>&1 | grep ‘^aCC: ‘ >/dev/null 2>&1`; then NGX_CC_NAME=acc echo " + using HP aC++ compiler"
2.9 unknown
else NGX_CC_NAME=unknown
Anatomy of nginx automatic scripts (6) compiler name variable script Auto/CC/Name