From 7b90834fbab2f2d5979a2787674bb246139405d9 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Wed, 10 Mar 2004 20:56:39 +0000 Subject: [PATCH] nginx-0.0.2-2004-03-10-23:56:39 import --- auto/cc | 61 ++++++++++++++++++++++++++----------- auto/lib/md5/make | 26 +++++++++++----- auto/lib/md5/makefile.msvc | 14 +++++++-- auto/lib/md5/makefile.owc | 2 +- auto/lib/pcre/make | 6 ++-- auto/lib/pcre/makefile.msvc | 2 +- auto/lib/pcre/makefile.owc | 2 +- auto/lib/zlib/make | 20 ++++++++---- auto/lib/zlib/makefile.msvc | 2 +- auto/lib/zlib/makefile.owc | 2 +- auto/options | 20 ++++++++++-- 11 files changed, 114 insertions(+), 43 deletions(-) diff --git a/auto/cc b/auto/cc index 207931141..d1cdea4d2 100644 --- a/auto/cc +++ b/auto/cc @@ -7,19 +7,30 @@ case $CC in # optimization #CFLAGS="$CFLAGS -O2 -fomit-frame-pointer" - case $CPU_OPT in + case $CPU in pentiumpro) # optimize for Pentium Pro, Pentium II and Pentium III - LIB_OPT="-march=pentiumpro" + CPU_OPT="-march=pentiumpro" ;; pentium4) # optimize for Pentium 4, gcc 3.x - LIB_OPT="-march=pentium4" + CPU_OPT="-march=pentium4" ;; esac - CFLAGS="$CFLAGS $LIB_OPT" - ZLIB_OPT="-O2 -fomit-frame-pointer $LIB_OPT" + CFLAGS="$CFLAGS $CPU_OPT" + + if [ $PCRE_OPT = NO ]; then + PCRE_OPT="CFLAGS=\"-O2 -fomit-frame-pointer $CPU_OPT\"" + fi + + if [ $MD5_OPT = NO ]; then + MD5_OPT="CFLAGS=\"-O2 -fomit-frame-pointer $CPU_OPT\"" + fi + + if [ $ZLIB_OPT = NO ]; then + ZLIB_OPT="CFLAGS=\"-O2 -fomit-frame-pointer $CPU_OPT $ZLIB_ASMV\"" + fi # warnings CFLAGS="$CFLAGS -O -W" @@ -57,19 +68,35 @@ case $CC in # optimization CFLAGS="$CFLAGS -O" + # inline functions declared with __inline + CFLAGS="$CFLAGS -Ob1" + # inline any function, at the compiler's discretion + #CFLAGS="$CFLAGS -Ob2" - case $CPU_OPT in + case $CPU in pentiumpro) # optimize for Pentium Pro, Pentium II and Pentium III - LIB_OUT="-mcpu=pentiumpro -march=pentiumpro" + CPU_OPT="-mcpu=pentiumpro -march=pentiumpro" ;; pentium4) # optimize for Pentium 4, default - LIB_OPT="-march=pentium4" + CPU_OPT="-march=pentium4" ;; esac - CFLAGS="$CFLAGS $LIB_OUT" + CFLAGS="$CFLAGS $CPU_OPT" + + if [ $PCRE_OPT = NO ]; then + PCRE_OPT="CFLAGS=\"-O $CPU_OPT\"" + fi + + if [ $MD5_OPT = NO ]; then + MD5_OPT="CFLAGS=\"-O $CPU_OPT\"" + fi + + if [ $ZLIB_OPT = NO ]; then + ZLIB_OPT="CFLAGS=\"-O $CPU_OPT $ZLIB_ASMV\"" + fi # warnings CFLAGS="$CFLAGS -w1" @@ -108,18 +135,18 @@ case $CC in # disable stack checking calls CFLAGS="$CFLAGS -Gs" - case $CPU_OPT in + case $CPU in pentiumpro) # optimize for Pentium Pro, Pentium II and Pentium III - LIB_OUT="-G6" + CPU_OPT="-G6" ;; pentium4) # optimize for Pentium 4 - #LIB_OUT="-G7" + #CPU_OPT="-G7" ;; esac - CFLAGS="$CFLAGS $LIB_OUT" + CFLAGS="$CFLAGS $CPU_OPT" # warnings CFLAGS="$CFLAGS -W3" @@ -184,17 +211,17 @@ case $CC in # disable stack checking calls CFLAGS="$CFLAGS -s" - case $CPU_OPT in + case $CPU in pentiumpro) # optimize for Pentium Pro, Pentium II and Pentium III # register-based arguments passing conventions - LIB_OUT="-6r" + CPU_OPT="-6r" # stack-based arguments passing conventions - #LIB_OUT="-6s" + #CPU_OPT="-6s" ;; esac - CFLAGS="$CFLAGS $LIB_OUT" + CFLAGS="$CFLAGS $CPU_OPT" # warnings #CFLAGS="$CFLAGS -w3" diff --git a/auto/lib/md5/make b/auto/lib/md5/make index d75a301e2..1cca3add7 100644 --- a/auto/lib/md5/make +++ b/auto/lib/md5/make @@ -31,24 +31,34 @@ case $PLATFORM in cp auto/lib/md5/$makefile $MD5 echo " cd $MD5" >> $MAKEFILE - echo " \$(MAKE) -f $makefile LIB_OPT=$LIB_OPT" >> $MAKEFILE + echo $ngx_n " \$(MAKE) -f $makefile" $ngx_c >> $MAKEFILE + echo " CPU_OPT=$CPU_OPT MD5_ASM=$MD5_ASM" >> $MAKEFILE echo " cd ..\\..\\.." >> $MAKEFILE ;; SunOS:*:i86pc) - echo " cd $MD5 && \$(MAKE) x86-solaris" >> $MAKEFILE + if [ $MD5_ASM = YES ]; then + echo " cd $MD5 && \$(MAKE) $MD5_OPT x86-solaris" >> $MAKEFILE + else + echo " cd $MD5 \\" >> $MAKEFILE + echo " && \$(MAKE) $MD5_OPT \\" >> $MAKEFILE + echo " MD5_ASM_OBJ= CC=$CC all" >> $MAKEFILE + fi ;; *:i386) - echo " cd $MD5 && \$(MAKE) x86-elf" >> $MAKEFILE + if [ $MD5_ASM = YES ]; then + echo " cd $MD5 && \$(MAKE) $MD5_OPT x86-elf" >> $MAKEFILE + else + echo " cd $MD5 \\" >> $MAKEFILE + echo " && \$(MAKE) $MD5_OPT \\" >> $MAKEFILE + echo " MD5_ASM_OBJ= CC=$CC all" >> $MAKEFILE + fi ;; *) - if [ $CC = gcc ]; then - echo " cd $MD5 && \$(MAKE) gcc" >> $MAKEFILE - else - echo " cd $MD5 && \$(MAKE) cc" >> $MAKEFILE - fi + echo " cd $MD5 \\" >> $MAKEFILE + echo " && \$(MAKE) $MD5_OPT MD5_ASM_OBJ= CC=$CC all" >> $MAKEFILE ;; esac diff --git a/auto/lib/md5/makefile.msvc b/auto/lib/md5/makefile.msvc index ad719c050..65ca4ab8d 100644 --- a/auto/lib/md5/makefile.msvc +++ b/auto/lib/md5/makefile.msvc @@ -1,6 +1,16 @@ -CFLAGS = -nologo -c -MT -O2 -Ob1 -Oi -Gs $(LIB_OPT) -D MD5_ASM -D L_ENDIAN +CFLAGS = -nologo -c -MT -O2 -Ob1 -Oi -Gs $(CPU_OPT) -D L_ENDIAN + +!if "$(MD5_ASM)" == "YES" + +md5.lib: + cl $(CFLAGS) -D MD5_ASM md5_dgst.c + link -lib -out:md5.lib md5_dgst.obj asm/m-win32.obj + +!else md5.lib: cl $(CFLAGS) md5_dgst.c - link -lib -out:md5.lib md5_dgst.obj asm/m-win32.obj + link -lib -out:md5.lib md5_dgst.obj + +!endif diff --git a/auto/lib/md5/makefile.owc b/auto/lib/md5/makefile.owc index f02a742ec..2cb6b654f 100644 --- a/auto/lib/md5/makefile.owc +++ b/auto/lib/md5/makefile.owc @@ -1,5 +1,5 @@ -CFLAGS = -c -zq -bt=nt -bm -ot -op -oi -oe -s $(LIB_OPT) +CFLAGS = -c -zq -bt=nt -bm -ot -op -oi -oe -s $(CPU_OPT) md5.lib: wcl386 $(CFLAGS) -dL_ENDIAN md5_dgst.c diff --git a/auto/lib/pcre/make b/auto/lib/pcre/make index 8bfd9438e..d4f658eb2 100644 --- a/auto/lib/pcre/make +++ b/auto/lib/pcre/make @@ -32,14 +32,14 @@ case $PLATFORM in cp auto/lib/pcre/patch.config $PCRE cp auto/lib/pcre/$makefile $PCRE echo " cd $PCRE" >> $MAKEFILE - echo " \$(MAKE) -f $makefile LIB_OPT=$LIB_OPT" >> $MAKEFILE + echo " \$(MAKE) -f $makefile CPU_OPT=$CPU_OPT" >> $MAKEFILE echo " cd ..\\..\\.." >> $MAKEFILE ;; *) echo " cd $PCRE \\" >> $MAKEFILE - echo $ngx_n " && CFLAGS=\"-O2 $LIB_OPT\"" $ngx_c >> $MAKEFILE - echo " ./configure --disable-shared \\" >> $MAKEFILE + echo " && CC=$CC $PCRE_OPT \\" >> $MAKEFILE + echo " ./configure --disable-shared \\" >> $MAKEFILE echo " && \$(MAKE)" >> $MAKEFILE ;; diff --git a/auto/lib/pcre/makefile.msvc b/auto/lib/pcre/makefile.msvc index f65196821..778607c2b 100644 --- a/auto/lib/pcre/makefile.msvc +++ b/auto/lib/pcre/makefile.msvc @@ -1,5 +1,5 @@ -CFLAGS = -O2 -Ob1 -Oi -Gs -MT $(LIB_OPT) +CFLAGS = -O2 -Ob1 -Oi -Gs -MT $(CPU_OPT) PCREFLAGS = -DPCRE_STATIC -DPOSIX_MALLOC_THRESHOLD=10 diff --git a/auto/lib/pcre/makefile.owc b/auto/lib/pcre/makefile.owc index 5c15e8770..706621547 100644 --- a/auto/lib/pcre/makefile.owc +++ b/auto/lib/pcre/makefile.owc @@ -1,5 +1,5 @@ -CFLAGS = -c -zq -bt=nt -ot -op -oi -oe -s -bm $(LIB_OPT) +CFLAGS = -c -zq -bt=nt -ot -op -oi -oe -s -bm $(CPU_OPT) PCREFLAGS = -DPCRE_STATIC -DPOSIX_MALLOC_THRESHOLD=10 diff --git a/auto/lib/zlib/make b/auto/lib/zlib/make index ff9ada0ae..50a655934 100644 --- a/auto/lib/zlib/make +++ b/auto/lib/zlib/make @@ -31,20 +31,28 @@ case $PLATFORM in cp auto/lib/zlib/$makefile $ZLIB echo " cd $ZLIB" >> $MAKEFILE - echo " \$(MAKE) -f $makefile LIB_OPT=$LIB_OPT" >> $MAKEFILE + echo " \$(MAKE) -f $makefile CPU_OPT=$CPU_OPT" >> $MAKEFILE echo " cd ..\\..\\.." >> $MAKEFILE ;; *:i386 | *:i686) - echo " cd $ZLIB \\" >> $MAKEFILE - echo " && cp contrib/asm686/match.S . \\" >> $MAKEFILE - echo " && CFLAGS=\"-O3 -DASMV\" ./configure \\" >> $MAKEFILE - echo " && \$(MAKE) OBJA=match.o" >> $MAKEFILE + if [ $ZLIB_ASM = pentiumpro ]; then + echo " cd $ZLIB \\" >> $MAKEFILE + echo " && cp contrib/asm686/match.S . \\" >> $MAKEFILE + echo " && CC=$CC $ZLIB_OPT ./configure \\" >> $MAKEFILE + echo " && \$(MAKE) OBJA=match.o" >> $MAKEFILE + else + echo " cd $ZLIB \\" >> $MAKEFILE + echo " && CC=$CC $ZLIB_OPT ./configure \\" >> $MAKEFILE + echo " && \$(MAKE)" >> $MAKEFILE + fi ;; *) - echo " cd $ZLIB && ./configure && \$(MAKE)" >> $MAKEFILE + echo " cd $ZLIB \\" >> $MAKEFILE + echo " && CC=$CC $ZLIB_OPT ./configure \\" >> $MAKEFILE + echo " && \$(MAKE)" >> $MAKEFILE ;; esac diff --git a/auto/lib/zlib/makefile.msvc b/auto/lib/zlib/makefile.msvc index 1d38c5b6c..ebb11d3fa 100644 --- a/auto/lib/zlib/makefile.msvc +++ b/auto/lib/zlib/makefile.msvc @@ -1,5 +1,5 @@ -CFLAGS = -nologo -c -MT -O2 -Ob1 -Oi -Gs $(LIB_OPT) +CFLAGS = -nologo -c -MT -O2 -Ob1 -Oi -Gs $(CPU_OPT) zlib.lib: cl $(CFLAGS) adler32.c crc32.c deflate.c trees.c zutil.c diff --git a/auto/lib/zlib/makefile.owc b/auto/lib/zlib/makefile.owc index 1a2823b40..e119bb9e3 100644 --- a/auto/lib/zlib/makefile.owc +++ b/auto/lib/zlib/makefile.owc @@ -1,5 +1,5 @@ -CFLAGS = -c -zq -bt=nt -ot -op -oi -oe -s -bm $(LIB_OPT) +CFLAGS = -c -zq -bt=nt -ot -op -oi -oe -s -bm $(CPU_OPT) zlib.lib: wcl386 $(CFLAGS) adler32.c crc32.c deflate.c trees.c zutil.c diff --git a/auto/options b/auto/options index 303292d17..07263c9fe 100644 --- a/auto/options +++ b/auto/options @@ -4,7 +4,7 @@ help=no CC=gcc OBJS=objs -CPU_OPT=NO +CPU=NO TEST_BUILD_DEVPOLL=NO TEST_BUILD_EPOLL=NO @@ -26,12 +26,17 @@ HTTP_PROXY=YES USE_PCRE=NO PCRE=NONE +PCRE_OPT=NO USE_MD5=NO MD5=NONE +MD5_OPT=NO +MD5_ASM=NO USE_ZLIB=NO ZLIB=NONE +ZLIB_OPT=NO +ZLIB_ASM=NO for option @@ -64,13 +69,19 @@ do --without-http_proxy_module) HTTP_PROXY=NO ;; --with-cc=*) CC="$value" ;; - --with-cpu=*) CPU_OPT="$value" ;; + --with-cpu-opt=*) CPU="$value" ;; --without-pcre) USE_PCRE=DISABLED ;; --with-pcre=*) PCRE="$value" ;; + --with-pcre-opt=*) PCRE_OPT="$value" ;; + --with-md5=*) MD5="$value" ;; + --with-md5-opt=*) MD5_OPT="$value" ;; + --with-md5-asm) MD5_ASM=YES ;; + --with-zlib=*) ZLIB="$value" ;; --with-zlib-opt=*) ZLIB_OPT="$value" ;; + --with-zlib-asm=*) ZLIB_ASM="$value" ;; --test-build-devpoll) TEST_BUILD_DEVPOLL=YES ;; --test-build-epoll) TEST_BUILD_EPOLL=YES ;; @@ -106,3 +117,8 @@ if [ $help = yes ]; then exit 1 fi + + +if [ $ZLIB_ASM != NO ]; then + ZLIB_ASMV=-DASMV +fi