nginx-0.3.2-RELEASE import

    *) Feature: the Sun Studio 10 C compiler support.

    *) Feature: the "proxy_upstream_max_fails",
       "proxy_upstream_fail_timeout", "fastcgi_upstream_max_fails", and
       "fastcgi_upstream_fail_timeout" directives.
diff --git a/auto/cc/conf b/auto/cc/conf
index 4d151da..37f2d2e 100644
--- a/auto/cc/conf
+++ b/auto/cc/conf
@@ -44,7 +44,7 @@
         gcc)
             # gcc 2.7.2.3, 2.8.1, 2.95.4, egcs-1.1.2
             #     3.0.4, 3.1.1, 3.2.3, 3.3.2, 3.3.3, 3.3.4, 3.4.0, 3.4.2
-            #     4.0.0
+            #     4.0.0, 4.0.1, 4.1.0
 
             . auto/cc/gcc
         ;;
@@ -55,6 +55,12 @@
             . auto/cc/icc
         ;;
 
+        sunc)
+            # Sun C 5.7 Patch 117837-04 2005/05/11
+
+            . auto/cc/sunc
+        ;;
+
         ccc)
             # Compaq C V6.5-207
 
diff --git a/auto/cc/gcc b/auto/cc/gcc
index d76d4a2..af279fa 100644
--- a/auto/cc/gcc
+++ b/auto/cc/gcc
@@ -33,6 +33,17 @@
     PIPE="-pipe"
 fi
 
+
+case "$NGX_PLATFORM" in
+
+    *:sun4u)
+        # "-mcpu=v9" enables the "casxa" assembler instruction
+        CFLAGS="$CFLAGS -mcpu=v9"
+    ;;
+
+esac
+
+
 # optimizations
 
 #NGX_GCC_OPT="-O2"
@@ -49,7 +60,7 @@
         CPU_OPT="-march=pentium"
     ;;
 
-    pentiumpro)
+    pentiumpro | pentium3)
         # optimize for Pentium Pro, Pentium II and Pentium III
         CPU_OPT="-march=pentiumpro"
     ;;
diff --git a/auto/cc/icc b/auto/cc/icc
index cca24cd..0aa975e 100644
--- a/auto/cc/icc
+++ b/auto/cc/icc
@@ -94,6 +94,8 @@
 CFLAGS="$CFLAGS -wd1419"
 # explicit conversion of a 64-bit integral type to a smaller integral type
 CFLAGS="$CFLAGS -wd1683"
+# conversion from pointer to same-sized integral type, warning on offsetof()
+CFLAGS="$CFLAGS -wd1684"
 
 case "$NGX_ICC_VER" in
     8.* | 9.*)
diff --git a/auto/cc/name b/auto/cc/name
index c89ce79..faa3290 100644
--- a/auto/cc/name
+++ b/auto/cc/name
@@ -39,6 +39,11 @@
     echo " using Intel C++ compiler"
 
 else
+if `$CC -V 2>&1 | grep 'Sun C' 2>&1 >/dev/null`; then
+    NGX_CC_NAME=sunc
+    echo " using Sun C compiler"
+
+else
 if `$CC -V 2>&1 | grep '^Compaq C' 2>&1 >/dev/null`; then
     NGX_CC_NAME=ccc
     echo " using Compaq C compiler"
@@ -54,6 +59,7 @@
 
 fi # acc
 fi # ccc
+fi # sunc
 fi # icc
 fi # gcc
 fi # bcc
diff --git a/auto/cc/sunc b/auto/cc/sunc
new file mode 100644
index 0000000..9d400a2
--- /dev/null
+++ b/auto/cc/sunc
@@ -0,0 +1,95 @@
+
+# Copyright (C) Igor Sysoev
+
+
+# Sun C 5.7 Patch 117837-04 2005/05/11
+
+NGX_SUNC_VER=`$CC -V 2>&1 | grep 'Sun C' 2>&1 \
+                         | sed -e 's/^.* Sun C \(.*\)/\1/'`
+
+echo " + Sun C version: $NGX_SUNC_VER"
+
+have=NGX_COMPILER value="\"Sun C $NGX_SUNC_VER\"" . auto/define
+
+
+case "$NGX_PLATFORM" in
+
+    *:i86pc)
+        NGX_AUX=" src/os/unix/ngx_sunpro_x86.il"
+    ;;
+
+    *:sun4u)
+        # "-xarch=v9" enables the "casa" assembler instruction
+        CFLAGS="$CFLAGS -xarch=v9"
+        CORE_LINK="$CORE_LINK -xarch=v9"
+        NGX_AUX=" src/os/unix/ngx_sunpro_sparc64.il"
+    ;;
+
+esac
+
+
+# optimizations
+
+CFLAGS="$CFLAGS -fast"
+
+
+case $CPU in
+    pentium)
+        # optimize for Pentium and Athlon
+        CPU_OPT="-xchip=pentium"
+    ;;
+
+    pentiumpro)
+        # optimize for Pentium Pro, Pentium II
+        CPU_OPT="-xchip=pentium_pro"
+    ;;
+
+    pentium3)
+        # optimize for Pentium III
+        CPU_OPT="-xchip=pentium3"
+        #CPU_OPT="$CPU_OPT -xarch=sse"
+        CPU_OPT="$CPU_OPT -xcache=16/32/4:256/32/4"
+    ;;
+
+    pentium4)
+        # optimize for Pentium 4
+        CPU_OPT="-xchip=pentium4"
+        #CPU_OPT="$CPU_OPT -xarch=sse2"
+        CPU_OPT="$CPU_OPT -xcache=8/64/4:256/128/8"
+    ;;
+
+    opteron)
+        # optimize for Opteron
+        CPU_OPT="-xchip=opteron"
+        #CPU_OPT="$CPU_OPT -xarch=sse2"
+        CPU_OPT="$CPU_OPT -xcache=64/64/2:1024/64/16"
+    ;;
+
+    amd64)
+        # build 64-bit amd64 binary
+        CPU_OPT="-xarch=amd64"
+        CORE_LINK="$CORE_LINK -xarch=amd64"
+        NGX_AUX=" src/os/unix/ngx_sunpro_amd64.il"
+    ;;
+
+esac
+
+
+CFLAGS="$CFLAGS $CPU_OPT"
+
+
+if [ ".$PCRE_OPT" = "." ]; then
+    PCRE_OPT="-fast $CPU_OPT"
+fi
+
+if [ ".$MD5_OPT" = "." ]; then
+    MD5_OPT="-fast $CPU_OPT"
+fi
+
+if [ ".$ZLIB_OPT" = "." ]; then
+    ZLIB_OPT="-fast $CPU_OPT"
+fi
+
+
+# stop on warning
+CFLAGS="$CFLAGS -errwarn=%all"