diff options
Diffstat (limited to 'auto')
51 files changed, 3602 insertions, 0 deletions
diff --git a/auto/cc b/auto/cc new file mode 100644 index 000000000..eff642125 --- /dev/null +++ b/auto/cc @@ -0,0 +1,376 @@ + +# Copyright (C) Igor Sysoev + + +CFLAGS="$CFLAGS $CC_OPT" + +case $CC in + + *gcc*) + # gcc 2.7.2.3, 2.8.1, 2.95.4, + # 3.0.4, 3.1.1, 3.2.3, 3.3.2, 3.3.3, 3.3.4, 3.4 + + # optimizations + #CFLAGS="$CFLAGS -O2 -fomit-frame-pointer" + + 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="-march=pentiumpro" + ;; + + pentium4) + # optimize for Pentium 4, gcc 3.x + CPU_OPT="-march=pentium4" + ;; + esac + + # STUB for batch builds + if [ $CC = gcc27 ]; then CPU_OPT=; fi + + 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 [ ".$MD5_OPT" = "." ]; then + MD5_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT" + else + MD5_OPT="$MD5_OPT $PIPE" + fi + + if [ ".$ZLIB_OPT" = "." ]; then + ZLIB_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT" + else + ZLIB_OPT="$ZLIB_OPT $PIPE" + fi + + # warnings + CFLAGS="$CFLAGS -O -W" + CFLAGS="$CFLAGS -Wall -Wpointer-arith" + #CFLAGS="$CFLAGS -Wconversion" + #CFLAGS="$CFLAGS -Winline" + + # we have a lot of the unused function arguments + CFLAGS="$CFLAGS -Wno-unused" + + # stop on warning + CFLAGS="$CFLAGS -Werror" + + # ANSI C warnings + #CFLAGS="$CFLAGS -pedantic" + + # debug + CFLAGS="$CFLAGS -g" + + # DragonFly's gcc3 generates DWARF + #CFLAGS="$CFLAGS -g -gstabs" + + have=HAVE_GCC_VARIADIC_MACROS . auto/have + + if [ ".$CPP" = "." ]; then + CPP="$CC -E" + fi + + LINK="\$(CC)" + + INCOPT="-I " + COMPOPT="-c" + OBJOUT="-o " + BINOUT="-o " + OBJEXT="o" + + CC_STRONG="$CC -Wall -Werror" + ;; + + + *icc) + # Intel C++ compiler 7.1, 8.0 + + # optimizations + CFLAGS="$CFLAGS -O" + # inline functions declared with __inline + #CFLAGS="$CFLAGS -Ob1" + # inline any function, at the compiler's discretion + CFLAGS="$CFLAGS -Ob2" + + # single-file IP optimizations + #IPO="-ip" + # multi-file IP optimizations + IPO="-ipo -ipo_obj" + CFLAGS="$CFLAGS $IPO" + CORE_LINK="$CORE_LINK $IPO" + CORE_LINK="$CORE_LINK -opt_report_file=$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 $IPO $CPU_OPT" + fi + + if [ ".$MD5_OPT" = "." ]; then + MD5_OPT="-O $IPO $CPU_OPT" + fi + + if [ ".$ZLIB_OPT" = "." ]; then + ZLIB_OPT="-O $IPO $CPU_OPT" + fi + + # warnings + CFLAGS="$CFLAGS -w1" + #CFLAGS="$CFLAGS -w2" + + # stop on warning + CFLAGS="$CFLAGS -Werror" + + # debug + CFLAGS="$CFLAGS -g" + + have=HAVE_C99_VARIADIC_MACROS . auto/have + + LINK="\$(CC)" + + INCOPT="-I " + COMPOPT="-c" + OBJOUT="-o " + BINOUT="-o " + OBJEXT="o" + + CC_STRONG="$CC -w1 -Werror" + ;; + + + cl) + # MSVC 6.0 SP2 + + # optimizations + + # maximize speed + CFLAGS="$CFLAGS -O2" + # enable global optimization + CFLAGS="$CFLAGS -Og" + # enable intrinsic functions + CFLAGS="$CFLAGS -Oi" + # inline expansion + CFLAGS="$CFLAGS -Ob1" + # enable frame pointer omission + CFLAGS="$CFLAGS -Oy" + # disable stack checking calls + CFLAGS="$CFLAGS -Gs" + + 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 + #CPU_OPT="-G7" + ;; + esac + + CFLAGS="$CFLAGS $CPU_OPT" + + # warnings + #CFLAGS="$CFLAGS -W3" + CFLAGS="$CFLAGS -W4" + + # stop on warning + CFLAGS="$CFLAGS -WX" + + # link with libcmt.lib, multithreaded + #LIBC="-MT" + # link with msvcrt.dll + LIBC="-MD" + + CFLAGS="$CFLAGS $LIBC" + + # disable logo + CFLAGS="$CFLAGS -nologo" + + LINK="\$(CC)" + + # link flags + CORE_LINK="$CORE_LINK -link -verbose:lib" + + # debug + CFLAGS="$CFLAGS -Yd" + CORE_LINK="$CORE_LINK -debug -debugtype:coff" + + # precompiled headers + CORE_DEPS="$CORE_DEPS ngx_config.pch" + PCH="ngx_config.pch" + BUILDPCH="-Ycngx_config.h" + USEPCH="-Yungx_config.h" + + INCOPT="-I " + COMPOPT="-c" + OBJOUT="-Fo" + BINOUT="-Fe" + OBJEXT="obj" + BINEXT=".exe" + #DIRSEP='\\' + ;; + + + wcl386) + # Open Watcom C 1.0, 1.2 + + # 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 + #CFLAGS="$CFLAGS -w3" + CFLAGS="$CFLAGS -wx" + + # 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=HAVE_C99_VARIADIC_MACROS . auto/have + + # precompiled headers + CORE_DEPS="$CORE_DEPS $OBJS\\ngx_config.pch" + PCH="$OBJS\\ngx_config.pch" + BUILDPCH="-fhq=$OBJS\\ngx_config.pch" + USEPCH="-fh=$OBJS\\ngx_config.pch" + + LINK="\$(CC)" + + # link flags + CORE_LINK="$CORE_LINK -l=nt" + + INCOPT="-i=" + COMPOPT="-c" + OBJOUT="-fo" + BINOUT="-fe=" + OBJEXT="obj" + BINEXT=".exe" + DIRSEP='\\' + + MAKE_SL=YES + ;; + + + bcc32) + # 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 + + 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 $OBJS\\ngx_config.csm" + PCH="$OBJS\\ngx_config.csm" + BUILDPCH="-H=$OBJS\\ngx_config.csm" + USEPCH="-Hu -H=$OBJS\\ngx_config.csm" + + LINK="\$(CC)" + + INCOPT="-I" + COMPOPT="-c" + OBJOUT="-o" + BINOUT="-e" + OBJEXT="obj" + BINEXT=".exe" + DIRSEP='\\' + ;; + +esac diff --git a/auto/define b/auto/define new file mode 100644 index 000000000..971f99df2 --- /dev/null +++ b/auto/define @@ -0,0 +1,11 @@ + +# Copyright (C) Igor Sysoev + + +cat << END >> $NGX_AUTO_CONFIG_H + +#ifndef $have +#define $have $value +#endif + +END diff --git a/auto/endianess b/auto/endianess new file mode 100644 index 000000000..4df7d01f1 --- /dev/null +++ b/auto/endianess @@ -0,0 +1,41 @@ + +# Copyright (C) Igor Sysoev + + +echo $ngx_n "checking for system endianess ..." $ngx_c +echo >> $NGX_ERR +echo "checking for system endianess" >> $NGX_ERR + + +cat << END > $NGX_AUTOTEST.c + +int main() { + int i = 0x11223344; + char *p; + + p = (char *) &i; + if (*p == 0x44) return 0; + return 1; +} + +END + +eval "${CC} -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1" + +if [ -x $NGX_AUTOTEST ]; then + if $NGX_AUTOTEST 2>&1 > /dev/null; then + echo " little endianess" + have=HAVE_LITTLE_ENDIAN . auto/have + else + echo " big endianess" + fi + + rm $NGX_AUTOTEST* + +else + rm $NGX_AUTOTEST* + + echo + echo "$0: error: can not detect system endianess" + exit 1 +fi diff --git a/auto/feature b/auto/feature new file mode 100644 index 000000000..bd5b08158 --- /dev/null +++ b/auto/feature @@ -0,0 +1,56 @@ + +# Copyright (C) Igor Sysoev + + +echo $ngx_n "checking for $ngx_feature ..." $ngx_c +echo >> $NGX_ERR +echo "checking for $ngx_feature" >> $NGX_ERR + +ngx_found=no + +feature=`echo $ngx_feature_name | tr '[a-z]' '[A-Z]'` + +cat << END > $NGX_AUTOTEST.c + +#include <sys/types.h> +$NGX_UNISTD_H +$ngx_feature_inc + +int main() { + $ngx_feature_test; + return 0; +} + +END + +test="$CC_WARN $CC_TEST_FLAGS -o $NGX_AUTOTEST $NGX_AUTOTEST.c \ + $ngx_feature_libs" +eval "$test >> $NGX_ERR 2>&1" + +if [ -x $NGX_AUTOTEST ]; then + + if [ $ngx_feature_run = yes ]; then + if $NGX_AUTOTEST 2>&1 > /dev/null; then + echo " found" + have=HAVE_$feature . auto/have + ngx_found=yes + else + echo " found but is not working" + fi + + else + echo " found" + have=HAVE_$feature . auto/have + ngx_found=yes + fi + +else + echo " not found" + echo "---------" >> $NGX_ERR + cat $NGX_AUTOTEST.c >> $NGX_ERR + echo "---------" >> $NGX_ERR + echo $test >> $NGX_ERR + echo "---------" >> $NGX_ERR +fi + +rm $NGX_AUTOTEST* diff --git a/auto/fmt/fmt b/auto/fmt/fmt new file mode 100644 index 000000000..980641ffa --- /dev/null +++ b/auto/fmt/fmt @@ -0,0 +1,80 @@ + +# Copyright (C) Igor Sysoev + + +echo $ngx_n "checking for $ngx_type printf() format ..." $ngx_c +echo >> $NGX_ERR +echo "checking for $ngx_type printf() format" >> $NGX_ERR + +ngx_fmt=no +comma= + +for fmt in $ngx_formats +do + + cat << END > $NGX_AUTOTEST.c + +#include <sys/types.h> +#include <sys/time.h> +#include <stdio.h> +#include <sys/resource.h> +$NGX_INTTYPES_H +$NGX_AUTO_CONFIG + +int main() { + printf("$fmt", ($ngx_type) $ngx_max_value); + return 0; +} + +END + + eval "$CC_WARN $CC_TEST_FLAGS -o $NGX_AUTOTEST $NGX_AUTOTEST.c \ + >> $NGX_ERR 2>&1" + + max_value=`echo $ngx_max_value | sed -e "s/L*\$//"` + + if [ -x $NGX_AUTOTEST ]; then + if [ "`$NGX_AUTOTEST`" = $max_value ]; then + if [ $ngx_fmt_collect = yes ]; then + echo $ngx_n "$comma \"${fmt}\" is appropriate" $ngx_c + else + echo $ngx_n "$comma \"${fmt}\" used" $ngx_c + fi + ngx_fmt=$fmt + fi + fi + + rm $NGX_AUTOTEST* + + if [ $ngx_fmt != no ]; then + if [ $ngx_fmt_collect = yes ]; then + eval "ngx_${ngx_size}_fmt=\"\${ngx_${ngx_size}_fmt} \$ngx_fmt\"" + comma="," + continue + else + break + fi + fi + + echo $ngx_n "$comma \"${fmt}\" is not appropriate" $ngx_c + comma="," +done + +echo + +if [ $ngx_fmt = no ]; then + echo "$0: error: printf() $ngx_type format not found" + exit 1 +fi + + +if [ $ngx_fmt_collect = no ]; then + cat << END >> $NGX_AUTO_CONFIG_H + +#ifndef $ngx_fmt_name +#define $ngx_fmt_name "$ngx_fmt" +#endif + +END + +fi diff --git a/auto/fmt/ptrfmt b/auto/fmt/ptrfmt new file mode 100644 index 000000000..163ca59e2 --- /dev/null +++ b/auto/fmt/ptrfmt @@ -0,0 +1,72 @@ + +# Copyright (C) Igor Sysoev + + +echo $ngx_n "checking for $ngx_type printf() format ..." $ngx_c +echo >> $NGX_ERR +echo "checking for $ngx_type printf() format" >> $NGX_ERR + +ngx_fmt=no +comma= +fmtX= + +for fmt in $ngx_formats +do + + cat << END > $NGX_AUTOTEST.c + +int main() { + printf("$fmt", ($ngx_type) $ngx_max_value); + return 0; +} + +END + + eval "$CC_WARN $CC_TEST_FLAGS -o $NGX_AUTOTEST $NGX_AUTOTEST.c \ + >> $NGX_ERR 2>&1" + + max_value=`echo $ngx_max_value | sed -e "s/L*\$//"` + + if [ -x $NGX_AUTOTEST ]; then + if [ "`$NGX_AUTOTEST`" = $max_value ]; then + ngx_fmt=$fmt + fi + fi + + rm $NGX_AUTOTEST* + + if [ $ngx_fmt != no ]; then + break + fi + + fmtX=`echo $fmt | sed -e "s/d/X/"` + + echo $ngx_n "$comma \"${fmtX}\" is not appropriate" $ngx_c + comma="," +done + + +if [ $ngx_fmt = no ]; then + echo "$0: error: printf() $ngx_type format not found" + exit 1 +fi + + +if [ $ngx_ptr_size = 4 ]; then + fmtX="%0`expr 2 \* $ngx_ptr_size`" +else + fmtX="%" +fi + +ngx_fmt=`echo $ngx_fmt | sed -e "s/d/X/" -e "s/^%/$fmtX/"` + +echo "$comma \"${ngx_fmt}\" used" + + +cat << END >> $NGX_AUTO_CONFIG_H + +#ifndef $ngx_fmt_name +#define $ngx_fmt_name "$ngx_fmt" +#endif + +END diff --git a/auto/fmt/xfmt b/auto/fmt/xfmt new file mode 100644 index 000000000..957e59030 --- /dev/null +++ b/auto/fmt/xfmt @@ -0,0 +1,11 @@ + +# Copyright (C) Igor Sysoev + + +cat << END | sed -e 's/d"$/x"/' >> $NGX_AUTO_CONFIG_H + +#ifndef $ngx_fmt_name +#define $ngx_fmt_name "$ngx_fmt" +#endif + +END diff --git a/auto/func b/auto/func new file mode 100644 index 000000000..970d63403 --- /dev/null +++ b/auto/func @@ -0,0 +1,43 @@ + +# Copyright (C) Igor Sysoev + + +echo $ngx_n "checking for $ngx_func ..." $ngx_c +echo >> $NGX_ERR +echo "checking for $ngx_func" >> $NGX_ERR + +ngx_found=no + +func=`echo $ngx_func | sed -e 's/()$//' | tr '[a-z]' '[A-Z]'` + +cat << END > $NGX_AUTOTEST.c + +#include <sys/types.h> +$NGX_UNISTD_H +$ngx_func_inc + +int main() { + $ngx_func_test; + return 0; +} + +END + +test="$CC_WARN $CC_TEST_FLAGS -o $NGX_AUTOTEST $NGX_AUTOTEST.c $ngx_func_libs" +eval "$test >> $NGX_ERR 2>&1" + +if [ -x $NGX_AUTOTEST ]; then + echo " found" + have=HAVE_$func . auto/have + ngx_found=yes + +else + echo " not found" + echo "---------" >> $NGX_ERR + cat $NGX_AUTOTEST.c >> $NGX_ERR + echo "---------" >> $NGX_ERR + echo $test >> $NGX_ERR + echo "---------" >> $NGX_ERR +fi + +rm $NGX_AUTOTEST* diff --git a/auto/have b/auto/have new file mode 100644 index 000000000..1b644ad32 --- /dev/null +++ b/auto/have @@ -0,0 +1,11 @@ + +# Copyright (C) Igor Sysoev + + +cat << END >> $NGX_AUTO_CONFIG_H + +#ifndef $have +#define $have 1 +#endif + +END diff --git a/auto/headers b/auto/headers new file mode 100644 index 000000000..2bfa685c9 --- /dev/null +++ b/auto/headers @@ -0,0 +1,6 @@ + +# Copyright (C) Igor Sysoev + + +ngx_inc="unistd.h"; . auto/inc +ngx_inc="inttypes.h"; . auto/inc diff --git a/auto/inc b/auto/inc new file mode 100644 index 000000000..867102223 --- /dev/null +++ b/auto/inc @@ -0,0 +1,35 @@ + +# Copyright (C) Igor Sysoev + + +echo $ngx_n "checking for $ngx_inc ..." $ngx_c +echo >> $NGX_ERR +echo "checking for $ngx_inc" >> $NGX_ERR + +ngx_found=no + +inc=`echo $ngx_inc | sed -e 's/\./_/' | sed -e 's/\//_/' | tr '[a-z]' '[A-Z]'` + +cat << END > $NGX_AUTOTEST.c + +#include <$ngx_inc> + +int main() { + return 0; +} + +END + +eval "${CC} -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1" + +if [ -x $NGX_AUTOTEST ]; then + echo " found" + have=HAVE_$inc . auto/have + eval "NGX_$inc='#include <$ngx_inc>'" + ngx_found=yes + +else + echo " not found" +fi + +rm $NGX_AUTOTEST* diff --git a/auto/init b/auto/init new file mode 100644 index 000000000..ebca44424 --- /dev/null +++ b/auto/init @@ -0,0 +1,38 @@ + +# Copyright (C) Igor Sysoev + + +MAKEFILE=$OBJS/Makefile + +NGX_AUTO_CONFIG_H=$OBJS/ngx_auto_config.h +NGX_MODULES_C=$OBJS/ngx_modules.c + +NGX_AUTOTEST=$OBJS/autotest +NGX_ERR=$OBJS/autoconf.err + +CC_WARN=$CC + +PCH=NO +USEPCH= + +OBJEXT= +BINEXT= +DIRSEP='\/' +MAKE_SL=NO + + +# checking echo's "-n" option and "\c" capabilties + +if echo "test\c" | grep c >/dev/null; then + if echo -n test | grep n >/dev/null; then + ngx_n= + ngx_c= + else + ngx_n=-n + ngx_c= + fi + +else + ngx_n= + ngx_c='\c' +fi diff --git a/auto/install b/auto/install new file mode 100644 index 000000000..b838b9b2c --- /dev/null +++ b/auto/install @@ -0,0 +1,65 @@ + +# Copyright (C) Igor Sysoev + + +cat << END >> $MAKEFILE +install: + test -d $PREFIX || mkdir -p $PREFIX + + test -d `dirname $SBIN_PATH` || mkdir -p `dirname $SBIN_PATH` + test ! -f $SBIN_PATH || mv $SBIN_PATH $SBIN_PATH.old + cp nginx $SBIN_PATH + + test -d `dirname $CONF_PATH` || mkdir -p `dirname $CONF_PATH` + + cp conf/koi-win `dirname $CONF_PATH` + + test -f `dirname $CONF_PATH`/mime.types || \ + cp conf/mime.types `dirname $CONF_PATH`/mime.types + cp conf/mime.types `dirname $CONF_PATH`/mime.types.default + + test -f $CONF_PATH || cp conf/nginx.conf $CONF_PATH + cp conf/nginx.conf `dirname $CONF_PATH`/nginx.conf.default + + test -d `dirname $PID_PATH` || mkdir -p `dirname $PID_PATH` + + test -d `dirname $HTTP_LOG_PATH` || mkdir -p `dirname $HTTP_LOG_PATH` + + test -d $PREFIX/html || cp -r html $PREFIX + + #test -d $PREFIX/temp || mkdir -p $PREFIX/temp +END + + +if [ ".$ERROR_LOG_PATH" != "." ]; then + cat << END >> $MAKEFILE + + test -d `dirname $ERROR_LOG_PATH` || mkdir -p `dirname $ERROR_LOG_PATH` +END + +fi + + +if test ! -f Makefile; then + + cat << END > Makefile + +build: + \$(MAKE) -f $OBJS/Makefile + +install: + \$(MAKE) -f $OBJS/Makefile install + +clean: + rm -rf Makefile $OBJS + +upgrade: + $SBIN_PATH -t + kill -USR2 \`cat $PID_PATH\` + sleep 1 + test -f $PID_PATH.newbin + kill -WINCH \`cat $PID_PATH\` + +END + +fi diff --git a/auto/lib/conf b/auto/lib/conf new file mode 100644 index 000000000..275bea9cf --- /dev/null +++ b/auto/lib/conf @@ -0,0 +1,19 @@ + +# Copyright (C) Igor Sysoev + + +if [ $USE_PCRE = YES ]; then + . auto/lib/pcre/conf +fi + +if [ $USE_MD5 = YES ]; then + . auto/lib/md5/conf +fi + +if [ $USE_OPENSSL = YES ]; then + . auto/lib/openssl/conf +fi + +if [ $USE_ZLIB = YES ]; then + . auto/lib/zlib/conf +fi diff --git a/auto/lib/make b/auto/lib/make new file mode 100644 index 000000000..ef571c5b8 --- /dev/null +++ b/auto/lib/make @@ -0,0 +1,19 @@ + +# Copyright (C) Igor Sysoev + + +if [ $PCRE != NONE -a $PCRE != NO -a $PCRE != YES ]; then + . auto/lib/pcre/make +fi + +if [ $MD5 != NONE -a $MD5 != NO -a $MD5 != YES ]; then + . auto/lib/md5/make +fi + +if [ $OPENSSL != NONE -a $OPENSSL != NO -a $OPENSSL != YES ]; then + . auto/lib/openssl/make +fi + +if [ $ZLIB != NONE -a $ZLIB != NO -a $ZLIB != YES ]; then + . auto/lib/zlib/make +fi diff --git a/auto/lib/md5/conf b/auto/lib/md5/conf new file mode 100644 index 000000000..748bea450 --- /dev/null +++ b/auto/lib/md5/conf @@ -0,0 +1,105 @@ + +# Copyright (C) Igor Sysoev + + +if [ $MD5 != NONE ]; then + + if grep MD5_Init $MD5/md5.h >/dev/null; then + # OpenSSL md5 + OPENSSL_MD5=YES + have=HAVE_OPENSSL_MD5 . auto/have + else + # rsaref md5 + OPENSSL_MD5=NO + fi + + CORE_INCS="$CORE_INCS $MD5" + + case "$CC" in + + cl | wcl386 | bcc32) + LINK_DEPS="$LINK_DEPS $MD5/md5.lib" + CORE_LIBS="$CORE_LIBS $MD5/md5.lib" + ;; + + *icc) + LINK_DEPS="$LINK_DEPS $MD5/libmd5.a" + + # to allow -ipo optimization we link with the *.o but not library + CORE_LIBS="$CORE_LIBS $MD5/md5_dgst.o" + + if [ $MD5_ASM = YES ]; then + CORE_LIBS="$CORE_LIBS $MD5/asm/mx86-elf.o" + fi + ;; + + *) + LINK_DEPS="$LINK_DEPS $MD5/libmd5.a" + CORE_LIBS="$CORE_LIBS $MD5/libmd5.a" + #CORE_LIBS="$CORE_LIBS -L $MD5 -lmd5" + ;; + + esac + +else + + if [ $PLATFORM != win32 ]; then + MD5=NO + ngx_lib_cflags= + + # Solaris 8/9 + + ngx_lib_inc="#include <sys/types.h> +#include <md5.h>" + ngx_lib="rsaref md5 library" + ngx_lib_test="MD5_CTX md5; MD5Init(&md5)" + ngx_libs=-lmd5 + . auto/lib/test + + + if [ $ngx_found = yes ]; then + CORE_LIBS="$CORE_LIBS $ngx_libs" + MD5=YES + MD5_LIB=md5 + ngx_found=no + + else + # FreeBSD + + ngx_lib="rsaref md library" + ngx_lib_test="MD5_CTX md5; MD5Init(&md5)" + ngx_libs=-lmd + . auto/lib/test + fi + + + if [ $ngx_found = yes ]; then + CORE_LIBS="$CORE_LIBS $ngx_libs" + MD5=YES + MD5_LIB=md + ngx_found=no + + else + if [ $MD5 = NO ]; then + + # OpenSSL crypto library + + ngx_lib_inc="#include <openssl/md5.h>" + ngx_lib="OpenSSL md5 crypto library" + ngx_lib_test="MD5_CTX md5; MD5_Init(&md5)" + ngx_libs=-lcrypto + . auto/lib/test + fi + fi + + + if [ $ngx_found = yes ]; then + have=HAVE_OPENSSL_MD5 . auto/have + have=HAVE_OPENSSL_MD5_H . auto/have + CORE_LIBS="$CORE_LIBS $ngx_libs" + MD5=YES + MD5_LIB=crypto + fi + fi + +fi diff --git a/auto/lib/md5/make b/auto/lib/md5/make new file mode 100644 index 000000000..f718e6c2c --- /dev/null +++ b/auto/lib/md5/make @@ -0,0 +1,98 @@ + +# Copyright (C) Igor Sysoev + + +case "$CC" in + + cl) + makefile=makefile.msvc + opt="CPU_OPT=$CPU_OPT LIBC=$LIBC MD5_ASM=$MD5_ASM" + ;; + + wcl386) + makefile=makefile.owc + opt="CPU_OPT=$CPU_OPT" + ;; + + bcc32) + makefile=makefile.bcc + opt="-DCPU_OPT=$CPU_OPT -DMD5_ASM=$MD5_ASM" + ;; + +esac + + +case $PLATFORM in + + win32) + line=`echo $MD5/md5.lib: | sed -e "s/\//$DIRSEP/g"` + echo "$line" >> $MAKEFILE + ;; + + *) + echo "$MD5/libmd5.a:" >> $MAKEFILE + ;; + +esac + + +done=NO + + +case $PLATFORM in + + win32) + md5=`echo $MD5 | sed -e "s/\//$DIRSEP/g"` + + cp auto/lib/md5/$makefile $MD5 + echo " cd $md5" >> $MAKEFILE + echo " \$(MAKE) -f $makefile $opt" >> $MAKEFILE + echo " cd ..\\..\\.." >> $MAKEFILE + + done=YES + ;; + + SunOS:*:i86pc) + if [ $MD5_ASM = YES ]; then + + MD5_OPT="CFLAGS=\"$MD5_OPT -DSOL -DMD5_ASM -DL_ENDIAN\"" + + echo " cd $MD5 \\" >> $MAKEFILE + echo " && \$(MAKE) $MD5_OPT \\" >> $MAKEFILE + echo " MD5_ASM_OBJ=asm/mx86-sol.o \\" >> $MAKEFILE + echo " CC=\"\$(CC)\" CPP=\"\$(CPP)\" \\" >> $MAKEFILE + echo " libmd5.a" >> $MAKEFILE + + done=YES + fi + ;; + + # FreeBSD: i386 + # Linux: i686 + + *:i386 | *:i686) + if [ $MD5_ASM = YES ]; then + + MD5_OPT="CFLAGS=\"$MD5_OPT -DELF -DMD5_ASM -DL_ENDIAN\"" + + echo " cd $MD5 \\" >> $MAKEFILE + echo " && \$(MAKE) $MD5_OPT \\" >> $MAKEFILE + echo " MD5_ASM_OBJ=asm/mx86-elf.o \\" >> $MAKEFILE + echo " CC=\"\$(CC)\" CPP=\"\$(CPP)\" \\" >> $MAKEFILE + echo " libmd5.a" >> $MAKEFILE + + done=YES + fi + ;; + +esac + + +if [ $done = NO ]; then + echo " cd $MD5 \\" >> $MAKEFILE + echo " && \$(MAKE) CFLAGS=\"$MD5_OPT\" \\" >> $MAKEFILE + echo " MD5_ASM_OBJ= CC=\"\$(CC)\" libmd5.a" >> $MAKEFILE +fi + + +echo >> $MAKEFILE diff --git a/auto/lib/md5/makefile.bcc b/auto/lib/md5/makefile.bcc new file mode 100644 index 000000000..837f2dff7 --- /dev/null +++ b/auto/lib/md5/makefile.bcc @@ -0,0 +1,19 @@ + +# Copyright (C) Igor Sysoev + + +CFLAGS = -q -O2 -tWM $(CPU_OPT) -DL_ENDIAN + +!if "$(MD5_ASM)" == "YES" + +md5.lib: + bcc32 -c $(CFLAGS) -DMD5_ASM md5_dgst.c + tlib md5.lib +md5_dgst.obj +asm/m-win32.obj + +!else + +md5.lib: + bcc32 -c $(CFLAGS) md5_dgst.c + tlib md5.lib +md5_dgst.obj + +!endif diff --git a/auto/lib/md5/makefile.msvc b/auto/lib/md5/makefile.msvc new file mode 100644 index 000000000..68f5cc49b --- /dev/null +++ b/auto/lib/md5/makefile.msvc @@ -0,0 +1,19 @@ + +# Copyright (C) Igor Sysoev + + +CFLAGS = -nologo -MT -O2 -Ob1 -Oi -Gs $(LIBC) $(CPU_OPT) -D L_ENDIAN + +!if "$(MD5_ASM)" == "YES" + +md5.lib: + cl -c $(CFLAGS) -D MD5_ASM md5_dgst.c + link -lib -out:md5.lib md5_dgst.obj asm/m-win32.obj + +!else + +md5.lib: + cl -c $(CFLAGS) md5_dgst.c + link -lib -out:md5.lib md5_dgst.obj + +!endif diff --git a/auto/lib/md5/makefile.owc b/auto/lib/md5/makefile.owc new file mode 100644 index 000000000..5fffa1707 --- /dev/null +++ b/auto/lib/md5/makefile.owc @@ -0,0 +1,9 @@ + +# Copyright (C) Igor Sysoev + + +CFLAGS = -zq -bt=nt -bm -ot -op -oi -oe -s $(CPU_OPT) + +md5.lib: + wcl386 -c $(CFLAGS) -dL_ENDIAN md5_dgst.c + wlib -n md5.lib md5_dgst.obj diff --git a/auto/lib/openssl/conf b/auto/lib/openssl/conf new file mode 100644 index 000000000..37c084f00 --- /dev/null +++ b/auto/lib/openssl/conf @@ -0,0 +1,43 @@ + +# Copyright (C) Igor Sysoev + + +if [ $OPENSSL != NONE ]; then + CORE_INCS="$CORE_INCS $OPENSSL/include" + CORE_DEPS="$CORE_DEPS $OPENSSL_DEPS" + CORE_SRCS="$CORE_SRCS $OPENSSL_SRCS" + + case "$CC" in + *) + have=NGX_OPENSSL . auto/have + LINK_DEPS="$LINK_DEPS $OPENSSL/libssl.a $OPENSSL/libcrypto.a" + CORE_LIBS="$CORE_LIBS $OPENSSL/libssl.a $OPENSSL/libcrypto.a" + ;; + + esac + +else + + if [ $PLATFORM != win32 ]; then + OPENSSL=NO + ngx_lib_cflags= + + ngx_lib_inc="#include <openssl/ssl.h>" + ngx_lib="OpenSSL library" + ngx_lib_test="SSL_library_init()" + ngx_libs="-lssl -lcrypto" + . auto/lib/test + + + if [ $ngx_found = yes ]; then + have=NGX_OPENSSL . auto/have + CORE_DEPS="$CORE_DEPS $OPENSSL_DEPS" + CORE_SRCS="$CORE_SRCS $OPENSSL_SRCS" + CORE_LIBS="$CORE_LIBS $ngx_libs" + OPENSSL=YES + ngx_found=no + fi + + fi + +fi diff --git a/auto/lib/openssl/make b/auto/lib/openssl/make new file mode 100644 index 000000000..5e931cbbe --- /dev/null +++ b/auto/lib/openssl/make @@ -0,0 +1,16 @@ + +# Copyright (C) Igor Sysoev + + +case $PLATFORM in + *) + echo "$OPENSSL/libssl.a:" >> $MAKEFILE + echo " cd $OPENSSL \\" >> $MAKEFILE + echo " && CC=\"\$(CC)\" \\" >> $MAKEFILE + echo " ./config threads no-shared \\" >> $MAKEFILE + echo " && \$(MAKE)" >> $MAKEFILE + ;; + +esac + +echo >> $MAKEFILE diff --git a/auto/lib/pcre/conf b/auto/lib/pcre/conf new file mode 100644 index 000000000..16feffa6b --- /dev/null +++ b/auto/lib/pcre/conf @@ -0,0 +1,86 @@ + +# Copyright (C) Igor Sysoev + + +if [ $PCRE != NONE ]; then + CORE_INCS="$CORE_INCS $PCRE" + CORE_DEPS="$CORE_DEPS $REGEX_DEPS" + CORE_SRCS="$CORE_SRCS $REGEX_SRCS" + + case "$CC" in + + cl | wcl386 | bcc32) + have=HAVE_PCRE . auto/have + have=PCRE_STATIC . auto/have + CORE_DEPS="$CORE_DEPS $PCRE/pcre.h" + LINK_DEPS="$LINK_DEPS $PCRE/pcre.lib" + CORE_LIBS="$CORE_LIBS $PCRE/pcre.lib" + ;; + + *icc) + have=HAVE_PCRE . auto/have + CORE_DEPS="$CORE_DEPS $PCRE/pcre.h" + + LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a" + + # to allow -ipo optimization we link with the *.o but not library + CORE_LIBS="$CORE_LIBS $PCRE/maketables.o" + CORE_LIBS="$CORE_LIBS $PCRE/get.o" + CORE_LIBS="$CORE_LIBS $PCRE/study.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre.o" + ;; + + *) + have=HAVE_PCRE . auto/have + CORE_DEPS="$CORE_DEPS $PCRE/pcre.h" + LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a" + CORE_LIBS="$CORE_LIBS $PCRE/.libs/libpcre.a" + #CORE_LIBS="$CORE_LIBS -L $PCRE/.libs -lpcre" + ;; + + esac + +else + + if [ $PLATFORM != win32 ]; then + PCRE=NO + ngx_lib_cflags= + + # Linux + + ngx_lib_inc="#include <pcre.h>" + ngx_lib="PCRE library" + ngx_lib_test="pcre *re; re = pcre_compile(NULL, 0, NULL, 0, NULL)" + ngx_libs="-lpcre" + . auto/lib/test + + + if [ $ngx_found = yes ]; then + have=HAVE_PCRE . auto/have + CORE_DEPS="$CORE_DEPS $REGEX_DEPS" + CORE_SRCS="$CORE_SRCS $REGEX_SRCS" + CORE_LIBS="$CORE_LIBS $ngx_libs" + PCRE=YES + ngx_found=no + + else + # FreeBSD PCRE port. + + ngx_lib="PCRE library in /usr/local/" + ngx_lib_cflags="-I /usr/local/include" + ngx_libs="-L /usr/local/lib -lpcre" + . auto/lib/test + fi + + + if [ $ngx_found = yes ]; then + have=HAVE_PCRE . auto/have + CORE_DEPS="$CORE_DEPS $REGEX_DEPS" + CORE_INCS="$CORE_INCS /usr/local/include" + CORE_SRCS="$CORE_SRCS $REGEX_SRCS" + CORE_LIBS="$CORE_LIBS $ngx_libs" + PCRE=YES + fi + fi + +fi diff --git a/auto/lib/pcre/make b/auto/lib/pcre/make new file mode 100644 index 000000000..fa7bf27d0 --- /dev/null +++ b/auto/lib/pcre/make @@ -0,0 +1,65 @@ + +# Copyright (C) Igor Sysoev + + +case "$CC" in + + cl) + makefile=makefile.msvc + opt="CPU_OPT=$CPU_OPT LIBC=$LIBC" + ;; + + wcl386) + makefile=makefile.owc + opt="CPU_OPT=$CPU_OPT" + ;; + + bcc32) + makefile=makefile.bcc + opt="-DCPU_OPT=$CPU_OPT" + ;; + +esac + + +case $PLATFORM in + + win32) + cp auto/lib/pcre/patch.pcre.in $PCRE + cp auto/lib/pcre/patch.config.in $PCRE + cp auto/lib/pcre/$makefile $PCRE + + pcre=`echo $PCRE | sed -e "s/\//$DIRSEP/g"` + line=`echo $PCRE/pcre.h: | sed -e "s/\//$DIRSEP/g"` + + echo "$line" >> $MAKEFILE + echo " cd $pcre" >> $MAKEFILE + echo " \$(MAKE) -f $makefile pcre.h" >> $MAKEFILE + echo " cd ..\\..\\.." >> $MAKEFILE + echo >> $MAKEFILE + + line="$PCRE/pcre.lib: $PCRE/pcre.h" + line=`echo $line | sed -e "s/\//$DIRSEP/g"` + + echo "$line" >> $MAKEFILE + echo " cd $pcre" >> $MAKEFILE + echo " \$(MAKE) -f $makefile $opt" >> $MAKEFILE + echo " cd ..\\..\\.." >> $MAKEFILE + ;; + + *) + PCRE_OPT="CFLAGS=\"$PCRE_OPT\"" + + echo "$PCRE/pcre.h:" >> $MAKEFILE + echo " cd $PCRE \\" >> $MAKEFILE + echo " && CC=\"\$(CC)\" $PCRE_OPT \\" >> $MAKEFILE + echo " ./configure --disable-shared" >> $MAKEFILE + echo >> $MAKEFILE + echo "$PCRE/.libs/libpcre.a: $PCRE/pcre.h" >> $MAKEFILE + echo " cd $PCRE \\" >> $MAKEFILE + echo " && \$(MAKE) libpcre.la" >> $MAKEFILE + ;; + +esac + +echo >> $MAKEFILE diff --git a/auto/lib/pcre/makefile.bcc b/auto/lib/pcre/makefile.bcc new file mode 100644 index 000000000..411945260 --- /dev/null +++ b/auto/lib/pcre/makefile.bcc @@ -0,0 +1,20 @@ + +# Copyright (C) Igor Sysoev + + +CFLAGS = -q -O2 -tWM $(CPU_OPT) +PCREFLAGS = -DPCRE_STATIC -DPOSIX_MALLOC_THRESHOLD=10 + + +pcre.lib: pcre.h + bcc32 -q -edftables dftables.c + + dftables > chartables.c + + bcc32 -c $(CFLAGS) $(PCREFLAGS) maketables.c get.c study.c pcre.c + + tlib pcre.lib +maketables.obj +get.obj +study.obj +pcre.obj + +pcre.h: + patch -o pcre.h pcre.in patch.pcre.in + patch -o config.h config.in patch.config.in diff --git a/auto/lib/pcre/makefile.msvc b/auto/lib/pcre/makefile.msvc new file mode 100644 index 000000000..7c61d31f7 --- /dev/null +++ b/auto/lib/pcre/makefile.msvc @@ -0,0 +1,22 @@ + +# Copyright (C) Igor Sysoev + + +CFLAGS = -O2 -Ob1 -Oi -Gs $(LIBC) $(CPU_OPT) +PCREFLAGS = -DPCRE_STATIC -DPOSIX_MALLOC_THRESHOLD=10 + + +pcre.lib: pcre.h + cl -Fedftables dftables.c + + dftables > chartables.c + + cl -nologo -c $(CFLAGS) $(PCREFLAGS) \ + maketables.c get.c study.c pcre.c + + link -lib -out:pcre.lib -verbose:lib \ + maketables.obj get.obj study.obj pcre.obj + +pcre.h: + patch -o pcre.h pcre.in patch.pcre.in + patch -o config.h config.in patch.config.in diff --git a/auto/lib/pcre/makefile.owc b/auto/lib/pcre/makefile.owc new file mode 100644 index 000000000..227fd90af --- /dev/null +++ b/auto/lib/pcre/makefile.owc @@ -0,0 +1,19 @@ + +# Copyright (C) Igor Sysoev + + +CFLAGS = -c -zq -bt=nt -ot -op -oi -oe -s -bm $(CPU_OPT) +PCREFLAGS = -DPCRE_STATIC -DPOSIX_MALLOC_THRESHOLD=10 + + +pcre.lib: pcre.h + wcl386 -zq -bt=nt -l=nt -fe=dftables dftables.c + dftables > chartables.c + + wcl386 $(CFLAGS) $(PCREFLAGS) maketables.c get.c study.c pcre.c + wlib -n pcre.lib maketables.obj get.obj study.obj pcre.obj + + +pcre.h: + patch -o pcre.h pcre.in patch.pcre.in + patch -o config.h config.in patch.config.in diff --git a/auto/lib/pcre/patch.config.in b/auto/lib/pcre/patch.config.in new file mode 100644 index 000000000..d28b6feb1 --- /dev/null +++ b/auto/lib/pcre/patch.config.in @@ -0,0 +1,11 @@ +--- config.in Thu Aug 21 14:43:07 2003 ++++ config.in Sun Mar 7 02:37:24 2004 +@@ -28,7 +28,7 @@ + found. */ + + #define HAVE_STRERROR 0 +-#define HAVE_MEMMOVE 0 ++#define HAVE_MEMMOVE 1 + + /* There are some non-Unix systems that don't even have bcopy(). If this macro + is false, an emulation is used. If HAVE_MEMMOVE is set to 1, the value of diff --git a/auto/lib/pcre/patch.pcre.in b/auto/lib/pcre/patch.pcre.in new file mode 100644 index 000000000..c49a68f7b --- /dev/null +++ b/auto/lib/pcre/patch.pcre.in @@ -0,0 +1,15 @@ +--- pcre.in Thu Aug 21 14:43:07 2003 ++++ pcre.in Sun Mar 7 02:10:11 2004 +@@ -10,9 +10,9 @@ + /* The file pcre.h is build by "configure". Do not edit it; instead + make changes to pcre.in. */ + +-#define PCRE_MAJOR @PCRE_MAJOR@ +-#define PCRE_MINOR @PCRE_MINOR@ +-#define PCRE_DATE @PCRE_DATE@ ++#define PCRE_MAJOR 4 ++#define PCRE_MINOR 4 ++#define PCRE_DATE 21-August-2003 + + /* Win32 uses DLL by default */ + diff --git a/auto/lib/test b/auto/lib/test new file mode 100644 index 000000000..7dfaafef1 --- /dev/null +++ b/auto/lib/test @@ -0,0 +1,27 @@ + +# Copyright (C) Igor Sysoev + + +echo $ngx_n "checking for $ngx_lib ..." $ngx_c +echo >> $NGX_ERR +echo "checking for $ngx_lib library" >> $NGX_ERR + +ngx_found=no + +echo "$ngx_lib_inc" > $NGX_AUTOTEST.c +echo "int main() { $ngx_lib_test; return 0; }" >> $NGX_AUTOTEST.c + +eval "$CC $cc_test_flags $ngx_lib_cflags \ + -o $NGX_AUTOTEST $NGX_AUTOTEST.c $ngx_libs \ + >> $NGX_ERR 2>&1" + +if [ -x $NGX_AUTOTEST ]; then + echo " found" + + ngx_found=yes + +else + echo " not found" +fi + +rm $NGX_AUTOTEST* diff --git a/auto/lib/zlib/conf b/auto/lib/zlib/conf new file mode 100644 index 000000000..a01eebe71 --- /dev/null +++ b/auto/lib/zlib/conf @@ -0,0 +1,60 @@ + +# Copyright (C) Igor Sysoev + + +if [ $ZLIB != NONE ]; then + CORE_INCS="$CORE_INCS $ZLIB" + + case "$CC" in + + cl | wcl386 | bcc32) + LINK_DEPS="$LINK_DEPS $ZLIB/zlib.lib" + CORE_LIBS="$CORE_LIBS $ZLIB/zlib.lib" + ;; + + *icc) + LINK_DEPS="$LINK_DEPS $ZLIB/libz.a" + + # to allow -ipo optimization we link with the *.o but not library + CORE_LIBS="$CORE_LIBS $ZLIB/adler32.o" + CORE_LIBS="$CORE_LIBS $ZLIB/crc32.o" + CORE_LIBS="$CORE_LIBS $ZLIB/deflate.o" + CORE_LIBS="$CORE_LIBS $ZLIB/trees.o" + CORE_LIBS="$CORE_LIBS $ZLIB/zutil.o" + + if [ $ZLIB_ASM != NO ]; then + CORE_LIBS="$CORE_LIBS $ZLIB/match.o" + fi + ;; + + *) + LINK_DEPS="$LINK_DEPS $ZLIB/libz.a" + CORE_LIBS="$CORE_LIBS $ZLIB/libz.a" + #CORE_LIBS="$CORE_LIBS -L $ZLIB -lz" + ;; + + esac + +else + + if [ $PLATFORM != win32 ]; then + + # FreeBSD, Solaris, Linux + + ngx_lib_cflags= + ngx_lib_inc="#include <zlib.h>" + ngx_lib="zlib library" + ngx_lib_test="z_stream z; deflate(&z, Z_NO_FLUSH)" + ngx_libs=-lz + . auto/lib/test + + + if [ $ngx_found = yes ]; then + CORE_LIBS="$CORE_LIBS $ngx_libs" + ZLIB=YES + else + ZLIB=NO + fi + fi + +fi diff --git a/auto/lib/zlib/make b/auto/lib/zlib/make new file mode 100644 index 000000000..0ced9a25c --- /dev/null +++ b/auto/lib/zlib/make @@ -0,0 +1,107 @@ + +# Copyright (C) Igor Sysoev + + +case "$CC" in + + cl) + makefile=makefile.msvc + opt="CPU_OPT=$CPU_OPT LIBC=$LIBC" + + ;; + + wcl386) + makefile=makefile.owc + opt="CPU_OPT=$CPU_OPT" + ;; + + bcc32) + makefile=makefile.bcc + opt="-DCPU_OPT=$CPU_OPT" + ;; + +esac + + +case $PLATFORM in + + win32) + line=`echo $ZLIB/zlib.lib: | sed -e "s/\//$DIRSEP/g"` + echo "$line" >> $MAKEFILE + ;; + + *) + echo "$ZLIB/libz.a:" >> $MAKEFILE + ;; + +esac + + +done=NO + + +case $PLATFORM in + + win32) + zlib=`echo $ZLIB | sed -e "s/\//$DIRSEP/g"` + + cp auto/lib/zlib/$makefile $ZLIB + echo " cd $zlib" >> $MAKEFILE + echo " \$(MAKE) -f $makefile $opt" >> $MAKEFILE + echo " cd ..\\..\\.." >> $MAKEFILE + + done=YES + ;; + + # FreeBSD: i386 + # Linux: i686 + + *:i386 | *:i686) + case $ZLIB_ASM in + pentium) + echo " cd $ZLIB \\" >> $MAKEFILE + echo " && cp contrib/asm586/match.S . \\" >> $MAKEFILE + echo " && CFLAGS=\"$ZLIB_OPT -DASMV\" \\" >> $MAKEFILE + echo " CC=\"\$(CC)\" \\" >> $MAKEFILE + echo " ./configure \\" >> $MAKEFILE + echo " && \$(MAKE) OBJA=match.o libz.a" >> $MAKEFILE + + done=YES + ;; + + pentiumpro) + echo " cd $ZLIB \\" >> $MAKEFILE + echo " && cp contrib/asm686/match.S . \\" >> $MAKEFILE + echo " && CFLAGS=\"$ZLIB_OPT -DASMV\" \\" >> $MAKEFILE + echo " CC=\"\$(CC)\" \\" >> $MAKEFILE + echo " ./configure \\" >> $MAKEFILE + echo " && \$(MAKE) OBJA=match.o libz.a" >> $MAKEFILE + + done=YES + ;; + + NO) + ;; + + *) + echo "$0: error: invalid --with-zlib-asm=$ZLIB_ASM option." + echo "The valid values are \"pentium\" and \"pentiumpro\" only". + echo + + exit 1; + ;; + esac + ;; + +esac + + +if [ $done = NO ]; then + echo " cd $ZLIB \\" >> $MAKEFILE + echo " && CFLAGS=\"$ZLIB_OPT\" CC=\"\$(CC)\" \\" >> $MAKEFILE + echo " ./configure \\" >> $MAKEFILE + echo " && \$(MAKE) libz.a" >> $MAKEFILE +fi + + +echo >> $MAKEFILE diff --git a/auto/lib/zlib/makefile.bcc b/auto/lib/zlib/makefile.bcc new file mode 100644 index 000000000..95e8800ad --- /dev/null +++ b/auto/lib/zlib/makefile.bcc @@ -0,0 +1,11 @@ + +# Copyright (C) Igor Sysoev + + +CFLAGS = -q -O2 -tWM $(CPU_OPT) + +zlib.lib: + bcc32 -c $(CFLAGS) adler32.c crc32.c deflate.c trees.c zutil.c + + tlib zlib.lib +adler32.obj +crc32.obj +deflate.obj \ + +trees.obj +zutil.obj diff --git a/auto/lib/zlib/makefile.msvc b/auto/lib/zlib/makefile.msvc new file mode 100644 index 000000000..304b986cd --- /dev/null +++ b/auto/lib/zlib/makefile.msvc @@ -0,0 +1,11 @@ + +# Copyright (C) Igor Sysoev + + +CFLAGS = -nologo -O2 -Ob1 -Oi -Gs $(LIBC) $(CPU_OPT) + +zlib.lib: + cl -c $(CFLAGS) adler32.c crc32.c deflate.c trees.c zutil.c + + link -lib -out:zlib.lib adler32.obj crc32.obj deflate.obj \ + trees.obj zutil.obj diff --git a/auto/lib/zlib/makefile.owc b/auto/lib/zlib/makefile.owc new file mode 100644 index 000000000..71ba512dc --- /dev/null +++ b/auto/lib/zlib/makefile.owc @@ -0,0 +1,9 @@ + +# Copyright (C) Igor Sysoev + + +CFLAGS = -zq -bt=nt -ot -op -oi -oe -s -bm $(CPU_OPT) + +zlib.lib: + wcl386 -c $(CFLAGS) adler32.c crc32.c deflate.c trees.c zutil.c + wlib -n zlib.lib adler32.obj crc32.obj deflate.obj trees.obj zutil.obj diff --git a/auto/make b/auto/make new file mode 100644 index 000000000..fee8a6f24 --- /dev/null +++ b/auto/make @@ -0,0 +1,360 @@ + +# Copyright (C) Igor Sysoev + + +mkdir -p $OBJS/src/core $OBJS/src/event $OBJS/src/event/modules \ + $OBJS/src/os/unix $OBJS/src/os/win32 \ + $OBJS/src/http $OBJS/src/http/modules $OBJS/src/http/modules/proxy \ + $OBJS/src/imap + + +echo "CC = $CC" > $MAKEFILE +echo "CPP = $CPP" >> $MAKEFILE +echo "LINK = $LINK" >> $MAKEFILE +if [ "$CC" = wcl386 ]; then + echo MAKE = wmake >> $MAKEFILE +fi +echo "CFLAGS = $CFLAGS" >> $MAKEFILE +echo >> $MAKEFILE + + +if [ $MAKE_SL = YES ]; then + echo >> $MAKEFILE +fi + +all_inc="$CORE_INCS $OBJS $HTTP_INCS $IMAP_INCS" +all_inc=`echo " $all_inc" | sed -e "s/ \([^ ]\)/ $INCOPT\1/g"` +all_inc=`echo $all_inc | sed -e "s/\//$DIRSEP/g"` + +echo "ALL_INCS = $all_inc" >> $MAKEFILE +echo >> $MAKEFILE + +all_srcs="$CORE_SRCS" + + +# CORE_DEPS + +if [ $MAKE_SL = YES ]; then + echo $ngx_n "CORE_DEPS =" $ngx_c >> $MAKEFILE +else + echo "CORE_DEPS = \\" >> $MAKEFILE +fi + +for dep in $CORE_DEPS +do + dep=`echo $dep | sed -e "s/\//$DIRSEP/g"` + + if [ $MAKE_SL = YES ]; then + echo $ngx_n " $dep" $ngx_c >> $MAKEFILE + else + echo " $dep \\" >> $MAKEFILE + fi +done +echo >> $MAKEFILE + + +# CORE_INCS + +if [ $MAKE_SL = YES ]; then + echo >> $MAKEFILE +fi + +inc="$CORE_INCS $OBJS" +inc=`echo " $inc" | sed -e "s/ \([^ ]\)/ $INCOPT\1/g" -e "s/\//$DIRSEP/g"` + +echo "CORE_INCS = $inc" >> $MAKEFILE +echo >> $MAKEFILE + + +if [ $HTTP = YES ]; then + + all_srcs="$all_srcs $HTTP_SRCS" + + # HTTP_DEPS + + if [ $MAKE_SL = YES ]; then + echo $ngx_n "HTTP_DEPS =" $ngx_c >> $MAKEFILE + else + echo "HTTP_DEPS = \\" >> $MAKEFILE + fi + + for dep in $HTTP_DEPS + do + dep=`echo $dep | sed -e "s/\//$DIRSEP/g"` + + if [ $MAKE_SL = YES ]; then + echo $ngx_n " $dep" $ngx_c >> $MAKEFILE + else + echo " $dep \\" >> $MAKEFILE + fi + done + echo >> $MAKEFILE + + + # HTTP_INCS + + if [ $MAKE_SL = YES ]; then + echo >> $MAKEFILE + fi + + inc="$HTTP_INCS $OBJS" + inc=`echo " $inc" | sed -e "s/ \([^ ]\)/ $INCOPT\1/g" -e "s/\//$DIRSEP/g"` + + echo "HTTP_INCS = $inc" >> $MAKEFILE + echo >> $MAKEFILE + +fi + + +if [ $IMAP = YES ]; then + + all_srcs="$all_srcs $IMAP_SRCS" + + # IMAP_DEPS + + if [ $MAKE_SL = YES ]; then + echo $ngx_n "IMAP_DEPS =" $ngx_c >> $MAKEFILE + else + echo "IMAP_DEPS = \\" >> $MAKEFILE + fi + + for dep in $IMAP_DEPS + do + dep=`echo $dep | sed -e "s/\//$DIRSEP/g"` + + if [ $MAKE_SL = YES ]; then + echo $ngx_n " $dep" $ngx_c >> $MAKEFILE + else + echo " $dep \\" >> $MAKEFILE + fi + done + echo >> $MAKEFILE + + + # IMAP_INCS + + if [ $MAKE_SL = YES ]; then + echo >> $MAKEFILE + fi + + inc="$IMAP_INCS $OBJS" + inc=`echo " $inc" | sed -e "s/ \([^ ]\)/ $INCOPT\1/g" -e "s/\//$DIRSEP/g"` + + echo "IMAP_INCS = $inc" >> $MAKEFILE + echo >> $MAKEFILE + +fi + + +# nginx + +if [ $MAKE_SL = YES ]; then + echo $ngx_n "nginx$BINEXT: " $ngx_c >> $MAKEFILE +else + echo "nginx$BINEXT: \\" >> $MAKEFILE +fi + + +# nginx deps + +for src in $all_srcs +do + obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\.S\$/.$OBJEXT/"` + obj=`echo $OBJS/$obj | sed -e "s/\//$DIRSEP/g"` + + if [ $MAKE_SL = YES ]; then + echo $ngx_n " $obj" $ngx_c >> $MAKEFILE + else + echo " $obj \\" >> $MAKEFILE + fi +done + +for src in $NGX_MODULES_C $LINK_DEPS +do + obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/"` + obj=`echo $obj | sed -e "s/\//$DIRSEP/g"` + + if [ $MAKE_SL = YES ]; then + echo $ngx_n " $obj" $ngx_c >> $MAKEFILE + else + echo " $obj \\" >> $MAKEFILE + fi +done +echo >> $MAKEFILE + + +# nginx build + +if [ $MAKE_SL = YES ]; then + echo $ngx_n " \$(LINK) ${BINOUT}nginx" $ngx_c >> $MAKEFILE +else + echo " \$(LINK) ${BINOUT}nginx \\" >> $MAKEFILE +fi + + +# nginx build sources + +for src in $all_srcs +do + obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\.S\$/.$OBJEXT/"` + obj=`echo $OBJS/$obj | sed -e "s/\//$DIRSEP/g"` + + if [ $MAKE_SL = YES ]; then + echo $ngx_n " $obj" $ngx_c >> $MAKEFILE + else + echo " $obj \\" >> $MAKEFILE + fi +done + + +# nginx build ngx_modules.c and libs + +obj=`echo $NGX_MODULES_C | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\//$DIRSEP/g"` +src=`echo $NGX_MODULES_C | sed -e "s/\//$DIRSEP/g"` +libs=`echo $CORE_LIBS | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\//$DIRSEP/g"` +link=`echo $CORE_LINK | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\//$DIRSEP/g"` + +if [ $MAKE_SL = YES ]; then + echo " $obj $libs $CORE_LINK" >> $MAKEFILE + echo >> $MAKEFILE +else + echo " $obj \\" >> $MAKEFILE + echo " $libs \\" >> $MAKEFILE + echo " $link" >> $MAKEFILE + echo >> $MAKEFILE +fi + + +# ngx_modules.c + +deps="\$(CORE_DEPS)" + +if [ $PCH != NO ]; then + args="\$(CFLAGS) $USEPCH \$(ALL_INCS)" +else + args="\$(CFLAGS) $USEPCH \$(CORE_INCS)" +fi + +if [ $MAKE_SL = YES ]; then + echo "$obj: $NGX_MODULES_C $deps" >> $MAKEFILE + echo $ngx_n " \$(CC) $COMPOPT $args" $ngx_c >> $MAKEFILE + echo " $OBJOUT$obj $src" >> $MAKEFILE + echo >> $MAKEFILE +else + echo "$obj: \\" >> $MAKEFILE + echo " $NGX_MODULES_C $deps" >> $MAKEFILE + echo " \$(CC) $COMPOPT $args \\" >> $MAKEFILE + echo " $OBJOUT$obj \\" >> $MAKEFILE + echo " $src" >> $MAKEFILE + echo >> $MAKEFILE +fi + + +# core sources + +for src in $CORE_SRCS +do + obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\.S\$/.$OBJEXT/"` + obj=`echo $OBJS/$obj | sed -e "s/\//$DIRSEP/g"` + src=`echo $src | sed -e "s/\//$DIRSEP/g"` + + if [ $MAKE_SL = YES ]; then + echo "$obj: $src $deps" >> $MAKEFILE + echo " \$(CC) $COMPOPT $args $OBJOUT$obj $src" >> $MAKEFILE + echo >> $MAKEFILE + else + echo "$obj: \\" >> $MAKEFILE + echo " $src $deps" >> $MAKEFILE + echo " \$(CC) $COMPOPT $args \\" >> $MAKEFILE + echo " $OBJOUT$obj \\" >> $MAKEFILE + echo " $src" >> $MAKEFILE + echo >> $MAKEFILE + fi +done + + +# http sources + +if [ $HTTP = YES ]; then + + deps="\$(CORE_DEPS) \$(HTTP_DEPS)" + + if [ $PCH != NO ]; then + args="\$(CFLAGS) $USEPCH \$(ALL_INCS)" + else + args="\$(CFLAGS) $USEPCH \$(CORE_INCS) \$(HTTP_INCS)" + fi + + for src in $HTTP_SRCS + do + obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/"` + obj=`echo $OBJS/$obj | sed -e "s/\//$DIRSEP/g"` + src=`echo $src | sed -e "s/\//$DIRSEP/g"` + + if [ $MAKE_SL = YES ]; then + echo "$obj: $src $deps" >> $MAKEFILE + echo " \$(CC) $COMPOPT $args $OBJOUT$obj $src" >> $MAKEFILE + echo >> $MAKEFILE + else + echo "$obj: \\" >> $MAKEFILE + echo " $src $deps" >> $MAKEFILE + echo " \$(CC) $COMPOPT $args \\" >> $MAKEFILE + echo " $OBJOUT$obj \\" >> $MAKEFILE + echo " $src" >> $MAKEFILE + echo >> $MAKEFILE + fi + done + +fi + + +# imap sources + +if [ $IMAP = YES ]; then + + deps="\$(CORE_DEPS) \$(IMAP_DEPS)" + + if [ $PCH != NO ]; then + args="\$(CFLAGS) $USEPCH \$(ALL_INCS)" + else + args="\$(CFLAGS) $USEPCH \$(CORE_INCS) \$(IMAP_INCS)" + fi + + for src in $IMAP_SRCS + do + obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/"` + obj=`echo $OBJS/$obj | sed -e "s/\//$DIRSEP/g"` + src=`echo $src | sed -e "s/\//$DIRSEP/g"` + + if [ $MAKE_SL = YES ]; then + echo "$obj: $src $deps" >> $MAKEFILE + echo " \$(CC) $COMPOPT $args $OBJOUT$obj $src" >> $MAKEFILE + echo >> $MAKEFILE + else + echo "$obj: \\" >> $MAKEFILE + echo " $src $deps" >> $MAKEFILE + echo " \$(CC) $COMPOPT $args \\" >> $MAKEFILE + echo " $OBJOUT$obj \\" >> $MAKEFILE + echo " $src" >> $MAKEFILE + echo >> $MAKEFILE + fi + done + +fi + + +# precompiled headers + +if [ $PCH != NO ]; then + echo "#include <ngx_config.h>" > $OBJS/pch.c + + pch="$PCH: src/core/ngx_config.h $OS_CONFIG $OBJS/ngx_auto_config.h" + pch=`echo $pch | sed -e "s/\//$DIRSEP/g"` + src="\$(CC) \$(CFLAGS) $BUILDPCH $COMPOPT \$(ALL_INCS)" + src="$src $OBJOUT$OBJS/pch.obj $OBJS/pch.c" + src=`echo $src | sed -e "s/\//$DIRSEP/g"` + + echo "$pch" >> $MAKEFILE + echo " $src" >> $MAKEFILE + echo >> $MAKEFILE +fi diff --git a/auto/modules b/auto/modules new file mode 100644 index 000000000..6c5111a28 --- /dev/null +++ b/auto/modules @@ -0,0 +1,167 @@ + +# Copyright (C) Igor Sysoev + + +if [ $EVENT_SELECT = NO -a $EVENT_FOUND = NO ]; then + EVENT_SELECT=YES +fi + +if [ $EVENT_SELECT = YES ]; then + CORE_SRCS="$CORE_SRCS $SELECT_SRCS" + EVENT_MODULES="$EVENT_MODULES $SELECT_MODULE" +fi + + +if [ $EVENT_POLL = NO -a $EVENT_FOUND = NO ]; then + EVENT_POLL=YES +fi + +if [ $EVENT_POLL = YES ]; then + CORE_SRCS="$CORE_SRCS $POLL_SRCS" + EVENT_MODULES="$EVENT_MODULES $POLL_MODULE" +fi + + +if [ $TEST_BUILD_DEVPOLL = YES ]; then + have=HAVE_DEVPOLL . auto/have + have=TEST_BUILD_DEVPOLL . auto/have + EVENT_MODULES="$EVENT_MODULES $DEVPOLL_MODULE" + CORE_SRCS="$CORE_SRCS $DEVPOLL_SRCS" +fi + +if [ $TEST_BUILD_EPOLL = YES ]; then + have=HAVE_EPOLL . auto/have + have=TEST_BUILD_EPOLL . auto/have + EVENT_MODULES="$EVENT_MODULES $EPOLL_MODULE" + CORE_SRCS="$CORE_SRCS $EPOLL_SRCS" +fi + +if [ $TEST_BUILD_RTSIG = YES ]; then + have=HAVE_RTSIG . auto/have + have=TEST_BUILD_RTSIG . auto/have + EVENT_MODULES="$EVENT_MODULES $RTSIG_MODULE" + CORE_SRCS="$CORE_SRCS $RTSIG_SRCS" +fi + + +# the filter order is important +# ngx_http_write_filter +# ngx_http_header_filter +# ngx_http_chunked_filter +# ngx_http_range_header_filter +# ngx_http_ssl_filter +# ngx_http_gzip_filter +# ngx_http_charset_filter +# ngx_http_ssi_filter +# ngx_http_headers_filter +# ngx_http_copy_filter +# ngx_http_range_body_filter +# ngx_http_not_modified_filter + +HTTP_FILTER_MODULES="$HTTP_WRITE_FILTER_MODULE \ + $HTTP_HEADER_FILTER_MODULE \ + $HTTP_CHUNKED_FILTER_MODULE \ + $HTTP_RANGE_HEADER_FILTER_MODULE" + +if [ $HTTP_GZIP = YES ]; then + have=NGX_HTTP_GZIP . auto/have + USE_ZLIB=YES + HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_GZIP_FILTER_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_GZIP_SRCS" +fi + +if [ $HTTP_CHARSET = YES ]; then + have=NGX_HTTP_CHARSET . auto/have + HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_CHARSET_FILTER_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_CHARSET_SRCS" +fi + +if [ $HTTP_SSI = YES ]; then + have=NGX_HTTP_SSI . auto/have + HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_SSI_FILTER_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_SSI_SRCS" +fi + +if [ $HTTP_USERID = YES ]; then + HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_USERID_FILTER_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_USERID_SRCS" +fi + +HTTP_MODULES="$HTTP_MODULES $HTTP_STATIC_MODULE $HTTP_INDEX_MODULE" + +if [ $HTTP_ACCESS = YES ]; then + have=NGX_HTTP_ACCESS . auto/have + HTTP_MODULES="$HTTP_MODULES $HTTP_ACCESS_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_ACCESS_SRCS" +fi + +if [ $HTTP_STATUS = YES ]; then + have=NGX_HTTP_STATUS . auto/have + HTTP_MODULES="$HTTP_MODULES $HTTP_STATUS_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_STATUS_SRCS" +fi + +if [ $HTTP_REWRITE = YES -a $USE_PCRE != DISABLED ]; then + have=NGX_HTTP_REWRITE . auto/have + USE_PCRE=YES + HTTP_MODULES="$HTTP_MODULES $HTTP_REWRITE_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_REWRITE_SRCS" +fi + +if [ $HTTP_SSL = YES ]; then + USE_OPENSSL=YES + have=NGX_HTTP_SSL . auto/have + HTTP_MODULES="$HTTP_MODULES $HTTP_SSL_MODULE" + HTTP_DEPS="$HTTP_DEPS $HTTP_SSL_DEPS" + HTTP_SRCS="$HTTP_SRCS $HTTP_SSL_SRCS" +fi + +if [ $HTTP_PROXY = YES ]; then + have=NGX_HTTP_PROXY . auto/have + #USE_MD5=YES + HTTP_MODULES="$HTTP_MODULES $HTTP_PROXY_MODULE" + HTTP_INCS="$HTTP_INCS $HTTP_PROXY_INCS" + HTTP_DEPS="$HTTP_DEPS $HTTP_PROXY_DEPS" + HTTP_SRCS="$HTTP_SRCS $HTTP_PROXY_SRCS" +fi + +if [ -r $OBJS/auto ]; then + . $OBJS/auto +fi + +modules="$CORE_MODULES $EVENT_MODULES" + +if [ $HTTP = YES ]; then + modules="$modules $HTTP_MODULES $HTTP_FILTER_MODULES \ + $HTTP_HEADERS_FILTER_MODULE \ + $HTTP_COPY_FILTER_MODULE \ + $HTTP_RANGE_BODY_FILTER_MODULE \ + $HTTP_NOT_MODIFIED_FILTER_MODULE" +fi + +IMAP_MODULES=$IMAP_MODULE + +if [ $IMAP = YES ]; then + modules="$modules $IMAP_MODULES" +fi + + +echo "#include <ngx_config.h>" > $NGX_MODULES_C +echo "#include <ngx_core.h>" >> $NGX_MODULES_C +echo >> $NGX_MODULES_C + +for mod in $modules +do + echo "extern ngx_module_t $mod;" >> $NGX_MODULES_C +done + +echo >> $NGX_MODULES_C +echo 'ngx_module_t *ngx_modules[] = {' >> $NGX_MODULES_C + +for mod in $modules +do + echo " &$mod," >> $NGX_MODULES_C +done + +echo " NULL" >> $NGX_MODULES_C +echo "};" >> $NGX_MODULES_C diff --git a/auto/nohave b/auto/nohave new file mode 100644 index 000000000..bb5632aaf --- /dev/null +++ b/auto/nohave @@ -0,0 +1,11 @@ + +# Copyright (C) Igor Sysoev + + +cat << END >> $NGX_AUTO_CONFIG_H + +#ifndef $have +#define $have 0 +#endif + +END diff --git a/auto/options b/auto/options new file mode 100644 index 000000000..259c049ad --- /dev/null +++ b/auto/options @@ -0,0 +1,260 @@ + +# Copyright (C) Igor Sysoev + +help=no + +PREFIX= +SBIN_PATH= +CONF_PATH= +HTTP_LOG_PATH= +ERROR_LOG_PATH= +PID_PATH= + +CC=gcc +CPP= +OBJS=objs + +DEBUG=NO +CC_OPT= +CPU=NO + +TEST_BUILD_DEVPOLL=NO +TEST_BUILD_EPOLL=NO +TEST_BUILD_RTSIG=NO + +EVENT_FOUND=NO + +EVENT_RTSIG=NO +EVENT_SELECT=NO +EVENT_POLL=NO +EVENT_AIO=NO + +USE_THREADS=NO + +HTTP=YES +HTTP_CHARSET=YES +HTTP_GZIP=YES +HTTP_SSL=NO +HTTP_SSI=NO +HTTP_ACCESS=YES +HTTP_USERID=YES +HTTP_STATUS=NO +HTTP_REWRITE=YES +HTTP_PROXY=YES + +IMAP=NO + +USE_PCRE=NO +PCRE=NONE +PCRE_OPT= + +USE_OPENSSL=NO +OPENSSL=NONE + +USE_MD5=NO +MD5=NONE +MD5_OPT= +MD5_ASM=NO + +USE_ZLIB=NO +ZLIB=NONE +ZLIB_OPT= +ZLIB_ASM=NO + + +for option +do + case "$option" in + -*=*) value=`echo "$option" | sed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) value="" ;; + esac + + case "$option" in + --help) help=yes ;; + + --prefix=*) PREFIX="$value" ;; + --sbin-path=*) SBIN_PATH="$value" ;; + --conf-path=*) CONF_PATH="$value" ;; + --error-log-path=*) ERROR_LOG_PATH="$value" ;; + --pid-path=*) PID_PATH="$value" ;; + + --crossbuild=*) PLATFORM="$value" ;; + + --builddir=*) OBJS="$value" ;; + + --with-rtsig_module) EVENT_RTSIG=YES ;; + --with-select_module) EVENT_SELECT=YES ;; + --without-select_module) EVENT_SELECT=NONE ;; + --with-poll_module) EVENT_POLL=YES ;; + --without-poll_module) EVENT_POLL=NONE ;; + --with-aio_module) EVENT_AIO=YES ;; + + --with-threads=*) USE_THREADS="$value" ;; + --with-threads) USE_THREADS="pthreads" ;; + + --without-http) HTTP=NO ;; + --http-log-path=*) HTTP_LOG_PATH="$value" ;; + + --with-http_ssl_module) HTTP_SSL=YES ;; + --without-http_charset_module) HTTP_CHARSET=NO ;; + --without-http_gzip_module) HTTP_GZIP=NO ;; + --without-http_ssi_module) HTTP_SSI=NO ;; + --without-http_userid_module) HTTP_USERID=NO ;; + --without-http_access_module) HTTP_ACCESS=NO ;; + --without-http_status_module) HTTP_STATUS=NO ;; + --without-http_rewrite_module) HTTP_REWRITE=NO ;; + --without-http_proxy_module) HTTP_PROXY=NO ;; + + --with-imap) IMAP=YES ;; + + --with-cc=*) CC="$value" ;; + --with-cpp=*) CPP="$value" ;; + --with-cc-opt=*) CC_OPT="$value" ;; + --with-cpu-opt=*) CPU="$value" ;; + --with-debug) DEBUG=YES ;; + + --without-pcre) USE_PCRE=DISABLED ;; + --with-pcre=*) PCRE="$value" ;; + --with-pcre-opt=*) PCRE_OPT="$value" ;; + + --with-openssl=*) OPENSSL="$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 ;; + --test-build-rtsig) TEST_BUILD_RTSIG=YES ;; + + *) + echo "$0: error: invalid option \"$option\"" + exit 1 + ;; + esac +done + + +if [ $help = yes ]; then + echo + echo " --help this message" + echo + + echo " --without-select_module disable select_module" + echo " --without-poll_module disable poll_module" + + echo " --without-http_rewrite_module disable http_rewrite_module" + echo " --without-http_gzip_module disable http_gzip_module" + echo " --without-http_proxy_module disable http_proxy_module" + + echo " --with-cc=NAME name of or path to C compiler" + echo + + echo " --with-pcre=DIR path to PCRE library" + echo " --with-md5=DIR path to md5 library" + echo " --with-zlib=DIR path to zlib library" + echo + + exit 1 +fi + + +if [ $HTTP = NO ]; then + HTTP_CHARSET=NO + HTTP_GZIP=NO + HTTP_SSI=NO + HTTP_USERID=NO + HTTP_ACCESS=NO + HTTP_STATUS=NO + HTTP_REWRITE=NO + HTTP_PROXY=NO +fi + + +if [ ".$PLATFORM" = ".win32" -a $EVENT_POLL = YES ]; then + EVENT_POLL=NO + echo "$0: warning: --with-poll_module option is ignored for win32" +fi + + +if [ ".$PREFIX" = "." ]; then + PREFIX=/usr/local/nginx +fi + + +case ".$SBIN_PATH" in + ./*) + ;; + + .) + SBIN_PATH=$PREFIX/sbin/nginx + ;; + + *) + SBIN_PATH=$PREFIX/$SBIN_PATH + ;; +esac + + +case ".$CONF_PATH" in + ./*) + ;; + + .) + CONF_PATH=$PREFIX/conf/nginx.conf + ;; + + *) + CONF_PATH=$PREFIX/$CONF_PATH + ;; +esac + + +case ".$PID_PATH" in + ./*) + ;; + + .) + PID_PATH=$PREFIX/logs/nginx.pid + ;; + + *) + PID_PATH=$PREFIX/$PID_PATH + ;; +esac + + +case ".$ERROR_LOG_PATH" in + ./*) + ;; + + .) + ERROR_LOG_PATH=$PREFIX/logs/error.log + ;; + + .stderr) + ERROR_LOG_PATH= + ;; + + *) + ERROR_LOG_PATH=$PREFIX/$ERROR_LOG_PATH + ;; +esac + + +case ".$HTTP_LOG_PATH" in + ./*) + ;; + + .) + HTTP_LOG_PATH=$PREFIX/logs/access.log + ;; + + *) + HTTP_LOG_PATH=$PREFIX/$HTTP_LOG_PATH + ;; +esac diff --git a/auto/os/conf b/auto/os/conf new file mode 100644 index 000000000..abffbe3d8 --- /dev/null +++ b/auto/os/conf @@ -0,0 +1,57 @@ + +# Copyright (C) Igor Sysoev + + +if [ ".$PLATFORM" = "." ]; then + echo "checking for OS" + + SYSTEM=`uname -s 2>/dev/null` + RELEASE=`uname -r 2>/dev/null` + MACHINE=`uname -m 2>/dev/null` + + echo " + $SYSTEM $RELEASE $MACHINE" + + PLATFORM="$SYSTEM:$RELEASE:$MACHINE"; +else + echo "building for $PLATFORM" +fi + +case $PLATFORM in + + FreeBSD:* | DragonFly:*) + . auto/os/freebsd + ;; + + Linux:*) + . auto/os/linux + ;; + + SunOS:*) + . auto/os/solaris + ;; + + win32) + CORE_INCS="$WIN32_INCS" + CORE_DEPS="$WIN32_DEPS" + CORE_SRCS="$WIN32_SRCS $IOCP_SRCS" + OS_CONFIG="$WIN32_CONFIG" + EVENT_MODULES="$EVENT_MODULES $IOCP_MODULE" + EVENT_FOUND=YES + + if [ $EVENT_SELECT = NO ]; then + CORE_SRCS="$CORE_SRCS $SELECT_SRCS" + EVENT_MODULES="$EVENT_MODULES $SELECT_MODULE" + fi + + have=HAVE_AIO . auto/have + have=HAVE_IOCP . auto/have + CORE_LIBS="$CORE_LIBS ws2_32.lib" + ;; + + *) + CORE_INCS="$UNIX_INCS" + CORE_DEPS="$UNIX_DEPS $POSIX_DEPS" + CORE_SRCS="$UNIX_SRCS" + ;; + +esac diff --git a/auto/os/freebsd b/auto/os/freebsd new file mode 100644 index 000000000..90cb49702 --- /dev/null +++ b/auto/os/freebsd @@ -0,0 +1,89 @@ + +# Copyright (C) Igor Sysoev + + +CORE_INCS="$UNIX_INCS" +CORE_DEPS="$UNIX_DEPS $FREEBSD_DEPS" +CORE_SRCS="$UNIX_SRCS $FREEBSD_SRCS" + +PIPE="-pipe" + + +# __FreeBSD_version is the best way to determine whether +# some capability exists and is safe to use + +version=`grep "#define __FreeBSD_version" /usr/include/osreldate.h \ + | sed -e 's/^.* \(.*\)$/\1/'` + + +# setproctitle() in libutil + +if [ \( $version -ge 500000 -a $version -lt 500012 \) \ + -o $version -lt 410002 ] +then + echo " + setproctitle() in libutil" + + CORE_LIBS="$CORE_LIBS -lutil" +fi + +# sendfile + +if [ $version -gt 300007 ]; then + echo " + using sendfile()" + + have=HAVE_SENDFILE . auto/have + CORE_SRCS="$CORE_SRCS $FREEBSD_SENDFILE_SRCS" +fi + + +# kqueue + +if [ \( $version -lt 500000 -a $version -ge 410000 \) \ + -o $version -ge 500011 ] +then + echo " + using kqueue" + + have=HAVE_KQUEUE . auto/have + have=HAVE_CLEAR_EVENT . auto/have + EVENT_MODULES="$EVENT_MODULES $KQUEUE_MODULE" + CORE_SRCS="$CORE_SRCS $KQUEUE_SRCS" + EVENT_FOUND=YES +fi + + +# kqueue's NOTE_LAWAT + +if [ \( $version -lt 500000 -a $version -ge 430000 \) \ + -o $version -ge 500018 ] +then + echo " + using kqueue's NOTE_LOWAT" + have=HAVE_LOWAT_EVENT . auto/have +fi + + +if [ $USE_THREADS = "rfork" ]; then + + echo " + using rfork()" + +# # kqueue's EVFILT_SIGNAL is safe +# +# if [ $version -gt 460101 ]; then +# echo " + kqueue's EVFILT_SIGNAL is safe" +# have=HAVE_SAFE_EVFILT_SIGNAL . auto/have +# else +# echo "$0: error: the kqueue's EVFILT_SIGNAL is unsafe on this" +# echo "FreeBSD version, so --with-threads=rfork could not be used" +# echo +# +# exit 1 +# fi +fi + + +if [ $EVENT_AIO = YES ]; then + have=HAVE_AIO . auto/have + EVENT_MODULES="$EVENT_MODULES $AIO_MODULE" + CORE_SRCS="$CORE_SRCS $AIO_SRCS" +else + have=HAVE_AIO . auto/nohave +fi diff --git a/auto/os/linux b/auto/os/linux new file mode 100644 index 000000000..8576ea680 --- /dev/null +++ b/auto/os/linux @@ -0,0 +1,82 @@ + +# Copyright (C) Igor Sysoev + + +CORE_INCS="$UNIX_INCS" +CORE_DEPS="$UNIX_DEPS $LINUX_DEPS" +CORE_SRCS="$UNIX_SRCS $LINUX_SRCS" +EVENT_MODULES="$EVENT_MODULES" + +PIPE="-pipe" + + +CC_TEST_FLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" + +# Linux kernel version + +version=`grep "#define LINUX_VERSION_CODE" /usr/include/linux/version.h \ + | sed -e 's/^.* \(.*\)$/\1/'` + + +# enable the rt signals on Linux 2.2.19 and onward + +if [ $version -ge 131609 -o $EVENT_RTSIG = YES ]; then + echo " + using rt signals" + have=HAVE_RTSIG . auto/have + EVENT_MODULES="$EVENT_MODULES $RTSIG_MODULE" + CORE_SRCS="$CORE_SRCS $RTSIG_SRCS" + EVENT_FOUND=YES +fi + + +# epoll, EPOLLET version + +ngx_func="epoll"; +ngx_func_inc="#include <sys/epoll.h>" +ngx_func_test="int efd = 0, fd = 1, n; + struct epoll_event ee; + ee.events = EPOLLIN|EPOLLOUT|EPOLLET; + ee.data.ptr = NULL; + n = epoll_ctl(efd, EPOLL_CTL_ADD, fd, &ee)" +. auto/func + +if [ $ngx_found = yes ]; then + have=HAVE_EPOLL . auto/have + have=HAVE_CLEAR_EVENT . auto/have + CORE_SRCS="$CORE_SRCS $EPOLL_SRCS" + EVENT_MODULES="$EVENT_MODULES $EPOLL_MODULE" + EVENT_FOUND=YES +fi + + +# sendfile() + +CC_TEST_FLAGS="-D_GNU_SOURCE" +ngx_func="sendfile()"; +ngx_func_inc="#include <sys/sendfile.h>" +ngx_func_test="int s = 0, fd = 1; + ssize_t n; off_t off = 0; + n = sendfile(s, fd, &off, 1)" +. auto/func + +if [ $ngx_found = yes ]; then + CORE_SRCS="$CORE_SRCS $LINUX_SENDFILE_SRCS" +fi + + +# sendfile64() + +CC_TEST_FLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" +ngx_func="sendfile64()"; . auto/func + + +# prctl(PR_SET_DUMPABLE) + +ngx_func="prctl()"; +ngx_func_inc="#include <sys/prctl.h>" +ngx_func_test="prctl(PR_SET_DUMPABLE, 1, 0, 0, 0)" +. auto/func + +if [ $ngx_found = yes ]; then + have=HAVE_PR_SET_DUMPABLE . auto/have +fi diff --git a/auto/os/solaris b/auto/os/solaris new file mode 100644 index 000000000..29497ff5f --- /dev/null +++ b/auto/os/solaris @@ -0,0 +1,83 @@ + +# Copyright (C) Igor Sysoev + + +CORE_INCS="$UNIX_INCS" +CORE_DEPS="$UNIX_DEPS $SOLARIS_DEPS" +CORE_SRCS="$UNIX_SRCS $SOLARIS_SRCS " +EVENT_MODULES="$EVENT_MODULES" + +CORE_LIBS="$CORE_LIBS -lsocket -lnsl -lrt" + +# the Solaris's make support +MAKE_SL=YES + + +CC_TEST_FLAGS="-D_FILE_OFFSET_BITS=64" + +case $PLATFORM in + + SunOS:5.[89]:* | SunOS:5.10:*) + PIPE="-pipe" + ;; + + *) + # Solaris 7's /usr/ccs/bin/as does not support "-pipe" + ;; + +esac + + +case $PLATFORM in + + *:sun4u) + CFLAGS="$CFLAGS -mcpu=v9" + + if [ ".$CPU" = ".sparc64" ]; then + CFLAGS="$CFLAGS -m64" + CPU_OPT="-m64" + CORE_LINK="$CORE_LINK -m64" + + CC_TEST_FLAGS="$CC_TEST_FLAGS -mcpu=v9 -m64" + fi + ;; + + *) + ;; + +esac + + +if [ $ZLIB_ASM != NO ]; then + echo "$0: error: the --with-zlib-asm=CPU option is not supported" + echo "on that platform" + echo + + exit 1 +fi + + +ngx_inc="sys/devpoll.h"; . auto/inc + +if [ $ngx_found = yes ]; then + have=HAVE_DEVPOLL . auto/have + CORE_SRCS="$CORE_SRCS $DEVPOLL_SRCS" + EVENT_MODULES="$EVENT_MODULES $DEVPOLL_MODULE" + EVENT_FOUND=YES +fi + + +ngx_func="sendfilev()"; +ngx_func_inc="#include <sys/sendfile.h>" +ngx_func_libs="-lsendfile" +ngx_func_test="int fd = 1; sendfilevec_t vec[1]; + size_t sent; ssize_t n; + n = sendfilev(fd, vec, 1, &sent)" +. auto/func + + +if [ $ngx_found = yes ]; then + have=HAVE_SENDFILE . auto/have + CORE_SRCS="$CORE_SRCS $SOLARIS_SENDFILEV_SRCS" + CORE_LIBS="$CORE_LIBS -lsendfile" +fi diff --git a/auto/sources b/auto/sources new file mode 100644 index 000000000..40fbad223 --- /dev/null +++ b/auto/sources @@ -0,0 +1,307 @@ + +# Copyright (C) Igor Sysoev + + +CORE_MODULES="ngx_core_module ngx_errlog_module ngx_conf_module" + +CORE_INCS="src/core" + +CORE_DEPS="src/core/nginx.h \ + src/core/ngx_config.h \ + src/core/ngx_core.h \ + src/core/ngx_log.h \ + src/core/ngx_palloc.h \ + src/core/ngx_array.h \ + src/core/ngx_list.h \ + src/core/ngx_table.h \ + src/core/ngx_buf.h \ + src/core/ngx_string.h \ + src/core/ngx_parse.h \ + src/core/ngx_inet.h \ + src/core/ngx_file.h \ + src/core/ngx_crc.h \ + src/core/ngx_rbtree.h \ + src/core/ngx_times.h \ + src/core/ngx_connection.h \ + src/core/ngx_cycle.h \ + src/core/ngx_conf_file.h \ + src/core/ngx_garbage_collector.h" + +# src/core/ngx_radix_tree.h \ +# src/core/ngx_radix_tree.c \ + +CORE_SRCS="src/core/nginx.c \ + src/core/ngx_log.c \ + src/core/ngx_palloc.c \ + src/core/ngx_array.c \ + src/core/ngx_list.c \ + src/core/ngx_buf.c \ + src/core/ngx_output_chain.c \ + src/core/ngx_string.c \ + src/core/ngx_parse.c \ + src/core/ngx_inet.c \ + src/core/ngx_file.c \ + src/core/ngx_rbtree.c \ + src/core/ngx_times.c \ + src/core/ngx_connection.c \ + src/core/ngx_cycle.c \ + src/core/ngx_spinlock.c \ + src/core/ngx_conf_file.c \ + src/core/ngx_garbage_collector.c" + + +REGEX_DEPS=src/core/ngx_regex.h +REGEX_SRCS=src/core/ngx_regex.c + + +EVENT_MODULES="ngx_events_module ngx_event_core_module" + +EVENT_INCS="src/event src/event/modules" + +EVENT_DEPS="src/event/ngx_event.h \ + src/event/ngx_event_timer.h \ + src/event/ngx_event_posted.h \ + src/event/ngx_event_busy_lock.h \ + src/event/ngx_event_connect.h \ + src/event/ngx_event_pipe.h" + +EVENT_SRCS="src/event/ngx_event.c \ + src/event/ngx_event_timer.c \ + src/event/ngx_event_posted.c \ + src/event/ngx_event_busy_lock.c \ + src/event/ngx_event_accept.c \ + src/event/ngx_event_connect.c \ + src/event/ngx_event_pipe.c" + + +SELECT_MODULE=ngx_select_module +SELECT_SRCS=src/event/modules/ngx_select_module.c + +POLL_MODULE=ngx_poll_module +POLL_SRCS=src/event/modules/ngx_poll_module.c + +KQUEUE_MODULE=ngx_kqueue_module +KQUEUE_SRCS=src/event/modules/ngx_kqueue_module.c + +DEVPOLL_MODULE=ngx_devpoll_module +DEVPOLL_SRCS=src/event/modules/ngx_devpoll_module.c + +EPOLL_MODULE=ngx_epoll_module +EPOLL_SRCS=src/event/modules/ngx_epoll_module.c + +RTSIG_MODULE=ngx_rtsig_module +RTSIG_SRCS=src/event/modules/ngx_rtsig_module.c + +IOCP_MODULE=ngx_iocp_module +IOCP_SRCS=src/event/modules/ngx_iocp_module.c + +AIO_MODULE=ngx_aio_module +AIO_SRCS="src/event/modules/ngx_aio_module.c \ + src/os/unix/ngx_aio_read.c \ + src/os/unix/ngx_aio_write.c \ + src/os/unix/ngx_aio_read_chain.c \ + src/os/unix/ngx_aio_write_chain.c" + + +OPENSSL_DEPS=src/event/ngx_event_openssl.h +OPENSSL_SRCS=src/event/ngx_event_openssl.c + + +UNIX_INCS="$CORE_INCS $EVENT_INCS src/os/unix" + +UNIX_DEPS="$CORE_DEPS $EVENT_DEPS \ + src/os/unix/ngx_time.h \ + src/os/unix/ngx_types.h \ + src/os/unix/ngx_errno.h \ + src/os/unix/ngx_alloc.h \ + src/os/unix/ngx_files.h \ + src/os/unix/ngx_channel.h \ + src/os/unix/ngx_shared.h \ + src/os/unix/ngx_process.h \ + src/os/unix/ngx_atomic.h \ + src/os/unix/ngx_thread.h \ + src/os/unix/ngx_socket.h \ + src/os/unix/ngx_os.h \ + src/os/unix/ngx_process_cycle.h" + +UNIX_SRCS="$CORE_SRCS $EVENT_SRCS \ + src/os/unix/ngx_time.c \ + src/os/unix/ngx_errno.c \ + src/os/unix/ngx_alloc.c \ + src/os/unix/ngx_files.c \ + src/os/unix/ngx_socket.c \ + src/os/unix/ngx_recv.c \ + src/os/unix/ngx_readv_chain.c \ + src/os/unix/ngx_send.c \ + src/os/unix/ngx_writev_chain.c \ + src/os/unix/ngx_channel.c \ + src/os/unix/ngx_shared.c \ + src/os/unix/ngx_process.c \ + src/os/unix/ngx_daemon.c \ + src/os/unix/ngx_posix_init.c \ + src/os/unix/ngx_process_cycle.c" + +POSIX_DEPS=src/os/unix/ngx_posix_config.h + +FREEBSD_DEPS=src/os/unix/ngx_freebsd_config.h +FREEBSD_SRCS=src/os/unix/ngx_freebsd_init.c +FREEBSD_SENDFILE_SRCS=src/os/unix/ngx_freebsd_sendfile_chain.c +FREEBSD_RFORK_DEPS="src/os/unix/ngx_freebsd_rfork_thread.h" +FREEBSD_RFORK_SRCS="src/os/unix/ngx_freebsd_rfork_thread.c" +FREEBSD_RFORK_THREAD_SRCS="src/os/unix/rfork_thread.S" + +PTHREAD_SRCS="src/os/unix/ngx_pthread_thread.c" + +LINUX_DEPS=src/os/unix/ngx_linux_config.h +LINUX_SRCS=src/os/unix/ngx_linux_init.c +LINUX_SENDFILE_SRCS=src/os/unix/ngx_linux_sendfile_chain.c + + +SOLARIS_DEPS=src/os/unix/ngx_solaris_config.h +SOLARIS_SRCS=src/os/unix/ngx_solaris_init.c +SOLARIS_SENDFILEV_SRCS=src/os/unix/ngx_solaris_sendfilev_chain.c + + +WIN32_INCS="$CORE_INCS $EVENT_INCS src/os/win32" + +WIN32_DEPS="$CORE_DEPS $EVENT_DEPS \ + src/os/win32/ngx_win32_config.h \ + src/os/win32/ngx_time.h \ + src/os/win32/ngx_types.h \ + src/os/win32/ngx_errno.h \ + src/os/win32/ngx_alloc.h \ + src/os/win32/ngx_files.h \ + src/os/win32/ngx_shared.h \ + src/os/win32/ngx_process.h \ + src/os/win32/ngx_atomic.h \ + src/os/win32/ngx_socket.h \ + src/os/win32/ngx_os.h \ + src/os/win32/ngx_process_cycle.h" + +WIN32_CONFIG=src/os/win32/ngx_win32_config.h + +WIN32_SRCS="$CORE_SRCS $EVENT_SRCS \ + src/os/win32/ngx_errno.c \ + src/os/win32/ngx_alloc.c \ + src/os/win32/ngx_files.c \ + src/os/win32/ngx_time.c \ + src/os/win32/ngx_process.c \ + src/os/win32/ngx_socket.c \ + src/os/win32/ngx_wsarecv.c \ + src/os/win32/ngx_wsarecv_chain.c \ + src/os/win32/ngx_wsasend_chain.c \ + src/os/win32/ngx_win32_init.c \ + src/os/win32/ngx_process_cycle.c \ + src/event/ngx_event_acceptex.c" + + +HTTP_MODULES="ngx_http_module \ + ngx_http_core_module \ + ngx_http_log_module" + +HTTP_FILE_CACHE_MODULE=ngx_http_cache_module + +HTTP_WRITE_FILTER_MODULE="ngx_http_write_filter_module" +HTTP_HEADER_FILTER_MODULE="ngx_http_header_filter_module" + +HTTP_CHUNKED_FILTER_MODULE=ngx_http_chunked_filter_module +HTTP_HEADERS_FILTER_MODULE=ngx_http_headers_filter_module +HTTP_COPY_FILTER_MODULE=ngx_http_copy_filter_module + +HTTP_RANGE_HEADER_FILTER_MODULE=ngx_http_range_header_filter_module +HTTP_RANGE_BODY_FILTER_MODULE=ngx_http_range_body_filter_module + +HTTP_NOT_MODIFIED_FILTER_MODULE=ngx_http_not_modified_filter_module + +HTTP_STATIC_MODULE=ngx_http_static_module +HTTP_INDEX_MODULE=ngx_http_index_module + +HTTP_INCS="src/http src/http/modules" + +HTTP_DEPS="src/http/ngx_http.h \ + src/http/ngx_http_request.h \ + src/http/ngx_http_config.h \ + src/http/ngx_http_core_module.h \ + src/http/ngx_http_cache.h \ + src/http/ngx_http_busy_lock.h \ + src/http/ngx_http_log_handler.h" + +HTTP_SRCS="src/http/ngx_http.c \ + src/http/ngx_http_core_module.c \ + src/http/ngx_http_special_response.c \ + src/http/ngx_http_request.c \ + src/http/ngx_http_parse.c \ + src/http/ngx_http_header_filter.c \ + src/http/ngx_http_write_filter.c \ + src/http/ngx_http_copy_filter.c \ + src/http/ngx_http_log_handler.c \ + src/http/ngx_http_request_body.c \ + src/http/ngx_http_parse_time.c \ + src/http/modules/ngx_http_static_handler.c \ + src/http/modules/ngx_http_index_handler.c \ + src/http/modules/ngx_http_chunked_filter.c \ + src/http/modules/ngx_http_range_filter.c \ + src/http/modules/ngx_http_headers_filter.c \ + src/http/modules/ngx_http_not_modified_filter.c" + +# STUB +HTTP_SRCS="$HTTP_SRCS src/http/ngx_http_busy_lock.c" + +HTPP_CACHE_SRCS=src/http/ngx_http_cache.c +HTPP_FILE_CACHE_SRCS=src/http/ngx_http_file_cache.c + + +HTTP_CHARSET_FILTER_MODULE=ngx_http_charset_filter_module +HTTP_CHARSET_SRCS=src/http/modules/ngx_http_charset_filter.c + + +HTTP_GZIP_FILTER_MODULE=ngx_http_gzip_filter_module +HTTP_GZIP_SRCS=src/http/modules/ngx_http_gzip_filter.c + + +HTTP_SSI_FILTER_MODULE=ngx_http_ssi_filter_module +HTTP_SSI_SRCS=src/http/modules/ngx_http_ssi_filter.c + + +HTTP_USERID_FILTER_MODULE=ngx_http_userid_filter_module +HTTP_USERID_SRCS=src/http/modules/ngx_http_userid_filter.c + + +HTTP_ACCESS_MODULE=ngx_http_access_module +HTTP_ACCESS_SRCS=src/http/modules/ngx_http_access_handler.c + + +HTTP_STATUS_MODULE=ngx_http_status_module +HTTP_STATUS_SRCS=src/http/modules/ngx_http_status_handler.c + + +HTTP_REWRITE_MODULE=ngx_http_rewrite_module +HTTP_REWRITE_SRCS=src/http/modules/ngx_http_rewrite_handler.c + + +HTTP_SSL_MODULE=ngx_http_ssl_module +HTTP_SSL_DEPS=src/http/modules/ngx_http_ssl_module.h +HTTP_SSL_SRCS=src/http/modules/ngx_http_ssl_module.c + + +HTTP_PROXY_MODULE=ngx_http_proxy_module +HTTP_PROXY_INCS="src/http/modules/proxy" +HTTP_PROXY_DEPS=src/http/modules/proxy/ngx_http_proxy_handler.h +HTTP_PROXY_SRCS="src/http/modules/proxy/ngx_http_proxy_handler.c \ + src/http/modules/proxy/ngx_http_proxy_upstream.c \ + src/http/modules/proxy/ngx_http_proxy_parse.c \ + src/http/modules/proxy/ngx_http_proxy_header.c" + +# STUB +# src/http/modules/proxy/ngx_http_proxy_cache.c \ + + +IMAP_INCS="src/imap" + +IMAP_DEPS="src/imap/ngx_imap.h" + +IMAP_MODULE=ngx_imap_module +IMAP_SRCS="src/imap/ngx_imap.c \ + src/imap/ngx_imap_handler.c \ + src/imap/ngx_imap_parse.c \ + src/imap/ngx_imap_proxy.c" diff --git a/auto/summary b/auto/summary new file mode 100644 index 000000000..45c68e0d5 --- /dev/null +++ b/auto/summary @@ -0,0 +1,98 @@ + +# Copyright (C) Igor Sysoev + + +echo +echo "Configuration summary" + + +if [ $USE_PCRE = DISABLED ]; then + echo " + PCRE library is disabled" + +else + case $PCRE in + YES) echo " + using system PCRE library" ;; + NONE) echo " + PCRE library is not used" ;; + NO) echo " + PCRE library is not found" ;; + *) echo " + using PCRE library: $PCRE" ;; + esac +fi + +case $MD5 in + YES) echo " + md5: using system $MD5_LIB library" ;; + NONE) echo " + md5 library is not used" ;; + NO) echo " + md5 library is not found" ;; + *) echo " + using md5 library: $MD5" ;; +esac + +case $OPENSSL in + YES) echo " + using system OpenSSL library" ;; + NONE) echo " + OpenSSL library is not used" ;; + NO) echo " + OpenSSL library is not found" ;; + *) echo " + using OpenSSL library: $OPENSSL" ;; +esac + +case $ZLIB in + YES) echo " + using system zlib library" ;; + NONE) echo " + zlib library is not used" ;; + NO) echo " + zlib library is not found" ;; + *) echo " + using zlib library: $ZLIB" ;; +esac + +echo + + +if [ $HTTP_REWRITE = YES ]; then + if [ $USE_PCRE = DISABLED ]; then + +cat << END +$0: error: the HTTP rewrite module requires the PCRE library. +You can either disable the module by using --without-http_rewrite_module +option or you have to enable the PCRE support. + +END + exit 1 + fi + + if [ $PCRE = NONE -o $PCRE = NO ]; then + +cat << END +$0: error: the HTTP rewrite module requires the PCRE library. +You can either disable the module by using --without-http_rewrite_module +option, or install the PCRE library into the system, or build the PCRE library +statically from the source with nginx by using --with-pcre=<path> option. + +END + + exit 1 + fi +fi + + +if [ $HTTP_GZIP = YES ]; then + if [ $ZLIB = NONE -o $ZLIB = NO ]; then + +cat << END +$0: error: the HTTP gzip module requires the zlib library. +You can either disable the module by using --without-http_gzip_module +option, or install the zlib library into the system, or build the zlib library +statically from the source with nginx by using --with-zlib=<path> option. + +END + + exit 1 + fi +fi + + +echo " nginx path prefix: $PREFIX" +echo " nginx binary file: $SBIN_PATH" +echo " nginx configuration file: $CONF_PATH" +echo " nginx pid file: $PID_PATH" +if [ ".$ERROR_LOG_PATH" != "." ]; then + echo " nginx error log file: $ERROR_LOG_PATH" +else + echo " nginx logs errors to stderr" +fi +echo " nginx http access log file: $HTTP_LOG_PATH" +echo diff --git a/auto/threads b/auto/threads new file mode 100644 index 000000000..9aaea5158 --- /dev/null +++ b/auto/threads @@ -0,0 +1,63 @@ + +# Copyright (C) Igor Sysoev + + +case $USE_THREADS in + rfork) + have=NGX_THREADS . auto/have + have=NGX_USE_RFORK . auto/have + CORE_DEPS="$CORE_DEPS $FREEBSD_RFORK_DEPS" + CORE_SRCS="$CORE_SRCS $FREEBSD_RFORK_SRCS" + + case $PLATFORM in + *:i386) + if [ \( $version -gt 500000 -a $version -lt 501000 \) \ + -o $version -lt 491000 ] + then + CORE_SRCS="$CORE_SRCS $FREEBSD_RFORK_THREAD_SRCS" + fi + ;; + esac + ;; + + pthread) + have=NGX_THREADS . auto/have + CORE_SRCS="$CORE_SRCS $PTHREAD_SRCS" + CORE_LIBS="$CORE_LIBS -lpthread" + ;; + + freebsd4) + have=NGX_THREADS . auto/have + CFLAGS="$CFLAGS -pthread" + CORE_SRCS="$CORE_SRCS $PTHREAD_SRCS" + CORE_LIBS="$CORE_LIBS -pthread" + ;; + + linuxthreads) + have=NGX_THREADS . auto/have + have=NGX_LINUXTHREADS . auto/have + CFLAGS="$CFLAGS -D_THREAD_SAFE" + CFLAGS="$CFLAGS -I /usr/local/include/pthread/linuxthreads" + CORE_SRCS="$CORE_SRCS $PTHREAD_SRCS" + CORE_LIBS="$CORE_LIBS -L /usr/local/lib -llthread -llgcc_r" + ;; + + lc_r) + have=NGX_THREADS . auto/have + CORE_SRCS="$CORE_SRCS $PTHREAD_SRCS" + CORE_LIBS="$CORE_LIBS -lc_r" + ;; + + lthr) + have=NGX_THREADS . auto/have + CORE_SRCS="$CORE_SRCS $PTHREAD_SRCS" + CORE_LIBS="$CORE_LIBS -lthr" + ;; + + lkse) + have=NGX_THREADS . auto/have + CORE_SRCS="$CORE_SRCS $PTHREAD_SRCS" + CORE_LIBS="$CORE_LIBS -lkse" + ;; + +esac diff --git a/auto/types/sizeof b/auto/types/sizeof new file mode 100644 index 000000000..ac22e759d --- /dev/null +++ b/auto/types/sizeof @@ -0,0 +1,62 @@ + +# Copyright (C) Igor Sysoev + + +echo $ngx_n "checking for $ngx_type size ..." $ngx_c +echo >> $NGX_ERR +echo "checking for $ngx_type size" >> $NGX_ERR + +ngx_size= + +cat << END > $NGX_AUTOTEST.c + +#include <sys/types.h> +#include <sys/time.h> +$NGX_UNISTD_H +#include <signal.h> +#include <sys/resource.h> +$NGX_INTTYPES_H +$NGX_AUTO_CONFIG + +int main() { + printf("%d", sizeof($ngx_type)); + return 0; +} + +END + +eval "$CC $CC_TEST_FLAGS -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1" + +if [ -x $NGX_AUTOTEST ]; then + ngx_size=`$NGX_AUTOTEST` + echo " $ngx_size bytes" +fi + +rm $NGX_AUTOTEST* + +case $ngx_size in + 4) + if [ "$ngx_type"="long" ]; then + ngx_max_value=2147483647L + else + ngx_max_value=2147483647 + fi + + ngx_max_len='sizeof("-2147483648") - 1' + ;; + + 8) + if [ "$ngx_type"="long long" ]; then + ngx_max_value=9223372036854775807LL + else + ngx_max_value=9223372036854775807L + fi + + ngx_max_len='sizeof("-9223372036854775808") - 1' + ;; + + *) + echo + echo "$0: error: can not detect $ngx_type size" + exit 1 +esac diff --git a/auto/types/typedef b/auto/types/typedef new file mode 100644 index 000000000..9762f4812 --- /dev/null +++ b/auto/types/typedef @@ -0,0 +1,60 @@ + +# Copyright (C) Igor Sysoev + + +echo $ngx_n "checking for $ngx_type ..." $ngx_c +echo >> $NGX_ERR +echo "checking for $ngx_type" >> $NGX_ERR + +found=no + +for type in $ngx_type $ngx_types +do + + cat << END > $NGX_AUTOTEST.c + +#include <sys/types.h> +#include <signal.h> +#include <sys/socket.h> +#include <sys/time.h> +#include <sys/resource.h> +#include <netinet/in.h> +$NGX_INTTYPES_H + +int main() { + $type i = 0; + return 0; +} + +END + + eval "$CC -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1" + + if [ -x $NGX_AUTOTEST ]; then + if [ $type = $ngx_type ]; then + echo " found" + found=yes + else + echo ", $type used" + found=$type + fi + fi + + rm $NGX_AUTOTEST* + + if [ $found = no ]; then + echo $ngx_n " $type not found" $ngx_c + else + break + fi +done + +if [ $found = no ]; then + echo + echo "$0: error: can not define $ngx_type" + exit 1 +fi + +if [ $found != yes ]; then + echo "typedef $found $ngx_type;" >> $NGX_AUTO_CONFIG_H +fi diff --git a/auto/types/uintptr_t b/auto/types/uintptr_t new file mode 100644 index 000000000..a1bb78a89 --- /dev/null +++ b/auto/types/uintptr_t @@ -0,0 +1,40 @@ + +# Copyright (C) Igor Sysoev + + +echo $ngx_n "checking for uintptr_t ... " $ngx_c +echo >> $NGX_ERR +echo "checking for uintptr_t" >> $NGX_ERR + +found=no + +cat << END > $NGX_AUTOTEST.c + +#include <sys/types.h> +$NGX_INTTYPES_H + +int main() { + uintptr_t i = 0; + return 0; +} + +END + +eval "$CC -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1" + +if [ -x $NGX_AUTOTEST ]; then + echo " uintptr_t found" + found=yes +else + echo $ngx_n " uintptr_t not found" $ngx_c +fi + +rm $NGX_AUTOTEST* + + +if [ $found = no ]; then + found="uint`expr 8 \* $ngx_ptr_size`_t" + echo ", $found used" + + echo "typedef $found uintptr_t;" >> $NGX_AUTO_CONFIG_H +fi diff --git a/auto/types/value b/auto/types/value new file mode 100644 index 000000000..d823ab323 --- /dev/null +++ b/auto/types/value @@ -0,0 +1,9 @@ + +# Copyright (C) Igor Sysoev + + +cat << END >> $NGX_AUTO_CONFIG_H + +#ifndef $ngx_param +#define $ngx_param $ngx_value +#endif diff --git a/auto/unix b/auto/unix new file mode 100755 index 000000000..4ba7d605f --- /dev/null +++ b/auto/unix @@ -0,0 +1,199 @@ + +# Copyright (C) Igor Sysoev + + +CC_WARN=$CC +ngx_fmt_collect=yes + +# C types + +ngx_type="int"; . auto/types/sizeof +ngx_formats="%d"; . auto/fmt/fmt + +ngx_type="long"; . auto/types/sizeof +ngx_formats="%ld"; . auto/fmt/fmt + +ngx_type="long long"; . auto/types/sizeof +ngx_formats="%lld %qd"; . auto/fmt/fmt + +ngx_type="void *"; . auto/types/sizeof; ngx_ptr_size=$ngx_size +ngx_fmt_name=PTR_FMT; +eval ngx_formats=\${ngx_${ngx_ptr_size}_fmt}; . auto/fmt/ptrfmt + + +# POSIX types + +NGX_AUTO_CONFIG="#include \"../$NGX_AUTO_CONFIG_H\"" + +ngx_type="uint64_t"; ngx_types="u_int64_t"; . auto/types/typedef + +ngx_type="sig_atomic_t"; ngx_types="int"; . auto/types/typedef +. auto/types/sizeof +ngx_param=SIG_ATOMIC_T_SIZE; ngx_value=$ngx_size; . auto/types/value + +ngx_type="socklen_t"; ngx_types="uint32_t"; . auto/types/typedef + +ngx_type="in_addr_t"; ngx_types="uint32_t"; . auto/types/typedef + +ngx_type="in_port_t"; ngx_types="u_short"; . auto/types/typedef + +ngx_type="rlim_t"; ngx_types="int"; . auto/types/typedef + +. auto/types/uintptr_t + +. auto/endianess + + +# printf() formats + +CC_WARN=$CC_STRONG +ngx_fmt_collect=no + +ngx_fmt_name=OFF_T_FMT; ngx_type="off_t"; . auto/types/sizeof +ngx_param=OFF_T_MAX_VALUE; ngx_value=$ngx_max_value; . auto/types/value +eval ngx_formats=\${ngx_${ngx_size}_fmt}; . auto/fmt/fmt + +ngx_fmt_name=TIME_T_FMT; ngx_type="time_t"; . auto/types/sizeof +ngx_param=TIME_T_SIZE; ngx_value=$ngx_size; . auto/types/value +ngx_param=TIME_T_LEN; ngx_value=$ngx_max_len; . auto/types/value +eval ngx_formats=\${ngx_${ngx_size}_fmt}; . auto/fmt/fmt + +ngx_fmt_name=SIZE_T_FMT; ngx_type="size_t"; . auto/types/sizeof +eval ngx_formats=\${ngx_${ngx_size}_fmt}; . auto/fmt/fmt + +ngx_fmt_name=SIZE_T_X_FMT; . auto/fmt/xfmt + +ngx_fmt_name=PID_T_FMT; ngx_type="pid_t"; . auto/types/sizeof +eval ngx_formats=\${ngx_${ngx_size}_fmt}; . auto/fmt/fmt + +ngx_fmt_name=RLIM_T_FMT; ngx_type="rlim_t"; . auto/types/sizeof +eval ngx_formats=\${ngx_${ngx_size}_fmt}; . auto/fmt/fmt + + +# syscalls, libc calls and some features + +ngx_feature_libs= +ngx_func_libs= + + +ngx_func="pread()" +ngx_func_inc= +ngx_func_test="char buf[1]; ssize_t n; n = pread(0, buf, 1, 0)" +. auto/func + + +ngx_func="pwrite()" +ngx_func_inc= +ngx_func_test="char buf[1]; ssize_t n; n = pwrite(1, buf, 1, 0)" +. auto/func + + +#ngx_func="strsignal()" +#ngx_func_inc="#include <string.h>" +#ngx_func_test="char *s = strsignal(1)" +#. auto/func + + +ngx_func="strerror_r()" +ngx_func_inc="#include <string.h>" +ngx_func_test="char buf[20]; int n; n = strerror_r(1, buf, 20)" +. auto/func + + +ngx_func="gnu_strerror_r()" +ngx_func_inc="#include <string.h>" +ngx_func_test="char buf[20], *str; str = strerror_r(1, buf, 20)" +. auto/func + + +ngx_func="localtime_r()" +ngx_func_inc="#include <time.h>" +ngx_func_test="struct tm t; time_t c=0; localtime_r(&c, &t)" +. auto/func + + +ngx_func="posix_memalign()" +ngx_func_inc="#include <stdlib.h>" +ngx_func_test="void *p; int n; n = posix_memalign(&p, 4096, 4096)" +. auto/func + + +ngx_func="memalign()" +ngx_func_inc="#include <stdlib.h>" +ngx_func_test="void *p; p = memalign(4096, 4096)" +. auto/func + + + +ngx_feature="mmap(MAP_ANON|MAP_SHARED)" +ngx_feature_name="MAP_ANON" +ngx_feature_inc="#include <sys/mman.h>" +ngx_feature_test="void *p; + p = mmap(NULL, 4096, PROT_READ|PROT_WRITE, + MAP_ANON|MAP_SHARED, -1, 0); + if (p == MAP_FAILED) return 1;" +ngx_feature_run=yes +. auto/feature + + +ngx_feature='mmap("/dev/zero", MAP_SHARED)' +ngx_feature_name="MAP_DEVZERO" +ngx_feature_inc="#include <sys/mman.h> +#include <sys/stat.h> +#include <fcntl.h>" +ngx_feature_test='void *p; int fd; + fd = open("/dev/zero", O_RDWR); + p = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); + if (p == MAP_FAILED) return 1;' +. auto/feature + + +ngx_feature="System V shared memory" +ngx_feature_name="SYSVSHM" +ngx_feature_inc="#include <sys/ipc.h> +#include <sys/shm.h>" +ngx_feature_test="int id; + id = shmget(IPC_PRIVATE, 4096, (SHM_R|SHM_W|IPC_CREAT)); + if (id == -1) return 1; + shmctl(id, IPC_RMID, NULL);" +. auto/feature + + + +ngx_feature="struct sockaddr_in.sin_len" +ngx_feature_name="sin_len" +ngx_feature_inc="#include <sys/socket.h> +#include <netinet/in.h>" +ngx_feature_test="struct sockaddr_in sa; sa.sin_len = 5" +ngx_feature_run=no +. auto/feature + + +ngx_feature="struct msghdr.msg_control" +ngx_feature_name="msghdr_msg_control" +ngx_feature_inc="#include <sys/socket.h>" +ngx_feature_test="struct msghdr msg; msg.msg_control = NULL" +. auto/feature + + +case $PLATFORM in + Linux:*) + ngx_feature_inc="#include <sys/ioctl.h>" + ;; + + *) + ngx_feature_inc="#include <sys/filio.h>" + ;; +esac + +ngx_feature="ioctl(FIONBIO)" +ngx_feature_name="FIONBIO" +ngx_feature_test="int i; i = FIONBIO" +. auto/feature + + +ngx_feature="struct tm.tm_gmtoff" +ngx_feature_name="gmtoff" +ngx_feature_inc="#include <time.h>" +ngx_feature_test="struct tm tm; tm.tm_gmtoff = 0" +. auto/feature |
