From e18a033b921d0d79fa8278f853548e6125b93e0c Mon Sep 17 00:00:00 2001 From: Konstantin Ananyev Date: Tue, 31 Oct 2017 12:40:17 +0000 Subject: Integrate TLDK with NGINX Created a clone of nginx (from https://github.com/nginx/nginx) to demonstrate and benchmark TLDK library integrated with real world application. A new nginx module is created and and BSD socket-like API is implemented on top of native TLDK API. Note, that right now only minimalistic subset of socket-like API is provided: - accept - close - readv - recv - writev so only limited nginx functionality is available for a moment. Change-Id: Ie1efe9349a0538da4348a48fb8306cbf636b5a92 Signed-off-by: Mohammad Abdul Awal Signed-off-by: Reshma Pattan Signed-off-by: Remy Horton Signed-off-by: Konstantin Ananyev --- app/nginx/auto/cc/acc | 14 +++ app/nginx/auto/cc/bcc | 72 ++++++++++++++ app/nginx/auto/cc/ccc | 46 +++++++++ app/nginx/auto/cc/clang | 98 +++++++++++++++++++ app/nginx/auto/cc/conf | 250 ++++++++++++++++++++++++++++++++++++++++++++++++ app/nginx/auto/cc/gcc | 179 ++++++++++++++++++++++++++++++++++ app/nginx/auto/cc/icc | 117 ++++++++++++++++++++++ app/nginx/auto/cc/msvc | 157 ++++++++++++++++++++++++++++++ app/nginx/auto/cc/name | 66 +++++++++++++ app/nginx/auto/cc/owc | 104 ++++++++++++++++++++ app/nginx/auto/cc/sunc | 160 +++++++++++++++++++++++++++++++ 11 files changed, 1263 insertions(+) create mode 100644 app/nginx/auto/cc/acc create mode 100644 app/nginx/auto/cc/bcc create mode 100644 app/nginx/auto/cc/ccc create mode 100644 app/nginx/auto/cc/clang create mode 100644 app/nginx/auto/cc/conf create mode 100644 app/nginx/auto/cc/gcc create mode 100644 app/nginx/auto/cc/icc create mode 100644 app/nginx/auto/cc/msvc create mode 100644 app/nginx/auto/cc/name create mode 100644 app/nginx/auto/cc/owc create mode 100644 app/nginx/auto/cc/sunc (limited to 'app/nginx/auto/cc') diff --git a/app/nginx/auto/cc/acc b/app/nginx/auto/cc/acc new file mode 100644 index 0000000..64fa671 --- /dev/null +++ b/app/nginx/auto/cc/acc @@ -0,0 +1,14 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +# aCC: HP ANSI C++ B3910B A.03.55.02 + +# C89 mode + +CFLAGS="$CFLAGS -Ae" +CC_TEST_FLAGS="-Ae" + +PCRE_OPT="$PCRE_OPT -Ae" +ZLIB_OPT="$ZLIB_OPT -Ae" diff --git a/app/nginx/auto/cc/bcc b/app/nginx/auto/cc/bcc new file mode 100644 index 0000000..ec82e60 --- /dev/null +++ b/app/nginx/auto/cc/bcc @@ -0,0 +1,72 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +# Borland C++ 5.5 + +# optimizations + +# maximize speed +CFLAGS="$CFLAGS -O2" + +case $CPU in + pentium) + # optimize for Pentium and Athlon + CPU_OPT="-5" + ;; + + pentiumpro) + # optimize for Pentium Pro, Pentium II and Pentium III + CPU_OPT="-6" + ;; +esac + +# __stdcall +#CPU_OPT="$CPU_OPT -ps" +# __fastcall +#CPU_OPT="$CPU_OPT -pr" + +CFLAGS="$CFLAGS $CPU_OPT" + +# multithreaded +CFLAGS="$CFLAGS -tWM" + +# stop on warning +CFLAGS="$CFLAGS -w!" + +# disable logo +CFLAGS="$CFLAGS -q" + + +# precompiled headers +CORE_DEPS="$CORE_DEPS $NGX_OBJS/ngx_config.csm" +NGX_PCH="$NGX_OBJS/ngx_config.csm" +NGX_BUILD_PCH="-H=$NGX_OBJS/ngx_config.csm" +NGX_USE_PCH="-Hu -H=$NGX_OBJS/ngx_config.csm" + + +# Win32 GUI mode application +#LINK="\$(CC) -laa" + + +# the resource file +NGX_RES="$NGX_OBJS/nginx.res" +NGX_RCC="brcc32 -fo$NGX_OBJS/nginx.res \$(CORE_INCS) $NGX_WIN32_RC" +# the pragma allows to link the resource file using bcc32 and +# to avoid the direct ilink32 calling and the c0w32.obj's WinMain/main problem +NGX_PRAGMA="#pragma resource \"$NGX_OBJS/nginx.res\"" + + +ngx_include_opt="-I" +ngx_objout="-o" +ngx_binout="-e" +ngx_objext="obj" +ngx_binext=".exe" + +ngx_long_start='@&&| + ' +ngx_long_end='|' + +ngx_regex_dirsep='\\' +ngx_dirsep="\\" diff --git a/app/nginx/auto/cc/ccc b/app/nginx/auto/cc/ccc new file mode 100644 index 0000000..c964045 --- /dev/null +++ b/app/nginx/auto/cc/ccc @@ -0,0 +1,46 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +# Compaq C V6.5-207 + +ngx_include_opt="-I" + +# warnings + +CFLAGS="$CFLAGS -msg_enable level6 -msg_fatal level6" + +CFLAGS="$CFLAGS -msg_disable unknownmacro" +CFLAGS="$CFLAGS -msg_disable unusedincl" +CFLAGS="$CFLAGS -msg_disable unnecincl" +CFLAGS="$CFLAGS -msg_disable nestincl" +CFLAGS="$CFLAGS -msg_disable strctpadding" +CFLAGS="$CFLAGS -msg_disable ansialiascast" +CFLAGS="$CFLAGS -msg_disable inlinestoclsmod" +CFLAGS="$CFLAGS -msg_disable cxxkeyword" +CFLAGS="$CFLAGS -msg_disable longlongsufx" +CFLAGS="$CFLAGS -msg_disable valuepres" + +# STUB +CFLAGS="$CFLAGS -msg_disable truncintcast" +CFLAGS="$CFLAGS -msg_disable trunclongcast" + +CFLAGS="$CFLAGS -msg_disable truncintasn" +CFLAGS="$CFLAGS -msg_disable trunclongint" +CFLAGS="$CFLAGS -msg_disable intconcastsgn" +CFLAGS="$CFLAGS -msg_disable intconstsign" +CFLAGS="$CFLAGS -msg_disable switchlong" +CFLAGS="$CFLAGS -msg_disable subscrbounds2" + +CFLAGS="$CFLAGS -msg_disable hexoctunsign" + +CFLAGS="$CFLAGS -msg_disable ignorecallval" +CFLAGS="$CFLAGS -msg_disable nonstandcast" +CFLAGS="$CFLAGS -msg_disable embedcomment" +CFLAGS="$CFLAGS -msg_disable unreachcode" +CFLAGS="$CFLAGS -msg_disable questcompare2" +CFLAGS="$CFLAGS -msg_disable unusedtop" +CFLAGS="$CFLAGS -msg_disable unrefdecl" + +CFLAGS="$CFLAGS -msg_disable bitnotint" diff --git a/app/nginx/auto/cc/clang b/app/nginx/auto/cc/clang new file mode 100644 index 0000000..19bdaaa --- /dev/null +++ b/app/nginx/auto/cc/clang @@ -0,0 +1,98 @@ + +# Copyright (C) Nginx, Inc. + + +# clang + + +NGX_CLANG_VER=`$CC -v 2>&1 | grep '\(clang\|LLVM\) version' 2>&1 \ + | sed -e 's/^.* version \(.*\)/\1/'` + +echo " + clang version: $NGX_CLANG_VER" + +have=NGX_COMPILER value="\"clang $NGX_CLANG_VER\"" . auto/define + + +CC_TEST_FLAGS="-pipe" + + +# optimizations + +#NGX_CLANG_OPT="-O2" +#NGX_CLANG_OPT="-Oz" +NGX_CLANG_OPT="-O" + +case $CPU in + pentium) + # optimize for Pentium + CPU_OPT="-march=pentium" + NGX_CPU_CACHE_LINE=32 + ;; + + pentiumpro | pentium3) + # optimize for Pentium Pro, Pentium II and Pentium III + CPU_OPT="-march=pentiumpro" + NGX_CPU_CACHE_LINE=32 + ;; + + pentium4) + # optimize for Pentium 4 + CPU_OPT="-march=pentium4" + NGX_CPU_CACHE_LINE=128 + ;; + + athlon) + # optimize for Athlon + CPU_OPT="-march=athlon" + NGX_CPU_CACHE_LINE=64 + ;; + + opteron) + # optimize for Opteron + CPU_OPT="-march=opteron" + NGX_CPU_CACHE_LINE=64 + ;; + +esac + +CC_AUX_FLAGS="$CC_AUX_FLAGS $CPU_OPT" + + +CFLAGS="$CFLAGS -pipe $CPU_OPT" + +if [ ".$PCRE_OPT" = "." ]; then + PCRE_OPT="-O2 -pipe $CPU_OPT" +else + PCRE_OPT="$PCRE_OPT -pipe" +fi + +if [ ".$ZLIB_OPT" = "." ]; then + ZLIB_OPT="-O2 -pipe $CPU_OPT" +else + ZLIB_OPT="$ZLIB_OPT -pipe" +fi + + +# warnings + +CFLAGS="$CFLAGS $NGX_CLANG_OPT -Wall -Wextra -Wpointer-arith" +CFLAGS="$CFLAGS -Wconditional-uninitialized" +#CFLAGS="$CFLAGS -Wmissing-prototypes" + +# we have a lot of unused function arguments +CFLAGS="$CFLAGS -Wno-unused-parameter" + +# deprecated system OpenSSL library on OS X +if [ "$NGX_SYSTEM" = "Darwin" ]; then + CFLAGS="$CFLAGS -Wno-deprecated-declarations" +fi + +# stop on warning +CFLAGS="$CFLAGS -Werror" + +# debug +CFLAGS="$CFLAGS -g" + +if [ ".$CPP" = "." ]; then + CPP="$CC -E" +fi diff --git a/app/nginx/auto/cc/conf b/app/nginx/auto/cc/conf new file mode 100644 index 0000000..b3b9f92 --- /dev/null +++ b/app/nginx/auto/cc/conf @@ -0,0 +1,250 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +LINK="\$(CC)" + +MAIN_LINK= +MODULE_LINK="-shared" + +ngx_include_opt="-I " +ngx_compile_opt="-c" +ngx_pic_opt="-fPIC" +ngx_objout="-o " +ngx_binout="-o " +ngx_objext="o" +ngx_binext= +ngx_modext=".so" + +ngx_long_start= +ngx_long_end= + +ngx_regex_dirsep="\/" +ngx_dirsep='/' + +ngx_regex_cont=' \\\ + ' +ngx_cont=' \ + ' +ngx_tab=' \ + ' +ngx_spacer= + +ngx_long_regex_cont=$ngx_regex_cont +ngx_long_cont=$ngx_cont + +. auto/cc/name + +if test -n "$CFLAGS"; then + + CC_TEST_FLAGS="$CFLAGS $NGX_CC_OPT" + + case $NGX_CC_NAME in + + ccc) + # Compaq C V6.5-207 + + ngx_include_opt="-I" + ;; + + sunc) + + MAIN_LINK= + MODULE_LINK="-G" + + case "$NGX_MACHINE" in + + i86pc) + NGX_AUX=" src/os/unix/ngx_sunpro_x86.il" + ;; + + sun4u | sun4v) + NGX_AUX=" src/os/unix/ngx_sunpro_sparc64.il" + ;; + + esac + + case $CPU in + + amd64) + NGX_AUX=" src/os/unix/ngx_sunpro_amd64.il" + ;; + + esac + ;; + + esac + +else + + case $NGX_CC_NAME in + gcc) + # gcc 2.7.2.3, 2.8.1, 2.95.4, egcs-1.1.2 + # 3.0.4, 3.1.1, 3.2.3, 3.3.2, 3.3.3, 3.3.4, 3.4.0, 3.4.2 + # 4.0.0, 4.0.1, 4.1.0 + + . auto/cc/gcc + ;; + + clang) + # Clang C compiler + + . auto/cc/clang + ;; + + icc) + # Intel C++ compiler 7.1, 8.0, 8.1 + + . auto/cc/icc + ;; + + sunc) + # Sun C 5.7 Patch 117837-04 2005/05/11 + + . auto/cc/sunc + ;; + + ccc) + # Compaq C V6.5-207 + + . auto/cc/ccc + ;; + + acc) + # aCC: HP ANSI C++ B3910B A.03.55.02 + + . auto/cc/acc + ;; + + msvc*) + # MSVC++ 6.0 SP2, MSVC++ Toolkit 2003 + + . auto/cc/msvc + ;; + + owc) + # Open Watcom C 1.0, 1.2 + + . auto/cc/owc + ;; + + bcc) + # Borland C++ 5.5 + + . auto/cc/bcc + ;; + + esac + + CC_TEST_FLAGS="$CC_TEST_FLAGS $NGX_CC_OPT" + +fi + +CFLAGS="$CFLAGS $NGX_CC_OPT" +NGX_TEST_LD_OPT="$NGX_LD_OPT" + +if [ "$NGX_PLATFORM" != win32 ]; then + + if test -n "$NGX_LD_OPT"; then + ngx_feature=--with-ld-opt=\"$NGX_LD_OPT\" + ngx_feature_name= + ngx_feature_run=no + ngx_feature_incs= + ngx_feature_path= + ngx_feature_libs= + ngx_feature_test= + . auto/feature + + if [ $ngx_found = no ]; then + echo $0: error: the invalid value in --with-ld-opt=\"$NGX_LD_OPT\" + echo + exit 1 + fi + fi + + + ngx_feature="-Wl,-E switch" + ngx_feature_name= + ngx_feature_run=no + ngx_feature_incs= + ngx_feature_path= + ngx_feature_libs=-Wl,-E + ngx_feature_test= + . auto/feature + + if [ $ngx_found = yes ]; then + MAIN_LINK="-Wl,-E" + fi + + + ngx_feature="gcc builtin atomic operations" + ngx_feature_name=NGX_HAVE_GCC_ATOMIC + ngx_feature_run=yes + ngx_feature_incs= + ngx_feature_path= + ngx_feature_libs= + ngx_feature_test="long n = 0; + if (!__sync_bool_compare_and_swap(&n, 0, 1)) + return 1; + if (__sync_fetch_and_add(&n, 1) != 1) + return 1; + if (n != 2) + return 1; + __sync_synchronize();" + . auto/feature + + + if [ "$NGX_CC_NAME" = "ccc" ]; then + echo "checking for C99 variadic macros ... disabled" + else + ngx_feature="C99 variadic macros" + ngx_feature_name="NGX_HAVE_C99_VARIADIC_MACROS" + ngx_feature_run=yes + ngx_feature_incs="#include +#define var(dummy, ...) sprintf(__VA_ARGS__)" + ngx_feature_path= + ngx_feature_libs= + ngx_feature_test="char buf[30]; buf[0] = '0'; + var(0, buf, \"%d\", 1); + if (buf[0] != '1') return 1" + . auto/feature + fi + + + ngx_feature="gcc variadic macros" + ngx_feature_name="NGX_HAVE_GCC_VARIADIC_MACROS" + ngx_feature_run=yes + ngx_feature_incs="#include +#define var(dummy, args...) sprintf(args)" + ngx_feature_path= + ngx_feature_libs= + ngx_feature_test="char buf[30]; buf[0] = '0'; + var(0, buf, \"%d\", 1); + if (buf[0] != '1') return 1" + . auto/feature + + + ngx_feature="gcc builtin 64 bit byteswap" + ngx_feature_name="NGX_HAVE_GCC_BSWAP64" + ngx_feature_run=no + ngx_feature_incs= + ngx_feature_path= + ngx_feature_libs= + ngx_feature_test="if (__builtin_bswap64(0)) return 1" + . auto/feature + + +# ngx_feature="inline" +# ngx_feature_name= +# ngx_feature_run=no +# ngx_feature_incs="int inline f(void) { return 1 }" +# ngx_feature_path= +# ngx_feature_libs= +# ngx_feature_test= +# . auto/feature +# +# if [ $ngx_found = yes ]; then +# fi + +fi diff --git a/app/nginx/auto/cc/gcc b/app/nginx/auto/cc/gcc new file mode 100644 index 0000000..a5c5c18 --- /dev/null +++ b/app/nginx/auto/cc/gcc @@ -0,0 +1,179 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +# gcc 2.7.2.3, 2.8.1, 2.95.4, egcs-1.1.2 +# 3.0.4, 3.1.1, 3.2.3, 3.3.2, 3.3.3, 3.3.4, 3.4.0, 3.4.2 +# 4.0.0, 4.0.1, 4.1.0 + + +NGX_GCC_VER=`$CC -v 2>&1 | grep 'gcc version' 2>&1 \ + | sed -e 's/^.* version \(.*\)/\1/'` + +echo " + gcc version: $NGX_GCC_VER" + +have=NGX_COMPILER value="\"gcc $NGX_GCC_VER\"" . auto/define + + +# Solaris 7's /usr/ccs/bin/as does not support "-pipe" + +CC_TEST_FLAGS="-pipe" + +ngx_feature="gcc -pipe switch" +ngx_feature_name= +ngx_feature_run=no +ngx_feature_incs= +ngx_feature_path= +ngx_feature_libs= +ngx_feature_test= +. auto/feature + +CC_TEST_FLAGS= + +if [ $ngx_found = yes ]; then + PIPE="-pipe" +fi + + +case "$NGX_MACHINE" in + + sun4u | sun4v | sparc | sparc64 ) + # "-mcpu=v9" enables the "casa" assembler instruction + CFLAGS="$CFLAGS -mcpu=v9" + ;; + +esac + + +# optimizations + +#NGX_GCC_OPT="-O2" +#NGX_GCC_OPT="-Os" +NGX_GCC_OPT="-O" + +#CFLAGS="$CFLAGS -fomit-frame-pointer" + +case $CPU in + pentium) + # optimize for Pentium and Athlon + CPU_OPT="-march=pentium" + NGX_CPU_CACHE_LINE=32 + ;; + + pentiumpro | pentium3) + # optimize for Pentium Pro, Pentium II and Pentium III + CPU_OPT="-march=pentiumpro" + NGX_CPU_CACHE_LINE=32 + ;; + + pentium4) + # optimize for Pentium 4, gcc 3.x + CPU_OPT="-march=pentium4" + NGX_CPU_CACHE_LINE=128 + ;; + + athlon) + # optimize for Athlon, gcc 3.x + CPU_OPT="-march=athlon" + NGX_CPU_CACHE_LINE=64 + ;; + + opteron) + # optimize for Opteron, gcc 3.x + CPU_OPT="-march=opteron" + NGX_CPU_CACHE_LINE=64 + ;; + + sparc32) + # build 32-bit UltraSparc binary + CPU_OPT="-m32" + CORE_LINK="$CORE_LINK -m32" + NGX_CPU_CACHE_LINE=64 + ;; + + sparc64) + # build 64-bit UltraSparc binary + CPU_OPT="-m64" + CORE_LINK="$CORE_LINK -m64" + NGX_CPU_CACHE_LINE=64 + ;; + + ppc64) + # build 64-bit PowerPC binary + CPU_OPT="-m64" + CPU_OPT="$CPU_OPT -falign-functions=32 -falign-labels=32" + CPU_OPT="$CPU_OPT -falign-loops=32 -falign-jumps=32" + CORE_LINK="$CORE_LINK -m64" + NGX_CPU_CACHE_LINE=128 + ;; + +esac + +CC_AUX_FLAGS="$CC_AUX_FLAGS $CPU_OPT" + +case "$NGX_GCC_VER" in + 2.7*) + # batch build + CPU_OPT= + ;; +esac + + +CFLAGS="$CFLAGS $PIPE $CPU_OPT" + +if [ ".$PCRE_OPT" = "." ]; then + PCRE_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT" +else + PCRE_OPT="$PCRE_OPT $PIPE" +fi + +if [ ".$ZLIB_OPT" = "." ]; then + ZLIB_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT" +else + ZLIB_OPT="$ZLIB_OPT $PIPE" +fi + + +# warnings + +# -W requires at least -O +CFLAGS="$CFLAGS ${NGX_GCC_OPT:--O} -W" + +CFLAGS="$CFLAGS -Wall -Wpointer-arith" +#CFLAGS="$CFLAGS -Wconversion" +#CFLAGS="$CFLAGS -Winline" +#CFLAGS="$CFLAGS -Wmissing-prototypes" + +case "$NGX_GCC_VER" in + 2.*) + # we have a lot of the unused function arguments + CFLAGS="$CFLAGS -Wno-unused" + ;; + + *) + # we have a lot of the unused function arguments + CFLAGS="$CFLAGS -Wno-unused-parameter" + # 4.2.1 shows the warning in wrong places + #CFLAGS="$CFLAGS -Wunreachable-code" + + # deprecated system OpenSSL library on OS X + if [ "$NGX_SYSTEM" = "Darwin" ]; then + CFLAGS="$CFLAGS -Wno-deprecated-declarations" + fi + ;; +esac + + +# stop on warning +CFLAGS="$CFLAGS -Werror" + +# debug +CFLAGS="$CFLAGS -g" + +# DragonFly's gcc3 generates DWARF +#CFLAGS="$CFLAGS -g -gstabs" + +if [ ".$CPP" = "." ]; then + CPP="$CC -E" +fi diff --git a/app/nginx/auto/cc/icc b/app/nginx/auto/cc/icc new file mode 100644 index 0000000..c47f6e4 --- /dev/null +++ b/app/nginx/auto/cc/icc @@ -0,0 +1,117 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +# Intel C++ compiler 7.1, 8.0, 8.1, 9.0, 11.1 + +NGX_ICC_VER=`$CC -V 2>&1 | grep 'Version' 2>&1 \ + | sed -e 's/^.* Version \([^ ]*\) *Build.*$/\1/'` + +echo " + icc version: $NGX_ICC_VER" + +have=NGX_COMPILER value="\"Intel C Compiler $NGX_ICC_VER\"" . auto/define + + +# optimizations + +CFLAGS="$CFLAGS -O" + +CORE_LINK="$CORE_LINK -opt_report_file=$NGX_OBJS/opt_report_file" + + +case $CPU in + pentium) + # optimize for Pentium and Athlon + CPU_OPT="-march=pentium" + ;; + + pentiumpro) + # optimize for Pentium Pro, Pentium II and Pentium III + CPU_OPT="-mcpu=pentiumpro -march=pentiumpro" + ;; + + pentium4) + # optimize for Pentium 4, default + CPU_OPT="-march=pentium4" + ;; +esac + +CFLAGS="$CFLAGS $CPU_OPT" + +if [ ".$PCRE_OPT" = "." ]; then + PCRE_OPT="-O $CPU_OPT" +fi + +if [ ".$ZLIB_OPT" = "." ]; then + ZLIB_OPT="-O $CPU_OPT" +fi + + +# warnings + +CFLAGS="$CFLAGS -w2" + +# disable some warnings + +# invalid type conversion: "int" to "char *" +CFLAGS="$CFLAGS -wd171" +# argument is incompatible with corresponding format string conversion +CFLAGS="$CFLAGS -wd181" +# zero used for undefined preprocessing identifier +CFLAGS="$CFLAGS -wd193" +# the format string ends before this argument +CFLAGS="$CFLAGS -wd268" +# invalid format string conversion +CFLAGS="$CFLAGS -wd269" +# conversion from "long long" to "size_t" may lose significant bits +CFLAGS="$CFLAGS -wd810" +# parameter was never referenced +CFLAGS="$CFLAGS -wd869" +# attribute "unused" is only allowed in a function definition, warning on pTHX_ +CFLAGS="$CFLAGS -wd1301" + +# STUB +# enumerated type mixed with another type +CFLAGS="$CFLAGS -wd188" +# controlling expression is constant +CFLAGS="$CFLAGS -wd279" +# operands are evaluated in unspecified order +CFLAGS="$CFLAGS -wd981" +# external definition with no prior declaration +CFLAGS="$CFLAGS -wd1418" +# external declaration in primary source file +CFLAGS="$CFLAGS -wd1419" + +case "$NGX_ICC_VER" in + 9.*) + # "cc" clobber ignored, warnings for Linux's htonl()/htons() + CFLAGS="$CFLAGS -wd1469" + # explicit conversion of a 64-bit integral type to a smaller + # integral type + CFLAGS="$CFLAGS -wd1683" + # conversion from pointer to same-sized integral type, + # warning on offsetof() + CFLAGS="$CFLAGS -wd1684" + # floating-point equality and inequality comparisons are unreliable, + # warning on SvTRUE() + CFLAGS="$CFLAGS -wd1572" + ;; + + 8.*) + # "cc" clobber ignored, warnings for Linux's htonl()/htons() + CFLAGS="$CFLAGS -wd1469" + # floating-point equality and inequality comparisons are unreliable, + # warning on SvTRUE() + CFLAGS="$CFLAGS -wd1572" + ;; + + *) + ;; +esac + +# stop on warning +CFLAGS="$CFLAGS -Werror" + +# debug +CFLAGS="$CFLAGS -g" diff --git a/app/nginx/auto/cc/msvc b/app/nginx/auto/cc/msvc new file mode 100644 index 0000000..4eef101 --- /dev/null +++ b/app/nginx/auto/cc/msvc @@ -0,0 +1,157 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +# 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 + +# maximize speed, equivalent to -Og -Oi -Ot -Oy -Ob2 -Gs -GF -Gy +CFLAGS="$CFLAGS -O2" + +# enable global optimization +#CFLAGS="$CFLAGS -Og" +# enable intrinsic functions +#CFLAGS="$CFLAGS -Oi" + +# disable inline expansion +#CFLAGS="$CFLAGS -Ob0" +# explicit inline expansion +#CFLAGS="$CFLAGS -Ob1" +# explicit and implicit inline expansion +#CFLAGS="$CFLAGS -Ob2" + +# enable frame pointer omission +#CFLAGS="$CFLAGS -Oy" +# disable stack checking calls +#CFLAGS="$CFLAGS -Gs" + +# pools strings as read/write +#CFLAGS="$CFLAGS -Gf" +# pools strings as read-only +#CFLAGS="$CFLAGS -GF" + + +case $CPU in + pentium) + # optimize for Pentium and Athlon + CPU_OPT="-G5" + ;; + + pentiumpro) + # optimize for Pentium Pro, Pentium II and Pentium III + CPU_OPT="-G6" + ;; + + pentium4) + # optimize for Pentium 4, MSVC 7 + CPU_OPT="-G7" + ;; +esac + +# __cdecl, default, must be used with OpenSSL, md5 asm, and sha1 asm +#CPU_OPT="$CPU_OPT -Gd" +# __stdcall +#CPU_OPT="$CPU_OPT -Gz" +# __fastcall +#CPU_OPT="$CPU_OPT -Gr" + + +CFLAGS="$CFLAGS $CPU_OPT" + + +# warnings + +CFLAGS="$CFLAGS -W4" + +# stop on warning +CFLAGS="$CFLAGS -WX" + +# disable logo +CFLAGS="$CFLAGS -nologo" + +# the link flags +CORE_LINK="$CORE_LINK -link -verbose:lib" + +# link with libcmt.lib, multithreaded +LIBC="-MT" +# link with msvcrt.dll +# however, MSVC Toolkit 2003 has no MSVCRT.LIB +#LIBC="-MD" + +CFLAGS="$CFLAGS $LIBC" + +CORE_LIBS="$CORE_LIBS kernel32.lib user32.lib" + +# Win32 GUI mode application +#CORE_LINK="$CORE_LINK -subsystem:windows -entry:mainCRTStartup" + +# debug +# 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_msvc_ver" -ge 14 ]; then + have=NGX_HAVE_C99_VARIADIC_MACROS . auto/have +fi + + +# precompiled headers +CORE_DEPS="$CORE_DEPS $NGX_OBJS/ngx_config.pch" +CORE_LINK="$CORE_LINK $NGX_OBJS/ngx_pch.obj" +NGX_PCH="$NGX_OBJS/ngx_config.pch" +NGX_BUILD_PCH="-Ycngx_config.h -Fp$NGX_OBJS/ngx_config.pch" +NGX_USE_PCH="-Yungx_config.h -Fp$NGX_OBJS/ngx_config.pch" + + +# the resource file +NGX_RES="$NGX_OBJS/nginx.res" +NGX_RCC="rc -fo$NGX_RES \$(CORE_INCS) $NGX_WIN32_RC" +CORE_LINK="$NGX_RES $CORE_LINK" + + +# dynamic modules +#MAIN_LINK="-link -def:$NGX_OBJS/nginx.def" +#MODULE_LINK="-LD $NGX_OBJS/nginx.lib" + + +ngx_pic_opt= +ngx_objout="-Fo" +ngx_binout="-Fe" +ngx_objext="obj" +ngx_binext=".exe" + +ngx_long_start='@<< + ' +ngx_long_end='<<' +ngx_long_regex_cont=' \ + ' +ngx_long_cont=' + ' + +# MSVC understand / in path +#ngx_regex_dirsep='\\' +#ngx_dirsep="\\" diff --git a/app/nginx/auto/cc/name b/app/nginx/auto/cc/name new file mode 100644 index 0000000..35d319e --- /dev/null +++ b/app/nginx/auto/cc/name @@ -0,0 +1,66 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +if [ "$NGX_PLATFORM" != win32 ]; then + + ngx_feature="C compiler" + ngx_feature_name= + ngx_feature_run=yes + ngx_feature_incs= + ngx_feature_path= + ngx_feature_libs= + ngx_feature_test= + . auto/feature + + if [ $ngx_found = no ]; then + echo + echo $0: error: C compiler $CC is not found + echo + exit 1 + fi + +fi + + +if [ "$CC" = cl ]; then + NGX_CC_NAME=msvc + echo " + using Microsoft Visual C++ compiler" + +elif [ "$CC" = wcl386 ]; then + NGX_CC_NAME=owc + echo " + using Open Watcom C compiler" + +elif [ "$CC" = bcc32 ]; then + NGX_CC_NAME=bcc + echo " + using Borland C++ compiler" + +elif `$CC -V 2>&1 | grep '^Intel(R) C' >/dev/null 2>&1`; then + NGX_CC_NAME=icc + echo " + using Intel C++ compiler" + +elif `$CC -v 2>&1 | grep 'gcc version' >/dev/null 2>&1`; then + NGX_CC_NAME=gcc + echo " + using GNU C compiler" + +elif `$CC -v 2>&1 | grep '\(clang\|LLVM\) version' >/dev/null 2>&1`; then + NGX_CC_NAME=clang + echo " + using Clang C compiler" + +elif `$CC -V 2>&1 | grep 'Sun C' >/dev/null 2>&1`; then + NGX_CC_NAME=sunc + echo " + using Sun C compiler" + +elif `$CC -V 2>&1 | grep '^Compaq C' >/dev/null 2>&1`; then + NGX_CC_NAME=ccc + echo " + using Compaq C compiler" + +elif `$CC -V 2>&1 | grep '^aCC: ' >/dev/null 2>&1`; then + NGX_CC_NAME=acc + echo " + using HP aC++ compiler" + +else + NGX_CC_NAME=unknown + +fi diff --git a/app/nginx/auto/cc/owc b/app/nginx/auto/cc/owc new file mode 100644 index 0000000..a063aa3 --- /dev/null +++ b/app/nginx/auto/cc/owc @@ -0,0 +1,104 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +# Open Watcom C 1.0, 1.2, 1.3 + +# optimizations + +# maximize speed +CFLAGS="$CFLAGS -ot" +# reorder instructions for best pipeline usage +CFLAGS="$CFLAGS -op" +# inline intrinsic functions +CFLAGS="$CFLAGS -oi" +# inline expansion +CFLAGS="$CFLAGS -oe" +# disable stack checking calls +CFLAGS="$CFLAGS -s" + +case $CPU in + pentium) + # optimize for Pentium and Athlon + # register-based arguments passing conventions + CPU_OPT="-5r" + # stack-based arguments passing conventions + #CPU_OPT="-5s" + ;; + + pentiumpro) + # optimize for Pentium Pro, Pentium II and Pentium III + # register-based arguments passing conventions + CPU_OPT="-6r" + # stack-based arguments passing conventions + #CPU_OPT="-6s" + ;; +esac + +CFLAGS="$CFLAGS $CPU_OPT" + + +# warnings + +# maximum level +CFLAGS="$CFLAGS -wx" +#CFLAGS="$CFLAGS -w3" + +# stop on warning +CFLAGS="$CFLAGS -we" + +# built target is NT +CFLAGS="$CFLAGS -bt=nt" + +# multithreaded +CFLAGS="$CFLAGS -bm" + +# debug +CFLAGS="$CFLAGS -d2" + +# quiet +CFLAGS="$CFLAGS -zq" + +# Open Watcom C 1.2 +have=NGX_HAVE_C99_VARIADIC_MACROS . auto/have + + +# the precompiled headers +#CORE_DEPS="$CORE_DEPS $NGX_OBJS/ngx_config.pch" +#NGX_PCH="$NGX_OBJS/ngx_config.pch" +#NGX_BUILD_PCH="-fhq=$NGX_OBJS/ngx_config.pch" +#NGX_USE_PCH="-fh=$NGX_OBJS/ngx_config.pch" + + +# the link flags, built target is NT GUI mode application +#CORE_LINK="$CORE_LINK -l=nt_win" + + +# the resource file +NGX_RCC="wrc \$(CORE_INCS) -fo=$NGX_OBJS/nginx.res " +NGX_RCC="$NGX_RCC $NGX_WIN32_RC $NGX_OBJS/nginx.exe" + + +ngx_include_opt="-i=" +ngx_objout="-fo" +ngx_binout="-fe=" +ngx_objext="obj" +ngx_binext=".exe" + +ngx_regex_dirsep='\\' +ngx_dirsep="\\" + +ngx_long_start=' ' +ngx_long_end=' ' +ngx_long_regex_cont=' \&\ + ' +ngx_long_cont=' & + ' + +ngx_regex_cont=' \&\ + ' +ngx_cont=' & + ' +ngx_tab=' & + ' diff --git a/app/nginx/auto/cc/sunc b/app/nginx/auto/cc/sunc new file mode 100644 index 0000000..806ccc4 --- /dev/null +++ b/app/nginx/auto/cc/sunc @@ -0,0 +1,160 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +# Sun C 5.7 Patch 117837-04 2005/05/11 Sun Studio 10 +# Sun C 5.8 2005/10/13 Sun Studio 11 +# Sun C 5.9 SunOS_i386 2007/05/03 Sun Studio 12 +# Sun C 5.9 SunOS_sparc 2007/05/03 +# Sun C 5.10 SunOS_i386 2009/06/03 Sun Studio 12.1 +# Sun C 5.11 SunOS_i386 2010/08/13 Sun Studio 12.2 + +NGX_SUNC_VER=`$CC -V 2>&1 | grep 'Sun C' 2>&1 \ + | sed -e 's/^.* Sun C \(.*\)/\1/'` + +echo " + Sun C version: $NGX_SUNC_VER" + +have=NGX_COMPILER value="\"Sun C $NGX_SUNC_VER\"" . auto/define + + +cat << END > $NGX_AUTOTEST.c + +int main(void) { + printf("%d", __SUNPRO_C); + return 0; +} + +END + +eval "$CC -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1" + +if [ -x $NGX_AUTOTEST ]; then + ngx_sunc_ver=`$NGX_AUTOTEST` +fi + +rm -rf $NGX_AUTOTEST* + +# 1424 == 0x590, Sun Studio 12 + +if [ "$ngx_sunc_ver" -ge 1424 ]; then + ngx_sparc32="-m32" + ngx_sparc64="-m64" + ngx_amd64="-m64" + +else + ngx_sparc32="-xarch=v8plus" + ngx_sparc64="-xarch=v9" + ngx_amd64="-xarch=amd64" +fi + +case "$NGX_MACHINE" in + + i86pc) + NGX_AUX=" src/os/unix/ngx_sunpro_x86.il" + ;; + + sun4u | sun4v) + NGX_AUX=" src/os/unix/ngx_sunpro_sparc64.il" + ;; + +esac + +MAIN_LINK= +MODULE_LINK="-G" + + +# optimizations + +# 20736 == 0x5100, Sun Studio 12.1 + +if [ "$ngx_sunc_ver" -ge 20736 ]; then + ngx_fast="-fast" + +else + # older versions had problems with bit-fields + ngx_fast="-fast -xalias_level=any" +fi + +IPO=-xipo +CFLAGS="$CFLAGS $ngx_fast $IPO" +CORE_LINK="$CORE_LINK $ngx_fast $IPO" + + +case $CPU in + pentium) + # optimize for Pentium and Athlon + CPU_OPT="-xchip=pentium" + ;; + + pentiumpro) + # optimize for Pentium Pro, Pentium II + CPU_OPT="-xchip=pentium_pro" + ;; + + pentium3) + # optimize for Pentium III + CPU_OPT="-xchip=pentium3" + #CPU_OPT="$CPU_OPT -xarch=sse" + CPU_OPT="$CPU_OPT -xcache=16/32/4:256/32/4" + ;; + + pentium4) + # optimize for Pentium 4 + CPU_OPT="-xchip=pentium4" + #CPU_OPT="$CPU_OPT -xarch=sse2" + CPU_OPT="$CPU_OPT -xcache=8/64/4:256/128/8" + ;; + + opteron) + # optimize for Opteron + CPU_OPT="-xchip=opteron" + #CPU_OPT="$CPU_OPT -xarch=sse2" + CPU_OPT="$CPU_OPT -xcache=64/64/2:1024/64/16" + ;; + + sparc32) + # build 32-bit UltraSparc binary + CPU_OPT="$ngx_sparc32" + CORE_LINK="$CORE_LINK $ngx_sparc32" + CC_AUX_FLAGS="$CC_AUX_FLAGS $ngx_sparc32" + NGX_CPU_CACHE_LINE=64 + ;; + + sparc64) + # build 64-bit UltraSparc binary + CPU_OPT="$ngx_sparc64" + CORE_LINK="$CORE_LINK $ngx_sparc64" + CC_AUX_FLAGS="$CC_AUX_FLAGS $ngx_sparc64" + NGX_CPU_CACHE_LINE=64 + ;; + + amd64) + # build 64-bit amd64 binary + CPU_OPT="$ngx_amd64" + CORE_LINK="$CORE_LINK $ngx_amd64" + CC_AUX_FLAGS="$CC_AUX_FLAGS $ngx_amd64" + NGX_AUX=" src/os/unix/ngx_sunpro_amd64.il" + NGX_CPU_CACHE_LINE=64 + ;; + +esac + + +CFLAGS="$CFLAGS $CPU_OPT" + + +if [ ".$PCRE_OPT" = "." ]; then + PCRE_OPT="$ngx_fast $IPO $CPU_OPT" +fi + +if [ ".$ZLIB_OPT" = "." ]; then + ZLIB_OPT="$ngx_fast $IPO $CPU_OPT" +fi + + +# stop on warning +CFLAGS="$CFLAGS -errwarn=%all" + +# debug +CFLAGS="$CFLAGS -g" -- cgit 1.2.3-korg