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/os/conf b/auto/os/conf
index abffbe3..5154f2b 100644
--- a/auto/os/conf
+++ b/auto/os/conf
@@ -31,21 +31,7 @@
;;
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"
+ . auto/os/win32
;;
*)
@@ -55,3 +41,56 @@
;;
esac
+
+
+if [ $PLATFORM != win32 ]; then
+
+ ngx_feature="/dev/poll"
+ ngx_feature_name="devpoll"
+ ngx_feature_run=no
+ ngx_feature_incs="#include <sys/devpoll.h>"
+ ngx_feature_libs=
+ ngx_feature_test="int n, dp; struct dvpoll dvp;
+ dp = 0;
+ dvp.dp_fds = NULL;
+ dvp.dp_nfds = 0;
+ dvp.dp_timeout = 0;
+ n = ioctl(dp, DP_POLL, &dvp)"
+ . auto/feature
+
+ 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
+
+
+ if test -z "$NGX_KQUEUE_CHECKED"; then
+ ngx_feature="kqueue"
+ ngx_feature_name="kqueue"
+ ngx_feature_run=no
+ ngx_feature_incs="#include <sys/event.h>"
+ ngx_feature_libs=
+ ngx_feature_test="int kq; kq = kqueue()"
+ . auto/feature
+
+ if [ $ngx_found = yes ]; then
+
+ 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
+
+ ngx_feature="kqueue's NOTE_LOWAT"
+ ngx_feature_name="HAVE_LOWAT_EVENT"
+ ngx_feature_run=no
+ ngx_feature_incs="#include <sys/event.h>"
+ ngx_feature_libs=
+ ngx_feature_test="struct kevent kev;
+ kev.fflags = NOTE_LOWAT;"
+ . auto/feature
+ fi
+ fi
+fi
diff --git a/auto/os/freebsd b/auto/os/freebsd
index 90cb497..f08ef97 100644
--- a/auto/os/freebsd
+++ b/auto/os/freebsd
@@ -2,19 +2,33 @@
# Copyright (C) Igor Sysoev
+cat << END >> $NGX_AUTO_HEADERS_H
+
+#ifndef NGX_FREEBSD
+#define NGX_FREEBSD 1
+#endif
+
+END
+
+
CORE_INCS="$UNIX_INCS"
CORE_DEPS="$UNIX_DEPS $FREEBSD_DEPS"
CORE_SRCS="$UNIX_SRCS $FREEBSD_SRCS"
-PIPE="-pipe"
+ngx_spacer='
+'
-# __FreeBSD_version is the best way to determine whether
-# some capability exists and is safe to use
+# __FreeBSD_version and sysctl kern.osreldate are the best ways
+# to determine whether some capability exists and is safe to use.
+# __FreeBSD_version is used for the testing of the build enviroment.
+# sysctl kern.osreldate is used for the testing of the kernel capabilities.
version=`grep "#define __FreeBSD_version" /usr/include/osreldate.h \
| sed -e 's/^.* \(.*\)$/\1/'`
+osreldate=`/sbin/sysctl -n kern.osreldate`
+
# setproctitle() in libutil
@@ -28,7 +42,7 @@
# sendfile
-if [ $version -gt 300007 ]; then
+if [ $osreldate -gt 300007 ]; then
echo " + using sendfile()"
have=HAVE_SENDFILE . auto/have
@@ -38,8 +52,8 @@
# kqueue
-if [ \( $version -lt 500000 -a $version -ge 410000 \) \
- -o $version -ge 500011 ]
+if [ \( $osreldate -lt 500000 -a $osreldate -ge 410000 \) \
+ -o $osreldate -ge 500011 ]
then
echo " + using kqueue"
@@ -50,6 +64,8 @@
EVENT_FOUND=YES
fi
+NGX_KQUEUE_CHECKED=YES
+
# kqueue's NOTE_LAWAT
diff --git a/auto/os/linux b/auto/os/linux
index 8576ea6..e68a0d2 100644
--- a/auto/os/linux
+++ b/auto/os/linux
@@ -2,15 +2,23 @@
# Copyright (C) Igor Sysoev
+cat << END >> $NGX_AUTO_HEADERS_H
+
+#ifndef NGX_LINUX
+#define NGX_LINUX 1
+#endif
+
+END
+
CORE_INCS="$UNIX_INCS"
CORE_DEPS="$UNIX_DEPS $LINUX_DEPS"
CORE_SRCS="$UNIX_SRCS $LINUX_SRCS"
EVENT_MODULES="$EVENT_MODULES"
-PIPE="-pipe"
+ngx_spacer='
+'
-
-CC_TEST_FLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
+CC_AUX_FLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"
# Linux kernel version
@@ -31,14 +39,18 @@
# 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
+ngx_feature="epoll"
+ngx_feature_name="epoll"
+ngx_feature_run=yes
+ngx_feature_incs="#include <sys/epoll.h>"
+ngx_feature_libs=
+ngx_feature_test="int efd = 0, fd = 1, n;
+ struct epoll_event ee;
+ ee.events = EPOLLIN|EPOLLOUT|EPOLLET;
+ ee.data.ptr = NULL;
+ efd = epoll_create(100);
+ if (efd == -1) return 1;"
+. auto/feature
if [ $ngx_found = yes ]; then
have=HAVE_EPOLL . auto/have
@@ -51,13 +63,16 @@
# 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
+CC_AUX_FLAGS="-D_GNU_SOURCE"
+ngx_feature="sendfile()"
+ngx_feature_name="sendfile"
+ngx_feature_run=no
+ngx_feature_incs="#include <sys/sendfile.h>"
+ngx_feature_libs=
+ngx_feature_test="int s = 0, fd = 1;
+ ssize_t n; off_t off = 0;
+ n = sendfile(s, fd, &off, 1)"
+. auto/feature
if [ $ngx_found = yes ]; then
CORE_SRCS="$CORE_SRCS $LINUX_SENDFILE_SRCS"
@@ -66,17 +81,26 @@
# sendfile64()
-CC_TEST_FLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
-ngx_func="sendfile64()"; . auto/func
+CC_AUX_FLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"
+ngx_feature="sendfile64()"
+ngx_feature_name="HAVE_SENDFILE64"
+ngx_feature_run=no
+ngx_feature_incs="#include <sys/sendfile.h>"
+ngx_feature_libs=
+ngx_feature_test="int s = 0, fd = 1;
+ ssize_t n; off_t off = 0;
+ n = sendfile(s, fd, &off, 1)"
+. auto/feature
+ngx_include="sys/prctl.h"; . auto/include
+
# 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
+ngx_feature="prctl(PR_SET_DUMPABLE)"
+ngx_feature_name="HAVE_PR_SET_DUMPABLE"
+ngx_feature_run=yes
+ngx_feature_incs="#include <sys/prctl.h>"
+ngx_feature_libs=
+ngx_feature_test="if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) == -1) return 1"
+. auto/feature
diff --git a/auto/os/solaris b/auto/os/solaris
index 29497ff..62708cd 100644
--- a/auto/os/solaris
+++ b/auto/os/solaris
@@ -2,6 +2,14 @@
# Copyright (C) Igor Sysoev
+cat << END >> $NGX_AUTO_HEADERS_H
+
+#ifndef NGX_SOLARIS
+#define NGX_SOLARIS 1
+#endif
+
+END
+
CORE_INCS="$UNIX_INCS"
CORE_DEPS="$UNIX_DEPS $SOLARIS_DEPS"
CORE_SRCS="$UNIX_SRCS $SOLARIS_SRCS "
@@ -9,40 +17,17 @@
CORE_LIBS="$CORE_LIBS -lsocket -lnsl -lrt"
-# the Solaris's make support
-MAKE_SL=YES
+# Solaris's make does not support a blank line between target and rules
+ngx_spacer=
-
-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
+CC_AUX_FLAGS="-D_FILE_OFFSET_BITS=64 -lrt"
case $PLATFORM in
*:sun4u)
+ # "-mcpu=v9" enables the "casa" assembler instruction
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
@@ -57,23 +42,15 @@
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
+ngx_feature="sendfilev()"
+ngx_feature_name="sendfile"
+ngx_feature_run=no
+ngx_feature_incs="#include <sys/sendfile.h>"
+ngx_feature_libs="-lsendfile"
+ngx_feature_test="int fd = 1; sendfilevec_t vec[1];
+ size_t sent; ssize_t n;
+ n = sendfilev(fd, vec, 1, &sent)"
+. auto/feature
if [ $ngx_found = yes ]; then
diff --git a/auto/os/win32 b/auto/os/win32
new file mode 100644
index 0000000..9e83e67
--- /dev/null
+++ b/auto/os/win32
@@ -0,0 +1,29 @@
+
+# Copyright (C) Igor Sysoev
+
+
+cat << END >> $NGX_AUTO_HEADERS_H
+
+#ifndef NGX_WIN32
+#define NGX_WIN32 1
+#endif
+
+END
+
+
+CORE_INCS="$WIN32_INCS"
+CORE_DEPS="$WIN32_DEPS"
+CORE_SRCS="$WIN32_SRCS $IOCP_SRCS"
+OS_CONFIG="$WIN32_CONFIG"
+CORE_LIBS="$CORE_LIBS ws2_32.lib"
+
+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