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/gcc | 179 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 app/nginx/auto/cc/gcc (limited to 'app/nginx/auto/cc/gcc') 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 -- cgit 1.2.3-korg