nginx-0.1.2-RELEASE import

    *) Feature: the --user=USER, --group=GROUP, and --with-ld-opt=OPTIONS
       options in configure.

    *) Feature: the server_name directive supports *.domain.tld.

    *) Bugfix: the portability improvements.

    *) Bugfix: if configuration file was set in command line, the
       reconfiguration was impossible; the bug had appeared in 0.1.1.

    *) Bugfix: proxy module may get caught in an endless loop when sendfile
       is not used.

    *) Bugfix: with sendfile the response was not recoded according to the
       charset module directives; the bug had appeared in 0.1.1.

    *) Bugfix: very seldom bug in the kqueue processing.

    *) Bugfix: the gzip module compressed the proxied responses that was
       already compressed.
diff --git a/auto/lib/md5/conf b/auto/lib/md5/conf
index 748bea4..623986f 100644
--- a/auto/lib/md5/conf
+++ b/auto/lib/md5/conf
@@ -15,14 +15,14 @@
 
     CORE_INCS="$CORE_INCS $MD5"
 
-    case "$CC" in
+    case "$NGX_CC_NAME" in
 
-        cl | wcl386 | bcc32)
+        msvc | owc | bcc)
             LINK_DEPS="$LINK_DEPS $MD5/md5.lib"
             CORE_LIBS="$CORE_LIBS $MD5/md5.lib"
         ;;
 
-        *icc)
+        icc)
             LINK_DEPS="$LINK_DEPS $MD5/libmd5.a"
 
             # to allow -ipo optimization we link with the *.o but not library
@@ -45,20 +45,19 @@
 
     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
-
+        ngx_feature="rsaref md5 library"
+        ngx_feature_name="rsaref_md5"
+        ngx_feature_run=no
+        ngx_feature_incs="#include <md5.h>"
+        ngx_feature_libs="-lmd5"
+        ngx_feature_test="MD5_CTX md5; MD5Init(&md5)"
+        . auto/feature
 
         if [ $ngx_found = yes ]; then
-            CORE_LIBS="$CORE_LIBS $ngx_libs"
+            CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
             MD5=YES
             MD5_LIB=md5
             ngx_found=no
@@ -66,15 +65,18 @@
         else
             # FreeBSD
 
-            ngx_lib="rsaref md library"
-            ngx_lib_test="MD5_CTX md5; MD5Init(&md5)"
-            ngx_libs=-lmd
-            . auto/lib/test
+            ngx_feature="rsaref md library"
+            ngx_feature_name="rsaref_md5"
+            ngx_feature_run=no
+            ngx_feature_incs="#include <md5.h>"
+            ngx_feature_libs="-lmd"
+            ngx_feature_test="MD5_CTX md5; MD5Init(&md5)"
+            . auto/feature
         fi
 
 
         if [ $ngx_found = yes ]; then
-            CORE_LIBS="$CORE_LIBS $ngx_libs"
+            CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
             MD5=YES
             MD5_LIB=md
             ngx_found=no
@@ -84,19 +86,20 @@
 
                # 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
+               ngx_feature="OpenSSL md5 crypto library"
+               ngx_feature_name="OpenSSL_md5"
+               ngx_feature_run=no
+               ngx_feature_incs="#include <openssl/md5.h>"
+               ngx_feature_libs="-lcrypto"
+               ngx_feature_test="MD5_CTX md5; MD5_Init(&md5)"
+               . auto/feature
             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"
+            CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
             MD5=YES
             MD5_LIB=crypto
         fi
diff --git a/auto/lib/md5/make b/auto/lib/md5/make
index f718e6c..6e2834e 100644
--- a/auto/lib/md5/make
+++ b/auto/lib/md5/make
@@ -25,7 +25,7 @@
 case $PLATFORM in
 
     win32)
-        line=`echo $MD5/md5.lib: | sed -e "s/\//$DIRSEP/g"`
+        line=`echo $MD5/md5.lib: | sed -e "s/\//$ngx_regex_dirsep/g"`
         echo "$line"                                              >> $MAKEFILE
     ;;
 
@@ -42,7 +42,7 @@
 case $PLATFORM in
 
     win32)
-        md5=`echo $MD5 | sed -e "s/\//$DIRSEP/g"`
+        md5=`echo $MD5 | sed -e "s/\//$ngx_regex_dirsep/g"`
 
         cp auto/lib/md5/$makefile $MD5
         echo "	cd $md5"                                          >> $MAKEFILE
diff --git a/auto/lib/openssl/conf b/auto/lib/openssl/conf
index 37c084f..8ef4f3a 100644
--- a/auto/lib/openssl/conf
+++ b/auto/lib/openssl/conf
@@ -19,23 +19,22 @@
 else
 
     if [ $PLATFORM != win32 ]; then
-            OPENSSL=NO
-            ngx_lib_cflags=
+        OPENSSL=NO
 
-            ngx_lib_inc="#include <openssl/ssl.h>"
-            ngx_lib="OpenSSL library"
-            ngx_lib_test="SSL_library_init()"
-            ngx_libs="-lssl -lcrypto"
-            . auto/lib/test
-
+        ngx_feature="OpenSSL library"
+        ngx_feature_name="OpenSSL"
+        ngx_feature_run=no
+        ngx_feature_incs="#include <openssl/ssl.h>"
+        ngx_feature_libs="-lssl -lcrypto"
+        ngx_feature_test="SSL_library_init()"
+        . auto/feature
 
         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"
+            CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
             OPENSSL=YES
-            ngx_found=no
         fi
 
     fi
diff --git a/auto/lib/pcre/conf b/auto/lib/pcre/conf
index 16feffa..cd516e1 100644
--- a/auto/lib/pcre/conf
+++ b/auto/lib/pcre/conf
@@ -7,18 +7,18 @@
     CORE_DEPS="$CORE_DEPS $REGEX_DEPS"
     CORE_SRCS="$CORE_SRCS $REGEX_SRCS"
 
-    case "$CC" in
+    case "$NGX_CC_NAME" in
 
-        cl | wcl386 | bcc32)
-            have=HAVE_PCRE . auto/have
+        msvc | owc | bcc)
+            have=NGX_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
+        icc)
+            have=NGX_PCRE . auto/have
             CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
 
             LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a"
@@ -31,7 +31,7 @@
         ;;
 
         *)
-            have=HAVE_PCRE . auto/have
+            have=NGX_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"
@@ -43,44 +43,25 @@
 else
 
     if [ $PLATFORM != win32 ]; then
-            PCRE=NO
-            ngx_lib_cflags=
+        PCRE=NO
 
-            # 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
-
+        # FreeBSD PCRE port requires --with-cc-opt="-I /usr/local/include"
+        #                            --with-ld-opt="-L /usr/local/lib"
+        
+        ngx_feature="PCRE library"
+        ngx_feature_name="PCRE"
+        ngx_feature_run=no
+        ngx_feature_incs="#include <pcre.h>"
+        ngx_feature_libs="-lpcre"
+        ngx_feature_test="pcre *re; re = pcre_compile(NULL, 0, NULL, 0, NULL)"
+        . auto/feature
 
         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"
+            CORE_LIBS="$CORE_LIBS $ngx_feature_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
index fa7bf27..714994d 100644
--- a/auto/lib/pcre/make
+++ b/auto/lib/pcre/make
@@ -29,8 +29,8 @@
         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"`
+        pcre=`echo $PCRE | sed -e "s/\//$ngx_regex_dirsep/g"`
+        line=`echo $PCRE/pcre.h: | sed -e "s/\//$ngx_regex_dirsep/g"`
 
         echo "$line"                                              >> $MAKEFILE
         echo "	cd $pcre"                                         >> $MAKEFILE
@@ -39,7 +39,7 @@
         echo                                                      >> $MAKEFILE
 
         line="$PCRE/pcre.lib:	$PCRE/pcre.h"
-        line=`echo $line | sed -e "s/\//$DIRSEP/g"`
+        line=`echo $line | sed -e "s/\//$ngx_regex_dirsep/g"`
 
         echo "$line"                                              >> $MAKEFILE
         echo "	cd $pcre"                                         >> $MAKEFILE
diff --git a/auto/lib/test b/auto/lib/test
index 7dfaafe..6821b51 100644
--- a/auto/lib/test
+++ b/auto/lib/test
@@ -2,14 +2,26 @@
 # Copyright (C) Igor Sysoev
 
 
-echo $ngx_n "checking for $ngx_lib ..." $ngx_c
-echo >> $NGX_ERR
-echo "checking for $ngx_lib library" >> $NGX_ERR
+echo $ngx_n "checking for $ngx_lib ...$ngx_c"
+
+cat << END >> $NGX_AUTOCONF_ERR
+
+----------------------------------------
+checking for $ngx_lib
+
+END
 
 ngx_found=no
 
-echo "$ngx_lib_inc" > $NGX_AUTOTEST.c
-echo "int main() { $ngx_lib_test; return 0; }" >> $NGX_AUTOTEST.c
+cat << END > $NGX_AUTOTEST.c
+
+$ngx_lib_incs
+
+int main() {
+    $ngx_lib_test;
+    return 0;
+}
+
 
 eval "$CC $cc_test_flags $ngx_lib_cflags \
      -o $NGX_AUTOTEST $NGX_AUTOTEST.c $ngx_libs \
diff --git a/auto/lib/zlib/conf b/auto/lib/zlib/conf
index a01eebe..f833d61 100644
--- a/auto/lib/zlib/conf
+++ b/auto/lib/zlib/conf
@@ -5,14 +5,14 @@
 if [ $ZLIB != NONE ]; then
     CORE_INCS="$CORE_INCS $ZLIB"
 
-    case "$CC" in
+    case "$NGX_CC_NAME" in
 
-        cl | wcl386 | bcc32)
+        msvc | owc | bcc)
             LINK_DEPS="$LINK_DEPS $ZLIB/zlib.lib"
             CORE_LIBS="$CORE_LIBS $ZLIB/zlib.lib"
         ;;
 
-        *icc)
+        icc)
             LINK_DEPS="$LINK_DEPS $ZLIB/libz.a"
 
             # to allow -ipo optimization we link with the *.o but not library
@@ -38,22 +38,23 @@
 else
 
     if [ $PLATFORM != win32 ]; then
+        ZLIB=NO
 
         # 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
+        ngx_feature="zlib library"
+        ngx_feature_name="zlib"
+        ngx_feature_run=no
+        ngx_feature_incs="#include <zlib.h>"
+        ngx_feature_libs="-lz"
+        ngx_feature_test="z_stream z; deflate(&z, Z_NO_FLUSH)"
+        . auto/feature
 
 
         if [ $ngx_found = yes ]; then
-            CORE_LIBS="$CORE_LIBS $ngx_libs"
+            CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
             ZLIB=YES
-        else
-            ZLIB=NO
+            ngx_found=no
         fi
     fi
 
diff --git a/auto/lib/zlib/make b/auto/lib/zlib/make
index 0ced9a2..5822762 100644
--- a/auto/lib/zlib/make
+++ b/auto/lib/zlib/make
@@ -26,7 +26,7 @@
 case $PLATFORM in
 
     win32)
-        line=`echo $ZLIB/zlib.lib: | sed -e "s/\//$DIRSEP/g"`
+        line=`echo $ZLIB/zlib.lib: | sed -e "s/\//$ngx_regex_dirsep/g"`
         echo "$line"                                              >> $MAKEFILE
     ;;
 
@@ -43,7 +43,7 @@
 case $PLATFORM in
 
     win32)
-        zlib=`echo $ZLIB | sed -e "s/\//$DIRSEP/g"`
+        zlib=`echo $ZLIB | sed -e "s/\//$ngx_regex_dirsep/g"`
 
         cp auto/lib/zlib/$makefile $ZLIB
         echo "	cd $zlib"                                         >> $MAKEFILE