[pkg-lighttpd] r355 - in lighttpd/trunk: . debian doc src tests tests/docroot tests/docroot/123 tests/docroot/www tests/docroot/www/expire tests/docroot/www/go tests/docroot/www/indexfile

eloy at alioth.debian.org eloy at alioth.debian.org
Wed Mar 18 10:20:11 UTC 2009


Author: eloy
Date: 2009-03-18 10:20:09 +0000 (Wed, 18 Mar 2009)
New Revision: 355

Added:
   lighttpd/trunk/tests/mod-compress.conf
Removed:
   lighttpd/trunk/cygwin/
   lighttpd/trunk/lighttpd.spec
   lighttpd/trunk/lighttpd.spec.in
   lighttpd/trunk/openwrt/
   lighttpd/trunk/tests/docroot/www/dummydir/
   lighttpd/trunk/tests/env-variables.conf
   lighttpd/trunk/tests/env-variables.t
Modified:
   lighttpd/trunk/Makefile.am
   lighttpd/trunk/Makefile.in
   lighttpd/trunk/NEWS
   lighttpd/trunk/SConstruct
   lighttpd/trunk/aclocal.m4
   lighttpd/trunk/config.guess
   lighttpd/trunk/config.h.in
   lighttpd/trunk/config.sub
   lighttpd/trunk/configure
   lighttpd/trunk/configure.in
   lighttpd/trunk/debian/changelog
   lighttpd/trunk/depcomp
   lighttpd/trunk/doc/Makefile.am
   lighttpd/trunk/doc/Makefile.in
   lighttpd/trunk/doc/authentication.txt
   lighttpd/trunk/doc/compress.txt
   lighttpd/trunk/doc/configuration.txt
   lighttpd/trunk/doc/lighttpd.conf
   lighttpd/trunk/doc/magnet.txt
   lighttpd/trunk/doc/redirect.txt
   lighttpd/trunk/doc/rewrite.txt
   lighttpd/trunk/doc/userdir.txt
   lighttpd/trunk/install-sh
   lighttpd/trunk/ltmain.sh
   lighttpd/trunk/src/Makefile.am
   lighttpd/trunk/src/Makefile.in
   lighttpd/trunk/src/SConscript
   lighttpd/trunk/src/array.c
   lighttpd/trunk/src/array.h
   lighttpd/trunk/src/base.h
   lighttpd/trunk/src/buffer.c
   lighttpd/trunk/src/chunk.c
   lighttpd/trunk/src/configfile-glue.c
   lighttpd/trunk/src/configfile.c
   lighttpd/trunk/src/configparser.c
   lighttpd/trunk/src/configparser.y
   lighttpd/trunk/src/connections-glue.c
   lighttpd/trunk/src/connections.c
   lighttpd/trunk/src/data_string.c
   lighttpd/trunk/src/fdevent_linux_sysepoll.c
   lighttpd/trunk/src/http-header-glue.c
   lighttpd/trunk/src/http_auth.c
   lighttpd/trunk/src/http_auth.h
   lighttpd/trunk/src/http_chunk.c
   lighttpd/trunk/src/inet_ntop_cache.c
   lighttpd/trunk/src/lemon.c
   lighttpd/trunk/src/lempar.c
   lighttpd/trunk/src/lighttpd-angel.c
   lighttpd/trunk/src/log.c
   lighttpd/trunk/src/log.h
   lighttpd/trunk/src/md5.c
   lighttpd/trunk/src/md5.h
   lighttpd/trunk/src/mod_access.c
   lighttpd/trunk/src/mod_accesslog.c
   lighttpd/trunk/src/mod_alias.c
   lighttpd/trunk/src/mod_auth.c
   lighttpd/trunk/src/mod_cgi.c
   lighttpd/trunk/src/mod_cml_lua.c
   lighttpd/trunk/src/mod_compress.c
   lighttpd/trunk/src/mod_dirlisting.c
   lighttpd/trunk/src/mod_evasive.c
   lighttpd/trunk/src/mod_evhost.c
   lighttpd/trunk/src/mod_expire.c
   lighttpd/trunk/src/mod_extforward.c
   lighttpd/trunk/src/mod_fastcgi.c
   lighttpd/trunk/src/mod_flv_streaming.c
   lighttpd/trunk/src/mod_indexfile.c
   lighttpd/trunk/src/mod_magnet.c
   lighttpd/trunk/src/mod_mysql_vhost.c
   lighttpd/trunk/src/mod_proxy.c
   lighttpd/trunk/src/mod_redirect.c
   lighttpd/trunk/src/mod_rewrite.c
   lighttpd/trunk/src/mod_rrdtool.c
   lighttpd/trunk/src/mod_scgi.c
   lighttpd/trunk/src/mod_secure_download.c
   lighttpd/trunk/src/mod_simple_vhost.c
   lighttpd/trunk/src/mod_skeleton.c
   lighttpd/trunk/src/mod_ssi.c
   lighttpd/trunk/src/mod_ssi_expr.c
   lighttpd/trunk/src/mod_ssi_exprparser.c
   lighttpd/trunk/src/mod_ssi_exprparser.y
   lighttpd/trunk/src/mod_staticfile.c
   lighttpd/trunk/src/mod_status.c
   lighttpd/trunk/src/mod_trigger_b4_dl.c
   lighttpd/trunk/src/mod_userdir.c
   lighttpd/trunk/src/mod_usertrack.c
   lighttpd/trunk/src/mod_webdav.c
   lighttpd/trunk/src/network.c
   lighttpd/trunk/src/network_freebsd_sendfile.c
   lighttpd/trunk/src/network_openssl.c
   lighttpd/trunk/src/plugin.c
   lighttpd/trunk/src/proc_open.c
   lighttpd/trunk/src/proc_open.h
   lighttpd/trunk/src/request.c
   lighttpd/trunk/src/response.c
   lighttpd/trunk/src/server.c
   lighttpd/trunk/src/spawn-fcgi.c
   lighttpd/trunk/src/stat_cache.c
   lighttpd/trunk/tests/404-handler.conf
   lighttpd/trunk/tests/LightyTest.pm
   lighttpd/trunk/tests/Makefile.am
   lighttpd/trunk/tests/Makefile.in
   lighttpd/trunk/tests/SConscript
   lighttpd/trunk/tests/bug-06.conf
   lighttpd/trunk/tests/bug-12.conf
   lighttpd/trunk/tests/condition.conf
   lighttpd/trunk/tests/docroot/123/Makefile.in
   lighttpd/trunk/tests/docroot/Makefile.in
   lighttpd/trunk/tests/docroot/www/Makefile.am
   lighttpd/trunk/tests/docroot/www/Makefile.in
   lighttpd/trunk/tests/docroot/www/expire/Makefile.in
   lighttpd/trunk/tests/docroot/www/get-env.php
   lighttpd/trunk/tests/docroot/www/go/Makefile.in
   lighttpd/trunk/tests/docroot/www/indexfile/Makefile.in
   lighttpd/trunk/tests/fastcgi-10.conf
   lighttpd/trunk/tests/fastcgi-13.conf
   lighttpd/trunk/tests/fastcgi-auth.conf
   lighttpd/trunk/tests/fastcgi-responder.conf
   lighttpd/trunk/tests/lighttpd.conf
   lighttpd/trunk/tests/lowercase.conf
   lighttpd/trunk/tests/mod-compress.t
   lighttpd/trunk/tests/mod-fastcgi.t
   lighttpd/trunk/tests/mod-proxy.t
   lighttpd/trunk/tests/mod-rewrite.t
   lighttpd/trunk/tests/proxy.conf
   lighttpd/trunk/tests/request.t
   lighttpd/trunk/tests/run-tests.pl
   lighttpd/trunk/tests/var-include.conf
Log:
new upstream version

Modified: lighttpd/trunk/Makefile.am
===================================================================
--- lighttpd/trunk/Makefile.am	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/Makefile.am	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,3 +1,5 @@
-SUBDIRS=src doc tests cygwin openwrt
+SUBDIRS=src doc tests
 
-EXTRA_DIST=lighttpd.spec autogen.sh SConstruct
+EXTRA_DIST=autogen.sh SConstruct
+
+distcleancheck_listfiles = find -type f -exec sh -c 'test -f $(srcdir)/{} || echo {}' ';'

Modified: lighttpd/trunk/Makefile.in
===================================================================
--- lighttpd/trunk/Makefile.in	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/Makefile.in	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -35,10 +35,9 @@
 subdir = .
 DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in $(srcdir)/config.h.in \
-	$(srcdir)/distribute.sh.in $(srcdir)/lighttpd.spec.in \
-	$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
-	compile config.guess config.sub depcomp install-sh ltmain.sh \
-	missing
+	$(srcdir)/distribute.sh.in $(top_srcdir)/configure AUTHORS \
+	COPYING ChangeLog INSTALL NEWS compile config.guess config.sub \
+	depcomp install-sh ltmain.sh missing
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -47,7 +46,7 @@
  configure.lineno config.status.lineno
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES = lighttpd.spec distribute.sh
+CONFIG_CLEAN_FILES = distribute.sh
 SOURCES =
 DIST_SOURCES =
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
@@ -72,7 +71,6 @@
 DIST_ARCHIVES = $(distdir).tar.gz
 GZIP_ENV = --best
 distuninstallcheck_listfiles = find . -type f -print
-distcleancheck_listfiles = find . -type f -print
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
 AR = @AR@
@@ -96,6 +94,7 @@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DL_LIB = @DL_LIB@
+DSYMUTIL = @DSYMUTIL@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -130,6 +129,7 @@
 MYSQL_CONFIG = @MYSQL_CONFIG@
 MYSQL_INCLUDE = @MYSQL_INCLUDE@
 MYSQL_LIBS = @MYSQL_LIBS@
+NMEDIT = @NMEDIT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -142,6 +142,7 @@
 PCRE_LIB = @PCRE_LIB@
 PKG_CONFIG = @PKG_CONFIG@
 RANLIB = @RANLIB@
+SED = @SED@
 SENDFILE_LIB = @SENDFILE_LIB@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
@@ -210,8 +211,9 @@
 target_vendor = @target_vendor@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-SUBDIRS = src doc tests cygwin openwrt
-EXTRA_DIST = lighttpd.spec autogen.sh SConstruct
+SUBDIRS = src doc tests
+EXTRA_DIST = autogen.sh SConstruct
+distcleancheck_listfiles = find -type f -exec sh -c 'test -f $(srcdir)/{} || echo {}' ';'
 all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
 
@@ -266,8 +268,6 @@
 
 distclean-hdr:
 	-rm -f config.h stamp-h1
-lighttpd.spec: $(top_builddir)/config.status $(srcdir)/lighttpd.spec.in
-	cd $(top_builddir) && $(SHELL) ./config.status $@
 distribute.sh: $(top_builddir)/config.status $(srcdir)/distribute.sh.in
 	cd $(top_builddir) && $(SHELL) ./config.status $@
 
@@ -355,8 +355,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -381,8 +381,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -392,13 +392,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique
@@ -469,6 +468,10 @@
 	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
 	$(am__remove_distdir)
 
+dist-lzma: distdir
+	tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+	$(am__remove_distdir)
+
 dist-tarZ: distdir
 	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
 	$(am__remove_distdir)
@@ -495,6 +498,8 @@
 	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
 	*.tar.bz2*) \
 	  bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+	*.tar.lzma*) \
+	  unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
 	*.tar.Z*) \
 	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
 	*.shar.gz*) \
@@ -646,8 +651,8 @@
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
 	all all-am am--refresh check check-am clean clean-generic \
 	clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
-	dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \
-	distclean-generic distclean-hdr distclean-libtool \
+	dist-gzip dist-lzma dist-shar dist-tarZ dist-zip distcheck \
+	distclean distclean-generic distclean-hdr distclean-libtool \
 	distclean-tags distcleancheck distdir distuninstallcheck dvi \
 	dvi-am html html-am info info-am install install-am \
 	install-data install-data-am install-dvi install-dvi-am \

Modified: lighttpd/trunk/NEWS
===================================================================
--- lighttpd/trunk/NEWS	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/NEWS	2009-03-18 10:20:09 UTC (rev 355)
@@ -3,8 +3,120 @@
 NEWS
 ====
 
-- 1.4.19 -
+- 1.4.22 -
+  * Fix wrong lua type for CACHE_MISS/CACHE_HIT in mod_cml (fixes #533)
+  * Fix default vhost in mod_simple_vhost (fixes #1905)
+  * Handle EINTR in mod_rrdtool (fixes #604)
+  * Fix rrd error after graceful restart (fixes #419)
+  * Fix EAGAIN handling for freebsd sendfile (fixes #1913, thx AnMaster for spotting the problem)
+  * Fix segfault in mod_scgi (fixes #1911)
+  * Treat EPIPE as connection-closed error in network_freebsd_sendfile.c (another fix from #1913)
+  * Fix useless redirection of stderr in mod_rrdtool, as it gets redirected to /dev/null later. (fixes #1922)
+  * Fix some problems with more strict compilers (#1923)
+  * Fix segfault if siginfo_t* is NULL in sigaction handler (fixes #1926)
 
+- 1.4.21 - 2009-02-16
+
+  * Fix base64 decoding in mod_auth (#1757, thx guido)
+  * Fix mod_cgi segfault when bound to unix domain socket (#653)
+  * Do not rely on ioctl FIONREAD (#673)
+  * Now really fix mod auth ldap (#1066)
+  * Fix leaving zombie process with include_shell (#1777)
+  * Removed debian/, openwrt/ and cygwin/; they weren't kept up-to-date, and we decided to remove dist. specific stuff
+  * Try to convert string options to shorts for numeric options in config file; allows to use env-vars for numeric options. (#1159, thx andrewb)
+  * Do not cache default vhost in mod_simple_vhost (#709)
+  * Trust pcre-config, do not check for pcre manually (#1769)
+  * Fix fastcgi authorization in subdirectories with check-local=disabled; don't split pathinfo for authorizer. (#963)
+  * Add possibility to disable methods in mod_compress (#1773)
+  * Fix duplicate connection keep-alive/transfer-encoding headers (#960)
+  * Fixed fix for round-robin in mod_proxy (forgot to increment the index) (#1715)
+  * Fix fastcgi-authorizer handling; Status: 200 is now accepted as the doc requests
+  * Compare address family in inet_ntop_cache
+  * Revert CVE-2008-4359 (#1720) fix "encoding+simplifying urls for rewrite/redirect": too many regressions.
+  * Use FD_CLOEXEC if possible (fixes #1821)
+  * Optimized buffer usage in mod_proxy (fixes #1850)
+  * Fix uninitialized value in time struct after strptime
+  * Do not pass Proxy-Connection: header from client to backend http server in mod_proxy (#1877)
+  * Fix wrong malloc sizes in mod_accesslog (probably nothing bad happened...) (fixes #1855, thx ycheng)
+  * Some small buffer.c fixes (closes #1837)
+  * Remove floating point math from server.c (fixes #1402)
+  * Disable SSLv2 by default
+  * Use/enforce sane max-connection values (fixes #1803)
+  * Allow mod_compress to return 304 (Not Modified); compress ignores the static-file.etags option.(fixes #1884)
+  * Add option to ignore the "Expect: 100-continue" header instead of returning 417 Expectation failed (closes #1017)
+  * Use modified etags in mod_compress (fixes #1800)
+  * Fix max-connection limit handling/100% cpu usage (fixes #1436)
+  * Fix error handling in freebsd-sendfile (fixes #1813)
+  * Silenced the annoying "request timed out" warning, enable with the "debug.log-timeouts" option (fixes #1529)
+  * Allow tabs in header values (fixes #1822)
+  * Added Language conditional (fixes #1119); patch by petar
+  * Fix wrong format strings (#1900, thx stepancheg)
+
+- 1.4.20 - 2008-09-30
+
+  * Fix mod_compress to compile with old gcc version (#1592)
+  * Fix mod_extforward to compile with old gcc version (#1591)
+  * Update documentation for #1587
+  * Fix #285 again: read error after SSL_shutdown (thx marton.illes at balabit.com) and clear the error queue before some other calls (CVE-2008-1531)
+  * Fix mod_magnet: enable "request.method" and "request.protocol" in lighty.env (#1308)
+  * Fix segfault for appending matched parts if there was no regex matching (just give empty strings) (#1601)
+  * Use data_response_init in mod_fastcgi x-sendfile handling for response.headers, fix a small "memleak" (#1628)
+  * Don't send empty Server headers (#1620)
+  * Fix conditional interpretation of core options
+  * Enable escaping of % and $ in redirect/rewrite; only two cases changed their behaviour: "%%" => "%", "$$" => "$"
+  * Fix accesslog port (should be port from the connection, not the "server.port") (#1618)
+  * Fix mod_fastcgi prefix matching: match the prefix always against url, not the absolute filepath (regardless of check-local)
+  * Overwrite Content-Type header in mod_dirlisting instead of inserting (#1614), patch by Henrik Holst
+  * Handle EINTR in mod_cgi during write() (#1640)
+  * Allow all http status codes by default; disable body only for 204,205 and 304; generate error pages for 4xx and 5xx (#1639)
+  * Fix mod_magnet to set con->mode = p->id if it generates content, so returning 4xx/5xx doesn't append an error page
+  * Remove lighttpd.spec* from source, fixing all problems with it ;-)
+  * Do not rely on PATH_MAX (POSIX does not require it) (#580)
+  * Disable logging to access.log if filename is an empty string
+  * Implement a clean way to open /dev/null and use it to close stdin/out/err in the needed places (#624)
+  * merge spawn-fcgi changes from trunk (from @2191)
+  * let spawn-fcgi propagate exit code from spawned fcgi application
+  * close connection after redirect in trigger_b4_dl (thx icy)
+  * close connection in mod_magnet if returned status code
+  * fix bug with IPv6 in mod_evasive (#1579)
+  * fix scgi HTTP/1.* status parsing (#1638), found by met at uberstats.com
+  * [tests] fixed system, use foreground daemons and waitpid
+  * [tests] removed pidfile from test system
+  * [tests] fixed tests needing php running (if not running on port 1026, search php in env[PHP] or /usr/bin/php-cgi)
+  * fixed typo in mod_accesslog (#1699)
+  * replaced buffer_{append,copy}_string with the _len variant where possible (#1732) (thx crypt)
+  * case insensitive match for secdownload md5 token (#1710)
+  * Handle only HEAD, GET and POST in mod_dirlisting (same as in staticfile) (#1687)
+  * fixed mod_secdownload problem with unsigned time_t (#1688)
+  * handle EAGAIN and EINTR for freebsd sendfile (#1675)
+  * Use filedescriptor 0 for mod_scgi spawn socket, redirect STDERR to /dev/null (#1716)
+  * fixed round-robin balancing in mod_proxy (#1715)
+  * fixed EINTR handling for waitpid in mod_fastcgi
+  * mod_{fast,s}cgi: overwrite environment variables (#1722)
+  * inserted many con->mode checks; they should prevent two modules to handle the same request if they shouldn't (#631)
+  * fixed url encoding to encode more characters (#266)
+  * allow digits in [s]cgi env vars (#1712)
+  * fixed dropping last character of evhost pattern (#161)
+  * print helpful error message on conditionals in global block (#1550)
+  * decode url before matching in mod_rewrite (#1720) -- (reverted for 1.4.21)
+  * fixed conditional patching of ldap filter (#1564)
+  * Match headers case insensitive in response (removing of X-{Sendfile,LIGHTTPD-*}, catching Date/Server) [2281]
+  * fixed bug with case-insensitive filenames in mod_userdir (#1589), spotted by "anders1" (CVE-2008-4360)
+  * fixed format string bugs in mod_accesslog for SYSLOG
+  * replaced fprintf with log_error_write in fastcgi debug
+  * fixed mem leak in ssi expression parser (#1753), thx Take5k
+  * hide some ssl errors per default, enable them with debug.log-ssl-noise (#397)
+  * do not send content-encoding for 304 (#1754), thx yzlai
+  * fix segfault for stat_cache(fam) calls with relative path (without '/', can be triggered by x-sendfile) (#1750)
+  * fix splitting of auth-ldap filter
+  * workaround ldap connection leak if a ldap connection failed (restarting ldap)
+  * fix auth.backend.ldap.bind-dn/pw problems (only read from global context for temporary ldap reconnects, thx ruskie)
+  * fix memleak in request header parsing (#1774, thx qhy) (CVE-2008-4298)
+  * fix mod_rewrite memleak/endless loop detection (#1775, thx phy - again!)
+  * use decoded url for matching in mod_redirect (#1720) (CVE-2008-4359) -- (reverted for 1.4.21)
+
+- 1.4.19 - 2008-03-10
+
   * added support for If-Range: <date> (#1346)
   * added support for matching $HTTP["scheme"] in configs
   * fixed initgroups() called after chroot (#1384)

Modified: lighttpd/trunk/SConstruct
===================================================================
--- lighttpd/trunk/SConstruct	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/SConstruct	2009-03-18 10:20:09 UTC (rev 355)
@@ -5,7 +5,7 @@
 from stat import *
 
 package = 'lighttpd'
-version = '1.4.19'
+version = '1.4.22'
 
 def checkCHeaders(autoconf, hdrs):
 	p = re.compile('[^A-Z0-9]')

Modified: lighttpd/trunk/aclocal.m4
===================================================================
--- lighttpd/trunk/aclocal.m4	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/aclocal.m4	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.10 -*- Autoconf -*-
+# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006  Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -11,14 +11,17 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
-m4_if(m4_PACKAGE_VERSION, [2.61],,
-[m4_fatal([this file was generated for autoconf 2.61.
-You have another version of autoconf.  If you want to use that,
-you should regenerate the build system entirely.], [63])])
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(AC_AUTOCONF_VERSION, [2.61],,
+[m4_warning([this file was generated for autoconf 2.61.
+You have another version of autoconf.  It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically `autoreconf'.])])
 
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 
-# serial 48 AC_PROG_LIBTOOL
+# serial 52 Debian 1.5.26-4 AC_PROG_LIBTOOL
 
 
 # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
@@ -106,7 +109,6 @@
 AC_REQUIRE([AC_OBJEXT])dnl
 AC_REQUIRE([AC_EXEEXT])dnl
 dnl
-
 AC_LIBTOOL_SYS_MAX_CMD_LEN
 AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
 AC_LIBTOOL_OBJDIR
@@ -181,7 +183,7 @@
 test -z "$ac_objext" && ac_objext=o
 
 # Determine commands to create old-style static archives.
-old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
 old_postinstall_cmds='chmod 644 $oldlib'
 old_postuninstall_cmds=
 
@@ -208,6 +210,8 @@
   ;;
 esac
 
+_LT_REQUIRED_DARWIN_CHECKS
+
 AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
 AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
 enable_win32_dll=yes, enable_win32_dll=no)
@@ -268,8 +272,9 @@
 # Check for compiler boilerplate output or warnings with
 # the simple compiler test code.
 AC_DEFUN([_LT_COMPILER_BOILERPLATE],
-[ac_outfile=conftest.$ac_objext
-printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
 eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_compiler_boilerplate=`cat conftest.err`
 $rm conftest*
@@ -281,14 +286,86 @@
 # Check for linker boilerplate output or warnings with
 # the simple link test code.
 AC_DEFUN([_LT_LINKER_BOILERPLATE],
-[ac_outfile=conftest.$ac_objext
-printf "$lt_simple_link_test_code" >conftest.$ac_ext
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
 eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_linker_boilerplate=`cat conftest.err`
-$rm conftest*
+$rm -r conftest*
 ])# _LT_LINKER_BOILERPLATE
 
+# _LT_REQUIRED_DARWIN_CHECKS
+# --------------------------
+# Check for some things on darwin
+AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS],[
+  case $host_os in
+    rhapsody* | darwin*)
+    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
 
+    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+      [lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+   # By default we will add the -single_module flag. You can override
+   # by either setting the environment variable LT_MULTI_MODULE
+   # non-empty at configure time, or by adding -multi_module to the
+   # link flags.
+   echo "int foo(void){return 1;}" > conftest.c
+   $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+     -dynamiclib ${wl}-single_module conftest.c
+   if test -f libconftest.dylib; then
+     lt_cv_apple_cc_single_mod=yes
+     rm -rf libconftest.dylib*
+   fi
+   rm conftest.c
+      fi])
+    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+      [lt_cv_ld_exported_symbols_list],
+      [lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+   [lt_cv_ld_exported_symbols_list=yes],
+   [lt_cv_ld_exported_symbols_list=no])
+   LDFLAGS="$save_LDFLAGS"
+    ])
+    case $host_os in
+    rhapsody* | darwin1.[[0123]])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+     _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*)
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+   10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+     _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+   10.[[012]]*)
+     _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+   10.*)
+     _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}"
+    fi
+    if test "$DSYMUTIL" != ":"; then
+      _lt_dsymutil="~$DSYMUTIL \$lib || :"
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+])
+
 # _LT_AC_SYS_LIBPATH_AIX
 # ----------------------
 # Links a minimal program and checks the executable
@@ -298,12 +375,20 @@
 # If we don't find anything, use the default library path according
 # to the aix ld manual.
 AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
-[AC_LINK_IFELSE(AC_LANG_PROGRAM,[
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
-}'`
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
 # Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
-}'`; fi],[])
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi],[])
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 ])# _LT_AC_SYS_LIBPATH_AIX
 
@@ -534,13 +619,17 @@
   rm -rf conftest*
   ;;
 
-x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|sparc*-*linux*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
     case `/usr/bin/file conftest.o` in
     *32-bit*)
       case $host in
+        x86_64-*kfreebsd*-gnu)
+          LD="${LD-ld} -m elf_i386_fbsd"
+          ;;
         x86_64-*linux*)
           LD="${LD-ld} -m elf_i386"
           ;;
@@ -557,6 +646,9 @@
       ;;
     *64-bit*)
       case $host in
+        x86_64-*kfreebsd*-gnu)
+          LD="${LD-ld} -m elf_x86_64_fbsd"
+          ;;
         x86_64-*linux*)
           LD="${LD-ld} -m elf_x86_64"
           ;;
@@ -597,7 +689,11 @@
     *64-bit*)
       case $lt_cv_prog_gnu_ld in
       yes*) LD="${LD-ld} -m elf64_sparc" ;;
-      *)    LD="${LD-ld} -64" ;;
+      *)
+        if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+	  LD="${LD-ld} -64"
+	fi
+	;;
       esac
       ;;
     esac
@@ -628,7 +724,7 @@
 AC_CACHE_CHECK([$1], [$2],
   [$2=no
   ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
-   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
    lt_compiler_flag="$3"
    # Insert the option either (1) after the last *FLAGS variable, or
    # (2) before a word containing "conftest.", or (3) at the end.
@@ -669,11 +765,12 @@
 # ------------------------------------------------------------
 # Check whether the given compiler option works
 AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
-[AC_CACHE_CHECK([$1], [$2],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
   [$2=no
    save_LDFLAGS="$LDFLAGS"
    LDFLAGS="$LDFLAGS $3"
-   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
    if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
      # The linker can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -689,7 +786,7 @@
        $2=yes
      fi
    fi
-   $rm conftest*
+   $rm -r conftest*
    LDFLAGS="$save_LDFLAGS"
 ])
 
@@ -787,24 +884,27 @@
     fi
     ;;
   *)
-    # If test is not a shell built-in, we'll probably end up computing a
-    # maximum length that is only half of the actual maximum length, but
-    # we can't tell.
-    SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
-    while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
 	       = "XX$teststring") >/dev/null 2>&1 &&
-	    new_result=`expr "X$teststring" : ".*" 2>&1` &&
-	    lt_cv_sys_max_cmd_len=$new_result &&
-	    test $i != 17 # 1/2 MB should be enough
-    do
-      i=`expr $i + 1`
-      teststring=$teststring$teststring
-    done
-    teststring=
-    # Add a significant safety factor because C++ compilers can tack on massive
-    # amounts of additional arguments before passing them to the linker.
-    # It appears as though 1/2 is a usable value.
-    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+	      new_result=`expr "X$teststring" : ".*" 2>&1` &&
+	      lt_cv_sys_max_cmd_len=$new_result &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on massive
+      # amounts of additional arguments before passing them to the linker.
+      # It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
     ;;
   esac
 ])
@@ -957,7 +1057,7 @@
     AC_CHECK_FUNC([shl_load],
 	  [lt_cv_dlopen="shl_load"],
       [AC_CHECK_LIB([dld], [shl_load],
-	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
+	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
 	[AC_CHECK_FUNC([dlopen],
 	      [lt_cv_dlopen="dlopen"],
 	  [AC_CHECK_LIB([dl], [dlopen],
@@ -965,7 +1065,7 @@
 	    [AC_CHECK_LIB([svld], [dlopen],
 		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
 	      [AC_CHECK_LIB([dld], [dld_link],
-		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
+		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
 	      ])
 	    ])
 	  ])
@@ -1031,7 +1131,8 @@
 # ---------------------------------
 # Check to see if options -c and -o are simultaneously supported by compiler
 AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
-[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
 AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
   [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
   [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
@@ -1039,7 +1140,7 @@
    mkdir conftest
    cd conftest
    mkdir out
-   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
    lt_compiler_flag="-o out/conftest2.$ac_objext"
    # Insert the option either (1) after the last *FLAGS variable, or
@@ -1179,6 +1280,7 @@
    darwin*)
        if test -n "$STRIP" ; then
          striplib="$STRIP -x"
+         old_striplib="$STRIP -S"
          AC_MSG_RESULT([yes])
        else
   AC_MSG_RESULT([no])
@@ -1196,7 +1298,8 @@
 # -----------------------------
 # PORTME Fill in your ld.so characteristics
 AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
-[AC_MSG_CHECKING([dynamic linker characteristics])
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
 library_names_spec=
 libname_spec='lib$name'
 soname_spec=
@@ -1210,20 +1313,58 @@
 version_type=none
 dynamic_linker="$host_os ld.so"
 sys_lib_dlsearch_path_spec="/lib /usr/lib"
+m4_if($1,[],[
 if test "$GCC" = yes; then
-  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then
     # if the path contains ";" then we assume it to be the separator
     # otherwise default to the standard path separator (i.e. ":") - it is
     # assumed that no part of a normal pathname contains ";" but that should
     # okay in the real world where ";" in dirpaths is itself problematic.
-    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'`
   else
-    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
   fi
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+  sys_lib_search_path_spec=`echo $lt_search_path_spec`
 else
   sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
-fi
+fi])
 need_lib_prefix=unknown
 hardcode_into_libs=no
 
@@ -1241,7 +1382,7 @@
   soname_spec='${libname}${release}${shared_ext}$major'
   ;;
 
-aix4* | aix5*)
+aix[[4-9]]*)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -1380,12 +1521,8 @@
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
   shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
-  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
-  if test "$GCC" = yes; then
-    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
-  else
-    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
-  fi
+  m4_if([$1], [],[
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) 
   sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
   ;;
 
@@ -1402,18 +1539,6 @@
   dynamic_linker=no
   ;;
 
-kfreebsd*-gnu)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='GNU ld.so'
-  ;;
-
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -1451,7 +1576,7 @@
     shlibpath_overrides_runpath=no
     hardcode_into_libs=yes
     ;;
-  freebsd*) # from 4.6 on
+  *) # from 4.6 on, and DragonFly
     shlibpath_overrides_runpath=yes
     hardcode_into_libs=yes
     ;;
@@ -1514,7 +1639,7 @@
   postinstall_cmds='chmod 555 $lib'
   ;;
 
-interix3*)
+interix[[3-9]]*)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -1569,7 +1694,7 @@
   ;;
 
 # This must be Linux ELF.
-linux*)
+linux* | k*bsd*-gnu)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -1585,7 +1710,7 @@
 
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
@@ -1598,7 +1723,7 @@
   dynamic_linker='GNU/Linux ld.so'
   ;;
 
-knetbsd*-gnu)
+netbsdelf*-gnu)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -1607,7 +1732,7 @@
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
-  dynamic_linker='GNU ld.so'
+  dynamic_linker='NetBSD ld.elf_so'
   ;;
 
 netbsd*)
@@ -1691,6 +1816,10 @@
   sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
   ;;
 
+rdos*)
+  dynamic_linker=no
+  ;;
+
 solaris*)
   version_type=linux
   need_lib_prefix=no
@@ -1786,6 +1915,13 @@
 AC_MSG_RESULT([$dynamic_linker])
 test "$dynamic_linker" = no && can_build_shared=no
 
+AC_CACHE_VAL([lt_cv_sys_lib_search_path_spec],
+[lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"])
+sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+AC_CACHE_VAL([lt_cv_sys_lib_dlsearch_path_spec],
+[lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"])
+sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
 if test "$GCC" = yes; then
   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
@@ -1796,7 +1932,8 @@
 # _LT_AC_TAGCONFIG
 # ----------------
 AC_DEFUN([_LT_AC_TAGCONFIG],
-[AC_ARG_WITH([tags],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_ARG_WITH([tags],
     [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
         [include additional configurations @<:@automatic@:>@])],
     [tagnames="$withval"])
@@ -2057,7 +2194,7 @@
 
 # AC_PATH_TOOL_PREFIX
 # -------------------
-# find a file program which can recognise shared library
+# find a file program which can recognize shared library
 AC_DEFUN([AC_PATH_TOOL_PREFIX],
 [AC_REQUIRE([AC_PROG_EGREP])dnl
 AC_MSG_CHECKING([for $1])
@@ -2120,7 +2257,7 @@
 
 # AC_PATH_MAGIC
 # -------------
-# find a file program which can recognise a shared library
+# find a file program which can recognize a shared library
 AC_DEFUN([AC_PATH_MAGIC],
 [AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
 if test -z "$lt_cv_path_MAGIC_CMD"; then
@@ -2267,7 +2404,7 @@
 # how to check for library dependencies
 #  -- PORTME fill in with the dynamic library characteristics
 AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
-[AC_CACHE_CHECK([how to recognise dependent libraries],
+[AC_CACHE_CHECK([how to recognize dependent libraries],
 lt_cv_deplibs_check_method,
 [lt_cv_file_magic_cmd='$MAGIC_CMD'
 lt_cv_file_magic_test_file=
@@ -2284,7 +2421,7 @@
 # whether `pass_all' will *always* work, you probably want this one.
 
 case $host_os in
-aix4* | aix5*)
+aix[[4-9]]*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
@@ -2306,16 +2443,22 @@
 
 mingw* | pw32*)
   # Base MSYS/MinGW do not provide the 'file' command needed by
-  # func_win32_libid shell function, so use a weaker test based on 'objdump'.
-  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
-  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  if ( file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
   ;;
 
 darwin* | rhapsody*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-freebsd* | kfreebsd*-gnu | dragonfly*)
+freebsd* | dragonfly*)
   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
     case $host_cpu in
     i*86 )
@@ -2353,7 +2496,7 @@
   esac
   ;;
 
-interix3*)
+interix[[3-9]]*)
   # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
   lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
   ;;
@@ -2369,11 +2512,11 @@
   ;;
 
 # This must be Linux ELF.
-linux*)
+linux* | k*bsd*-gnu)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-netbsd*)
+netbsd* | netbsdelf*-gnu)
   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
     lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
   else
@@ -2403,6 +2546,10 @@
   lt_cv_deplibs_check_method=pass_all
   ;;
 
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
 solaris*)
   lt_cv_deplibs_check_method=pass_all
   ;;
@@ -2455,7 +2602,7 @@
   lt_cv_path_NM="$NM"
 else
   lt_nm_to_check="${ac_tool_prefix}nm"
-  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then 
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
     lt_nm_to_check="$lt_nm_to_check nm"
   fi
   for lt_tmp_nm in $lt_nm_to_check; do
@@ -2671,10 +2818,10 @@
 _LT_AC_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;\n"
+lt_simple_compile_test_code="int some_variable = 0;"
 
 # Code to be used in simple link tests
-lt_simple_link_test_code='int main(){return(0);}\n'
+lt_simple_link_test_code='int main(){return(0);}'
 
 _LT_AC_SYS_COMPILER
 
@@ -2710,7 +2857,7 @@
   fi
   ;;
 
-aix4* | aix5*)
+aix[[4-9]]*)
   if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
     test "$enable_shared" = yes && enable_static=no
   fi
@@ -2767,6 +2914,7 @@
 _LT_AC_TAGVAR(predeps, $1)=
 _LT_AC_TAGVAR(postdeps, $1)=
 _LT_AC_TAGVAR(compiler_lib_search_path, $1)=
+_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=
 
 # Source file extension for C++ test sources.
 ac_ext=cpp
@@ -2776,10 +2924,10 @@
 _LT_AC_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;\n"
+lt_simple_compile_test_code="int some_variable = 0;"
 
 # Code to be used in simple link tests
-lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }\n'
+lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
 
 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 _LT_AC_SYS_COMPILER
@@ -2876,7 +3024,7 @@
     # FIXME: insert proper C++ library support
     _LT_AC_TAGVAR(ld_shlibs, $1)=no
     ;;
-  aix4* | aix5*)
+  aix[[4-9]]*)
     if test "$host_cpu" = ia64; then
       # On IA64, the linker does run time linking by default, so we don't
       # have to do anything special.
@@ -2889,7 +3037,7 @@
       # Test if we are trying to use run time linking or normal
       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
       # need to do runtime linking.
-      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
 	for ld_flag in $LDFLAGS; do
 	  case $ld_flag in
 	  *-brtl*)
@@ -2925,7 +3073,7 @@
 	   strings "$collect2name" | grep resolve_lib_name >/dev/null
 	then
 	  # We have reworked collect2
-	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+	  :
 	else
 	  # We have old collect2
 	  _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
@@ -3035,59 +3183,31 @@
     fi
   ;;
       darwin* | rhapsody*)
-        case $host_os in
-        rhapsody* | darwin1.[[012]])
-         _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
-         ;;
-       *) # Darwin 1.3 on
-         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
-           _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
-         else
-           case ${MACOSX_DEPLOYMENT_TARGET} in
-             10.[[012]])
-               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
-               ;;
-             10.*)
-               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
-               ;;
-           esac
-         fi
-         ;;
-        esac
       _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
       _LT_AC_TAGVAR(hardcode_direct, $1)=no
       _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
       _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-
-    if test "$GXX" = yes ; then
-      lt_int_apple_cc_single_mod=no
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+      if test "$GXX" = yes ; then
       output_verbose_link_cmd='echo'
-      if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
-       lt_int_apple_cc_single_mod=yes
+      _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+      _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+      _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+      if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+        _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+        _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
       fi
-      if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
-       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
       else
-          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
-        fi
-        _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-        # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-          if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
-            _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          else
-            _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          fi
-            _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-      else
       case $cc_basename in
         xlc*)
          output_verbose_link_cmd='echo'
-          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
           _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
           # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-          _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
           _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
           ;;
        *)
@@ -3121,7 +3241,7 @@
   freebsd-elf*)
     _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
     ;;
-  freebsd* | kfreebsd*-gnu | dragonfly*)
+  freebsd* | dragonfly*)
     # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
     # conventions
     _LT_AC_TAGVAR(ld_shlibs, $1)=yes
@@ -3170,9 +3290,7 @@
       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
 
       case $host_cpu in
-      hppa*64*|ia64*)
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
-        ;;
+      hppa*64*|ia64*) ;;
       *)
 	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
         ;;
@@ -3240,7 +3358,7 @@
 	;;
     esac
     ;;
-  interix3*)
+  interix[[3-9]]*)
     _LT_AC_TAGVAR(hardcode_direct, $1)=no
     _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
@@ -3280,7 +3398,7 @@
     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
     _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
     ;;
-  linux*)
+  linux* | k*bsd*-gnu)
     case $cc_basename in
       KCC*)
 	# Kuck and Associates, Inc. (KAI) C++ Compiler
@@ -3332,7 +3450,7 @@
 	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
 	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
 	;;
-      pgCC*)
+      pgCC* | pgcpp*)
         # Portland Group C++ compiler
 	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
   	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
@@ -3360,6 +3478,29 @@
 	# dependencies.
 	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
 	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C++ 5.9
+	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+
+	  # Not sure whether something based on
+	  # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+	  # would be better.
+	  output_verbose_link_cmd='echo'
+
+	  # Archives containing C++ object files must be created using
+	  # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	  # necessary to make sure instantiated templates are included
+	  # in the archive.
+	  _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	  ;;
+	esac
+	;;
     esac
     ;;
   lynxos*)
@@ -3382,7 +3523,7 @@
 	;;
     esac
     ;;
-  netbsd*)
+  netbsd* | netbsdelf*-gnu)
     if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
       wlarc=
@@ -3398,16 +3539,20 @@
     _LT_AC_TAGVAR(ld_shlibs, $1)=no
     ;;
   openbsd*)
-    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-    if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    if test -f /usr/libexec/ld.so; then
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      fi
+      output_verbose_link_cmd='echo'
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
     fi
-    output_verbose_link_cmd='echo'
     ;;
   osf3*)
     case $cc_basename in
@@ -3569,15 +3714,10 @@
 	case $host_os in
 	  solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
 	  *)
-	    # The C++ compiler is used as linker so we must use $wl
-	    # flag to pass the commands to the underlying system
-	    # linker. We must also pass each convience library through
-	    # to the system linker between allextract/defaultextract.
-	    # The C++ compiler will combine linker options so we
-	    # cannot just pass the convience library names through
-	    # without $wl.
+	    # The compiler driver will combine and reorder linker options,
+	    # but understands `-z linker_flag'.
 	    # Supported since Solaris 2.6 (maybe 2.5.1?)
-	    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract'
+	    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
 	    ;;
 	esac
 	_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
@@ -3624,6 +3764,12 @@
 	  fi
 
 	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+	  case $host_os in
+	  solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+	  *)
+	    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	    ;;
+	  esac
 	fi
 	;;
     esac
@@ -3739,7 +3885,8 @@
 # compiler output when linking a shared library.
 # Parse the compiler output and extract the necessary
 # objects, libraries and library flags.
-AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[
+AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
 dnl we can't use the lt_simple_compile_test_code here,
 dnl because it contains code intended for an executable,
 dnl not a library.  It's possible we should let each
@@ -3864,10 +4011,15 @@
 
 $rm -f confest.$objext
 
+_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
+  _LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_AC_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+
 # PORTME: override above test on systems where it is broken
 ifelse([$1],[CXX],
 [case $host_os in
-interix3*)
+interix[[3-9]]*)
   # Interix 3.5 installs completely hosed .la files for C++, so rather than
   # hack all around it, let's just trust "g++" to DTRT.
   _LT_AC_TAGVAR(predep_objects,$1)=
@@ -3875,19 +4027,51 @@
   _LT_AC_TAGVAR(postdeps,$1)=
   ;;
 
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+    #
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
 solaris*)
   case $cc_basename in
   CC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
     # Adding this requires a known-good setup of shared libraries for
     # Sun compiler versions before 5.6, else PIC objects from an old
     # archive will be linked into the output, leading to subtle bugs.
-    _LT_AC_TAGVAR(postdeps,$1)='-lCstd -lCrun'
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
     ;;
   esac
   ;;
 esac
 ])
-
 case " $_LT_AC_TAGVAR(postdeps, $1) " in
 *" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
 esac
@@ -3930,10 +4114,17 @@
 _LT_AC_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="      subroutine t\n      return\n      end\n"
+lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
 
 # Code to be used in simple link tests
-lt_simple_link_test_code="      program t\n      end\n"
+lt_simple_link_test_code="\
+      program t
+      end
+"
 
 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 _LT_AC_SYS_COMPILER
@@ -3965,7 +4156,7 @@
     postinstall_cmds='$RANLIB $lib'
   fi
   ;;
-aix4* | aix5*)
+aix[[4-9]]*)
   if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
     test "$enable_shared" = yes && enable_static=no
   fi
@@ -4012,10 +4203,10 @@
 _LT_AC_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="class foo {}\n"
+lt_simple_compile_test_code="class foo {}"
 
 # Code to be used in simple link tests
-lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }\n'
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
 
 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 _LT_AC_SYS_COMPILER
@@ -4068,7 +4259,7 @@
 _LT_AC_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
 
 # Code to be used in simple link tests
 lt_simple_link_test_code="$lt_simple_compile_test_code"
@@ -4142,6 +4333,7 @@
     _LT_AC_TAGVAR(predeps, $1) \
     _LT_AC_TAGVAR(postdeps, $1) \
     _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
+    _LT_AC_TAGVAR(compiler_lib_search_dirs, $1) \
     _LT_AC_TAGVAR(archive_cmds, $1) \
     _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
     _LT_AC_TAGVAR(postinstall_cmds, $1) \
@@ -4157,6 +4349,7 @@
     _LT_AC_TAGVAR(module_cmds, $1) \
     _LT_AC_TAGVAR(module_expsym_cmds, $1) \
     _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
+    _LT_AC_TAGVAR(fix_srcfile_path, $1) \
     _LT_AC_TAGVAR(exclude_expsyms, $1) \
     _LT_AC_TAGVAR(include_expsyms, $1); do
 
@@ -4203,7 +4396,7 @@
 # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
 # Free Software Foundation, Inc.
 #
 # This file is part of GNU Libtool:
@@ -4440,6 +4633,10 @@
 # shared library.
 postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
 
+# The directories searched by this compiler when creating a shared
+# library
+compiler_lib_search_dirs=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)
+
 # The library search path used internally by the compiler when linking
 # a shared library.
 compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
@@ -4528,7 +4725,7 @@
 sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
 
 # Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)"
+fix_srcfile_path=$lt_fix_srcfile_path
 
 # Set to yes if exported symbols are required.
 always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1)
@@ -4611,6 +4808,7 @@
 # ---------------------------------
 AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
 [AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([LT_AC_PROG_SED])
 AC_REQUIRE([AC_PROG_NM])
 AC_REQUIRE([AC_OBJEXT])
 # Check for command to grab the raw symbol name followed by C symbol from nm.
@@ -4647,7 +4845,7 @@
   lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
   lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
   ;;
-linux*)
+linux* | k*bsd*-gnu)
   if test "$host_cpu" = ia64; then
     symcode='[[ABCDGIRSTW]]'
     lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
@@ -4788,7 +4986,7 @@
     echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
     cat conftest.$ac_ext >&5
   fi
-  rm -f conftest* conftst*
+  rm -rf conftest* conftst*
 
   # Do not use the global_symbol_pipe unless it works.
   if test "$pipe_works" = yes; then
@@ -4837,13 +5035,16 @@
       # like `-m68040'.
       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
       ;;
-    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
       # PIC is the default for these OSes.
       ;;
-    mingw* | os2* | pw32*)
+    mingw* | cygwin* | os2* | pw32*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
       ;;
     darwin* | rhapsody*)
       # PIC is the default on this platform
@@ -4854,7 +5055,7 @@
       # DJGPP does not support shared libraries at all
       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
       ;;
-    interix3*)
+    interix[[3-9]]*)
       # Interix 3.x gcc -fpic/-fPIC options generate broken code.
       # Instead, we relocate shared libraries at runtime.
       ;;
@@ -4880,7 +5081,7 @@
     esac
   else
     case $host_os in
-      aix4* | aix5*)
+      aix[[4-9]]*)
 	# All AIX code is PIC.
 	if test "$host_cpu" = ia64; then
 	  # AIX 5 now supports IA64 processor
@@ -4920,7 +5121,7 @@
 	    ;;
 	esac
 	;;
-      freebsd* | kfreebsd*-gnu | dragonfly*)
+      freebsd* | dragonfly*)
 	# FreeBSD uses GNU C++
 	;;
       hpux9* | hpux10* | hpux11*)
@@ -4963,7 +5164,7 @@
 	    ;;
 	esac
 	;;
-      linux*)
+      linux* | k*bsd*-gnu)
 	case $cc_basename in
 	  KCC*)
 	    # KAI C++ Compiler
@@ -4976,7 +5177,7 @@
 	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
 	    ;;
-	  pgCC*)
+	  pgCC* | pgcpp*)
 	    # Portland Group C++ compiler.
 	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
@@ -4990,6 +5191,14 @@
 	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
 	    ;;
 	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	      ;;
+	    esac
 	    ;;
 	esac
 	;;
@@ -5006,7 +5215,7 @@
 	    ;;
 	esac
 	;;
-      netbsd*)
+      netbsd* | netbsdelf*-gnu)
 	;;
       osf3* | osf4* | osf5*)
 	case $cc_basename in
@@ -5110,14 +5319,17 @@
       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
       ;;
 
-    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
       # PIC is the default for these OSes.
       ;;
 
-    mingw* | pw32* | os2*)
+    mingw* | cygwin* | pw32* | os2*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
       ;;
 
     darwin* | rhapsody*)
@@ -5126,7 +5338,7 @@
       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
       ;;
 
-    interix3*)
+    interix[[3-9]]*)
       # Interix 3.x gcc -fpic/-fPIC options generate broken code.
       # Instead, we relocate shared libraries at runtime.
       ;;
@@ -5184,10 +5396,11 @@
        esac
        ;;
 
-    mingw* | pw32* | os2*)
+    mingw* | cygwin* | pw32* | os2*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      m4_if([$1], [GCJ], [],
+	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
       ;;
 
     hpux9* | hpux10* | hpux11*)
@@ -5217,7 +5430,7 @@
       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
       ;;
 
-    linux*)
+    linux* | k*bsd*-gnu)
       case $cc_basename in
       icc* | ecc*)
 	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
@@ -5236,6 +5449,22 @@
         # All Alpha code is PIC.
         _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
         ;;
+      *)
+        case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C 5.9
+	  _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  ;;
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=''
+	  ;;
+	esac
+	;;
       esac
       ;;
 
@@ -5245,6 +5474,10 @@
       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
       ;;
 
+    rdos*)
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
     solaris*)
       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
@@ -5304,7 +5537,7 @@
 #
 if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
   AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
-    _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1),
+    _LT_AC_TAGVAR(lt_cv_prog_compiler_pic_works, $1),
     [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
     [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
      "" | " "*) ;;
@@ -5328,7 +5561,7 @@
 #
 wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\"
 AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
-  _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1),
+  _LT_AC_TAGVAR(lt_cv_prog_compiler_static_works, $1),
   $lt_tmp_static_flag,
   [],
   [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
@@ -5339,11 +5572,12 @@
 # ------------------------------------
 # See if the linker supports building shared libraries.
 AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
-[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
 ifelse([$1],[CXX],[
   _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
   case $host_os in
-  aix4* | aix5*)
+  aix[[4-9]]*)
     # If we're using GNU nm, then we don't want the "-C" option.
     # -C means demangle to AIX nm, but means don't demangle with GNU nm
     if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
@@ -5356,12 +5590,16 @@
     _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
   ;;
   cygwin* | mingw*)
-    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
   ;;
+  linux* | k*bsd*-gnu)
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=no
+  ;;
   *)
     _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
   ;;
   esac
+  _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
 ],[
   runpath_var=
   _LT_AC_TAGVAR(allow_undefined_flag, $1)=
@@ -5392,12 +5630,14 @@
   # it will be wrapped by ` (' and `)$', so one must not match beginning or
   # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
   # as well as any symbol that contains `d'.
-  _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_"
+  _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
   # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
   # platforms (ab)use it in PIC code, but their linkers get confused if
   # the symbol is explicitly referenced.  Since portable code cannot
   # rely on this symbol name, it's probably fine to never include it in
   # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
   extract_expsyms_cmds=
   # Just being paranoid about ensuring that cc_basename is set.
   _LT_CC_BASENAME([$compiler])
@@ -5447,7 +5687,7 @@
 
     # See if GNU ld supports shared libraries.
     case $host_os in
-    aix3* | aix4* | aix5*)
+    aix[[3-9]]*)
       # On AIX/PPC, the GNU linker is very broken
       if test "$host_cpu" != ia64; then
 	_LT_AC_TAGVAR(ld_shlibs, $1)=no
@@ -5495,7 +5735,7 @@
       _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
       _LT_AC_TAGVAR(always_export_symbols, $1)=no
       _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
 
       if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
@@ -5513,7 +5753,7 @@
       fi
       ;;
 
-    interix3*)
+    interix[[3-9]]*)
       _LT_AC_TAGVAR(hardcode_direct, $1)=no
       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
@@ -5528,7 +5768,7 @@
       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
 
-    linux*)
+    gnu* | linux* | k*bsd*-gnu)
       if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
 	tmp_addflag=
 	case $cc_basename,$host_cpu in
@@ -5546,20 +5786,30 @@
 	ifc* | ifort*)			# Intel Fortran compiler
 	  tmp_addflag=' -nofor_main' ;;
 	esac
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	*)
+	  tmp_sharedflag='-shared' ;;
+	esac
+	_LT_AC_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
 
 	if test $supports_anon_versioning = yes; then
 	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~
   cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
   $echo "local: *; };" >> $output_objdir/$libname.ver~
-	  $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
 	fi
+	_LT_AC_TAGVAR(link_all_deplibs, $1)=no
       else
 	_LT_AC_TAGVAR(ld_shlibs, $1)=no
       fi
       ;;
 
-    netbsd*)
+    netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
 	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
@@ -5592,7 +5842,7 @@
 
     sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
       case `$LD -v 2>&1` in
-        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) 
+        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
 	_LT_AC_TAGVAR(ld_shlibs, $1)=no
 	cat <<_LT_EOF 1>&2
 
@@ -5657,7 +5907,7 @@
       fi
       ;;
 
-    aix4* | aix5*)
+    aix[[4-9]]*)
       if test "$host_cpu" = ia64; then
 	# On IA64, the linker does run time linking by default, so we don't
 	# have to do anything special.
@@ -5677,7 +5927,7 @@
 	# Test if we are trying to use run time linking or normal
 	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
 	# need to do runtime linking.
-	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
 	  for ld_flag in $LDFLAGS; do
   	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
   	    aix_use_runtimelinking=yes
@@ -5711,7 +5961,7 @@
   	   strings "$collect2name" | grep resolve_lib_name >/dev/null
 	  then
   	  # We have reworked collect2
-  	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+  	  :
 	  else
   	  # We have old collect2
   	  _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
@@ -5804,7 +6054,7 @@
       # The linker will automatically build a .lib file if we build a DLL.
       _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
       # FIXME: Should let the user specify the lib program.
-      _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      _LT_AC_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
       _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
       _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
       ;;
@@ -5837,19 +6087,18 @@
       _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
     if test "$GCC" = yes ; then
     	output_verbose_link_cmd='echo'
-        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
-      _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-      _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+        _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+        _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+        _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
     else
       case $cc_basename in
         xlc*)
          output_verbose_link_cmd='echo'
-         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
          _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
           # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-         _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+         _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
           _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
           ;;
        *)
@@ -5889,7 +6138,7 @@
       ;;
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | kfreebsd*-gnu | dragonfly*)
+    freebsd* | dragonfly*)
       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
       _LT_AC_TAGVAR(hardcode_direct, $1)=yes
@@ -5991,7 +6240,7 @@
       _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
       ;;
 
-    netbsd*)
+    netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
 	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
       else
@@ -6011,24 +6260,28 @@
       ;;
 
     openbsd*)
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      if test -f /usr/libexec/ld.so; then
+	_LT_AC_TAGVAR(hardcode_direct, $1)=yes
+	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+	     _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	     ;;
+	   *)
+	     _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+        fi
       else
-       case $host_os in
-	 openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
-	   _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-	   _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	   ;;
-	 *)
-	   _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	   _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	   ;;
-       esac
+	_LT_AC_TAGVAR(ld_shlibs, $1)=no
       fi
       ;;
 
@@ -6087,17 +6340,16 @@
       case $host_os in
       solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
       *)
- 	# The compiler driver will combine linker options so we
- 	# cannot just pass the convience library names through
- 	# without $wl, iff we do not link with $LD.
- 	# Luckily, gcc supports the same syntax we need for Sun Studio.
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
  	# Supported since Solaris 2.6 (maybe 2.5.1?)
- 	case $wlarc in
- 	'')
- 	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;;
- 	*)
- 	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
- 	esac ;;
+	if test "$GCC" = yes; then
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	fi
+	;;
       esac
       _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
       ;;
@@ -6154,7 +6406,7 @@
       fi
       ;;
 
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7*)
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
       _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
       _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
@@ -6229,7 +6481,7 @@
       # to ld, don't add -lc before -lgcc.
       AC_MSG_CHECKING([whether -lc should be explicitly linked in])
       $rm conftest*
-      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
       if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
         soname=conftest
@@ -6332,6 +6584,30 @@
 [AC_CHECK_TOOL(RC, windres, no)
 ])
 
+
+# Cheap backport of AS_EXECUTABLE_P and required macros
+# from Autoconf 2.59; we should not use $as_executable_p directly.
+
+# _AS_TEST_PREPARE
+# ----------------
+m4_ifndef([_AS_TEST_PREPARE],
+[m4_defun([_AS_TEST_PREPARE],
+[if test -x / >/dev/null 2>&1; then
+  as_executable_p='test -x'
+else
+  as_executable_p='test -f'
+fi
+])])# _AS_TEST_PREPARE
+
+# AS_EXECUTABLE_P
+# ---------------
+# Check whether a file is executable.
+m4_ifndef([AS_EXECUTABLE_P],
+[m4_defun([AS_EXECUTABLE_P],
+[AS_REQUIRE([_AS_TEST_PREPARE])dnl
+$as_executable_p $1[]dnl
+])])# AS_EXECUTABLE_P
+
 # NOTE: This macro has been submitted for inclusion into   #
 #  GNU Autoconf as AC_PROG_SED.  When it is available in   #
 #  a released version of Autoconf we should remove this    #
@@ -6352,12 +6628,13 @@
   test -z "$as_dir" && as_dir=.
   for lt_ac_prog in sed gsed; do
     for ac_exec_ext in '' $ac_executable_extensions; do
-      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+      if AS_EXECUTABLE_P(["$as_dir/$lt_ac_prog$ac_exec_ext"]); then
         lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
       fi
     done
   done
 done
+IFS=$as_save_IFS
 lt_ac_max=0
 lt_ac_count=0
 # Add /usr/xpg4/bin/sed as it is typically found on Solaris
@@ -6390,6 +6667,7 @@
 done
 ])
 SED=$lt_cv_path_SED
+AC_SUBST([SED])
 AC_MSG_RESULT([$SED])
 ])
 
@@ -6531,7 +6809,8 @@
 
 _PKG_TEXT
 ])],
-		[$4])
+		[AC_MSG_RESULT([no])
+                $4])
 elif test $pkg_failed = untried; then
 	ifelse([$4], , [AC_MSG_FAILURE(dnl
 [The pkg-config script could not be found or is too old.  Make sure it
@@ -6540,7 +6819,7 @@
 
 _PKG_TEXT
 
-To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
 		[$4])
 else
 	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
@@ -6550,7 +6829,7 @@
 fi[]dnl
 ])# PKG_CHECK_MODULES
 
-# Copyright (C) 2002, 2003, 2005, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 2006, 2007  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -6565,7 +6844,7 @@
 [am__api_version='1.10'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.10], [],
+m4_if([$1], [1.10.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -6581,8 +6860,10 @@
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.10])dnl
-_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
+[AM_AUTOMAKE_VERSION([1.10.1])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
@@ -6854,7 +7135,7 @@
   # each Makefile.in and add a new line on top of each file to say so.
   # Grep'ing the whole file is not good either: AIX grep has a line
   # limit of 2048, but all sed's we know have understand at least 4000.
-  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
+  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
     dirpart=`AS_DIRNAME("$mf")`
   else
     continue
@@ -6902,13 +7183,13 @@
 # Do all the work for Automake.                             -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006 Free Software Foundation, Inc.
+# 2005, 2006, 2008 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 12
+# serial 13
 
 # This macro actually does too much.  Some checks are only needed if
 # your package does certain things.  But this isn't really a big deal.
@@ -7013,16 +7294,17 @@
 # our stamp files there.
 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
 [# Compute $1's index in $config_headers.
+_am_arg=$1
 _am_stamp_count=1
 for _am_header in $config_headers :; do
   case $_am_header in
-    $1 | $1:* )
+    $_am_arg | $_am_arg:* )
       break ;;
     * )
       _am_stamp_count=`expr $_am_stamp_count + 1` ;;
   esac
 done
-echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
 # Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
 #
@@ -7383,7 +7665,7 @@
 
 # _AM_SUBST_NOTMAKE(VARIABLE)
 # ---------------------------
-# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in.
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
 # This macro is traced by Automake.
 AC_DEFUN([_AM_SUBST_NOTMAKE])
 

Modified: lighttpd/trunk/config.guess
===================================================================
--- lighttpd/trunk/config.guess	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/config.guess	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-#   Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+#   Free Software Foundation, Inc.
 
-timestamp='2006-07-02'
+timestamp='2008-01-23'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -56,8 +56,8 @@
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -139,16 +139,6 @@
 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
-case "${UNAME_MACHINE}" in
-    i?86)
-	test -z "$VENDOR" && VENDOR=pc
-	;;
-    *)
-	test -z "$VENDOR" && VENDOR=unknown
-	;;
-esac
-test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse
-
 # Note: order is significant - the case branches are not exclusive.
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
@@ -171,6 +161,7 @@
 	    arm*) machine=arm-unknown ;;
 	    sh3el) machine=shl-unknown ;;
 	    sh3eb) machine=sh-unknown ;;
+	    sh5el) machine=sh5le-unknown ;;
 	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
 	esac
 	# The Operating System including object format, if it has switched
@@ -339,7 +330,7 @@
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
 	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
-    i86pc:SunOS:5.*:*)
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
 	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
     sun4*:SunOS:6*:*)
@@ -541,7 +532,7 @@
 		echo rs6000-ibm-aix3.2
 	fi
 	exit ;;
-    *:AIX:*:[45])
+    *:AIX:*:[456])
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
@@ -790,7 +781,7 @@
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
 	exit ;;
-    i*:MINGW*:*)
+    *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
     i*:windows32*:*)
@@ -800,12 +791,18 @@
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit ;;
-    x86:Interix*:[3456]*)
-	echo i586-pc-interix${UNAME_RELEASE}
-	exit ;;
-    EM64T:Interix*:[3456]*)
-	echo x86_64-unknown-interix${UNAME_RELEASE}
-	exit ;;
+    *:Interix*:[3456]*)
+    	case ${UNAME_MACHINE} in
+	    x86)
+		echo i586-pc-interix${UNAME_RELEASE}
+		exit ;;
+	    EM64T | authenticamd)
+		echo x86_64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	    IA64)
+		echo ia64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	esac ;;
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
 	echo i${UNAME_MACHINE}-pc-mks
 	exit ;;
@@ -839,7 +836,14 @@
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
     arm*:Linux:*:*)
-	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+	eval $set_cc_for_build
+	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+	    | grep -q __ARM_EABI__
+	then
+	    echo ${UNAME_MACHINE}-unknown-linux-gnu
+	else
+	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	fi
 	exit ;;
     avr32*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -851,16 +855,16 @@
 	echo crisv32-axis-linux-gnu
 	exit ;;
     frv:Linux:*:*)
-    	echo frv-${VENDOR}-linux-gnu
+    	echo frv-unknown-linux-gnu
 	exit ;;
     ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     m32r*:Linux:*:*)
-	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     m68*:Linux:*:*)
-	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     mips:Linux:*:*)
 	eval $set_cc_for_build
@@ -883,7 +887,7 @@
 		s: ::g
 		p
 	    }'`"
-	test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux-gnu"; exit; }
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 	;;
     mips64:Linux:*:*)
 	eval $set_cc_for_build
@@ -906,16 +910,16 @@
 		s: ::g
 		p
 	    }'`"
-	test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux-gnu"; exit; }
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 	;;
     or32:Linux:*:*)
-	echo or32-${VENDOR}-linux-gnu
+	echo or32-unknown-linux-gnu
 	exit ;;
     ppc:Linux:*:*)
-	echo powerpc-${VENDOR}-linux-gnu
+	echo powerpc-unknown-linux-gnu
 	exit ;;
     ppc64:Linux:*:*)
-	echo powerpc64-${VENDOR}-linux-gnu
+	echo powerpc64-unknown-linux-gnu
 	exit ;;
     alpha:Linux:*:*)
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
@@ -929,37 +933,40 @@
         esac
 	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
 	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu${LIBC}
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
 	exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-	  PA7*) echo hppa1.1-${VENDOR}-linux-gnu ;;
-	  PA8*) echo hppa2.0-${VENDOR}-linux-gnu ;;
-	  *)    echo hppa-${VENDOR}-linux-gnu ;;
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
 	esac
 	exit ;;
     parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-${VENDOR}-linux-gnu
+	echo hppa64-unknown-linux-gnu
 	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
 	echo ${UNAME_MACHINE}-ibm-linux
 	exit ;;
     sh64*:Linux:*:*)
-    	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     sh*:Linux:*:*)
-	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     vax:Linux:*:*)
 	echo ${UNAME_MACHINE}-dec-linux-gnu
 	exit ;;
     x86_64:Linux:*:*)
-	echo x86_64-${VENDOR}-linux-gnu
+	echo x86_64-unknown-linux-gnu
 	exit ;;
+    xtensa*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
     i*86:Linux:*:*)
 	# The BFD linker knows what the default object file format is, so
 	# first see if it will tell us. cd to the root directory to prevent
@@ -973,18 +980,18 @@
 				    p'`
         case "$ld_supported_targets" in
 	  elf32-i386)
-		TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux-gnu"
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
 		;;
 	  a.out-i386-linux)
-		echo "${UNAME_MACHINE}-${VENDOR}-linux-gnuaout"
+		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
 		exit ;;
 	  coff-i386)
-		echo "${UNAME_MACHINE}-${VENDOR}-linux-gnucoff"
+		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
 		exit ;;
 	  "")
 		# Either a pre-BFD a.out linker (linux-gnuoldld) or
 		# one that does not give us useful --help.
-		echo "${UNAME_MACHINE}-${VENDOR}-linux-gnuoldld"
+		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
 		exit ;;
 	esac
 	# Determine whether the default compiler is a.out or elf
@@ -1018,7 +1025,7 @@
 		p
 	    }'`"
 	test x"${LIBC}" != x && {
-		echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}"
+		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
 		exit
 	}
 	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
@@ -1218,6 +1225,15 @@
     SX-6:SUPER-UX:*:*)
 	echo sx6-nec-superux${UNAME_RELEASE}
 	exit ;;
+    SX-7:SUPER-UX:*:*)
+	echo sx7-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8:SUPER-UX:*:*)
+	echo sx8-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8R:SUPER-UX:*:*)
+	echo sx8r-nec-superux${UNAME_RELEASE}
+	exit ;;
     Power*:Rhapsody:*:*)
 	echo powerpc-apple-rhapsody${UNAME_RELEASE}
 	exit ;;
@@ -1468,9 +1484,9 @@
 the operating system you are using. It is advised that you
 download the most up to date version of the config scripts from
 
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
 and
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
 
 If the version you run ($0) is already up to date, please
 send the following data and any information you think might be

Modified: lighttpd/trunk/config.h.in
===================================================================
--- lighttpd/trunk/config.h.in	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/config.h.in	2009-03-18 10:20:09 UTC (rev 355)
@@ -69,6 +69,9 @@
 /* Define to 1 if you have the `getuid' function. */
 #undef HAVE_GETUID
 
+/* Define to 1 if you have the `gmtime_r' function. */
+#undef HAVE_GMTIME_R
+
 /* Define to 1 if you have the `inet_ntoa' function. */
 #undef HAVE_INET_NTOA
 
@@ -171,7 +174,7 @@
 /* Define to 1 if you have the `pathconf' function. */
 #undef HAVE_PATHCONF
 
-/* Define to 1 if you have the <pcre.h> header file. */
+/* pcre.h */
 #undef HAVE_PCRE_H
 
 /* Define to 1 if you have the `poll' function. */
@@ -367,6 +370,9 @@
 /* Define to 1 if you have the <zlib.h> header file. */
 #undef HAVE_ZLIB_H
 
+/* Using deprecated ldap api */
+#undef LDAP_DEPRECATED
+
 /* lighttpd-version-id */
 #undef LIGHTTPD_VERSION_ID
 

Modified: lighttpd/trunk/config.sub
===================================================================
--- lighttpd/trunk/config.sub	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/config.sub	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-#   Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+#   Free Software Foundation, Inc.
 
-timestamp='2006-09-20'
+timestamp='2008-01-16'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -72,8 +72,8 @@
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -245,12 +245,12 @@
 	| bfin \
 	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
-	| fr30 | frv \
+	| fido | fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
-	| maxq | mb | microblaze | mcore \
+	| maxq | mb | microblaze | mcore | mep \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
@@ -324,7 +324,7 @@
 	| clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
 	| elxsi-* \
-	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
@@ -369,10 +369,14 @@
 	| v850-* | v850e-* | vax-* \
 	| we32k-* \
 	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
-	| xstormy16-* | xtensa-* \
+	| xstormy16-* | xtensa*-* \
 	| ymp-* \
 	| z8k-*)
 		;;
+	# Recognize the basic CPU types without company name, with glob match.
+	xtensa*)
+		basic_machine=$basic_machine-unknown
+		;;
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
 	386bsd)
@@ -443,6 +447,14 @@
 		basic_machine=ns32k-sequent
 		os=-dynix
 		;;
+	blackfin)
+		basic_machine=bfin-unknown
+		os=-linux
+		;;
+	blackfin-*)
+		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
 	c90)
 		basic_machine=c90-cray
 		os=-unicos
@@ -475,8 +487,8 @@
 		basic_machine=craynv-cray
 		os=-unicosmp
 		;;
-	cr16c)
-		basic_machine=cr16c-unknown
+	cr16)
+		basic_machine=cr16-unknown
 		os=-elf
 		;;
 	crds | unos)
@@ -668,6 +680,14 @@
 		basic_machine=m68k-isi
 		os=-sysv
 		;;
+	m68knommu)
+		basic_machine=m68k-unknown
+		os=-linux
+		;;
+	m68knommu-*)
+		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
 	m88k-omron*)
 		basic_machine=m88k-omron
 		;;
@@ -683,6 +703,10 @@
 		basic_machine=i386-pc
 		os=-mingw32
 		;;
+	mingw32ce)
+		basic_machine=arm-unknown
+		os=-mingw32ce
+		;;
 	miniframe)
 		basic_machine=m68000-convergent
 		;;
@@ -809,6 +833,14 @@
 		basic_machine=i860-intel
 		os=-osf
 		;;
+	parisc)
+		basic_machine=hppa-unknown
+		os=-linux
+		;;
+	parisc-*)
+		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
 	pbd)
 		basic_machine=sparc-tti
 		;;
@@ -925,6 +957,9 @@
 		basic_machine=sh-hitachi
 		os=-hms
 		;;
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
 	sh64)
 		basic_machine=sh64-unknown
 		;;
@@ -1014,6 +1049,10 @@
 		basic_machine=tic6x-unknown
 		os=-coff
 		;;
+	tile*)
+		basic_machine=tile-unknown
+		os=-linux-gnu
+		;;
 	tx39)
 		basic_machine=mipstx39-unknown
 		;;
@@ -1219,7 +1258,7 @@
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos* | -toppers*)
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1414,6 +1453,9 @@
 	m68*-cisco)
 		os=-aout
 		;;
+        mep-*)
+		os=-elf
+		;;
 	mips*-cisco)
 		os=-elf
 		;;

Modified: lighttpd/trunk/configure
===================================================================
--- lighttpd/trunk/configure	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/configure	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for lighttpd 1.4.19.
+# Generated by GNU Autoconf 2.61 for lighttpd 1.4.22.
 #
 # Report bugs to <jan at kneschke.de>.
 #
@@ -728,8 +728,8 @@
 # Identity of this package.
 PACKAGE_NAME='lighttpd'
 PACKAGE_TARNAME='lighttpd'
-PACKAGE_VERSION='1.4.19'
-PACKAGE_STRING='lighttpd 1.4.19'
+PACKAGE_VERSION='1.4.22'
+PACKAGE_STRING='lighttpd 1.4.22'
 PACKAGE_BUGREPORT='jan at kneschke.de'
 
 ac_unique_file="src/server.c"
@@ -859,6 +859,7 @@
 CCDEPMODE
 am__fastdepCC_TRUE
 am__fastdepCC_FALSE
+SED
 GREP
 EGREP
 CPP
@@ -870,6 +871,8 @@
 ECHO
 AR
 RANLIB
+DSYMUTIL
+NMEDIT
 CXX
 CXXFLAGS
 ac_ct_CXX
@@ -1440,7 +1443,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures lighttpd 1.4.19 to adapt to many kinds of systems.
+\`configure' configures lighttpd 1.4.22 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1511,7 +1514,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of lighttpd 1.4.19:";;
+     short | recursive ) echo "Configuration of lighttpd 1.4.22:";;
    esac
   cat <<\_ACEOF
 
@@ -1646,7 +1649,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-lighttpd configure 1.4.19
+lighttpd configure 1.4.22
 generated by GNU Autoconf 2.61
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1660,7 +1663,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by lighttpd $as_me 1.4.19, which was
+It was created by lighttpd $as_me 1.4.22, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   $ $0 $@
@@ -2479,7 +2482,7 @@
 
 # Define the identity of the package.
  PACKAGE='lighttpd'
- VERSION='1.4.19'
+ VERSION='1.4.22'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -3882,12 +3885,13 @@
   test -z "$as_dir" && as_dir=.
   for lt_ac_prog in sed gsed; do
     for ac_exec_ext in '' $ac_executable_extensions; do
-      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+      if { test -f "$as_dir/$lt_ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$lt_ac_prog$ac_exec_ext"; }; then
         lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
       fi
     done
   done
 done
+IFS=$as_save_IFS
 lt_ac_max=0
 lt_ac_count=0
 # Add /usr/xpg4/bin/sed as it is typically found on Solaris
@@ -3922,6 +3926,7 @@
 fi
 
 SED=$lt_cv_path_SED
+
 { echo "$as_me:$LINENO: result: $SED" >&5
 echo "${ECHO_T}$SED" >&6; }
 
@@ -5445,8 +5450,8 @@
 echo "${ECHO_T}$lt_cv_path_NM" >&6; }
 NM="$lt_cv_path_NM"
 
-{ echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5
-echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5
+echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6; }
 if test "${lt_cv_deplibs_check_method+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -5465,7 +5470,7 @@
 # whether `pass_all' will *always* work, you probably want this one.
 
 case $host_os in
-aix4* | aix5*)
+aix[4-9]*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
@@ -5487,16 +5492,22 @@
 
 mingw* | pw32*)
   # Base MSYS/MinGW do not provide the 'file' command needed by
-  # func_win32_libid shell function, so use a weaker test based on 'objdump'.
-  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
-  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  if ( file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
   ;;
 
 darwin* | rhapsody*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-freebsd* | kfreebsd*-gnu | dragonfly*)
+freebsd* | dragonfly*)
   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
     case $host_cpu in
     i*86 )
@@ -5534,7 +5545,7 @@
   esac
   ;;
 
-interix3*)
+interix[3-9]*)
   # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
   lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
   ;;
@@ -5550,11 +5561,11 @@
   ;;
 
 # This must be Linux ELF.
-linux*)
+linux* | k*bsd*-gnu)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-netbsd*)
+netbsd* | netbsdelf*-gnu)
   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
     lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
   else
@@ -5584,6 +5595,10 @@
   lt_cv_deplibs_check_method=pass_all
   ;;
 
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
 solaris*)
   lt_cv_deplibs_check_method=pass_all
   ;;
@@ -5669,7 +5684,7 @@
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 5672 "configure"' > conftest.$ac_ext
+  echo '#line 5687 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -5704,7 +5719,8 @@
   rm -rf conftest*
   ;;
 
-x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|sparc*-*linux*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
@@ -5715,6 +5731,9 @@
     case `/usr/bin/file conftest.o` in
     *32-bit*)
       case $host in
+        x86_64-*kfreebsd*-gnu)
+          LD="${LD-ld} -m elf_i386_fbsd"
+          ;;
         x86_64-*linux*)
           LD="${LD-ld} -m elf_i386"
           ;;
@@ -5731,6 +5750,9 @@
       ;;
     *64-bit*)
       case $host in
+        x86_64-*kfreebsd*-gnu)
+          LD="${LD-ld} -m elf_x86_64_fbsd"
+          ;;
         x86_64-*linux*)
           LD="${LD-ld} -m elf_x86_64"
           ;;
@@ -5834,7 +5856,11 @@
     *64-bit*)
       case $lt_cv_prog_gnu_ld in
       yes*) LD="${LD-ld} -m elf64_sparc" ;;
-      *)    LD="${LD-ld} -64" ;;
+      *)
+        if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+	  LD="${LD-ld} -64"
+	fi
+	;;
       esac
       ;;
     esac
@@ -6962,7 +6988,6 @@
 
 
 # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
-
 # find the maximum length of command line arguments
 { echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
 echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; }
@@ -7049,24 +7074,27 @@
     fi
     ;;
   *)
-    # If test is not a shell built-in, we'll probably end up computing a
-    # maximum length that is only half of the actual maximum length, but
-    # we can't tell.
-    SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
-    while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \
 	       = "XX$teststring") >/dev/null 2>&1 &&
-	    new_result=`expr "X$teststring" : ".*" 2>&1` &&
-	    lt_cv_sys_max_cmd_len=$new_result &&
-	    test $i != 17 # 1/2 MB should be enough
-    do
-      i=`expr $i + 1`
-      teststring=$teststring$teststring
-    done
-    teststring=
-    # Add a significant safety factor because C++ compilers can tack on massive
-    # amounts of additional arguments before passing them to the linker.
-    # It appears as though 1/2 is a usable value.
-    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+	      new_result=`expr "X$teststring" : ".*" 2>&1` &&
+	      lt_cv_sys_max_cmd_len=$new_result &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on massive
+      # amounts of additional arguments before passing them to the linker.
+      # It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
     ;;
   esac
 
@@ -7083,6 +7111,7 @@
 
 
 
+
 # Check for command to grab the raw symbol name followed by C symbol from nm.
 { echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
 echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; }
@@ -7120,7 +7149,7 @@
   lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
   lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
   ;;
-linux*)
+linux* | k*bsd*-gnu)
   if test "$host_cpu" = ia64; then
     symcode='[ABCDGIRSTW]'
     lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
@@ -7273,7 +7302,7 @@
     echo "$progname: failed program was:" >&5
     cat conftest.$ac_ext >&5
   fi
-  rm -f conftest* conftst*
+  rm -rf conftest* conftst*
 
   # Do not use the global_symbol_pipe unless it works.
   if test "$pipe_works" = yes; then
@@ -7671,7 +7700,7 @@
 test -z "$ac_objext" && ac_objext=o
 
 # Determine commands to create old-style static archives.
-old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
 old_postinstall_cmds='chmod 644 $oldlib'
 old_postuninstall_cmds=
 
@@ -7833,6 +7862,318 @@
   ;;
 esac
 
+
+  case $host_os in
+    rhapsody* | darwin*)
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_DSYMUTIL+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$DSYMUTIL"; then
+  ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+  { echo "$as_me:$LINENO: result: $DSYMUTIL" >&5
+echo "${ECHO_T}$DSYMUTIL" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+  ac_ct_DSYMUTIL=$DSYMUTIL
+  # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_DSYMUTIL"; then
+  ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_DSYMUTIL" >&5
+echo "${ECHO_T}$ac_ct_DSYMUTIL" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_DSYMUTIL" = x; then
+    DSYMUTIL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    DSYMUTIL=$ac_ct_DSYMUTIL
+  fi
+else
+  DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_NMEDIT+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$NMEDIT"; then
+  ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+  { echo "$as_me:$LINENO: result: $NMEDIT" >&5
+echo "${ECHO_T}$NMEDIT" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_NMEDIT"; then
+  ac_ct_NMEDIT=$NMEDIT
+  # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_NMEDIT"; then
+  ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_NMEDIT="nmedit"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_NMEDIT" >&5
+echo "${ECHO_T}$ac_ct_NMEDIT" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_NMEDIT" = x; then
+    NMEDIT=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    NMEDIT=$ac_ct_NMEDIT
+  fi
+else
+  NMEDIT="$ac_cv_prog_NMEDIT"
+fi
+
+
+    { echo "$as_me:$LINENO: checking for -single_module linker flag" >&5
+echo $ECHO_N "checking for -single_module linker flag... $ECHO_C" >&6; }
+if test "${lt_cv_apple_cc_single_mod+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+   # By default we will add the -single_module flag. You can override
+   # by either setting the environment variable LT_MULTI_MODULE
+   # non-empty at configure time, or by adding -multi_module to the
+   # link flags.
+   echo "int foo(void){return 1;}" > conftest.c
+   $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+     -dynamiclib ${wl}-single_module conftest.c
+   if test -f libconftest.dylib; then
+     lt_cv_apple_cc_single_mod=yes
+     rm -rf libconftest.dylib*
+   fi
+   rm conftest.c
+      fi
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5
+echo "${ECHO_T}$lt_cv_apple_cc_single_mod" >&6; }
+    { echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5
+echo $ECHO_N "checking for -exported_symbols_list linker flag... $ECHO_C" >&6; }
+if test "${lt_cv_ld_exported_symbols_list+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  lt_cv_ld_exported_symbols_list=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	lt_cv_ld_exported_symbols_list=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5
+echo "${ECHO_T}$lt_cv_ld_exported_symbols_list" >&6; }
+    case $host_os in
+    rhapsody* | darwin1.[0123])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+     _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*)
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+   10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+     _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+   10.[012]*)
+     _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+   10.*)
+     _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}"
+    fi
+    if test "$DSYMUTIL" != ":"; then
+      _lt_dsymutil="~$DSYMUTIL \$lib || :"
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+
+
 enable_dlopen=yes
 enable_win32_dll=no
 
@@ -7871,10 +8212,10 @@
 objext=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;\n"
+lt_simple_compile_test_code="int some_variable = 0;"
 
 # Code to be used in simple link tests
-lt_simple_link_test_code='int main(){return(0);}\n'
+lt_simple_link_test_code='int main(){return(0);}'
 
 
 # If no C compiler was specified, use CC.
@@ -7889,16 +8230,16 @@
 
 # save warnings/boilerplate of simple test code
 ac_outfile=conftest.$ac_objext
-printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
 eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_compiler_boilerplate=`cat conftest.err`
 $rm conftest*
 
 ac_outfile=conftest.$ac_objext
-printf "$lt_simple_link_test_code" >conftest.$ac_ext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
 eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_linker_boilerplate=`cat conftest.err`
-$rm conftest*
+$rm -r conftest*
 
 
 
@@ -7915,7 +8256,7 @@
 else
   lt_cv_prog_compiler_rtti_exceptions=no
   ac_outfile=conftest.$ac_objext
-   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
    lt_compiler_flag="-fno-rtti -fno-exceptions"
    # Insert the option either (1) after the last *FLAGS variable, or
    # (2) before a word containing "conftest.", or (3) at the end.
@@ -7926,11 +8267,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7929: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8270: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7933: \$? = $ac_status" >&5
+   echo "$as_me:8274: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7981,13 +8322,15 @@
       lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
       ;;
 
-    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
       # PIC is the default for these OSes.
       ;;
 
-    mingw* | pw32* | os2*)
+    mingw* | cygwin* | pw32* | os2*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
       lt_prog_compiler_pic='-DDLL_EXPORT'
       ;;
 
@@ -7997,7 +8340,7 @@
       lt_prog_compiler_pic='-fno-common'
       ;;
 
-    interix3*)
+    interix[3-9]*)
       # Interix 3.x gcc -fpic/-fPIC options generate broken code.
       # Instead, we relocate shared libraries at runtime.
       ;;
@@ -8055,7 +8398,7 @@
        esac
        ;;
 
-    mingw* | pw32* | os2*)
+    mingw* | cygwin* | pw32* | os2*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
       lt_prog_compiler_pic='-DDLL_EXPORT'
@@ -8088,7 +8431,7 @@
       lt_prog_compiler_static='-Bstatic'
       ;;
 
-    linux*)
+    linux* | k*bsd*-gnu)
       case $cc_basename in
       icc* | ecc*)
 	lt_prog_compiler_wl='-Wl,'
@@ -8107,6 +8450,22 @@
         # All Alpha code is PIC.
         lt_prog_compiler_static='-non_shared'
         ;;
+      *)
+        case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C 5.9
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl='-Wl,'
+	  ;;
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl=''
+	  ;;
+	esac
+	;;
       esac
       ;;
 
@@ -8116,6 +8475,10 @@
       lt_prog_compiler_static='-non_shared'
       ;;
 
+    rdos*)
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
     solaris*)
       lt_prog_compiler_pic='-KPIC'
       lt_prog_compiler_static='-Bstatic'
@@ -8178,12 +8541,12 @@
 
 { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; }
-if test "${lt_prog_compiler_pic_works+set}" = set; then
+if test "${lt_cv_prog_compiler_pic_works+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  lt_prog_compiler_pic_works=no
+  lt_cv_prog_compiler_pic_works=no
   ac_outfile=conftest.$ac_objext
-   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
    lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
    # Insert the option either (1) after the last *FLAGS variable, or
    # (2) before a word containing "conftest.", or (3) at the end.
@@ -8194,27 +8557,27 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8197: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8560: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:8201: \$? = $ac_status" >&5
+   echo "$as_me:8564: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
      $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       lt_prog_compiler_pic_works=yes
+       lt_cv_prog_compiler_pic_works=yes
      fi
    fi
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6; }
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_pic_works" >&6; }
 
-if test x"$lt_prog_compiler_pic_works" = xyes; then
+if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
     case $lt_prog_compiler_pic in
      "" | " "*) ;;
      *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
@@ -8241,13 +8604,13 @@
 wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
 { echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
-if test "${lt_prog_compiler_static_works+set}" = set; then
+if test "${lt_cv_prog_compiler_static_works+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  lt_prog_compiler_static_works=no
+  lt_cv_prog_compiler_static_works=no
    save_LDFLAGS="$LDFLAGS"
    LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
-   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
    if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
      # The linker can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -8257,20 +8620,20 @@
        $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
-         lt_prog_compiler_static_works=yes
+         lt_cv_prog_compiler_static_works=yes
        fi
      else
-       lt_prog_compiler_static_works=yes
+       lt_cv_prog_compiler_static_works=yes
      fi
    fi
-   $rm conftest*
+   $rm -r conftest*
    LDFLAGS="$save_LDFLAGS"
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
-echo "${ECHO_T}$lt_prog_compiler_static_works" >&6; }
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_static_works" >&6; }
 
-if test x"$lt_prog_compiler_static_works" = xyes; then
+if test x"$lt_cv_prog_compiler_static_works" = xyes; then
     :
 else
     lt_prog_compiler_static=
@@ -8287,7 +8650,7 @@
    mkdir conftest
    cd conftest
    mkdir out
-   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
    lt_compiler_flag="-o out/conftest2.$ac_objext"
    # Insert the option either (1) after the last *FLAGS variable, or
@@ -8298,11 +8661,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8301: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8664: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:8305: \$? = $ac_status" >&5
+   echo "$as_me:8668: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -8382,12 +8745,13 @@
   # it will be wrapped by ` (' and `)$', so one must not match beginning or
   # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
   # as well as any symbol that contains `d'.
-  exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+  exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
   # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
   # platforms (ab)use it in PIC code, but their linkers get confused if
   # the symbol is explicitly referenced.  Since portable code cannot
   # rely on this symbol name, it's probably fine to never include it in
   # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
   extract_expsyms_cmds=
   # Just being paranoid about ensuring that cc_basename is set.
   for cc_temp in $compiler""; do
@@ -8446,7 +8810,7 @@
 
     # See if GNU ld supports shared libraries.
     case $host_os in
-    aix3* | aix4* | aix5*)
+    aix[3-9]*)
       # On AIX/PPC, the GNU linker is very broken
       if test "$host_cpu" != ia64; then
 	ld_shlibs=no
@@ -8494,7 +8858,7 @@
       allow_undefined_flag=unsupported
       always_export_symbols=no
       enable_shared_with_static_runtimes=yes
-      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
 
       if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
         archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
@@ -8512,7 +8876,7 @@
       fi
       ;;
 
-    interix3*)
+    interix[3-9]*)
       hardcode_direct=no
       hardcode_shlibpath_var=no
       hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
@@ -8527,7 +8891,7 @@
       archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
 
-    linux*)
+    gnu* | linux* | k*bsd*-gnu)
       if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
 	tmp_addflag=
 	case $cc_basename,$host_cpu in
@@ -8545,20 +8909,30 @@
 	ifc* | ifort*)			# Intel Fortran compiler
 	  tmp_addflag=' -nofor_main' ;;
 	esac
-	archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	*)
+	  tmp_sharedflag='-shared' ;;
+	esac
+	archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
 
 	if test $supports_anon_versioning = yes; then
 	  archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
   cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
   $echo "local: *; };" >> $output_objdir/$libname.ver~
-	  $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
 	fi
+	link_all_deplibs=no
       else
 	ld_shlibs=no
       fi
       ;;
 
-    netbsd*)
+    netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
 	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
@@ -8656,7 +9030,7 @@
       fi
       ;;
 
-    aix4* | aix5*)
+    aix[4-9]*)
       if test "$host_cpu" = ia64; then
 	# On IA64, the linker does run time linking by default, so we don't
 	# have to do anything special.
@@ -8676,7 +9050,7 @@
 	# Test if we are trying to use run time linking or normal
 	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
 	# need to do runtime linking.
-	case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+	case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
 	  for ld_flag in $LDFLAGS; do
   	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
   	    aix_use_runtimelinking=yes
@@ -8710,7 +9084,7 @@
   	   strings "$collect2name" | grep resolve_lib_name >/dev/null
 	  then
   	  # We have reworked collect2
-  	  hardcode_direct=yes
+  	  :
 	  else
   	  # We have old collect2
   	  hardcode_direct=unsupported
@@ -8784,11 +9158,18 @@
        } && test -s conftest$ac_exeext &&
        $as_test_x conftest$ac_exeext; then
 
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
-}'`
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
 # Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
-}'`; fi
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
@@ -8843,11 +9224,18 @@
        } && test -s conftest$ac_exeext &&
        $as_test_x conftest$ac_exeext; then
 
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
-}'`
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
 # Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
-}'`; fi
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
@@ -8901,7 +9289,7 @@
       # The linker will automatically build a .lib file if we build a DLL.
       old_archive_From_new_cmds='true'
       # FIXME: Should let the user specify the lib program.
-      old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
       fix_srcfile_path='`cygpath -w "$srcfile"`'
       enable_shared_with_static_runtimes=yes
       ;;
@@ -8934,19 +9322,18 @@
       link_all_deplibs=yes
     if test "$GCC" = yes ; then
     	output_verbose_link_cmd='echo'
-        archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
-      module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-      archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-      module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+        module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+        archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+        module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
     else
       case $cc_basename in
         xlc*)
          output_verbose_link_cmd='echo'
-         archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+         archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
          module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
           # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-         archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+         archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
           module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
           ;;
        *)
@@ -8986,7 +9373,7 @@
       ;;
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | kfreebsd*-gnu | dragonfly*)
+    freebsd* | dragonfly*)
       archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec='-R$libdir'
       hardcode_direct=yes
@@ -9088,7 +9475,7 @@
       link_all_deplibs=yes
       ;;
 
-    netbsd*)
+    netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
 	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
       else
@@ -9108,24 +9495,28 @@
       ;;
 
     openbsd*)
-      hardcode_direct=yes
-      hardcode_shlibpath_var=no
-      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-	hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-	export_dynamic_flag_spec='${wl}-E'
+      if test -f /usr/libexec/ld.so; then
+	hardcode_direct=yes
+	hardcode_shlibpath_var=no
+	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	  export_dynamic_flag_spec='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     hardcode_libdir_flag_spec='-R$libdir'
+	     ;;
+	   *)
+	     archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+        fi
       else
-       case $host_os in
-	 openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
-	   archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-	   hardcode_libdir_flag_spec='-R$libdir'
-	   ;;
-	 *)
-	   archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	   hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-	   ;;
-       esac
+	ld_shlibs=no
       fi
       ;;
 
@@ -9184,17 +9575,16 @@
       case $host_os in
       solaris2.[0-5] | solaris2.[0-5].*) ;;
       *)
- 	# The compiler driver will combine linker options so we
- 	# cannot just pass the convience library names through
- 	# without $wl, iff we do not link with $LD.
- 	# Luckily, gcc supports the same syntax we need for Sun Studio.
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
  	# Supported since Solaris 2.6 (maybe 2.5.1?)
- 	case $wlarc in
- 	'')
- 	  whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
- 	*)
- 	  whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
- 	esac ;;
+	if test "$GCC" = yes; then
+	  whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+	fi
+	;;
       esac
       link_all_deplibs=yes
       ;;
@@ -9251,7 +9641,7 @@
       fi
       ;;
 
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
       no_undefined_flag='${wl}-z,text'
       archive_cmds_need_lc=no
       hardcode_shlibpath_var=no
@@ -9328,7 +9718,7 @@
       { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
       $rm conftest*
-      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
       if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
@@ -9386,17 +9776,55 @@
 version_type=none
 dynamic_linker="$host_os ld.so"
 sys_lib_dlsearch_path_spec="/lib /usr/lib"
+
 if test "$GCC" = yes; then
-  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then
     # if the path contains ";" then we assume it to be the separator
     # otherwise default to the standard path separator (i.e. ":") - it is
     # assumed that no part of a normal pathname contains ";" but that should
     # okay in the real world where ";" in dirpaths is itself problematic.
-    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'`
   else
-    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
   fi
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[lt_foo]++; }
+  if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+  sys_lib_search_path_spec=`echo $lt_search_path_spec`
 else
   sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
 fi
@@ -9417,7 +9845,7 @@
   soname_spec='${libname}${release}${shared_ext}$major'
   ;;
 
-aix4* | aix5*)
+aix[4-9]*)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -9556,12 +9984,8 @@
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
   shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
-  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
-  if test "$GCC" = yes; then
-    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
-  else
-    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
-  fi
+
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
   sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
   ;;
 
@@ -9578,18 +10002,6 @@
   dynamic_linker=no
   ;;
 
-kfreebsd*-gnu)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='GNU ld.so'
-  ;;
-
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -9627,7 +10039,7 @@
     shlibpath_overrides_runpath=no
     hardcode_into_libs=yes
     ;;
-  freebsd*) # from 4.6 on
+  *) # from 4.6 on, and DragonFly
     shlibpath_overrides_runpath=yes
     hardcode_into_libs=yes
     ;;
@@ -9690,7 +10102,7 @@
   postinstall_cmds='chmod 555 $lib'
   ;;
 
-interix3*)
+interix[3-9]*)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -9745,7 +10157,7 @@
   ;;
 
 # This must be Linux ELF.
-linux*)
+linux* | k*bsd*-gnu)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -9761,7 +10173,7 @@
 
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
@@ -9774,7 +10186,7 @@
   dynamic_linker='GNU/Linux ld.so'
   ;;
 
-knetbsd*-gnu)
+netbsdelf*-gnu)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -9783,7 +10195,7 @@
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
-  dynamic_linker='GNU ld.so'
+  dynamic_linker='NetBSD ld.elf_so'
   ;;
 
 netbsd*)
@@ -9867,6 +10279,10 @@
   sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
   ;;
 
+rdos*)
+  dynamic_linker=no
+  ;;
+
 solaris*)
   version_type=linux
   need_lib_prefix=no
@@ -9963,6 +10379,21 @@
 echo "${ECHO_T}$dynamic_linker" >&6; }
 test "$dynamic_linker" = no && can_build_shared=no
 
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"
+fi
+
+sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"
+fi
+
+sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
 if test "$GCC" = yes; then
   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
@@ -10020,6 +10451,7 @@
    darwin*)
        if test -n "$STRIP" ; then
          striplib="$STRIP -x"
+         old_striplib="$STRIP -S"
          { echo "$as_me:$LINENO: result: yes" >&5
 echo "${ECHO_T}yes" >&6; }
        else
@@ -10281,7 +10713,7 @@
 { echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
 echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
 if test $ac_cv_lib_dld_shl_load = yes; then
-  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
 else
   { echo "$as_me:$LINENO: checking for dlopen" >&5
 echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; }
@@ -10557,7 +10989,7 @@
 { echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
 echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; }
 if test $ac_cv_lib_dld_dld_link = yes; then
-  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
 fi
 
 
@@ -10606,7 +11038,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 10609 "configure"
+#line 11041 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10706,7 +11138,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 10709 "configure"
+#line 11141 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10833,7 +11265,7 @@
   fi
   ;;
 
-aix4* | aix5*)
+aix[4-9]*)
   if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
     test "$enable_shared" = yes && enable_static=no
   fi
@@ -10889,6 +11321,7 @@
     predeps \
     postdeps \
     compiler_lib_search_path \
+    compiler_lib_search_dirs \
     archive_cmds \
     archive_expsym_cmds \
     postinstall_cmds \
@@ -10904,6 +11337,7 @@
     module_cmds \
     module_expsym_cmds \
     lt_cv_prog_compiler_c_o \
+    fix_srcfile_path \
     exclude_expsyms \
     include_expsyms; do
 
@@ -10948,7 +11382,7 @@
 # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
 # Free Software Foundation, Inc.
 #
 # This file is part of GNU Libtool:
@@ -11184,6 +11618,10 @@
 # shared library.
 postdeps=$lt_postdeps
 
+# The directories searched by this compiler when creating a shared
+# library
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs
+
 # The library search path used internally by the compiler when linking
 # a shared library.
 compiler_lib_search_path=$lt_compiler_lib_search_path
@@ -11272,7 +11710,7 @@
 sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
 
 # Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path="$fix_srcfile_path"
+fix_srcfile_path=$lt_fix_srcfile_path
 
 # Set to yes if exported symbols are required.
 always_export_symbols=$always_export_symbols
@@ -11432,6 +11870,7 @@
 predeps_CXX=
 postdeps_CXX=
 compiler_lib_search_path_CXX=
+compiler_lib_search_dirs_CXX=
 
 # Source file extension for C++ test sources.
 ac_ext=cpp
@@ -11441,10 +11880,10 @@
 objext_CXX=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;\n"
+lt_simple_compile_test_code="int some_variable = 0;"
 
 # Code to be used in simple link tests
-lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n'
+lt_simple_link_test_code='int main(int, char *[]) { return(0); }'
 
 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 
@@ -11460,16 +11899,16 @@
 
 # save warnings/boilerplate of simple test code
 ac_outfile=conftest.$ac_objext
-printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
 eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_compiler_boilerplate=`cat conftest.err`
 $rm conftest*
 
 ac_outfile=conftest.$ac_objext
-printf "$lt_simple_link_test_code" >conftest.$ac_ext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
 eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_linker_boilerplate=`cat conftest.err`
-$rm conftest*
+$rm -r conftest*
 
 
 # Allow CC to be a program name with arguments.
@@ -11676,7 +12115,7 @@
     # FIXME: insert proper C++ library support
     ld_shlibs_CXX=no
     ;;
-  aix4* | aix5*)
+  aix[4-9]*)
     if test "$host_cpu" = ia64; then
       # On IA64, the linker does run time linking by default, so we don't
       # have to do anything special.
@@ -11689,7 +12128,7 @@
       # Test if we are trying to use run time linking or normal
       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
       # need to do runtime linking.
-      case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+      case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
 	for ld_flag in $LDFLAGS; do
 	  case $ld_flag in
 	  *-brtl*)
@@ -11725,7 +12164,7 @@
 	   strings "$collect2name" | grep resolve_lib_name >/dev/null
 	then
 	  # We have reworked collect2
-	  hardcode_direct_CXX=yes
+	  :
 	else
 	  # We have old collect2
 	  hardcode_direct_CXX=unsupported
@@ -11799,11 +12238,18 @@
        } && test -s conftest$ac_exeext &&
        $as_test_x conftest$ac_exeext; then
 
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
-}'`
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
 # Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
-}'`; fi
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
@@ -11859,11 +12305,18 @@
        } && test -s conftest$ac_exeext &&
        $as_test_x conftest$ac_exeext; then
 
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
-}'`
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
 # Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
-}'`; fi
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
@@ -11933,59 +12386,31 @@
     fi
   ;;
       darwin* | rhapsody*)
-        case $host_os in
-        rhapsody* | darwin1.[012])
-         allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress'
-         ;;
-       *) # Darwin 1.3 on
-         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
-           allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
-         else
-           case ${MACOSX_DEPLOYMENT_TARGET} in
-             10.[012])
-               allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
-               ;;
-             10.*)
-               allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup'
-               ;;
-           esac
-         fi
-         ;;
-        esac
       archive_cmds_need_lc_CXX=no
       hardcode_direct_CXX=no
       hardcode_automatic_CXX=yes
       hardcode_shlibpath_var_CXX=unsupported
       whole_archive_flag_spec_CXX=''
       link_all_deplibs_CXX=yes
-
-    if test "$GXX" = yes ; then
-      lt_int_apple_cc_single_mod=no
+      allow_undefined_flag_CXX="$_lt_dar_allow_undefined"
+      if test "$GXX" = yes ; then
       output_verbose_link_cmd='echo'
-      if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
-       lt_int_apple_cc_single_mod=yes
+      archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+      module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+      archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+      module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+      if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+        archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+        archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
       fi
-      if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
-       archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
       else
-          archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
-        fi
-        module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-        # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-          if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
-            archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          else
-            archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          fi
-            module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-      else
       case $cc_basename in
         xlc*)
          output_verbose_link_cmd='echo'
-          archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+          archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
           module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
           # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-          archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
           module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
           ;;
        *)
@@ -12019,7 +12444,7 @@
   freebsd-elf*)
     archive_cmds_need_lc_CXX=no
     ;;
-  freebsd* | kfreebsd*-gnu | dragonfly*)
+  freebsd* | dragonfly*)
     # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
     # conventions
     ld_shlibs_CXX=yes
@@ -12068,9 +12493,7 @@
       hardcode_libdir_separator_CXX=:
 
       case $host_cpu in
-      hppa*64*|ia64*)
-	hardcode_libdir_flag_spec_ld_CXX='+b $libdir'
-        ;;
+      hppa*64*|ia64*) ;;
       *)
 	export_dynamic_flag_spec_CXX='${wl}-E'
         ;;
@@ -12138,7 +12561,7 @@
 	;;
     esac
     ;;
-  interix3*)
+  interix[3-9]*)
     hardcode_direct_CXX=no
     hardcode_shlibpath_var_CXX=no
     hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
@@ -12178,7 +12601,7 @@
     hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
     hardcode_libdir_separator_CXX=:
     ;;
-  linux*)
+  linux* | k*bsd*-gnu)
     case $cc_basename in
       KCC*)
 	# Kuck and Associates, Inc. (KAI) C++ Compiler
@@ -12230,7 +12653,7 @@
 	export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
 	whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
 	;;
-      pgCC*)
+      pgCC* | pgcpp*)
         # Portland Group C++ compiler
 	archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
   	archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
@@ -12258,6 +12681,29 @@
 	# dependencies.
 	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
 	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C++ 5.9
+	  no_undefined_flag_CXX=' -zdefs'
+	  archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	  archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	  hardcode_libdir_flag_spec_CXX='-R$libdir'
+	  whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+
+	  # Not sure whether something based on
+	  # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+	  # would be better.
+	  output_verbose_link_cmd='echo'
+
+	  # Archives containing C++ object files must be created using
+	  # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	  # necessary to make sure instantiated templates are included
+	  # in the archive.
+	  old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+	  ;;
+	esac
+	;;
     esac
     ;;
   lynxos*)
@@ -12280,7 +12726,7 @@
 	;;
     esac
     ;;
-  netbsd*)
+  netbsd* | netbsdelf*-gnu)
     if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
       archive_cmds_CXX='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
       wlarc=
@@ -12296,16 +12742,20 @@
     ld_shlibs_CXX=no
     ;;
   openbsd*)
-    hardcode_direct_CXX=yes
-    hardcode_shlibpath_var_CXX=no
-    archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
-    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
-    if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-      archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
-      export_dynamic_flag_spec_CXX='${wl}-E'
-      whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    if test -f /usr/libexec/ld.so; then
+      hardcode_direct_CXX=yes
+      hardcode_shlibpath_var_CXX=no
+      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	export_dynamic_flag_spec_CXX='${wl}-E'
+	whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      fi
+      output_verbose_link_cmd='echo'
+    else
+      ld_shlibs_CXX=no
     fi
-    output_verbose_link_cmd='echo'
     ;;
   osf3*)
     case $cc_basename in
@@ -12467,15 +12917,10 @@
 	case $host_os in
 	  solaris2.[0-5] | solaris2.[0-5].*) ;;
 	  *)
-	    # The C++ compiler is used as linker so we must use $wl
-	    # flag to pass the commands to the underlying system
-	    # linker. We must also pass each convience library through
-	    # to the system linker between allextract/defaultextract.
-	    # The C++ compiler will combine linker options so we
-	    # cannot just pass the convience library names through
-	    # without $wl.
+	    # The compiler driver will combine and reorder linker options,
+	    # but understands `-z linker_flag'.
 	    # Supported since Solaris 2.6 (maybe 2.5.1?)
-	    whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract'
+	    whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'
 	    ;;
 	esac
 	link_all_deplibs_CXX=yes
@@ -12522,6 +12967,12 @@
 	  fi
 
 	  hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
+	  case $host_os in
+	  solaris2.[0-5] | solaris2.[0-5].*) ;;
+	  *)
+	    whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	    ;;
+	  esac
 	fi
 	;;
     esac
@@ -12609,7 +13060,6 @@
 GCC_CXX="$GXX"
 LD_CXX="$LD"
 
-
 cat > conftest.$ac_ext <<EOF
 class Foo
 {
@@ -12711,9 +13161,14 @@
 
 $rm -f confest.$objext
 
+compiler_lib_search_dirs_CXX=
+if test -n "$compiler_lib_search_path_CXX"; then
+  compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+
 # PORTME: override above test on systems where it is broken
 case $host_os in
-interix3*)
+interix[3-9]*)
   # Interix 3.5 installs completely hosed .la files for C++, so rather than
   # hack all around it, let's just trust "g++" to DTRT.
   predep_objects_CXX=
@@ -12721,19 +13176,51 @@
   postdeps_CXX=
   ;;
 
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+    #
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+    if test "$solaris_use_stlport4" != yes; then
+      postdeps_CXX='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
 solaris*)
   case $cc_basename in
   CC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
     # Adding this requires a known-good setup of shared libraries for
     # Sun compiler versions before 5.6, else PIC objects from an old
     # archive will be linked into the output, leading to subtle bugs.
-    postdeps_CXX='-lCstd -lCrun'
+    if test "$solaris_use_stlport4" != yes; then
+      postdeps_CXX='-library=Cstd -library=Crun'
+    fi
     ;;
   esac
   ;;
 esac
 
-
 case " $postdeps_CXX " in
 *" -lc "*) archive_cmds_need_lc_CXX=no ;;
 esac
@@ -12764,12 +13251,14 @@
       # like `-m68040'.
       lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'
       ;;
-    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
       # PIC is the default for these OSes.
       ;;
-    mingw* | os2* | pw32*)
+    mingw* | cygwin* | os2* | pw32*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
       lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
       ;;
     darwin* | rhapsody*)
@@ -12781,7 +13270,7 @@
       # DJGPP does not support shared libraries at all
       lt_prog_compiler_pic_CXX=
       ;;
-    interix3*)
+    interix[3-9]*)
       # Interix 3.x gcc -fpic/-fPIC options generate broken code.
       # Instead, we relocate shared libraries at runtime.
       ;;
@@ -12807,7 +13296,7 @@
     esac
   else
     case $host_os in
-      aix4* | aix5*)
+      aix[4-9]*)
 	# All AIX code is PIC.
 	if test "$host_cpu" = ia64; then
 	  # AIX 5 now supports IA64 processor
@@ -12847,7 +13336,7 @@
 	    ;;
 	esac
 	;;
-      freebsd* | kfreebsd*-gnu | dragonfly*)
+      freebsd* | dragonfly*)
 	# FreeBSD uses GNU C++
 	;;
       hpux9* | hpux10* | hpux11*)
@@ -12890,7 +13379,7 @@
 	    ;;
 	esac
 	;;
-      linux*)
+      linux* | k*bsd*-gnu)
 	case $cc_basename in
 	  KCC*)
 	    # KAI C++ Compiler
@@ -12903,7 +13392,7 @@
 	    lt_prog_compiler_pic_CXX='-KPIC'
 	    lt_prog_compiler_static_CXX='-static'
 	    ;;
-	  pgCC*)
+	  pgCC* | pgcpp*)
 	    # Portland Group C++ compiler.
 	    lt_prog_compiler_wl_CXX='-Wl,'
 	    lt_prog_compiler_pic_CXX='-fpic'
@@ -12917,6 +13406,14 @@
 	    lt_prog_compiler_static_CXX='-non_shared'
 	    ;;
 	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      lt_prog_compiler_pic_CXX='-KPIC'
+	      lt_prog_compiler_static_CXX='-Bstatic'
+	      lt_prog_compiler_wl_CXX='-Qoption ld '
+	      ;;
+	    esac
 	    ;;
 	esac
 	;;
@@ -12933,7 +13430,7 @@
 	    ;;
 	esac
 	;;
-      netbsd*)
+      netbsd* | netbsdelf*-gnu)
 	;;
       osf3* | osf4* | osf5*)
 	case $cc_basename in
@@ -13026,12 +13523,12 @@
 
 { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6; }
-if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then
+if test "${lt_cv_prog_compiler_pic_works_CXX+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  lt_prog_compiler_pic_works_CXX=no
+  lt_cv_prog_compiler_pic_works_CXX=no
   ac_outfile=conftest.$ac_objext
-   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
    lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
    # Insert the option either (1) after the last *FLAGS variable, or
    # (2) before a word containing "conftest.", or (3) at the end.
@@ -13042,27 +13539,27 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13045: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13542: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:13049: \$? = $ac_status" >&5
+   echo "$as_me:13546: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
      $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       lt_prog_compiler_pic_works_CXX=yes
+       lt_cv_prog_compiler_pic_works_CXX=yes
      fi
    fi
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6; }
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_CXX" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_CXX" >&6; }
 
-if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then
+if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then
     case $lt_prog_compiler_pic_CXX in
      "" | " "*) ;;
      *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
@@ -13089,13 +13586,13 @@
 wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
 { echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
-if test "${lt_prog_compiler_static_works_CXX+set}" = set; then
+if test "${lt_cv_prog_compiler_static_works_CXX+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  lt_prog_compiler_static_works_CXX=no
+  lt_cv_prog_compiler_static_works_CXX=no
    save_LDFLAGS="$LDFLAGS"
    LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
-   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
    if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
      # The linker can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -13105,20 +13602,20 @@
        $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
-         lt_prog_compiler_static_works_CXX=yes
+         lt_cv_prog_compiler_static_works_CXX=yes
        fi
      else
-       lt_prog_compiler_static_works_CXX=yes
+       lt_cv_prog_compiler_static_works_CXX=yes
      fi
    fi
-   $rm conftest*
+   $rm -r conftest*
    LDFLAGS="$save_LDFLAGS"
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5
-echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6; }
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_CXX" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_static_works_CXX" >&6; }
 
-if test x"$lt_prog_compiler_static_works_CXX" = xyes; then
+if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then
     :
 else
     lt_prog_compiler_static_CXX=
@@ -13135,7 +13632,7 @@
    mkdir conftest
    cd conftest
    mkdir out
-   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
    lt_compiler_flag="-o out/conftest2.$ac_objext"
    # Insert the option either (1) after the last *FLAGS variable, or
@@ -13146,11 +13643,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13149: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13646: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:13153: \$? = $ac_status" >&5
+   echo "$as_me:13650: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -13203,7 +13700,7 @@
 
   export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
   case $host_os in
-  aix4* | aix5*)
+  aix[4-9]*)
     # If we're using GNU nm, then we don't want the "-C" option.
     # -C means demangle to AIX nm, but means don't demangle with GNU nm
     if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
@@ -13216,12 +13713,16 @@
     export_symbols_cmds_CXX="$ltdll_cmds"
   ;;
   cygwin* | mingw*)
-    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
   ;;
+  linux* | k*bsd*-gnu)
+    link_all_deplibs_CXX=no
+  ;;
   *)
     export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
   ;;
   esac
+  exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
 
 { echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
 echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
@@ -13247,7 +13748,7 @@
       { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
       $rm conftest*
-      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
       if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
@@ -13305,20 +13806,7 @@
 version_type=none
 dynamic_linker="$host_os ld.so"
 sys_lib_dlsearch_path_spec="/lib /usr/lib"
-if test "$GCC" = yes; then
-  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
-    # if the path contains ";" then we assume it to be the separator
-    # otherwise default to the standard path separator (i.e. ":") - it is
-    # assumed that no part of a normal pathname contains ";" but that should
-    # okay in the real world where ";" in dirpaths is itself problematic.
-    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-  else
-    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-  fi
-else
-  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
-fi
+
 need_lib_prefix=unknown
 hardcode_into_libs=no
 
@@ -13336,7 +13824,7 @@
   soname_spec='${libname}${release}${shared_ext}$major'
   ;;
 
-aix4* | aix5*)
+aix[4-9]*)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -13475,12 +13963,7 @@
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
   shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
-  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
-  if test "$GCC" = yes; then
-    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
-  else
-    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
-  fi
+
   sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
   ;;
 
@@ -13497,18 +13980,6 @@
   dynamic_linker=no
   ;;
 
-kfreebsd*-gnu)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='GNU ld.so'
-  ;;
-
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -13546,7 +14017,7 @@
     shlibpath_overrides_runpath=no
     hardcode_into_libs=yes
     ;;
-  freebsd*) # from 4.6 on
+  *) # from 4.6 on, and DragonFly
     shlibpath_overrides_runpath=yes
     hardcode_into_libs=yes
     ;;
@@ -13609,7 +14080,7 @@
   postinstall_cmds='chmod 555 $lib'
   ;;
 
-interix3*)
+interix[3-9]*)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -13664,7 +14135,7 @@
   ;;
 
 # This must be Linux ELF.
-linux*)
+linux* | k*bsd*-gnu)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -13680,7 +14151,7 @@
 
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
@@ -13693,7 +14164,7 @@
   dynamic_linker='GNU/Linux ld.so'
   ;;
 
-knetbsd*-gnu)
+netbsdelf*-gnu)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -13702,7 +14173,7 @@
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
-  dynamic_linker='GNU ld.so'
+  dynamic_linker='NetBSD ld.elf_so'
   ;;
 
 netbsd*)
@@ -13786,6 +14257,10 @@
   sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
   ;;
 
+rdos*)
+  dynamic_linker=no
+  ;;
+
 solaris*)
   version_type=linux
   need_lib_prefix=no
@@ -13882,6 +14357,21 @@
 echo "${ECHO_T}$dynamic_linker" >&6; }
 test "$dynamic_linker" = no && can_build_shared=no
 
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"
+fi
+
+sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"
+fi
+
+sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
 if test "$GCC" = yes; then
   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
@@ -13965,6 +14455,7 @@
     predeps_CXX \
     postdeps_CXX \
     compiler_lib_search_path_CXX \
+    compiler_lib_search_dirs_CXX \
     archive_cmds_CXX \
     archive_expsym_cmds_CXX \
     postinstall_cmds_CXX \
@@ -13980,6 +14471,7 @@
     module_cmds_CXX \
     module_expsym_cmds_CXX \
     lt_cv_prog_compiler_c_o_CXX \
+    fix_srcfile_path_CXX \
     exclude_expsyms_CXX \
     include_expsyms_CXX; do
 
@@ -14212,6 +14704,10 @@
 # shared library.
 postdeps=$lt_postdeps_CXX
 
+# The directories searched by this compiler when creating a shared
+# library
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX
+
 # The library search path used internally by the compiler when linking
 # a shared library.
 compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
@@ -14300,7 +14796,7 @@
 sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
 
 # Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path="$fix_srcfile_path_CXX"
+fix_srcfile_path=$lt_fix_srcfile_path
 
 # Set to yes if exported symbols are required.
 always_export_symbols=$always_export_symbols_CXX
@@ -14391,10 +14887,17 @@
 objext_F77=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="      subroutine t\n      return\n      end\n"
+lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
 
 # Code to be used in simple link tests
-lt_simple_link_test_code="      program t\n      end\n"
+lt_simple_link_test_code="\
+      program t
+      end
+"
 
 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 
@@ -14410,16 +14913,16 @@
 
 # save warnings/boilerplate of simple test code
 ac_outfile=conftest.$ac_objext
-printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
 eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_compiler_boilerplate=`cat conftest.err`
 $rm conftest*
 
 ac_outfile=conftest.$ac_objext
-printf "$lt_simple_link_test_code" >conftest.$ac_ext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
 eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_linker_boilerplate=`cat conftest.err`
-$rm conftest*
+$rm -r conftest*
 
 
 # Allow CC to be a program name with arguments.
@@ -14457,7 +14960,7 @@
     postinstall_cmds='$RANLIB $lib'
   fi
   ;;
-aix4* | aix5*)
+aix[4-9]*)
   if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
     test "$enable_shared" = yes && enable_static=no
   fi
@@ -14503,13 +15006,15 @@
       lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4'
       ;;
 
-    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
       # PIC is the default for these OSes.
       ;;
 
-    mingw* | pw32* | os2*)
+    mingw* | cygwin* | pw32* | os2*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
       lt_prog_compiler_pic_F77='-DDLL_EXPORT'
       ;;
 
@@ -14519,7 +15024,7 @@
       lt_prog_compiler_pic_F77='-fno-common'
       ;;
 
-    interix3*)
+    interix[3-9]*)
       # Interix 3.x gcc -fpic/-fPIC options generate broken code.
       # Instead, we relocate shared libraries at runtime.
       ;;
@@ -14577,7 +15082,7 @@
        esac
        ;;
 
-    mingw* | pw32* | os2*)
+    mingw* | cygwin* | pw32* | os2*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
       lt_prog_compiler_pic_F77='-DDLL_EXPORT'
@@ -14610,7 +15115,7 @@
       lt_prog_compiler_static_F77='-Bstatic'
       ;;
 
-    linux*)
+    linux* | k*bsd*-gnu)
       case $cc_basename in
       icc* | ecc*)
 	lt_prog_compiler_wl_F77='-Wl,'
@@ -14629,6 +15134,22 @@
         # All Alpha code is PIC.
         lt_prog_compiler_static_F77='-non_shared'
         ;;
+      *)
+        case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C 5.9
+	  lt_prog_compiler_pic_F77='-KPIC'
+	  lt_prog_compiler_static_F77='-Bstatic'
+	  lt_prog_compiler_wl_F77='-Wl,'
+	  ;;
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic_F77='-KPIC'
+	  lt_prog_compiler_static_F77='-Bstatic'
+	  lt_prog_compiler_wl_F77=''
+	  ;;
+	esac
+	;;
       esac
       ;;
 
@@ -14638,6 +15159,10 @@
       lt_prog_compiler_static_F77='-non_shared'
       ;;
 
+    rdos*)
+      lt_prog_compiler_static_F77='-non_shared'
+      ;;
+
     solaris*)
       lt_prog_compiler_pic_F77='-KPIC'
       lt_prog_compiler_static_F77='-Bstatic'
@@ -14700,12 +15225,12 @@
 
 { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5
 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6; }
-if test "${lt_prog_compiler_pic_works_F77+set}" = set; then
+if test "${lt_cv_prog_compiler_pic_works_F77+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  lt_prog_compiler_pic_works_F77=no
+  lt_cv_prog_compiler_pic_works_F77=no
   ac_outfile=conftest.$ac_objext
-   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
    lt_compiler_flag="$lt_prog_compiler_pic_F77"
    # Insert the option either (1) after the last *FLAGS variable, or
    # (2) before a word containing "conftest.", or (3) at the end.
@@ -14716,27 +15241,27 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14719: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15244: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:14723: \$? = $ac_status" >&5
+   echo "$as_me:15248: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
      $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       lt_prog_compiler_pic_works_F77=yes
+       lt_cv_prog_compiler_pic_works_F77=yes
      fi
    fi
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6; }
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_F77" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_F77" >&6; }
 
-if test x"$lt_prog_compiler_pic_works_F77" = xyes; then
+if test x"$lt_cv_prog_compiler_pic_works_F77" = xyes; then
     case $lt_prog_compiler_pic_F77 in
      "" | " "*) ;;
      *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;;
@@ -14763,13 +15288,13 @@
 wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\"
 { echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
-if test "${lt_prog_compiler_static_works_F77+set}" = set; then
+if test "${lt_cv_prog_compiler_static_works_F77+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  lt_prog_compiler_static_works_F77=no
+  lt_cv_prog_compiler_static_works_F77=no
    save_LDFLAGS="$LDFLAGS"
    LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
-   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
    if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
      # The linker can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -14779,20 +15304,20 @@
        $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
-         lt_prog_compiler_static_works_F77=yes
+         lt_cv_prog_compiler_static_works_F77=yes
        fi
      else
-       lt_prog_compiler_static_works_F77=yes
+       lt_cv_prog_compiler_static_works_F77=yes
      fi
    fi
-   $rm conftest*
+   $rm -r conftest*
    LDFLAGS="$save_LDFLAGS"
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5
-echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6; }
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_F77" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_static_works_F77" >&6; }
 
-if test x"$lt_prog_compiler_static_works_F77" = xyes; then
+if test x"$lt_cv_prog_compiler_static_works_F77" = xyes; then
     :
 else
     lt_prog_compiler_static_F77=
@@ -14809,7 +15334,7 @@
    mkdir conftest
    cd conftest
    mkdir out
-   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
    lt_compiler_flag="-o out/conftest2.$ac_objext"
    # Insert the option either (1) after the last *FLAGS variable, or
@@ -14820,11 +15345,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14823: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15348: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:14827: \$? = $ac_status" >&5
+   echo "$as_me:15352: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -14904,12 +15429,13 @@
   # it will be wrapped by ` (' and `)$', so one must not match beginning or
   # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
   # as well as any symbol that contains `d'.
-  exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_"
+  exclude_expsyms_F77='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
   # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
   # platforms (ab)use it in PIC code, but their linkers get confused if
   # the symbol is explicitly referenced.  Since portable code cannot
   # rely on this symbol name, it's probably fine to never include it in
   # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
   extract_expsyms_cmds=
   # Just being paranoid about ensuring that cc_basename is set.
   for cc_temp in $compiler""; do
@@ -14968,7 +15494,7 @@
 
     # See if GNU ld supports shared libraries.
     case $host_os in
-    aix3* | aix4* | aix5*)
+    aix[3-9]*)
       # On AIX/PPC, the GNU linker is very broken
       if test "$host_cpu" != ia64; then
 	ld_shlibs_F77=no
@@ -15016,7 +15542,7 @@
       allow_undefined_flag_F77=unsupported
       always_export_symbols_F77=no
       enable_shared_with_static_runtimes_F77=yes
-      export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+      export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
 
       if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
         archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
@@ -15034,7 +15560,7 @@
       fi
       ;;
 
-    interix3*)
+    interix[3-9]*)
       hardcode_direct_F77=no
       hardcode_shlibpath_var_F77=no
       hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
@@ -15049,7 +15575,7 @@
       archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
 
-    linux*)
+    gnu* | linux* | k*bsd*-gnu)
       if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
 	tmp_addflag=
 	case $cc_basename,$host_cpu in
@@ -15067,20 +15593,30 @@
 	ifc* | ifort*)			# Intel Fortran compiler
 	  tmp_addflag=' -nofor_main' ;;
 	esac
-	archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  whole_archive_flag_spec_F77='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	*)
+	  tmp_sharedflag='-shared' ;;
+	esac
+	archive_cmds_F77='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
 
 	if test $supports_anon_versioning = yes; then
 	  archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~
   cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
   $echo "local: *; };" >> $output_objdir/$libname.ver~
-	  $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
 	fi
+	link_all_deplibs_F77=no
       else
 	ld_shlibs_F77=no
       fi
       ;;
 
-    netbsd*)
+    netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
 	archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
@@ -15178,7 +15714,7 @@
       fi
       ;;
 
-    aix4* | aix5*)
+    aix[4-9]*)
       if test "$host_cpu" = ia64; then
 	# On IA64, the linker does run time linking by default, so we don't
 	# have to do anything special.
@@ -15198,7 +15734,7 @@
 	# Test if we are trying to use run time linking or normal
 	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
 	# need to do runtime linking.
-	case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+	case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
 	  for ld_flag in $LDFLAGS; do
   	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
   	    aix_use_runtimelinking=yes
@@ -15232,7 +15768,7 @@
   	   strings "$collect2name" | grep resolve_lib_name >/dev/null
 	  then
   	  # We have reworked collect2
-  	  hardcode_direct_F77=yes
+  	  :
 	  else
   	  # We have old collect2
   	  hardcode_direct_F77=unsupported
@@ -15296,11 +15832,18 @@
        } && test -s conftest$ac_exeext &&
        $as_test_x conftest$ac_exeext; then
 
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
-}'`
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
 # Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
-}'`; fi
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
@@ -15345,11 +15888,18 @@
        } && test -s conftest$ac_exeext &&
        $as_test_x conftest$ac_exeext; then
 
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
-}'`
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
 # Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
-}'`; fi
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
@@ -15403,7 +15953,7 @@
       # The linker will automatically build a .lib file if we build a DLL.
       old_archive_From_new_cmds_F77='true'
       # FIXME: Should let the user specify the lib program.
-      old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      old_archive_cmds_F77='lib -OUT:$oldlib$oldobjs$old_deplibs'
       fix_srcfile_path_F77='`cygpath -w "$srcfile"`'
       enable_shared_with_static_runtimes_F77=yes
       ;;
@@ -15436,19 +15986,18 @@
       link_all_deplibs_F77=yes
     if test "$GCC" = yes ; then
     	output_verbose_link_cmd='echo'
-        archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
-      module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-      archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-      module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        archive_cmds_F77="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+        module_cmds_F77="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+        archive_expsym_cmds_F77="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+        module_expsym_cmds_F77="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
     else
       case $cc_basename in
         xlc*)
          output_verbose_link_cmd='echo'
-         archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+         archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
          module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
           # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-         archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+         archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
           module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
           ;;
        *)
@@ -15488,7 +16037,7 @@
       ;;
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | kfreebsd*-gnu | dragonfly*)
+    freebsd* | dragonfly*)
       archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec_F77='-R$libdir'
       hardcode_direct_F77=yes
@@ -15590,7 +16139,7 @@
       link_all_deplibs_F77=yes
       ;;
 
-    netbsd*)
+    netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
 	archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
       else
@@ -15610,24 +16159,28 @@
       ;;
 
     openbsd*)
-      hardcode_direct_F77=yes
-      hardcode_shlibpath_var_F77=no
-      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-	hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
-	export_dynamic_flag_spec_F77='${wl}-E'
+      if test -f /usr/libexec/ld.so; then
+	hardcode_direct_F77=yes
+	hardcode_shlibpath_var_F77=no
+	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+	  export_dynamic_flag_spec_F77='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	     archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     hardcode_libdir_flag_spec_F77='-R$libdir'
+	     ;;
+	   *)
+	     archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+        fi
       else
-       case $host_os in
-	 openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
-	   archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-	   hardcode_libdir_flag_spec_F77='-R$libdir'
-	   ;;
-	 *)
-	   archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	   hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
-	   ;;
-       esac
+	ld_shlibs_F77=no
       fi
       ;;
 
@@ -15686,17 +16239,16 @@
       case $host_os in
       solaris2.[0-5] | solaris2.[0-5].*) ;;
       *)
- 	# The compiler driver will combine linker options so we
- 	# cannot just pass the convience library names through
- 	# without $wl, iff we do not link with $LD.
- 	# Luckily, gcc supports the same syntax we need for Sun Studio.
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
  	# Supported since Solaris 2.6 (maybe 2.5.1?)
- 	case $wlarc in
- 	'')
- 	  whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;;
- 	*)
- 	  whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
- 	esac ;;
+	if test "$GCC" = yes; then
+	  whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract'
+	fi
+	;;
       esac
       link_all_deplibs_F77=yes
       ;;
@@ -15753,7 +16305,7 @@
       fi
       ;;
 
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
       no_undefined_flag_F77='${wl}-z,text'
       archive_cmds_need_lc_F77=no
       hardcode_shlibpath_var_F77=no
@@ -15830,7 +16382,7 @@
       { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
       $rm conftest*
-      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
       if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
@@ -15888,20 +16440,7 @@
 version_type=none
 dynamic_linker="$host_os ld.so"
 sys_lib_dlsearch_path_spec="/lib /usr/lib"
-if test "$GCC" = yes; then
-  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
-    # if the path contains ";" then we assume it to be the separator
-    # otherwise default to the standard path separator (i.e. ":") - it is
-    # assumed that no part of a normal pathname contains ";" but that should
-    # okay in the real world where ";" in dirpaths is itself problematic.
-    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-  else
-    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-  fi
-else
-  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
-fi
+
 need_lib_prefix=unknown
 hardcode_into_libs=no
 
@@ -15919,7 +16458,7 @@
   soname_spec='${libname}${release}${shared_ext}$major'
   ;;
 
-aix4* | aix5*)
+aix[4-9]*)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -16058,12 +16597,7 @@
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
   shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
-  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
-  if test "$GCC" = yes; then
-    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
-  else
-    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
-  fi
+
   sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
   ;;
 
@@ -16080,18 +16614,6 @@
   dynamic_linker=no
   ;;
 
-kfreebsd*-gnu)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='GNU ld.so'
-  ;;
-
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -16129,7 +16651,7 @@
     shlibpath_overrides_runpath=no
     hardcode_into_libs=yes
     ;;
-  freebsd*) # from 4.6 on
+  *) # from 4.6 on, and DragonFly
     shlibpath_overrides_runpath=yes
     hardcode_into_libs=yes
     ;;
@@ -16192,7 +16714,7 @@
   postinstall_cmds='chmod 555 $lib'
   ;;
 
-interix3*)
+interix[3-9]*)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -16247,7 +16769,7 @@
   ;;
 
 # This must be Linux ELF.
-linux*)
+linux* | k*bsd*-gnu)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -16263,7 +16785,7 @@
 
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
@@ -16276,7 +16798,7 @@
   dynamic_linker='GNU/Linux ld.so'
   ;;
 
-knetbsd*-gnu)
+netbsdelf*-gnu)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -16285,7 +16807,7 @@
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
-  dynamic_linker='GNU ld.so'
+  dynamic_linker='NetBSD ld.elf_so'
   ;;
 
 netbsd*)
@@ -16369,6 +16891,10 @@
   sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
   ;;
 
+rdos*)
+  dynamic_linker=no
+  ;;
+
 solaris*)
   version_type=linux
   need_lib_prefix=no
@@ -16465,6 +16991,21 @@
 echo "${ECHO_T}$dynamic_linker" >&6; }
 test "$dynamic_linker" = no && can_build_shared=no
 
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"
+fi
+
+sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"
+fi
+
+sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
 if test "$GCC" = yes; then
   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
@@ -16548,6 +17089,7 @@
     predeps_F77 \
     postdeps_F77 \
     compiler_lib_search_path_F77 \
+    compiler_lib_search_dirs_F77 \
     archive_cmds_F77 \
     archive_expsym_cmds_F77 \
     postinstall_cmds_F77 \
@@ -16563,6 +17105,7 @@
     module_cmds_F77 \
     module_expsym_cmds_F77 \
     lt_cv_prog_compiler_c_o_F77 \
+    fix_srcfile_path_F77 \
     exclude_expsyms_F77 \
     include_expsyms_F77; do
 
@@ -16795,6 +17338,10 @@
 # shared library.
 postdeps=$lt_postdeps_F77
 
+# The directories searched by this compiler when creating a shared
+# library
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_F77
+
 # The library search path used internally by the compiler when linking
 # a shared library.
 compiler_lib_search_path=$lt_compiler_lib_search_path_F77
@@ -16883,7 +17430,7 @@
 sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
 
 # Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path="$fix_srcfile_path_F77"
+fix_srcfile_path=$lt_fix_srcfile_path
 
 # Set to yes if exported symbols are required.
 always_export_symbols=$always_export_symbols_F77
@@ -16941,10 +17488,10 @@
 objext_GCJ=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="class foo {}\n"
+lt_simple_compile_test_code="class foo {}"
 
 # Code to be used in simple link tests
-lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n'
+lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }'
 
 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 
@@ -16960,16 +17507,16 @@
 
 # save warnings/boilerplate of simple test code
 ac_outfile=conftest.$ac_objext
-printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
 eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_compiler_boilerplate=`cat conftest.err`
 $rm conftest*
 
 ac_outfile=conftest.$ac_objext
-printf "$lt_simple_link_test_code" >conftest.$ac_ext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
 eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_linker_boilerplate=`cat conftest.err`
-$rm conftest*
+$rm -r conftest*
 
 
 # Allow CC to be a program name with arguments.
@@ -17007,7 +17554,7 @@
 else
   lt_cv_prog_compiler_rtti_exceptions=no
   ac_outfile=conftest.$ac_objext
-   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
    lt_compiler_flag="-fno-rtti -fno-exceptions"
    # Insert the option either (1) after the last *FLAGS variable, or
    # (2) before a word containing "conftest.", or (3) at the end.
@@ -17018,11 +17565,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:17021: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:17568: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:17025: \$? = $ac_status" >&5
+   echo "$as_me:17572: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -17073,14 +17620,16 @@
       lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4'
       ;;
 
-    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
       # PIC is the default for these OSes.
       ;;
 
-    mingw* | pw32* | os2*)
+    mingw* | cygwin* | pw32* | os2*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
-      lt_prog_compiler_pic_GCJ='-DDLL_EXPORT'
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+
       ;;
 
     darwin* | rhapsody*)
@@ -17089,7 +17638,7 @@
       lt_prog_compiler_pic_GCJ='-fno-common'
       ;;
 
-    interix3*)
+    interix[3-9]*)
       # Interix 3.x gcc -fpic/-fPIC options generate broken code.
       # Instead, we relocate shared libraries at runtime.
       ;;
@@ -17147,10 +17696,10 @@
        esac
        ;;
 
-    mingw* | pw32* | os2*)
+    mingw* | cygwin* | pw32* | os2*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
-      lt_prog_compiler_pic_GCJ='-DDLL_EXPORT'
+
       ;;
 
     hpux9* | hpux10* | hpux11*)
@@ -17180,7 +17729,7 @@
       lt_prog_compiler_static_GCJ='-Bstatic'
       ;;
 
-    linux*)
+    linux* | k*bsd*-gnu)
       case $cc_basename in
       icc* | ecc*)
 	lt_prog_compiler_wl_GCJ='-Wl,'
@@ -17199,6 +17748,22 @@
         # All Alpha code is PIC.
         lt_prog_compiler_static_GCJ='-non_shared'
         ;;
+      *)
+        case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C 5.9
+	  lt_prog_compiler_pic_GCJ='-KPIC'
+	  lt_prog_compiler_static_GCJ='-Bstatic'
+	  lt_prog_compiler_wl_GCJ='-Wl,'
+	  ;;
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic_GCJ='-KPIC'
+	  lt_prog_compiler_static_GCJ='-Bstatic'
+	  lt_prog_compiler_wl_GCJ=''
+	  ;;
+	esac
+	;;
       esac
       ;;
 
@@ -17208,6 +17773,10 @@
       lt_prog_compiler_static_GCJ='-non_shared'
       ;;
 
+    rdos*)
+      lt_prog_compiler_static_GCJ='-non_shared'
+      ;;
+
     solaris*)
       lt_prog_compiler_pic_GCJ='-KPIC'
       lt_prog_compiler_static_GCJ='-Bstatic'
@@ -17270,12 +17839,12 @@
 
 { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5
 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6; }
-if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then
+if test "${lt_cv_prog_compiler_pic_works_GCJ+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  lt_prog_compiler_pic_works_GCJ=no
+  lt_cv_prog_compiler_pic_works_GCJ=no
   ac_outfile=conftest.$ac_objext
-   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
    lt_compiler_flag="$lt_prog_compiler_pic_GCJ"
    # Insert the option either (1) after the last *FLAGS variable, or
    # (2) before a word containing "conftest.", or (3) at the end.
@@ -17286,27 +17855,27 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:17289: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:17858: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:17293: \$? = $ac_status" >&5
+   echo "$as_me:17862: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
      $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       lt_prog_compiler_pic_works_GCJ=yes
+       lt_cv_prog_compiler_pic_works_GCJ=yes
      fi
    fi
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6; }
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_GCJ" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_GCJ" >&6; }
 
-if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then
+if test x"$lt_cv_prog_compiler_pic_works_GCJ" = xyes; then
     case $lt_prog_compiler_pic_GCJ in
      "" | " "*) ;;
      *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;;
@@ -17333,13 +17902,13 @@
 wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\"
 { echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
-if test "${lt_prog_compiler_static_works_GCJ+set}" = set; then
+if test "${lt_cv_prog_compiler_static_works_GCJ+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  lt_prog_compiler_static_works_GCJ=no
+  lt_cv_prog_compiler_static_works_GCJ=no
    save_LDFLAGS="$LDFLAGS"
    LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
-   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
    if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
      # The linker can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -17349,20 +17918,20 @@
        $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
-         lt_prog_compiler_static_works_GCJ=yes
+         lt_cv_prog_compiler_static_works_GCJ=yes
        fi
      else
-       lt_prog_compiler_static_works_GCJ=yes
+       lt_cv_prog_compiler_static_works_GCJ=yes
      fi
    fi
-   $rm conftest*
+   $rm -r conftest*
    LDFLAGS="$save_LDFLAGS"
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5
-echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6; }
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_GCJ" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_static_works_GCJ" >&6; }
 
-if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then
+if test x"$lt_cv_prog_compiler_static_works_GCJ" = xyes; then
     :
 else
     lt_prog_compiler_static_GCJ=
@@ -17379,7 +17948,7 @@
    mkdir conftest
    cd conftest
    mkdir out
-   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
    lt_compiler_flag="-o out/conftest2.$ac_objext"
    # Insert the option either (1) after the last *FLAGS variable, or
@@ -17390,11 +17959,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:17393: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:17962: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:17397: \$? = $ac_status" >&5
+   echo "$as_me:17966: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -17474,12 +18043,13 @@
   # it will be wrapped by ` (' and `)$', so one must not match beginning or
   # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
   # as well as any symbol that contains `d'.
-  exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_"
+  exclude_expsyms_GCJ='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
   # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
   # platforms (ab)use it in PIC code, but their linkers get confused if
   # the symbol is explicitly referenced.  Since portable code cannot
   # rely on this symbol name, it's probably fine to never include it in
   # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
   extract_expsyms_cmds=
   # Just being paranoid about ensuring that cc_basename is set.
   for cc_temp in $compiler""; do
@@ -17538,7 +18108,7 @@
 
     # See if GNU ld supports shared libraries.
     case $host_os in
-    aix3* | aix4* | aix5*)
+    aix[3-9]*)
       # On AIX/PPC, the GNU linker is very broken
       if test "$host_cpu" != ia64; then
 	ld_shlibs_GCJ=no
@@ -17586,7 +18156,7 @@
       allow_undefined_flag_GCJ=unsupported
       always_export_symbols_GCJ=no
       enable_shared_with_static_runtimes_GCJ=yes
-      export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+      export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
 
       if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
         archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
@@ -17604,7 +18174,7 @@
       fi
       ;;
 
-    interix3*)
+    interix[3-9]*)
       hardcode_direct_GCJ=no
       hardcode_shlibpath_var_GCJ=no
       hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
@@ -17619,7 +18189,7 @@
       archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
 
-    linux*)
+    gnu* | linux* | k*bsd*-gnu)
       if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
 	tmp_addflag=
 	case $cc_basename,$host_cpu in
@@ -17637,20 +18207,30 @@
 	ifc* | ifort*)			# Intel Fortran compiler
 	  tmp_addflag=' -nofor_main' ;;
 	esac
-	archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  whole_archive_flag_spec_GCJ='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	*)
+	  tmp_sharedflag='-shared' ;;
+	esac
+	archive_cmds_GCJ='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
 
 	if test $supports_anon_versioning = yes; then
 	  archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~
   cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
   $echo "local: *; };" >> $output_objdir/$libname.ver~
-	  $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
 	fi
+	link_all_deplibs_GCJ=no
       else
 	ld_shlibs_GCJ=no
       fi
       ;;
 
-    netbsd*)
+    netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
 	archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
@@ -17748,7 +18328,7 @@
       fi
       ;;
 
-    aix4* | aix5*)
+    aix[4-9]*)
       if test "$host_cpu" = ia64; then
 	# On IA64, the linker does run time linking by default, so we don't
 	# have to do anything special.
@@ -17768,7 +18348,7 @@
 	# Test if we are trying to use run time linking or normal
 	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
 	# need to do runtime linking.
-	case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+	case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
 	  for ld_flag in $LDFLAGS; do
   	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
   	    aix_use_runtimelinking=yes
@@ -17802,7 +18382,7 @@
   	   strings "$collect2name" | grep resolve_lib_name >/dev/null
 	  then
   	  # We have reworked collect2
-  	  hardcode_direct_GCJ=yes
+  	  :
 	  else
   	  # We have old collect2
   	  hardcode_direct_GCJ=unsupported
@@ -17876,11 +18456,18 @@
        } && test -s conftest$ac_exeext &&
        $as_test_x conftest$ac_exeext; then
 
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
-}'`
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
 # Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
-}'`; fi
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
@@ -17935,11 +18522,18 @@
        } && test -s conftest$ac_exeext &&
        $as_test_x conftest$ac_exeext; then
 
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
-}'`
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
 # Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
-}'`; fi
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
@@ -17993,7 +18587,7 @@
       # The linker will automatically build a .lib file if we build a DLL.
       old_archive_From_new_cmds_GCJ='true'
       # FIXME: Should let the user specify the lib program.
-      old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      old_archive_cmds_GCJ='lib -OUT:$oldlib$oldobjs$old_deplibs'
       fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`'
       enable_shared_with_static_runtimes_GCJ=yes
       ;;
@@ -18026,19 +18620,18 @@
       link_all_deplibs_GCJ=yes
     if test "$GCC" = yes ; then
     	output_verbose_link_cmd='echo'
-        archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
-      module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-      archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-      module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        archive_cmds_GCJ="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+        module_cmds_GCJ="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+        archive_expsym_cmds_GCJ="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+        module_expsym_cmds_GCJ="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
     else
       case $cc_basename in
         xlc*)
          output_verbose_link_cmd='echo'
-         archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+         archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
          module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
           # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-         archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+         archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
           module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
           ;;
        *)
@@ -18078,7 +18671,7 @@
       ;;
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | kfreebsd*-gnu | dragonfly*)
+    freebsd* | dragonfly*)
       archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec_GCJ='-R$libdir'
       hardcode_direct_GCJ=yes
@@ -18180,7 +18773,7 @@
       link_all_deplibs_GCJ=yes
       ;;
 
-    netbsd*)
+    netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
 	archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
       else
@@ -18200,24 +18793,28 @@
       ;;
 
     openbsd*)
-      hardcode_direct_GCJ=yes
-      hardcode_shlibpath_var_GCJ=no
-      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-	hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
-	export_dynamic_flag_spec_GCJ='${wl}-E'
+      if test -f /usr/libexec/ld.so; then
+	hardcode_direct_GCJ=yes
+	hardcode_shlibpath_var_GCJ=no
+	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+	  export_dynamic_flag_spec_GCJ='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	     archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     hardcode_libdir_flag_spec_GCJ='-R$libdir'
+	     ;;
+	   *)
+	     archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+        fi
       else
-       case $host_os in
-	 openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
-	   archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-	   hardcode_libdir_flag_spec_GCJ='-R$libdir'
-	   ;;
-	 *)
-	   archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	   hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
-	   ;;
-       esac
+	ld_shlibs_GCJ=no
       fi
       ;;
 
@@ -18276,17 +18873,16 @@
       case $host_os in
       solaris2.[0-5] | solaris2.[0-5].*) ;;
       *)
- 	# The compiler driver will combine linker options so we
- 	# cannot just pass the convience library names through
- 	# without $wl, iff we do not link with $LD.
- 	# Luckily, gcc supports the same syntax we need for Sun Studio.
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
  	# Supported since Solaris 2.6 (maybe 2.5.1?)
- 	case $wlarc in
- 	'')
- 	  whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;;
- 	*)
- 	  whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
- 	esac ;;
+	if test "$GCC" = yes; then
+	  whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract'
+	fi
+	;;
       esac
       link_all_deplibs_GCJ=yes
       ;;
@@ -18343,7 +18939,7 @@
       fi
       ;;
 
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
       no_undefined_flag_GCJ='${wl}-z,text'
       archive_cmds_need_lc_GCJ=no
       hardcode_shlibpath_var_GCJ=no
@@ -18420,7 +19016,7 @@
       { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
       $rm conftest*
-      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
       if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
@@ -18478,20 +19074,7 @@
 version_type=none
 dynamic_linker="$host_os ld.so"
 sys_lib_dlsearch_path_spec="/lib /usr/lib"
-if test "$GCC" = yes; then
-  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
-    # if the path contains ";" then we assume it to be the separator
-    # otherwise default to the standard path separator (i.e. ":") - it is
-    # assumed that no part of a normal pathname contains ";" but that should
-    # okay in the real world where ";" in dirpaths is itself problematic.
-    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-  else
-    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-  fi
-else
-  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
-fi
+
 need_lib_prefix=unknown
 hardcode_into_libs=no
 
@@ -18509,7 +19092,7 @@
   soname_spec='${libname}${release}${shared_ext}$major'
   ;;
 
-aix4* | aix5*)
+aix[4-9]*)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -18648,12 +19231,7 @@
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
   shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
-  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
-  if test "$GCC" = yes; then
-    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
-  else
-    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
-  fi
+
   sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
   ;;
 
@@ -18670,18 +19248,6 @@
   dynamic_linker=no
   ;;
 
-kfreebsd*-gnu)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='GNU ld.so'
-  ;;
-
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -18719,7 +19285,7 @@
     shlibpath_overrides_runpath=no
     hardcode_into_libs=yes
     ;;
-  freebsd*) # from 4.6 on
+  *) # from 4.6 on, and DragonFly
     shlibpath_overrides_runpath=yes
     hardcode_into_libs=yes
     ;;
@@ -18782,7 +19348,7 @@
   postinstall_cmds='chmod 555 $lib'
   ;;
 
-interix3*)
+interix[3-9]*)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -18837,7 +19403,7 @@
   ;;
 
 # This must be Linux ELF.
-linux*)
+linux* | k*bsd*-gnu)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -18853,7 +19419,7 @@
 
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
@@ -18866,7 +19432,7 @@
   dynamic_linker='GNU/Linux ld.so'
   ;;
 
-knetbsd*-gnu)
+netbsdelf*-gnu)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -18875,7 +19441,7 @@
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
-  dynamic_linker='GNU ld.so'
+  dynamic_linker='NetBSD ld.elf_so'
   ;;
 
 netbsd*)
@@ -18959,6 +19525,10 @@
   sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
   ;;
 
+rdos*)
+  dynamic_linker=no
+  ;;
+
 solaris*)
   version_type=linux
   need_lib_prefix=no
@@ -19055,6 +19625,21 @@
 echo "${ECHO_T}$dynamic_linker" >&6; }
 test "$dynamic_linker" = no && can_build_shared=no
 
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"
+fi
+
+sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"
+fi
+
+sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
 if test "$GCC" = yes; then
   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
@@ -19138,6 +19723,7 @@
     predeps_GCJ \
     postdeps_GCJ \
     compiler_lib_search_path_GCJ \
+    compiler_lib_search_dirs_GCJ \
     archive_cmds_GCJ \
     archive_expsym_cmds_GCJ \
     postinstall_cmds_GCJ \
@@ -19153,6 +19739,7 @@
     module_cmds_GCJ \
     module_expsym_cmds_GCJ \
     lt_cv_prog_compiler_c_o_GCJ \
+    fix_srcfile_path_GCJ \
     exclude_expsyms_GCJ \
     include_expsyms_GCJ; do
 
@@ -19385,6 +19972,10 @@
 # shared library.
 postdeps=$lt_postdeps_GCJ
 
+# The directories searched by this compiler when creating a shared
+# library
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_GCJ
+
 # The library search path used internally by the compiler when linking
 # a shared library.
 compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ
@@ -19473,7 +20064,7 @@
 sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
 
 # Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path="$fix_srcfile_path_GCJ"
+fix_srcfile_path=$lt_fix_srcfile_path
 
 # Set to yes if exported symbols are required.
 always_export_symbols=$always_export_symbols_GCJ
@@ -19530,7 +20121,7 @@
 objext_RC=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
 
 # Code to be used in simple link tests
 lt_simple_link_test_code="$lt_simple_compile_test_code"
@@ -19549,16 +20140,16 @@
 
 # save warnings/boilerplate of simple test code
 ac_outfile=conftest.$ac_objext
-printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
 eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_compiler_boilerplate=`cat conftest.err`
 $rm conftest*
 
 ac_outfile=conftest.$ac_objext
-printf "$lt_simple_link_test_code" >conftest.$ac_ext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
 eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_linker_boilerplate=`cat conftest.err`
-$rm conftest*
+$rm -r conftest*
 
 
 # Allow CC to be a program name with arguments.
@@ -19618,6 +20209,7 @@
     predeps_RC \
     postdeps_RC \
     compiler_lib_search_path_RC \
+    compiler_lib_search_dirs_RC \
     archive_cmds_RC \
     archive_expsym_cmds_RC \
     postinstall_cmds_RC \
@@ -19633,6 +20225,7 @@
     module_cmds_RC \
     module_expsym_cmds_RC \
     lt_cv_prog_compiler_c_o_RC \
+    fix_srcfile_path_RC \
     exclude_expsyms_RC \
     include_expsyms_RC; do
 
@@ -19865,6 +20458,10 @@
 # shared library.
 postdeps=$lt_postdeps_RC
 
+# The directories searched by this compiler when creating a shared
+# library
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_RC
+
 # The library search path used internally by the compiler when linking
 # a shared library.
 compiler_lib_search_path=$lt_compiler_lib_search_path_RC
@@ -19953,7 +20550,7 @@
 sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
 
 # Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path="$fix_srcfile_path_RC"
+fix_srcfile_path=$lt_fix_srcfile_path
 
 # Set to yes if exported symbols are required.
 always_export_symbols=$always_export_symbols_RC
@@ -22489,6 +23086,11 @@
 _ACEOF
 
 
+cat >>confdefs.h <<\_ACEOF
+#define LDAP_DEPRECATED 1
+_ACEOF
+
+
 fi
 
 done
@@ -24016,233 +24618,19 @@
   if test x"$PCRECONFIG" != x; then
     PCRE_LIB=`$PCRECONFIG --libs`
     CPPFLAGS="$CPPFLAGS `$PCRECONFIG --cflags`"
-    OLDLIBS="$LIBS"
-    LIBS="$LIBS $PCRE_LIB"
-    { echo "$as_me:$LINENO: checking for pcre_compile in -lpcre" >&5
-echo $ECHO_N "checking for pcre_compile in -lpcre... $ECHO_C" >&6; }
-if test "${ac_cv_lib_pcre_pcre_compile+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpcre  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char pcre_compile ();
-int
-main ()
-{
-return pcre_compile ();
-  ;
-  return 0;
-}
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBPCRE 1
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_lib_pcre_pcre_compile=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_pcre_pcre_compile=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_pcre_pcre_compile" >&5
-echo "${ECHO_T}$ac_cv_lib_pcre_pcre_compile" >&6; }
-if test $ac_cv_lib_pcre_pcre_compile = yes; then
-
-
-for ac_header in pcre.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------ ##
-## Report this to jan at kneschke.de ##
-## ------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-
 cat >>confdefs.h <<\_ACEOF
-#define HAVE_LIBPCRE 1
-_ACEOF
-
-        cat >>confdefs.h <<\_ACEOF
 #define HAVE_PCRE_H 1
 _ACEOF
 
-
-fi
-
-done
-
-
-fi
-
-    LIBS="$OLDLIBS"
   else
-     { { echo "$as_me:$LINENO: error: pcre-config not found, install the pcre-devel package and build with --without-pcre" >&5
-echo "$as_me: error: pcre-config not found, install the pcre-devel package and build with --without-pcre" >&2;}
+     { { echo "$as_me:$LINENO: error: pcre-config not found, install the pcre-devel package or build with --without-pcre" >&5
+echo "$as_me: error: pcre-config not found, install the pcre-devel package or build with --without-pcre" >&2;}
    { (exit 1); exit 1; }; }
   fi
 fi
@@ -25230,7 +25618,7 @@
 and FAM_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
-To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
 See \`config.log' for more details." >&5
 echo "$as_me: error: The pkg-config script could not be found or is too old.  Make sure it
 is in your PATH or set the PKG_CONFIG environment variable to the full
@@ -25240,7 +25628,7 @@
 and FAM_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
-To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
 See \`config.log' for more details." >&2;}
    { (exit 1); exit 1; }; }
 else
@@ -25472,7 +25860,7 @@
 and XML_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
-To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
 See \`config.log' for more details." >&5
 echo "$as_me: error: The pkg-config script could not be found or is too old.  Make sure it
 is in your PATH or set the PKG_CONFIG environment variable to the full
@@ -25482,7 +25870,7 @@
 and XML_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
-To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
 See \`config.log' for more details." >&2;}
    { (exit 1); exit 1; }; }
 else
@@ -25594,7 +25982,7 @@
 and SQLITE_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
-To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
 See \`config.log' for more details." >&5
 echo "$as_me: error: The pkg-config script could not be found or is too old.  Make sure it
 is in your PATH or set the PKG_CONFIG environment variable to the full
@@ -25604,7 +25992,7 @@
 and SQLITE_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
-To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
 See \`config.log' for more details." >&2;}
    { (exit 1); exit 1; }; }
 else
@@ -26422,8 +26810,71 @@
 	# Put the nasty error message in config.log where it belongs
 	echo "$LUA_PKG_ERRORS" >&5
 
-	{ { echo "$as_me:$LINENO: error: Package requirements ($WITH_LUA >= 5.1) were not met:
+	{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 
+   # for debian based systems
+
+pkg_failed=no
+{ echo "$as_me:$LINENO: checking for LUA" >&5
+echo $ECHO_N "checking for LUA... $ECHO_C" >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$LUA_CFLAGS"; then
+        pkg_cv_LUA_CFLAGS="$LUA_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"lua5.1 >= 5.1\"") >&5
+  ($PKG_CONFIG --exists --print-errors "lua5.1 >= 5.1") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  pkg_cv_LUA_CFLAGS=`$PKG_CONFIG --cflags "lua5.1 >= 5.1" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$LUA_LIBS"; then
+        pkg_cv_LUA_LIBS="$LUA_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"lua5.1 >= 5.1\"") >&5
+  ($PKG_CONFIG --exists --print-errors "lua5.1 >= 5.1") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  pkg_cv_LUA_LIBS=`$PKG_CONFIG --libs "lua5.1 >= 5.1" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        LUA_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "lua5.1 >= 5.1"`
+        else
+	        LUA_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "lua5.1 >= 5.1"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$LUA_PKG_ERRORS" >&5
+
+	{ { echo "$as_me:$LINENO: error: Package requirements (lua5.1 >= 5.1) were not met:
+
 $LUA_PKG_ERRORS
 
 Consider adjusting the PKG_CONFIG_PATH environment variable if you
@@ -26433,7 +26884,7 @@
 and LUA_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 " >&5
-echo "$as_me: error: Package requirements ($WITH_LUA >= 5.1) were not met:
+echo "$as_me: error: Package requirements (lua5.1 >= 5.1) were not met:
 
 $LUA_PKG_ERRORS
 
@@ -26454,7 +26905,7 @@
 and LUA_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
-To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
 See \`config.log' for more details." >&5
 echo "$as_me: error: The pkg-config script could not be found or is too old.  Make sure it
 is in your PATH or set the PKG_CONFIG environment variable to the full
@@ -26464,7 +26915,7 @@
 and LUA_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
-To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
 See \`config.log' for more details." >&2;}
    { (exit 1); exit 1; }; }
 else
@@ -26486,10 +26937,155 @@
 
 fi
 
+elif test $pkg_failed = untried; then
 
+   # for debian based systems
 
+pkg_failed=no
+{ echo "$as_me:$LINENO: checking for LUA" >&5
+echo $ECHO_N "checking for LUA... $ECHO_C" >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$LUA_CFLAGS"; then
+        pkg_cv_LUA_CFLAGS="$LUA_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"lua5.1 >= 5.1\"") >&5
+  ($PKG_CONFIG --exists --print-errors "lua5.1 >= 5.1") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  pkg_cv_LUA_CFLAGS=`$PKG_CONFIG --cflags "lua5.1 >= 5.1" 2>/dev/null`
+else
+  pkg_failed=yes
 fi
+    fi
+else
+	pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$LUA_LIBS"; then
+        pkg_cv_LUA_LIBS="$LUA_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"lua5.1 >= 5.1\"") >&5
+  ($PKG_CONFIG --exists --print-errors "lua5.1 >= 5.1") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  pkg_cv_LUA_LIBS=`$PKG_CONFIG --libs "lua5.1 >= 5.1" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
 
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        LUA_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "lua5.1 >= 5.1"`
+        else
+	        LUA_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "lua5.1 >= 5.1"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$LUA_PKG_ERRORS" >&5
+
+	{ { echo "$as_me:$LINENO: error: Package requirements (lua5.1 >= 5.1) were not met:
+
+$LUA_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables LUA_CFLAGS
+and LUA_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+" >&5
+echo "$as_me: error: Package requirements (lua5.1 >= 5.1) were not met:
+
+$LUA_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables LUA_CFLAGS
+and LUA_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+" >&2;}
+   { (exit 1); exit 1; }; }
+elif test $pkg_failed = untried; then
+	{ { echo "$as_me:$LINENO: error: The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables LUA_CFLAGS
+and LUA_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details." >&5
+echo "$as_me: error: The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables LUA_CFLAGS
+and LUA_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+else
+	LUA_CFLAGS=$pkg_cv_LUA_CFLAGS
+	LUA_LIBS=$pkg_cv_LUA_LIBS
+        { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LUA 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LUA_H 1
+_ACEOF
+
+
+fi
+
+else
+	LUA_CFLAGS=$pkg_cv_LUA_CFLAGS
+	LUA_LIBS=$pkg_cv_LUA_LIBS
+        { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LUA 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LUA_H 1
+_ACEOF
+
+
+fi
+
+
+
+fi
+
 save_LIBS=$LIBS
 { echo "$as_me:$LINENO: checking for library containing crypt" >&5
 echo $ECHO_N "checking for library containing crypt... $ECHO_C" >&6; }
@@ -26874,11 +27470,12 @@
 
 
 
+
 for ac_func in dup2 getcwd inet_ntoa inet_ntop memset mmap munmap strchr \
 		  strdup strerror strstr strtol sendfile  getopt socket lstat \
 		  gethostbyname poll sigtimedwait epoll_ctl getrlimit chroot \
 		  getuid select signal pathconf madvise posix_fadvise posix_madvise \
-		  writev sigaction sendfile64 send_file kqueue port_create localtime_r
+		  writev sigaction sendfile64 send_file kqueue port_create localtime_r gmtime_r
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 { echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -28208,7 +28805,7 @@
 _ACEOF
 
 
-ac_config_files="$ac_config_files Makefile src/Makefile doc/Makefile tests/Makefile tests/docroot/Makefile tests/docroot/123/Makefile tests/docroot/www/Makefile tests/docroot/www/go/Makefile tests/docroot/www/indexfile/Makefile tests/docroot/www/expire/Makefile lighttpd.spec distribute.sh cygwin/Makefile cygwin/lighttpd.README openwrt/Makefile openwrt/control openwrt/lighttpd.mk"
+ac_config_files="$ac_config_files Makefile src/Makefile doc/Makefile tests/Makefile tests/docroot/Makefile tests/docroot/123/Makefile tests/docroot/www/Makefile tests/docroot/www/go/Makefile tests/docroot/www/indexfile/Makefile tests/docroot/www/expire/Makefile distribute.sh"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -28655,7 +29252,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by lighttpd $as_me 1.4.19, which was
+This file was extended by lighttpd $as_me 1.4.22, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -28708,7 +29305,7 @@
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-lighttpd config.status 1.4.19
+lighttpd config.status 1.4.22
 configured by $0, generated by GNU Autoconf 2.61,
   with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
@@ -28834,13 +29431,7 @@
     "tests/docroot/www/go/Makefile") CONFIG_FILES="$CONFIG_FILES tests/docroot/www/go/Makefile" ;;
     "tests/docroot/www/indexfile/Makefile") CONFIG_FILES="$CONFIG_FILES tests/docroot/www/indexfile/Makefile" ;;
     "tests/docroot/www/expire/Makefile") CONFIG_FILES="$CONFIG_FILES tests/docroot/www/expire/Makefile" ;;
-    "lighttpd.spec") CONFIG_FILES="$CONFIG_FILES lighttpd.spec" ;;
     "distribute.sh") CONFIG_FILES="$CONFIG_FILES distribute.sh" ;;
-    "cygwin/Makefile") CONFIG_FILES="$CONFIG_FILES cygwin/Makefile" ;;
-    "cygwin/lighttpd.README") CONFIG_FILES="$CONFIG_FILES cygwin/lighttpd.README" ;;
-    "openwrt/Makefile") CONFIG_FILES="$CONFIG_FILES openwrt/Makefile" ;;
-    "openwrt/control") CONFIG_FILES="$CONFIG_FILES openwrt/control" ;;
-    "openwrt/lighttpd.mk") CONFIG_FILES="$CONFIG_FILES openwrt/lighttpd.mk" ;;
 
   *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
@@ -28993,13 +29584,13 @@
 CCDEPMODE!$CCDEPMODE$ac_delim
 am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
 am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
+SED!$SED$ac_delim
 GREP!$GREP$ac_delim
 EGREP!$EGREP$ac_delim
 CPP!$CPP$ac_delim
 LN_S!$LN_S$ac_delim
 NO_RDYNAMIC_TRUE!$NO_RDYNAMIC_TRUE$ac_delim
 NO_RDYNAMIC_FALSE!$NO_RDYNAMIC_FALSE$ac_delim
-U!$U$ac_delim
 _ACEOF
 
   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -29041,10 +29632,13 @@
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
+U!$U$ac_delim
 ANSI2KNR!$ANSI2KNR$ac_delim
 ECHO!$ECHO$ac_delim
 AR!$AR$ac_delim
 RANLIB!$RANLIB$ac_delim
+DSYMUTIL!$DSYMUTIL$ac_delim
+NMEDIT!$NMEDIT$ac_delim
 CXX!$CXX$ac_delim
 CXXFLAGS!$CXXFLAGS$ac_delim
 ac_ct_CXX!$ac_ct_CXX$ac_delim
@@ -29090,7 +29684,7 @@
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 47; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 50; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
@@ -29491,21 +30085,22 @@
   fi
   rm -f "$tmp/out12"
 # Compute $ac_file's index in $config_headers.
+_am_arg=$ac_file
 _am_stamp_count=1
 for _am_header in $config_headers :; do
   case $_am_header in
-    $ac_file | $ac_file:* )
+    $_am_arg | $_am_arg:* )
       break ;;
     * )
       _am_stamp_count=`expr $_am_stamp_count + 1` ;;
   esac
 done
-echo "timestamp for $ac_file" >`$as_dirname -- $ac_file ||
-$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X$ac_file : 'X\(//\)[^/]' \| \
-	 X$ac_file : 'X\(//\)$' \| \
-	 X$ac_file : 'X\(/\)' \| . 2>/dev/null ||
-echo X$ac_file |
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$_am_arg" : 'X\(//\)[^/]' \| \
+	 X"$_am_arg" : 'X\(//\)$' \| \
+	 X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$_am_arg" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
 	    s//\1/
 	    q
@@ -29542,7 +30137,7 @@
   # each Makefile.in and add a new line on top of each file to say so.
   # Grep'ing the whole file is not good either: AIX grep has a line
   # limit of 2048, but all sed's we know have understand at least 4000.
-  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
+  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
     dirpart=`$as_dirname -- "$mf" ||
 $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
 	 X"$mf" : 'X\(//\)[^/]' \| \

Modified: lighttpd/trunk/configure.in
===================================================================
--- lighttpd/trunk/configure.in	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/configure.in	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,7 +1,7 @@
 #                                               -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.57)
-AC_INIT(lighttpd, 1.4.19, jan at kneschke.de)
+AC_INIT(lighttpd, 1.4.22, jan at kneschke.de)
 AC_CONFIG_SRCDIR([src/server.c])
 
 AC_CANONICAL_TARGET
@@ -142,6 +142,7 @@
     LDAP_LIB=-lldap
     AC_DEFINE([HAVE_LIBLDAP], [1], [libldap])
     AC_DEFINE([HAVE_LDAP_H], [1])
+    AC_DEFINE([LDAP_DEPRECATED], [1], [Using deprecated ldap api])
   ])
  ])
  AC_SUBST(LDAP_LIB)
@@ -257,17 +258,10 @@
   if test x"$PCRECONFIG" != x; then
     PCRE_LIB=`$PCRECONFIG --libs`
     CPPFLAGS="$CPPFLAGS `$PCRECONFIG --cflags`"
-    OLDLIBS="$LIBS"
-    LIBS="$LIBS $PCRE_LIB"
-    AC_CHECK_LIB(pcre, pcre_compile, [
-      AC_CHECK_HEADERS([pcre.h], [
-        AC_DEFINE([HAVE_LIBPCRE], [1], [libpcre])
-        AC_DEFINE([HAVE_PCRE_H], [1])
-      ])
-    ])
-    LIBS="$OLDLIBS"
+    AC_DEFINE([HAVE_LIBPCRE], [1], [libpcre])
+    AC_DEFINE([HAVE_PCRE_H], [1], [pcre.h])
   else
-     AC_MSG_ERROR([pcre-config not found, install the pcre-devel package and build with --without-pcre])
+     AC_MSG_ERROR([pcre-config not found, install the pcre-devel package or build with --without-pcre])
   fi
 fi
 
@@ -424,6 +418,12 @@
  PKG_CHECK_MODULES(LUA, $WITH_LUA >= 5.1, [
    AC_DEFINE([HAVE_LUA], [1], [liblua])
    AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
+ ],[
+   # for debian based systems
+   PKG_CHECK_MODULES(LUA, lua5.1 >= 5.1, [
+     AC_DEFINE([HAVE_LUA], [1], [liblua])
+     AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
+   ])
  ])
 
  AC_SUBST(LUA_CFLAGS)
@@ -463,7 +463,7 @@
 		  strdup strerror strstr strtol sendfile  getopt socket lstat \
 		  gethostbyname poll sigtimedwait epoll_ctl getrlimit chroot \
 		  getuid select signal pathconf madvise posix_fadvise posix_madvise \
-		  writev sigaction sendfile64 send_file kqueue port_create localtime_r])
+		  writev sigaction sendfile64 send_file kqueue port_create localtime_r gmtime_r])
 
 AC_MSG_CHECKING(for Large File System support)
 AC_ARG_ENABLE(lfs,
@@ -553,8 +553,7 @@
 		 tests/docroot/www/go/Makefile \
 		 tests/docroot/www/indexfile/Makefile \
 		 tests/docroot/www/expire/Makefile \
-		 lighttpd.spec distribute.sh cygwin/Makefile cygwin/lighttpd.README
-		 openwrt/Makefile openwrt/control openwrt/lighttpd.mk])
+		 distribute.sh])
 AC_OUTPUT
 
 

Modified: lighttpd/trunk/debian/changelog
===================================================================
--- lighttpd/trunk/debian/changelog	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/debian/changelog	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,3 +1,9 @@
+lighttpd (1.4.22-1) UNRELEASED; urgency=low
+
+  * (NOT RELEASED YET) New upstream release
+
+ -- Krzysztof Krzyżaniak (eloy) <eloy at debian.org>  Wed, 18 Mar 2009 11:19:55 +0100
+
 lighttpd (1.4.19-5) unstable; urgency=high
 
   * Remove the alias.url stanza from 10-cgi.conf (Closes: #499334).

Modified: lighttpd/trunk/depcomp
===================================================================
--- lighttpd/trunk/depcomp	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/depcomp	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,9 +1,9 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2006-10-15.18
+scriptversion=2007-03-29.01
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
 # Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -215,34 +215,39 @@
   # current directory.  Also, the AIX compiler puts `$object:' at the
   # start of each line; $object doesn't have directory information.
   # Version 6 uses the directory in both cases.
-  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
-  tmpdepfile="$stripped.u"
+  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+  test "x$dir" = "x$object" && dir=
+  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
   if test "$libtool" = yes; then
+    tmpdepfile1=$dir$base.u
+    tmpdepfile2=$base.u
+    tmpdepfile3=$dir.libs/$base.u
     "$@" -Wc,-M
   else
+    tmpdepfile1=$dir$base.u
+    tmpdepfile2=$dir$base.u
+    tmpdepfile3=$dir$base.u
     "$@" -M
   fi
   stat=$?
 
-  if test -f "$tmpdepfile"; then :
-  else
-    stripped=`echo "$stripped" | sed 's,^.*/,,'`
-    tmpdepfile="$stripped.u"
-  fi
-
   if test $stat -eq 0; then :
   else
-    rm -f "$tmpdepfile"
+    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
     exit $stat
   fi
 
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+  do
+    test -f "$tmpdepfile" && break
+  done
   if test -f "$tmpdepfile"; then
-    outname="$stripped.o"
     # Each line is of the form `foo.o: dependent.h'.
     # Do two passes, one to just change these to
     # `$object: dependent.h' and one to simply `dependent.h:'.
-    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
-    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+    # That's a tab and a space in the [].
+    sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
   else
     # The sourcefile does not contain any dependencies, so just
     # store a dummy comment line, to avoid errors with the Makefile

Modified: lighttpd/trunk/doc/Makefile.am
===================================================================
--- lighttpd/trunk/doc/Makefile.am	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/doc/Makefile.am	2009-03-18 10:20:09 UTC (rev 355)
@@ -86,7 +86,7 @@
 	oldstyle.css \
 	$(DOCS)
 
-%.html: %.txt
+.txt.html:
 	rst2html $^ > $@
 
 

Modified: lighttpd/trunk/doc/Makefile.in
===================================================================
--- lighttpd/trunk/doc/Makefile.in	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/doc/Makefile.in	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -72,6 +72,7 @@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DL_LIB = @DL_LIB@
+DSYMUTIL = @DSYMUTIL@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -106,6 +107,7 @@
 MYSQL_CONFIG = @MYSQL_CONFIG@
 MYSQL_INCLUDE = @MYSQL_INCLUDE@
 MYSQL_LIBS = @MYSQL_LIBS@
+NMEDIT = @NMEDIT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -118,6 +120,7 @@
 PCRE_LIB = @PCRE_LIB@
 PKG_CONFIG = @PKG_CONFIG@
 RANLIB = @RANLIB@
+SED = @SED@
 SENDFILE_LIB = @SENDFILE_LIB@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
@@ -275,6 +278,7 @@
 all: all-am
 
 .SUFFIXES:
+.SUFFIXES: .html .txt
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -488,7 +492,7 @@
 	ps ps-am uninstall uninstall-am uninstall-man uninstall-man1
 
 
-%.html: %.txt
+.txt.html:
 	rst2html $^ > $@
 
 html: $(HTMLDOCS)

Modified: lighttpd/trunk/doc/authentication.txt
===================================================================
--- lighttpd/trunk/doc/authentication.txt	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/doc/authentication.txt	2009-03-18 10:20:09 UTC (rev 355)
@@ -7,8 +7,8 @@
 ----------------
 
 :Author: Jan Kneschke
-:Date: $Date: 2006-10-04 15:26:23 +0200 (Wed, 04 Oct 2006) $
-:Revision: $Revision: 1371 $
+:Date: $Date$
+:Revision: $Revision$
 
 :abstract:
   The auth module provides ...

Modified: lighttpd/trunk/doc/compress.txt
===================================================================
--- lighttpd/trunk/doc/compress.txt	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/doc/compress.txt	2009-03-18 10:20:09 UTC (rev 355)
@@ -6,13 +6,7 @@
 Module: mod_compress
 --------------------
 
-:Author: Jan Kneschke
-:Date: $Date: 2004/08/29 09:43:49 $
-:Revision: $Revision: 1.1 $
 
-:abstract:
-  a nice, short abstrace about the module
-
 .. meta::
   :keywords: lighttpd, compress
 
@@ -22,16 +16,57 @@
 ===========
 
 Output compression reduces the network load and can improve the overall
-throughput of the webserver.
+throughput of the webserver. All major http-clients support compression by
+announcing it in the Accept-Encoding header. This is used to negotiate the
+most suitable compression method. We support deflate, gzip and bzip2.
 
-Only static content is supported up to now.
+deflate (RFC1950, RFC1951) and gzip (RFC1952) depend on zlib while bzip2
+depends on libbzip2. bzip2 is only supported by lynx and some other console
+text-browsers.
 
-The server negotiates automaticly which compression method is used.
-Supported are gzip, deflate, bzip.
+We currently limit to compression support to static files.
 
+Caching
+-------
+
+mod_compress can store compressed files on disk to optimize the compression
+on a second request away. As soon as compress.cache-dir is set the files are
+compressed.
+
+(You will need to create the cache directory if it doesn't already exist. The web server will not do this for you.  The directory will also need the proper ownership.  For Debian/Ubuntu the user and group ids should both be www-data.)
+
+The names of the cache files are made of the filename, the compression method
+and the etag associated to the file.
+
+Cleaning the cache is left to the user. A cron job deleting files older than
+10 days could do it: ::
+
+  find /var/www/cache -type f -mtime +10 | xargs -r rm
+
+Limitations
+-----------
+
+The module limits the compression of files to files smaller than 128 MByte and
+larger than 128 Byte.
+
+The lower limit is set as small files tend to become larger by compressing due
+to the compression headers, the upper limit is set to work sensibly with
+memory and cpu-time.
+
+Directories containing a tilde ('~') are not created automatically (See ticket
+#113). To enable compression for user dirs you have to create the directories
+by hand in the cache directory.
+
 Options
 =======
 
+compress.allowed-encodings
+  override default set of allowed encodings
+
+  e.g.: ::
+
+    compress.allowed-encodings = ("bzip2", "gzip", "deflate")
+
 compress.cache-dir
   name of the directory where compressed content will be cached
 
@@ -47,20 +82,111 @@
   Default: not set, compress the file for every request
 
 compress.filetype
-  mimetypes where might get compressed
+  mimetypes which might get compressed
 
   e.g.: ::
 
     compress.filetype           = ("text/plain", "text/html")
 
+  Keep in mind that compressed JavaScript and CSS files are broken in some
+  browsers. Not setting any filetypes will result in no files being compressed.
+
+  NOTE: You have to specify the full mime-type! If you also define a charset, for example, you have to use "text/plain; charset=utf-8" instead of just "text/plain".
+
   Default: not set
 
+compress.max-filesize
+  maximum size of the original file to be compressed kBytes.
 
+  This is meant to protect the server against DoSing as compressing large
+  (let's say 1Gbyte) takes a lot of time and would delay the whole operation
+  of the server.
+
+  There is a hard upper limit of 128Mbyte.
+
+  Default: unlimited (== hard-limit of 128MByte)
+
+Display compressed files
+========================
+
+If you enable mod_compress, and you want to force clients to uncompress and display compressed text files, please force mimetype to nothing.
+Exemple :
+If you want to add headers for uncompress and display diff.gz files , add this section in your conf : ::
+
+  $HTTP["url"] =~ "\.diff\.gz" {
+    setenv.add-response-header = ( "Content-Encoding" => "gzip" )
+    mimetype.assign = ()
+  }
+
+
 Compressing Dynamic Content
 ===========================
 
+PHP
+---
+
 To compress dynamic content with PHP please enable ::
 
   zlib.output_compression = 1
+  zlib.output_handler = On
 
 in the php.ini as PHP provides compression support by itself.
+
+mod_compress of lighttpd 1.5 r1992 may not set correct Content-Encoding with php-fcgi. A solution to that problem would be:
+
+1.disable mod_compress when request a php file::
+
+    $HTTP["url"] !~ "\.php$" {
+    	compress.filetype = ("text/plain", "text/html", "text/javascript", "text/css", "text/xml")
+    }
+
+2.enable mod_setenv of your lighttpd::
+
+    server.modules  += ( "mod_setenv" )
+
+3.manually set Content-Encoding::
+
+    $HTTP["url"] =~ "\.php$" {
+  	setenv.add-response-header  = ( "Content-Encoding" => "gzip")
+    }
+
+
+TurboGears
+----------
+
+To compress dynamic content with TurboGears please enable ::
+
+  [/]
+  gzip_filter.on = True
+  gzip_filter.mime_types = ["application/x-javascript", "text/javascript", "text/html", "text/css", "text/plain"]
+
+in the config/app.cfg file in your TurboGears application.  The above lines should already be in the file.  You just need to remove the comment symbol in front of the lines to make them active.
+
+Django
+------
+
+To compress dynamic content with Django please enable the GZipMiddleware ::
+
+  MIDDLEWARE_CLASSES = (
+      'django.middleware.gzip.GZipMiddleware',
+      ...
+  )
+
+in the settings.py file in your Django project.
+
+Catalyst
+--------
+
+To compress dynamic content with Perl/Catalyst, simply use the Catalyst::Plugin::Compress::Gzip module available on CPAN ::
+
+  use Catalyst qw(
+      Compress::Gzip
+      ...
+  );
+
+in your main package (MyApp.pm). Further configuration is not required.
+
+}}}
+
+
+

Modified: lighttpd/trunk/doc/configuration.txt
===================================================================
--- lighttpd/trunk/doc/configuration.txt	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/doc/configuration.txt	2009-03-18 10:20:09 UTC (rev 355)
@@ -7,8 +7,8 @@
 ------------
 
 :Author: Jan Kneschke
-:Date: $Date: 2007-11-04 17:53:17 +0100 (Sun, 04 Nov 2007) $
-:Revision: $Revision: 2012 $
+:Date: $Date$
+:Revision: $Revision$
 
 :abstract:
   the layout of the configuration file
@@ -90,13 +90,21 @@
 $HTTP["host"]
   match on host
 $HTTP["useragent"]
+$HTTP["user-agent"]
   match on useragent
 $HTTP["referer"]
   match on referer
+$HTTP["method"]
+  math on the http method
 $HTTP["url"]
   match on url
+$HTTP["query-string"]
+  match on the (not decoded) query-string
 $HTTP["remoteip"]
+$HTTP["remote-ip"]
   match on the remote IP or a remote Network
+$HTTP["language"]
+  match on the Accept-Language header
 $SERVER["socket"]
   match on socket. Value must be on the format "ip:port" where ip is an IP
   address and port a port number. Only equal match (==) is supported.
@@ -513,3 +521,6 @@
 
 debug.log-request-handling
   default: disabled
+
+debug.log-ssl-noise
+  default: disabled

Modified: lighttpd/trunk/doc/lighttpd.conf
===================================================================
--- lighttpd/trunk/doc/lighttpd.conf	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/doc/lighttpd.conf	2009-03-18 10:20:09 UTC (rev 355)
@@ -174,6 +174,8 @@
 
 ## virtual directory listings
 #dir-listing.activate       = "enable"
+## select encoding for directory listings
+#dir-listing.encoding        = "utf-8"
 
 ## enable debugging
 #debug.log-request-header   = "enable"

Modified: lighttpd/trunk/doc/magnet.txt
===================================================================
--- lighttpd/trunk/doc/magnet.txt	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/doc/magnet.txt	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,429 +1,429 @@
-{{{
-#!rst
-==============
-a power-magnet
-==============
-
-------------------
-Module: mod_magnet
-------------------
-
-
-
-.. contents:: Table of Contents
-
-Requirements
-============
-
-:Version: lighttpd 1.4.12 or higher
-:Packages: lua >= 5.1
-
-Overview
-========
-
-mod_magnet is a module to control the request handling in lighty. 
-
-.. note::
-
-  Keep in mind that the magnet is executed in the core of lighty. EVERY long-running operation is blocking 
-  ALL connections in the server. You are warned. For time-consuming or blocking scripts use mod_fastcgi and friends.
-
-For performance reasons mod_magnet caches the compiled script. For each script-run the script itself is checked for 
-freshness and recompile if neccesary.
-
-
-Installation
-============
-
-mod_magnet needs a lighty which is compiled with the lua-support ( --with-lua). Lua 5.1 or higher are required by
-the module. Use "--with-lua=lua5.1" to install on Debian and friends. ::
-
-  server.modules = ( ..., "mod_magnet", ... )
-
-Options
-=======
-
-mod_magnet can attract a request in several stages in the request-handling. 
-
-* either at the same level as mod_rewrite, before any parsing of the URL is done
-* or at a later stage, when the doc-root is known and the physical-path is already setup
-
-It depends on the purpose of the script which stage you want to intercept. Usually you want to use
-the 2nd stage where the physical-path which relates to your request is known. At this level you
-can run checks against lighty.env["physical.path"].
-
-::
-
-  magnet.attract-raw-url-to = ( ... )
-  magnet.attract-physical-path-to = ( ... )
-
-You can define multiple scripts when separated by a semicolon. The scripts are executed in the specified 
-order. If one of them a returning a status-code, the following scripts will not be executed.
-
-Tables
-======
-
-Most of the interaction between between mod_magnet and lighty is done through tables. Tables in lua are hashes (Perl), dictionaries (Java), arrays (PHP), ...
-
-Request-Environment
--------------------
-
-Lighttpd has its internal variables which are exported as read/write to the magnet. 
-
-If "http://example.org/search.php?q=lighty" is requested this results in a request like ::
-
-  GET /search.php?q=lighty HTTP/1.1
-  Host: example.org
-
-When you are using ``attract-raw-url-to`` you can access the following variables:
-
-* parts of the request-line
-
- * lighty.env["request.uri"] = "/search.php?q=lighty"
-
-* HTTP request-headers
-
-  * lighty.request["Host"] = "example.org"
-
-Later in the request-handling, the URL is splitted, cleaned up and turned into a physical path name:
-
-* parts of the URI
-
- * lighty.env["uri.path"] = "/search.php"
- * lighty.env["uri.path-raw"] = "/search.php"
- * lighty.env["uri.scheme"] = "http"
- * lighty.env["uri.authority"] = "example.org"
- * lighty.env["uri.query"] = "q=lighty"
-
-* filenames, pathnames
-
- * lighty.env["physical.path"] = "/my-docroot/search.php"
- * lighty.env["physical.rel-path"] = "/search.php"
- * lighty.env["physical.doc-root"] = "/my-docroot"
-
-All of them are readable, not all of the are writable (or don't have an effect if you write to them). 
-
-As a start, you might want to use those variables for writing: ::
-
-  -- 1. simple rewriting is done via the request.uri
-  lighty.env["request.uri"] = ... 
-  return lighty.RESTART_REQUEST
-
-  -- 2. changing the physical-path
-  lighty.env["physical.path"] = ...
-
-  -- 3. changing the query-string
-  lighty.env["uri.query"] = ...
-
-Response Headers
-----------------
-
-If you want to set a response header for your request, you can add a field to the lighty.header[] table: ::
-
-  lighty.header["Content-Type"] = "text/html"
-
-Sending Content
-===============
-
-You can generate your own content and send it out to the clients. ::
-
-  lighty.content = { "<pre>", { filename = "/etc/passwd" }, "</pre>" }
-  lighty.header["Content-Type"] = "text/html"
-
-  return 200
-
-The lighty.content[] table is executed when the script is finished. The elements of the array are processed left to right and the elements can either be a string or a table. Strings are included AS IS into the output of the request.
-
-* Strings
-
-  * are included as is
-
-* Tables
-
-  * filename = "<absolute-path>" is required
-  * offset = <number> [default: 0]
-  * length = <number> [default: size of the file - offset]
-
-Internally lighty will use the sendfile() call to send out the static files at full speed.
-
-Status Codes
-============
-
-You might have seen it already in other examples: In case you are handling the request completly in the magnet you
-can return your own status-codes. Examples are: Redirected, Input Validation, ... ::
-
-  if (lighty.env["uri.scheme"] == "http") then
-    lighty.header["Location"] = "https://" .. lighty.env["uri.authority"] .. lighty.env["request.uri"]
-    return 302
-  end
-
-You every number above and equal to 100 is taken as final status code and finishes the request. No other modules are 
-executed after this return.
-
-A special return-code is lighty.RESTART_REQUEST (currently equal to 99) which is usually used in combination with 
-changing the request.uri in a rewrite. It restarts the splitting of the request-uri again.
-
-If you return nothing (or nil) the request-handling just continues.
-
-Debugging
-=========
-
-To easy debugging we overloaded the print()-function in lua and redirect the output of print() to the error-log. ::
-
-  print("Host: " .. lighty.request["Host"])
-  print("Request-URI: " .. lighty.env["request.uri"])
-
-
-Examples
-========
-
-Sending text-files as HTML
---------------------------
-
-This is a bit simplistic, but it illustrates the idea: Take a text-file and cover it in a <pre> tag.
-
-Config-file ::
-
-  magnet.attract-physical-path-to = server.docroot + "/readme.lua"
-
-readme.lua ::
-
-  lighty.content = { "<pre>", { filename = "/README" }, "</pre>" }
-  lighty.header["Content-Type"] = "text/html"
-  
-  return 200
-
-Maintainance pages
-------------------
-
-Your side might be on maintainance from time to time. Instead of shutting down the server confusing all
-users, you can just send a maintainance page.
-
-Config-file ::
-
-  magnet.attract-physical-path-to = server.docroot + "/maintainance.lua"
-
-maintainance.lua ::
-
-  require "lfs"
-
-  if (nil == lfs.attributes(lighty.env["physical.doc-root"] .. "/maintainance.html")) then
-    lighty.content = ( lighty.env["physical.doc-root"] .. "/maintainance.html" )
-
-    lighty.header["Content-Type"] = "text/html"
-
-    return 200
-  end
-
-mod_flv_streaming
------------------
-
-Config-file ::
-
-  magnet.attract-physical-path-to = server.docroot + "/flv-streaming.lua"
-
-flv-streaming.lua::
-
-  if (lighty.env["uri.query"]) then
-    -- split the query-string
-    get = {}
-    for k, v in string.gmatch(lighty.env["uri.query"], "(%w+)=(%w+)") do
-      get[k] = v
-    end
-
-    if (get["start"]) then
-      -- missing: check if start is numeric and positive
-
-      -- send te FLV header + a seek into the file
-      lighty.content = { "FLV\x1\x1\0\0\0\x9\0\0\0\x9", 
-         { filename = lighty.env["physical.path"], offset = get["start"] } }
-      lighty.header["Content-Type"] = "video/x-flv"
-
-      return 200
-    end
-  end
-
-  
-selecting a random file from a directory
-----------------------------------------
-
-Say, you want to send a random file (ad-content) from a directory. 
-
-To simplify the code and to improve the performance we define:
-
-* all images have the same format (e.g. image/png)
-* all images use increasing numbers starting from 1
-* a special index-file names the highest number
-
-Config ::
-
-  server.modules += ( "mod_magnet" )
-  magnet.attract-physical-path-to = "random.lua"
-
-random.lua ::
-
-  dir = lighty.env["physical.path"]
-
-  f = assert(io.open(dir .. "/index", "r"))
-  maxndx = f:read("*all")
-  f:close()
-
-  ndx = math.random(maxndx)
-
-  lighty.content = { { filename = dir .. "/" .. ndx }}
-  lighty.header["Content-Type"] = "image/png"
-
-  return 200
-
-denying illegal character sequences in the URL
-----------------------------------------------
-
-Instead of implementing mod_security, you might just want to apply filters on the content
-and deny special sequences that look like SQL injection. 
-
-A common injection is using UNION to extend a query with another SELECT query.
-
-::
-
-  if (string.find(lighty.env["request.uri"], "UNION%s")) then
-    return 400
-  end
-
-Traffic Quotas
---------------
-
-If you only allow your virtual hosts a certain amount for traffic each month and want to 
-disable them if the traffic is reached, perhaps this helps: ::
-
-  host_blacklist = { ["www.example.org"] = 0 }
-
-  if (host_blacklist[lighty.request["Host"]]) then
-    return 404
-  end
-
-Just add the hosts you want to blacklist into the blacklist table in the shown way.
-
-Complex rewrites
-----------------
-
-If you want to implement caching on your document-root and only want to regenerate 
-content if the requested file doesn't exist, you can attract the physical.path: ::
-
-  magnet.attract-physical-path-to = ( server.document-root + "/rewrite.lua" )
-
-rewrite.lua ::
-
-  require "lfs"
-
-  attr = lfs.attributes(lighty.env["physical.path"])
-
-  if (not attr) then
-    -- we couldn't stat() the file for some reason
-    -- let the backend generate it
-
-    lighty.env["uri.path"] = "/dispatch.fcgi"
-    lighty.env["physical.rel-path"] = lighty.env["uri.path"]
-    lighty.env["physical.path"] = lighty.env["physical.doc-root"] .. lighty.env["physical.rel-path"]
-  fi
-
-luafilesystem
-+++++++++++++
-
-We are requiring the lua-module 'lfs' (http://www.keplerproject.org/luafilesystem/). 
-
-I had to compile lfs myself for lua-5.1 which required a minor patch as compat-5.1 is not needed::
-
-  $ wget http://luaforge.net/frs/download.php/1487/luafilesystem-1.2.tar.gz
-  $ wget http://www.lighttpd.net/download/luafilesystem-1.2-lua51.diff
-  $ gzip -cd luafilesystem-1.2.tar.gz | tar xf -
-  $ cd luafilesystem-1.2
-  $ patch -ls -p1 < ../luafilesystem-1.2-lua51.diff
-  $ make install
-
-It will install lfs.so into /usr/lib/lua/5.1/ which is where lua expects the extensions on my system.
-
-SuSE and Gentoo are known to have their own lfs packages and don't require a compile.
-
-Usertracking
-------------
-
-... or how to store data globally in the script-context:
-
-Each script has its own script-context. When the script is started it only contains the lua-functions
-and the special lighty.* name-space. If you want to save data between script runs, you can use the global-script
-context:
-
-::
-
-  if (nil == _G["usertrack"]) then
-    _G["usertrack"] = {}
-  end
-  if (nil == _G["usertrack"][lighty.request["Cookie"]]) then
-    _G["usertrack"][lighty.request["Cookie"]]
-  else 
-    _G["usertrack"][lighty.request["Cookie"]] = _G["usertrack"][lighty.request["Cookie"]] + 1
-  end
-
-  print _G["usertrack"][lighty.request["Cookie"]]
-
-The global-context is per script. If you update the script without restarting the server, the context will still be maintained.
-
-Counters
---------
-
-mod_status support a global statistics page and mod_magnet allows to add and update values in the status page:
-
-Config ::
-
-  status.statistics-url = "/server-counters"
-  magnet.attract-raw-url-to = server.docroot + "/counter.lua"
-
-counter.lua ::
-
-  lighty.status["core.connections"] = lighty.status["core.connections"] + 1
-
-Result::
-
-  core.connections: 7
-  fastcgi.backend.php-foo.0.connected: 0
-  fastcgi.backend.php-foo.0.died: 0
-  fastcgi.backend.php-foo.0.disabled: 0
-  fastcgi.backend.php-foo.0.load: 0
-  fastcgi.backend.php-foo.0.overloaded: 0
-  fastcgi.backend.php-foo.1.connected: 0
-  fastcgi.backend.php-foo.1.died: 0
-  fastcgi.backend.php-foo.1.disabled: 0
-  fastcgi.backend.php-foo.1.load: 0
-  fastcgi.backend.php-foo.1.overloaded: 0
-  fastcgi.backend.php-foo.load: 0
-
-Porting mod_cml scripts
------------------------
-
-mod_cml got replaced by mod_magnet.
-
-A CACHE_HIT in mod_cml::
- 
-  output_include = { "file1", "file2" } 
-
-  return CACHE_HIT
-
-becomes::
-
-  content = { { filename = "/path/to/file1" }, { filename = "/path/to/file2"} }
-
-  return 200
-
-while a CACHE_MISS like (CML) ::
-
-  trigger_handler = "/index.php"
-
-  return CACHE_MISS
-
-becomes (magnet) ::
-
-  lighty.env["request.uri"] = "/index.php"
-
-  return lighty.RESTART_REQUEST
-
-}}}
\ No newline at end of file
+{{{
+#!rst
+==============
+a power-magnet
+==============
+
+------------------
+Module: mod_magnet
+------------------
+
+
+
+.. contents:: Table of Contents
+
+Requirements
+============
+
+:Version: lighttpd 1.4.12 or higher
+:Packages: lua >= 5.1
+
+Overview
+========
+
+mod_magnet is a module to control the request handling in lighty. 
+
+.. note::
+
+  Keep in mind that the magnet is executed in the core of lighty. EVERY long-running operation is blocking 
+  ALL connections in the server. You are warned. For time-consuming or blocking scripts use mod_fastcgi and friends.
+
+For performance reasons mod_magnet caches the compiled script. For each script-run the script itself is checked for 
+freshness and recompile if neccesary.
+
+
+Installation
+============
+
+mod_magnet needs a lighty which is compiled with the lua-support ( --with-lua). Lua 5.1 or higher are required by
+the module. Use "--with-lua=lua5.1" to install on Debian and friends. ::
+
+  server.modules = ( ..., "mod_magnet", ... )
+
+Options
+=======
+
+mod_magnet can attract a request in several stages in the request-handling. 
+
+* either at the same level as mod_rewrite, before any parsing of the URL is done
+* or at a later stage, when the doc-root is known and the physical-path is already setup
+
+It depends on the purpose of the script which stage you want to intercept. Usually you want to use
+the 2nd stage where the physical-path which relates to your request is known. At this level you
+can run checks against lighty.env["physical.path"].
+
+::
+
+  magnet.attract-raw-url-to = ( ... )
+  magnet.attract-physical-path-to = ( ... )
+
+You can define multiple scripts when separated by a semicolon. The scripts are executed in the specified 
+order. If one of them a returning a status-code, the following scripts will not be executed.
+
+Tables
+======
+
+Most of the interaction between between mod_magnet and lighty is done through tables. Tables in lua are hashes (Perl), dictionaries (Java), arrays (PHP), ...
+
+Request-Environment
+-------------------
+
+Lighttpd has its internal variables which are exported as read/write to the magnet. 
+
+If "http://example.org/search.php?q=lighty" is requested this results in a request like ::
+
+  GET /search.php?q=lighty HTTP/1.1
+  Host: example.org
+
+When you are using ``attract-raw-url-to`` you can access the following variables:
+
+* parts of the request-line
+
+ * lighty.env["request.uri"] = "/search.php?q=lighty"
+
+* HTTP request-headers
+
+  * lighty.request["Host"] = "example.org"
+
+Later in the request-handling, the URL is splitted, cleaned up and turned into a physical path name:
+
+* parts of the URI
+
+ * lighty.env["uri.path"] = "/search.php"
+ * lighty.env["uri.path-raw"] = "/search.php"
+ * lighty.env["uri.scheme"] = "http"
+ * lighty.env["uri.authority"] = "example.org"
+ * lighty.env["uri.query"] = "q=lighty"
+
+* filenames, pathnames
+
+ * lighty.env["physical.path"] = "/my-docroot/search.php"
+ * lighty.env["physical.rel-path"] = "/search.php"
+ * lighty.env["physical.doc-root"] = "/my-docroot"
+
+All of them are readable, not all of the are writable (or don't have an effect if you write to them). 
+
+As a start, you might want to use those variables for writing: ::
+
+  -- 1. simple rewriting is done via the request.uri
+  lighty.env["request.uri"] = ... 
+  return lighty.RESTART_REQUEST
+
+  -- 2. changing the physical-path
+  lighty.env["physical.path"] = ...
+
+  -- 3. changing the query-string
+  lighty.env["uri.query"] = ...
+
+Response Headers
+----------------
+
+If you want to set a response header for your request, you can add a field to the lighty.header[] table: ::
+
+  lighty.header["Content-Type"] = "text/html"
+
+Sending Content
+===============
+
+You can generate your own content and send it out to the clients. ::
+
+  lighty.content = { "<pre>", { filename = "/etc/passwd" }, "</pre>" }
+  lighty.header["Content-Type"] = "text/html"
+
+  return 200
+
+The lighty.content[] table is executed when the script is finished. The elements of the array are processed left to right and the elements can either be a string or a table. Strings are included AS IS into the output of the request.
+
+* Strings
+
+  * are included as is
+
+* Tables
+
+  * filename = "<absolute-path>" is required
+  * offset = <number> [default: 0]
+  * length = <number> [default: size of the file - offset]
+
+Internally lighty will use the sendfile() call to send out the static files at full speed.
+
+Status Codes
+============
+
+You might have seen it already in other examples: In case you are handling the request completly in the magnet you
+can return your own status-codes. Examples are: Redirected, Input Validation, ... ::
+
+  if (lighty.env["uri.scheme"] == "http") then
+    lighty.header["Location"] = "https://" .. lighty.env["uri.authority"] .. lighty.env["request.uri"]
+    return 302
+  end
+
+You every number above and equal to 100 is taken as final status code and finishes the request. No other modules are 
+executed after this return.
+
+A special return-code is lighty.RESTART_REQUEST (currently equal to 99) which is usually used in combination with 
+changing the request.uri in a rewrite. It restarts the splitting of the request-uri again.
+
+If you return nothing (or nil) the request-handling just continues.
+
+Debugging
+=========
+
+To easy debugging we overloaded the print()-function in lua and redirect the output of print() to the error-log. ::
+
+  print("Host: " .. lighty.request["Host"])
+  print("Request-URI: " .. lighty.env["request.uri"])
+
+
+Examples
+========
+
+Sending text-files as HTML
+--------------------------
+
+This is a bit simplistic, but it illustrates the idea: Take a text-file and cover it in a <pre> tag.
+
+Config-file ::
+
+  magnet.attract-physical-path-to = server.docroot + "/readme.lua"
+
+readme.lua ::
+
+  lighty.content = { "<pre>", { filename = "/README" }, "</pre>" }
+  lighty.header["Content-Type"] = "text/html"
+  
+  return 200
+
+Maintainance pages
+------------------
+
+Your side might be on maintainance from time to time. Instead of shutting down the server confusing all
+users, you can just send a maintainance page.
+
+Config-file ::
+
+  magnet.attract-physical-path-to = server.docroot + "/maintainance.lua"
+
+maintainance.lua ::
+
+  require "lfs"
+
+  if (nil == lfs.attributes(lighty.env["physical.doc-root"] .. "/maintainance.html")) then
+    lighty.content = ( lighty.env["physical.doc-root"] .. "/maintainance.html" )
+
+    lighty.header["Content-Type"] = "text/html"
+
+    return 200
+  end
+
+mod_flv_streaming
+-----------------
+
+Config-file ::
+
+  magnet.attract-physical-path-to = server.docroot + "/flv-streaming.lua"
+
+flv-streaming.lua::
+
+  if (lighty.env["uri.query"]) then
+    -- split the query-string
+    get = {}
+    for k, v in string.gmatch(lighty.env["uri.query"], "(%w+)=(%w+)") do
+      get[k] = v
+    end
+
+    if (get["start"]) then
+      -- missing: check if start is numeric and positive
+
+      -- send te FLV header + a seek into the file
+      lighty.content = { "FLV\x1\x1\0\0\0\x9\0\0\0\x9", 
+         { filename = lighty.env["physical.path"], offset = get["start"] } }
+      lighty.header["Content-Type"] = "video/x-flv"
+
+      return 200
+    end
+  end
+
+  
+selecting a random file from a directory
+----------------------------------------
+
+Say, you want to send a random file (ad-content) from a directory. 
+
+To simplify the code and to improve the performance we define:
+
+* all images have the same format (e.g. image/png)
+* all images use increasing numbers starting from 1
+* a special index-file names the highest number
+
+Config ::
+
+  server.modules += ( "mod_magnet" )
+  magnet.attract-physical-path-to = "random.lua"
+
+random.lua ::
+
+  dir = lighty.env["physical.path"]
+
+  f = assert(io.open(dir .. "/index", "r"))
+  maxndx = f:read("*all")
+  f:close()
+
+  ndx = math.random(maxndx)
+
+  lighty.content = { { filename = dir .. "/" .. ndx }}
+  lighty.header["Content-Type"] = "image/png"
+
+  return 200
+
+denying illegal character sequences in the URL
+----------------------------------------------
+
+Instead of implementing mod_security, you might just want to apply filters on the content
+and deny special sequences that look like SQL injection. 
+
+A common injection is using UNION to extend a query with another SELECT query.
+
+::
+
+  if (string.find(lighty.env["request.uri"], "UNION%s")) then
+    return 400
+  end
+
+Traffic Quotas
+--------------
+
+If you only allow your virtual hosts a certain amount for traffic each month and want to 
+disable them if the traffic is reached, perhaps this helps: ::
+
+  host_blacklist = { ["www.example.org"] = 0 }
+
+  if (host_blacklist[lighty.request["Host"]]) then
+    return 404
+  end
+
+Just add the hosts you want to blacklist into the blacklist table in the shown way.
+
+Complex rewrites
+----------------
+
+If you want to implement caching on your document-root and only want to regenerate 
+content if the requested file doesn't exist, you can attract the physical.path: ::
+
+  magnet.attract-physical-path-to = ( server.document-root + "/rewrite.lua" )
+
+rewrite.lua ::
+
+  require "lfs"
+
+  attr = lfs.attributes(lighty.env["physical.path"])
+
+  if (not attr) then
+    -- we couldn't stat() the file for some reason
+    -- let the backend generate it
+
+    lighty.env["uri.path"] = "/dispatch.fcgi"
+    lighty.env["physical.rel-path"] = lighty.env["uri.path"]
+    lighty.env["physical.path"] = lighty.env["physical.doc-root"] .. lighty.env["physical.rel-path"]
+  fi
+
+luafilesystem
++++++++++++++
+
+We are requiring the lua-module 'lfs' (http://www.keplerproject.org/luafilesystem/). 
+
+I had to compile lfs myself for lua-5.1 which required a minor patch as compat-5.1 is not needed::
+
+  $ wget http://luaforge.net/frs/download.php/1487/luafilesystem-1.2.tar.gz
+  $ wget http://www.lighttpd.net/download/luafilesystem-1.2-lua51.diff
+  $ gzip -cd luafilesystem-1.2.tar.gz | tar xf -
+  $ cd luafilesystem-1.2
+  $ patch -ls -p1 < ../luafilesystem-1.2-lua51.diff
+  $ make install
+
+It will install lfs.so into /usr/lib/lua/5.1/ which is where lua expects the extensions on my system.
+
+SuSE and Gentoo are known to have their own lfs packages and don't require a compile.
+
+Usertracking
+------------
+
+... or how to store data globally in the script-context:
+
+Each script has its own script-context. When the script is started it only contains the lua-functions
+and the special lighty.* name-space. If you want to save data between script runs, you can use the global-script
+context:
+
+::
+
+  if (nil == _G["usertrack"]) then
+    _G["usertrack"] = {}
+  end
+  if (nil == _G["usertrack"][lighty.request["Cookie"]]) then
+    _G["usertrack"][lighty.request["Cookie"]]
+  else 
+    _G["usertrack"][lighty.request["Cookie"]] = _G["usertrack"][lighty.request["Cookie"]] + 1
+  end
+
+  print _G["usertrack"][lighty.request["Cookie"]]
+
+The global-context is per script. If you update the script without restarting the server, the context will still be maintained.
+
+Counters
+--------
+
+mod_status support a global statistics page and mod_magnet allows to add and update values in the status page:
+
+Config ::
+
+  status.statistics-url = "/server-counters"
+  magnet.attract-raw-url-to = server.docroot + "/counter.lua"
+
+counter.lua ::
+
+  lighty.status["core.connections"] = lighty.status["core.connections"] + 1
+
+Result::
+
+  core.connections: 7
+  fastcgi.backend.php-foo.0.connected: 0
+  fastcgi.backend.php-foo.0.died: 0
+  fastcgi.backend.php-foo.0.disabled: 0
+  fastcgi.backend.php-foo.0.load: 0
+  fastcgi.backend.php-foo.0.overloaded: 0
+  fastcgi.backend.php-foo.1.connected: 0
+  fastcgi.backend.php-foo.1.died: 0
+  fastcgi.backend.php-foo.1.disabled: 0
+  fastcgi.backend.php-foo.1.load: 0
+  fastcgi.backend.php-foo.1.overloaded: 0
+  fastcgi.backend.php-foo.load: 0
+
+Porting mod_cml scripts
+-----------------------
+
+mod_cml got replaced by mod_magnet.
+
+A CACHE_HIT in mod_cml::
+ 
+  output_include = { "file1", "file2" } 
+
+  return CACHE_HIT
+
+becomes::
+
+  content = { { filename = "/path/to/file1" }, { filename = "/path/to/file2"} }
+
+  return 200
+
+while a CACHE_MISS like (CML) ::
+
+  trigger_handler = "/index.php"
+
+  return CACHE_MISS
+
+becomes (magnet) ::
+
+  lighty.env["request.uri"] = "/index.php"
+
+  return lighty.RESTART_REQUEST
+
+}}}

Modified: lighttpd/trunk/doc/redirect.txt
===================================================================
--- lighttpd/trunk/doc/redirect.txt	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/doc/redirect.txt	2009-03-18 10:20:09 UTC (rev 355)
@@ -39,3 +39,9 @@
     $HTTP["host"] =~ "^www\.(.*)" {
       url.redirect = ( "^/(.*)" => "http://%1/$1" )
     }
+
+Warning
+=======
+
+Do NOT use mod_redirect to protect specific urls, as the original url passed from the client
+is matched against your rules, for example strings like "/abc/../xyz%2f/path".

Modified: lighttpd/trunk/doc/rewrite.txt
===================================================================
--- lighttpd/trunk/doc/rewrite.txt	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/doc/rewrite.txt	2009-03-18 10:20:09 UTC (rev 355)
@@ -43,6 +43,12 @@
 The options ``url.rewrite`` and ``url.rewrite-final`` were mapped to ``url.rewrite-once``
 in 1.3.16.
 
+Warning
+=======
+
+Do NOT use mod_rewrite to protect specific urls, as the original url passed from the client
+is matched against your rules, for example strings like "/abc/../xyz%2f/path".
+
 Examples
 ========
 

Modified: lighttpd/trunk/doc/userdir.txt
===================================================================
--- lighttpd/trunk/doc/userdir.txt	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/doc/userdir.txt	2009-03-18 10:20:09 UTC (rev 355)
@@ -46,10 +46,10 @@
 Options
 =======
 
-userdir.path
+userdir.path (required option)
   usually it should be set to "public_html" to take ~/public_html/ as the document root
 
-  Default: empty (document root is the home directory)
+  Default: unset (mod_userdir disabled; set it to "" if you want the home directory to be the document root as it was the default before 1.4.19)
   Example: ::
 
     userdir.path = "public_html"

Modified: lighttpd/trunk/install-sh
===================================================================
--- lighttpd/trunk/install-sh	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/install-sh	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2006-10-14.15
+scriptversion=2006-12-25.00
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -48,7 +48,7 @@
 # set DOITPROG to echo to test this script
 
 # Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
+doit=${DOITPROG-}
 if test -z "$doit"; then
   doit_exec=exec
 else
@@ -58,34 +58,49 @@
 # Put in absolute file names if you don't have them in your path;
 # or use environment vars.
 
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
 
-posix_glob=
+posix_glob='?'
+initialize_posix_glob='
+  test "$posix_glob" != "?" || {
+    if (set -f) 2>/dev/null; then
+      posix_glob=
+    else
+      posix_glob=:
+    fi
+  }
+'
+
 posix_mkdir=
 
 # Desired mode of installed file.
 mode=0755
 
+chgrpcmd=
 chmodcmd=$chmodprog
 chowncmd=
-chgrpcmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
 stripcmd=
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
+
 src=
 dst=
 dir_arg=
-dstarg=
+dst_arg=
+
+copy_on_change=false
 no_target_directory=
 
-usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
    or: $0 [OPTION]... SRCFILES... DIRECTORY
    or: $0 [OPTION]... -t DIRECTORY SRCFILES...
    or: $0 [OPTION]... -d DIRECTORIES...
@@ -95,65 +110,55 @@
 In the 4th, create DIRECTORIES.
 
 Options:
--c         (ignored)
--d         create directories instead of installing files.
--g GROUP   $chgrpprog installed files to GROUP.
--m MODE    $chmodprog installed files to MODE.
--o USER    $chownprog installed files to USER.
--s         $stripprog installed files.
--t DIRECTORY  install into DIRECTORY.
--T         report an error if DSTFILE is a directory.
---help     display this help and exit.
---version  display version info and exit.
+     --help     display this help and exit.
+     --version  display version info and exit.
 
+  -c            (ignored)
+  -C            install only if different (preserve the last data modification time)
+  -d            create directories instead of installing files.
+  -g GROUP      $chgrpprog installed files to GROUP.
+  -m MODE       $chmodprog installed files to MODE.
+  -o USER       $chownprog installed files to USER.
+  -s            $stripprog installed files.
+  -t DIRECTORY  install into DIRECTORY.
+  -T            report an error if DSTFILE is a directory.
+
 Environment variables override the default commands:
-  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+  RMPROG STRIPPROG
 "
 
 while test $# -ne 0; do
   case $1 in
-    -c) shift
-        continue;;
+    -c) ;;
 
-    -d) dir_arg=true
-        shift
-        continue;;
+    -C) copy_on_change=true;;
 
+    -d) dir_arg=true;;
+
     -g) chgrpcmd="$chgrpprog $2"
-        shift
-        shift
-        continue;;
+	shift;;
 
     --help) echo "$usage"; exit $?;;
 
     -m) mode=$2
-        shift
-        shift
 	case $mode in
 	  *' '* | *'	'* | *'
 '*	  | *'*'* | *'?'* | *'['*)
 	    echo "$0: invalid mode: $mode" >&2
 	    exit 1;;
 	esac
-        continue;;
+	shift;;
 
     -o) chowncmd="$chownprog $2"
-        shift
-        shift
-        continue;;
+	shift;;
 
-    -s) stripcmd=$stripprog
-        shift
-        continue;;
+    -s) stripcmd=$stripprog;;
 
-    -t) dstarg=$2
-	shift
-	shift
-	continue;;
+    -t) dst_arg=$2
+	shift;;
 
-    -T) no_target_directory=true
-	shift
-	continue;;
+    -T) no_target_directory=true;;
 
     --version) echo "$0 $scriptversion"; exit $?;;
 
@@ -165,21 +170,22 @@
 
     *)  break;;
   esac
+  shift
 done
 
-if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
   # When -d is used, all remaining arguments are directories to create.
   # When -t is used, the destination is already specified.
   # Otherwise, the last argument is the destination.  Remove it from $@.
   for arg
   do
-    if test -n "$dstarg"; then
+    if test -n "$dst_arg"; then
       # $@ is not empty: it contains at least $arg.
-      set fnord "$@" "$dstarg"
+      set fnord "$@" "$dst_arg"
       shift # fnord
     fi
     shift # arg
-    dstarg=$arg
+    dst_arg=$arg
   done
 fi
 
@@ -224,7 +230,7 @@
 do
   # Protect names starting with `-'.
   case $src in
-    -*) src=./$src ;;
+    -*) src=./$src;;
   esac
 
   if test -n "$dir_arg"; then
@@ -242,22 +248,22 @@
       exit 1
     fi
 
-    if test -z "$dstarg"; then
+    if test -z "$dst_arg"; then
       echo "$0: no destination specified." >&2
       exit 1
     fi
 
-    dst=$dstarg
+    dst=$dst_arg
     # Protect names starting with `-'.
     case $dst in
-      -*) dst=./$dst ;;
+      -*) dst=./$dst;;
     esac
 
     # If destination is a directory, append the input filename; won't work
     # if double slashes aren't ignored.
     if test -d "$dst"; then
       if test -n "$no_target_directory"; then
-	echo "$0: $dstarg: Is a directory" >&2
+	echo "$0: $dst_arg: Is a directory" >&2
 	exit 1
       fi
       dstdir=$dst
@@ -378,26 +384,19 @@
       # directory the slow way, step by step, checking for races as we go.
 
       case $dstdir in
-	/*) prefix=/ ;;
-	-*) prefix=./ ;;
-	*)  prefix= ;;
+	/*) prefix='/';;
+	-*) prefix='./';;
+	*)  prefix='';;
       esac
 
-      case $posix_glob in
-        '')
-	  if (set -f) 2>/dev/null; then
-	    posix_glob=true
-	  else
-	    posix_glob=false
-	  fi ;;
-      esac
+      eval "$initialize_posix_glob"
 
       oIFS=$IFS
       IFS=/
-      $posix_glob && set -f
+      $posix_glob set -f
       set fnord $dstdir
       shift
-      $posix_glob && set +f
+      $posix_glob set +f
       IFS=$oIFS
 
       prefixes=
@@ -459,42 +458,55 @@
     # ignore errors from any of these, just make sure not to ignore
     # errors from the above "$doit $cpprog $src $dsttmp" command.
     #
-    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
-      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
-      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
-      && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
 
-    # Now rename the file to the real destination.
-    { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
-      || {
-	   # The rename failed, perhaps because mv can't rename something else
-	   # to itself, or perhaps because mv is so ancient that it does not
-	   # support -f.
+    # If -C, don't bother to copy if it wouldn't change the file.
+    if $copy_on_change &&
+       old=`LC_ALL=C ls -dlL "$dst"	2>/dev/null` &&
+       new=`LC_ALL=C ls -dlL "$dsttmp"	2>/dev/null` &&
 
-	   # Now remove or move aside any old file at destination location.
-	   # We try this two ways since rm can't unlink itself on some
-	   # systems and the destination file might be busy for other
-	   # reasons.  In this case, the final cleanup might fail but the new
-	   # file should still install successfully.
-	   {
-	     if test -f "$dst"; then
-	       $doit $rmcmd -f "$dst" 2>/dev/null \
-	       || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
-		     && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
-	       || {
-		 echo "$0: cannot unlink or rename $dst" >&2
-		 (exit 1); exit 1
-	       }
-	     else
-	       :
-	     fi
-	   } &&
+       eval "$initialize_posix_glob" &&
+       $posix_glob set -f &&
+       set X $old && old=:$2:$4:$5:$6 &&
+       set X $new && new=:$2:$4:$5:$6 &&
+       $posix_glob set +f &&
 
-	   # Now rename the file to the real destination.
-	   $doit $mvcmd "$dsttmp" "$dst"
-	 }
-    } || exit 1
+       test "$old" = "$new" &&
+       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+    then
+      rm -f "$dsttmp"
+    else
+      # Rename the file to the real destination.
+      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
 
+      # The rename failed, perhaps because mv can't rename something else
+      # to itself, or perhaps because mv is so ancient that it does not
+      # support -f.
+      {
+	# Now remove or move aside any old file at destination location.
+	# We try this two ways since rm can't unlink itself on some
+	# systems and the destination file might be busy for other
+	# reasons.  In this case, the final cleanup might fail but the new
+	# file should still install successfully.
+	{
+	  test ! -f "$dst" ||
+	  $doit $rmcmd -f "$dst" 2>/dev/null ||
+	  { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+	    { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+	  } ||
+	  { echo "$0: cannot unlink or rename $dst" >&2
+	    (exit 1); exit 1
+	  }
+	} &&
+
+	# Now rename the file to the real destination.
+	$doit $mvcmd "$dsttmp" "$dst"
+      }
+    fi || exit 1
+
     trap '' 0
   fi
 done

Deleted: lighttpd/trunk/lighttpd.spec
===================================================================
--- lighttpd/trunk/lighttpd.spec	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/lighttpd.spec	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,83 +0,0 @@
-Summary: A fast webserver with minimal memory-footprint (lighttpd)
-Name: lighttpd
-Version: 1.4.19
-Release: 1
-Source: http://jan.kneschke.de/projects/lighttpd/download/lighttpd-%version.tar.gz
-Packager: Jan Kneschke <jan at kneschke.de>
-License: BSD
-Group: Networking/Daemons
-URL: http://www.lighttpd.net/
-Requires: pcre >= 3.1 zlib
-BuildRequires: libtool zlib-devel
-BuildRoot: %{_tmppath}/%{name}-root
-
-%description
-lighttpd is intented to be a frontend for ad-servers which have to deliver
-small files concurrently to many connections.
-
-Available rpmbuild rebuild options:
---with: ssl mysql lua memcache
-
-%prep
-%setup -q
-
-%build
-rm -rf %{buildroot}
-%configure \
-    %{?_with_mysql:       --with-mysql} \
-    %{?_with_lua:         --with-lua} \
-    %{?_with_memcache:    --with-memcache} \
-    %{?_with_ssl:         --with-openssl}
-make
-
-%install
-%makeinstall
-
-mkdir -p %{buildroot}%{_sysconfdir}/{init.d,sysconfig}
-if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then
-	install -m 755 doc/rc.lighttpd.redhat %{buildroot}%{_sysconfdir}/init.d/lighttpd
-else
-	install -m 755 doc/rc.lighttpd %{buildroot}%{_sysconfdir}/init.d/lighttpd
-fi
-install -m 644 doc/sysconfig.lighttpd %{buildroot}%{_sysconfdir}/sysconfig/lighttpd
-
-%clean
-rm -rf %{buildroot}
-
-%post
-## read http://www.fedora.us/docs/spec.html next time :)
-if [ "$1" = "1" ]; then
-	# real install, not upgrade
-	/sbin/chkconfig --add lighttpd
-fi
-
-%preun
-if [ "$1" = "0"]; then
-	# real uninstall, not upgrade
-	%{_sysconfdir}/init.d/lighttpd stop
-	/sbin/chkconfig --del lighttpd
-fi
-
-%files
-%defattr(-,root,root)
-%doc doc/lighttpd.conf doc/lighttpd.user README INSTALL ChangeLog COPYING AUTHORS
-%doc doc/*.txt
-%config(noreplace) %attr(0755,root,root) %{_sysconfdir}/init.d/lighttpd
-%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/sysconfig/lighttpd
-%{_mandir}/*
-%{_libdir}/*
-%{_sbindir}/*
-%{_bindir}/*
-
-%changelog
-* Thu Sep 30 2004 12:41 <jan at kneschke.de> 1.3.1
-- upgraded to 1.3.1
-
-* Tue Jun 29 2004 17:26 <jan at kneschke.de> 1.2.3
-- rpmlint'ed the package
-- added URL
-- added (noreplace) to start-script
-- change group to Networking/Daemon (like apache)
-
-* Sun Feb 23 2003 15:04 <jan at kneschke.de>
-- initial version

Deleted: lighttpd/trunk/lighttpd.spec.in
===================================================================
--- lighttpd/trunk/lighttpd.spec.in	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/lighttpd.spec.in	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,83 +0,0 @@
-Summary: A fast webserver with minimal memory-footprint (lighttpd)
-Name: lighttpd
-Version: @VERSION@
-Release: 1
-Source: http://jan.kneschke.de/projects/lighttpd/download/lighttpd-%version.tar.gz
-Packager: Jan Kneschke <jan at kneschke.de>
-License: BSD
-Group: Networking/Daemons
-URL: http://www.lighttpd.net/
-Requires: pcre >= 3.1 zlib
-BuildRequires: libtool zlib-devel
-BuildRoot: %{_tmppath}/%{name}-root
-
-%description
-lighttpd is intented to be a frontend for ad-servers which have to deliver
-small files concurrently to many connections.
-
-Available rpmbuild rebuild options:
---with: ssl mysql lua memcache
-
-%prep
-%setup -q
-
-%build
-rm -rf %{buildroot}
-%configure \
-    %{?_with_mysql:       --with-mysql} \
-    %{?_with_lua:         --with-lua} \
-    %{?_with_memcache:    --with-memcache} \
-    %{?_with_ssl:         --with-openssl}
-make
-
-%install
-%makeinstall
-
-mkdir -p %{buildroot}%{_sysconfdir}/{init.d,sysconfig}
-if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then
-	install -m 755 doc/rc.lighttpd.redhat %{buildroot}%{_sysconfdir}/init.d/lighttpd
-else
-	install -m 755 doc/rc.lighttpd %{buildroot}%{_sysconfdir}/init.d/lighttpd
-fi
-install -m 644 doc/sysconfig.lighttpd %{buildroot}%{_sysconfdir}/sysconfig/lighttpd
-
-%clean
-rm -rf %{buildroot}
-
-%post
-## read http://www.fedora.us/docs/spec.html next time :)
-if [ "$1" = "1" ]; then
-	# real install, not upgrade
-	/sbin/chkconfig --add lighttpd
-fi
-
-%preun
-if [ "$1" = "0"]; then
-	# real uninstall, not upgrade
-	%{_sysconfdir}/init.d/lighttpd stop
-	/sbin/chkconfig --del lighttpd
-fi
-
-%files
-%defattr(-,root,root)
-%doc doc/lighttpd.conf doc/lighttpd.user README INSTALL ChangeLog COPYING AUTHORS
-%doc doc/*.txt
-%config(noreplace) %attr(0755,root,root) %{_sysconfdir}/init.d/lighttpd
-%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/sysconfig/lighttpd
-%{_mandir}/*
-%{_libdir}/*
-%{_sbindir}/*
-%{_bindir}/*
-
-%changelog
-* Thu Sep 30 2004 12:41 <jan at kneschke.de> 1.3.1
-- upgraded to 1.3.1
-
-* Tue Jun 29 2004 17:26 <jan at kneschke.de> 1.2.3
-- rpmlint'ed the package
-- added URL
-- added (noreplace) to start-script
-- change group to Networking/Daemon (like apache)
-
-* Sun Feb 23 2003 15:04 <jan at kneschke.de>
-- initial version

Modified: lighttpd/trunk/ltmain.sh
===================================================================
--- lighttpd/trunk/ltmain.sh	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/ltmain.sh	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,8 +1,8 @@
 # ltmain.sh - Provide generalized library-building support services.
 # NOTE: Changing this file will not affect anything until you rerun configure.
 #
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007, 2008  Free Software Foundation, Inc.
 # Originally by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
 #
 # This program is free software; you can redistribute it and/or modify
@@ -43,14 +43,22 @@
 
 PROGRAM=ltmain.sh
 PACKAGE=libtool
-VERSION=1.5.22
-TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
+VERSION="1.5.26 Debian 1.5.26-4"
+TIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)"
 
-# See if we are running on zsh, and set the options which allow our
-# commands through without removal of \ escapes.
-if test -n "${ZSH_VERSION+set}" ; then
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
 fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
 
 # Check that we have a working $echo.
 if test "X$1" = X--no-reexec; then
@@ -105,12 +113,20 @@
 # These must not be set unconditionally because not all systems understand
 # e.g. LANG=C (notably SCO).
 # We save the old values to restore during execute mode.
-if test "${LC_ALL+set}" = set; then
-  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
+lt_env=
+for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+  eval "if test \"\${$lt_var+set}\" = set; then
+	  save_$lt_var=\$$lt_var
+	  lt_env=\"$lt_var=\$$lt_var \$lt_env\"
+	  $lt_var=C
+	  export $lt_var
+	fi"
+done
+
+if test -n "$lt_env"; then
+  lt_env="env $lt_env"
 fi
-if test "${LANG+set}" = set; then
-  save_LANG="$LANG"; LANG=C; export LANG
-fi
 
 # Make sure IFS has a sensible default
 lt_nl='
@@ -136,6 +152,8 @@
 preserve_args=
 lo2o="s/\\.lo\$/.${objext}/"
 o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
 
 #####################################
 # Shell function definitions:
@@ -196,7 +214,13 @@
     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
       $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
       win32_nmres=`eval $NM -f posix -A $1 | \
-	$SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
+	$SED -n -e '1,100{
+		/ I /{
+			s,.*,import,
+			p
+			q
+			}
+		}'`
       case $win32_nmres in
       import*)  win32_libid_type="x86 archive import";;
       *)        win32_libid_type="x86 archive static";;
@@ -327,7 +351,17 @@
 	*) my_xabs=`pwd`"/$my_xlib" ;;
       esac
       my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
-      my_xdir="$my_gentop/$my_xlib"
+      my_xlib_u=$my_xlib
+      while :; do
+        case " $extracted_archives " in
+	*" $my_xlib_u "*)
+	  extracted_serial=`expr $extracted_serial + 1`
+	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
+	*) break ;;
+	esac
+      done
+      extracted_archives="$extracted_archives $my_xlib_u"
+      my_xdir="$my_gentop/$my_xlib_u"
 
       $show "${rm}r $my_xdir"
       $run ${rm}r "$my_xdir"
@@ -454,11 +488,12 @@
     ;;
 
   --version)
-    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
-    $echo
-    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
-    $echo "This is free software; see the source for copying conditions.  There is NO"
-    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+    echo "\
+$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
+
+Copyright (C) 2008  Free Software Foundation, Inc.
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
     exit $?
     ;;
 
@@ -755,9 +790,11 @@
     *.class) xform=class ;;
     *.cpp) xform=cpp ;;
     *.cxx) xform=cxx ;;
-    *.f90) xform=f90 ;;
+    *.[fF][09]?) xform=[fF][09]. ;;
     *.for) xform=for ;;
     *.java) xform=java ;;
+    *.obj) xform=obj ;;
+    *.sx) xform=sx ;;
     esac
 
     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
@@ -926,7 +963,7 @@
       $run $rm "$lobj" "$output_obj"
 
       $show "$command"
-      if $run eval "$command"; then :
+      if $run eval $lt_env "$command"; then :
       else
 	test -n "$output_obj" && $run $rm $removelist
 	exit $EXIT_FAILURE
@@ -998,7 +1035,7 @@
       command="$command$suppress_output"
       $run $rm "$obj" "$output_obj"
       $show "$command"
-      if $run eval "$command"; then :
+      if $run eval $lt_env "$command"; then :
       else
 	$run $rm $removelist
 	exit $EXIT_FAILURE
@@ -1131,6 +1168,7 @@
     thread_safe=no
     vinfo=
     vinfo_number=no
+    single_module="${wl}-single_module"
 
     func_infer_tag $base_compile
 
@@ -1138,8 +1176,9 @@
     for arg
     do
       case $arg in
-      -all-static | -static)
-	if test "X$arg" = "X-all-static"; then
+      -all-static | -static | -static-libtool-libs)
+	case $arg in
+	-all-static)
 	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
 	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
 	  fi
@@ -1147,12 +1186,20 @@
 	    dlopen_self=$dlopen_self_static
 	  fi
 	  prefer_static_libs=yes
-	else
+	  ;;
+	-static)
 	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
 	    dlopen_self=$dlopen_self_static
 	  fi
 	  prefer_static_libs=built
-	fi
+	  ;;
+	-static-libtool-libs)
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=yes
+	  ;;
+	esac
 	build_libtool_libs=no
 	build_old_libs=yes
 	break
@@ -1600,13 +1647,18 @@
 	continue
 	;;
 
-     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
 	compiler_flags="$compiler_flags $arg"
 	compile_command="$compile_command $arg"
 	finalize_command="$finalize_command $arg"
 	continue
 	;;
 
+      -multi_module)
+	single_module="${wl}-multi_module"
+	continue
+	;;
+
       -module)
 	module=yes
 	continue
@@ -1620,10 +1672,11 @@
       # -m* pass through architecture-specific compiler args for GCC
       # -m*, -t[45]*, -txscale* pass through architecture-specific
       # compiler args for GCC
-      # -pg pass through profiling flag for GCC
+      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
+      # -F/path gives path to uninstalled frameworks, gcc on darwin
       # @file GCC response files
-      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
-      -t[45]*|-txscale*|@*)
+      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
 
 	# Unknown arguments in both finalize_command and compile_command need
 	# to be aesthetically quoted because they are evaled later.
@@ -1651,9 +1704,9 @@
 
       -no-install)
 	case $host in
-	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
 	  # The PATH hackery in wrapper scripts is required on Windows
-	  # in order for the loader to find any dlls it needs.
+	  # and Darwin in order for the loader to find any dlls it needs.
 	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
 	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
 	  fast_install=no
@@ -1712,7 +1765,7 @@
 	continue
 	;;
 
-      -static)
+      -static | -static-libtool-libs)
 	# The effects of -static are defined in a previous loop.
 	# We used to do the same as -all-static on platforms that
 	# didn't have a PIC flag, but the assumption that the effects
@@ -2082,7 +2135,10 @@
 	case $pass in
 	dlopen) libs="$dlfiles" ;;
 	dlpreopen) libs="$dlprefiles" ;;
-	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+	link)
+	  libs="$deplibs %DEPLIBS%"
+	  test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
+	  ;;
 	esac
       fi
       if test "$pass" = dlopen; then
@@ -2094,7 +2150,7 @@
 	lib=
 	found=no
 	case $deplib in
-	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
 	  if test "$linkmode,$pass" = "prog,link"; then
 	    compile_deplibs="$deplib $compile_deplibs"
 	    finalize_deplibs="$deplib $finalize_deplibs"
@@ -2109,7 +2165,12 @@
 	    continue
 	  fi
 	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
-	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
+	  if test "$linkmode" = lib; then
+	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
+	  else
+	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
+	  fi
+	  for searchdir in $searchdirs; do
 	    for search_ext in .la $std_shrext .so .a; do
 	      # Search the libtool library
 	      lib="$searchdir/lib${name}${search_ext}"
@@ -2490,7 +2551,9 @@
 
 	if test "$linkmode,$pass" = "prog,link"; then
 	  if test -n "$library_names" &&
-	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+	     { { test "$prefer_static_libs" = no ||
+		 test "$prefer_static_libs,$installed" = "built,yes"; } ||
+	       test -z "$old_library"; }; then
 	    # We need to hardcode the library path
 	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
 	      # Make sure the rpath contains only unique directories.
@@ -2903,12 +2966,18 @@
 		  # we do not want to link against static libs,
 		  # but need to link against shared
 		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+		  eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 		  if test -n "$deplibrary_names" ; then
 		    for tmp in $deplibrary_names ; do
 		      depdepl=$tmp
 		    done
-		    if test -f "$path/$depdepl" ; then
+		    if test -f "$deplibdir/$depdepl" ; then
+		      depdepl="$deplibdir/$depdepl"
+	      	    elif test -f "$path/$depdepl" ; then
 		      depdepl="$path/$depdepl"
+		    else
+		      # Can't find it, oh well...
+		      depdepl=
 		    fi
 		    # do not add paths which are already there
 		    case " $newlib_search_path " in
@@ -3056,9 +3125,10 @@
 
     case $linkmode in
     oldlib)
-      if test -n "$deplibs"; then
-	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
-      fi
+      case " $deplibs" in
+      *\ -l* | *\ -L*)
+	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
+      esac
 
       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
 	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
@@ -3186,7 +3256,7 @@
 	  # which has an extra 1 added just for fun
 	  #
 	  case $version_type in
-	  darwin|linux|osf|windows)
+	  darwin|linux|osf|windows|none)
 	    current=`expr $number_major + $number_minor`
 	    age="$number_minor"
 	    revision="$number_revision"
@@ -3197,10 +3267,16 @@
 	    age="0"
 	    ;;
 	  irix|nonstopux)
-	    current=`expr $number_major + $number_minor - 1`
+	    current=`expr $number_major + $number_minor`
 	    age="$number_minor"
 	    revision="$number_minor"
+	    lt_irix_increment=no
 	    ;;
+	  *)
+	    $echo "$modename: unknown library version type \`$version_type'" 1>&2
+	    $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+	    exit $EXIT_FAILURE
+	    ;;
 	  esac
 	  ;;
 	no)
@@ -3258,7 +3334,8 @@
 	  versuffix="$major.$age.$revision"
 	  # Darwin ld doesn't like 0 for these options...
 	  minor_current=`expr $current + 1`
-	  verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
 	  ;;
 
 	freebsd-aout)
@@ -3272,8 +3349,11 @@
 	  ;;
 
 	irix | nonstopux)
-	  major=`expr $current - $age + 1`
-
+	  if test "X$lt_irix_increment" = "Xno"; then
+	    major=`expr $current - $age`
+	  else
+	    major=`expr $current - $age + 1`
+	  fi
 	  case $version_type in
 	    nonstopux) verstring_prefix=nonstopux ;;
 	    *)         verstring_prefix=sgi ;;
@@ -3410,11 +3490,11 @@
       fi
 
       # Eliminate all temporary directories.
-      for path in $notinst_path; do
-	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
-	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
-	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
-      done
+      #for path in $notinst_path; do
+      #	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
+      #	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
+      #	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
+      #done
 
       if test -n "$xrpath"; then
 	# If the user specified any rpath flags, then add them.
@@ -3515,13 +3595,12 @@
 	  int main() { return 0; }
 EOF
 	  $rm conftest
-	  $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
-	  if test "$?" -eq 0 ; then
+	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
 	    ldd_output=`ldd conftest`
 	    for i in $deplibs; do
 	      name=`expr $i : '-l\(.*\)'`
 	      # If $name is empty we are operating on a -L argument.
-              if test "$name" != "" && test "$name" -ne "0"; then
+              if test "$name" != "" && test "$name" != "0"; then
 		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		  case " $predeps $postdeps " in
 		  *" $i "*)
@@ -3560,9 +3639,7 @@
 	      # If $name is empty we are operating on a -L argument.
               if test "$name" != "" && test "$name" != "0"; then
 		$rm conftest
-		$LTCC $LTCFLAGS -o conftest conftest.c $i
-		# Did it work?
-		if test "$?" -eq 0 ; then
+		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
 		  ldd_output=`ldd conftest`
 		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		    case " $predeps $postdeps " in
@@ -3594,7 +3671,7 @@
 		  droppeddeps=yes
 		  $echo
 		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
-		  $echo "***  make it link in!  You will probably need to install it or some"
+		  $echo "*** make it link in!  You will probably need to install it or some"
 		  $echo "*** library that it depends on before this library will be fully"
 		  $echo "*** functional.  Installing it before continuing would be even better."
 		fi
@@ -3880,7 +3957,10 @@
 	     test -n "$hardcode_libdirs"; then
 	    libdir="$hardcode_libdirs"
 	    if test -n "$hardcode_libdir_flag_spec_ld"; then
-	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
+	      case $archive_cmds in
+	      *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
+	      *)      eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
+	      esac
 	    else
 	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 	    fi
@@ -4190,9 +4270,10 @@
       ;;
 
     obj)
-      if test -n "$deplibs"; then
-	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
-      fi
+      case " $deplibs" in
+      *\ -l* | *\ -L*)
+	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
+      esac
 
       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
 	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
@@ -4239,12 +4320,14 @@
       reload_conv_objs=
       gentop=
       # reload_cmds runs $LD directly, so let us get rid of
-      # -Wl from whole_archive_flag_spec
+      # -Wl from whole_archive_flag_spec and hope we can get by with
+      # turning comma into space..
       wl=
 
       if test -n "$convenience"; then
 	if test -n "$whole_archive_flag_spec"; then
-	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+	  reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
 	else
 	  gentop="$output_objdir/${obj}x"
 	  generated="$generated $gentop"
@@ -4692,16 +4775,16 @@
           case $host in
           *cygwin* | *mingw* )
             if test -f "$output_objdir/${outputname}.def" ; then
-              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
-              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
+              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
+              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
             else
-              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
-              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
              fi
             ;;
           * )
-            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
-            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
             ;;
           esac
 	  ;;
@@ -4716,13 +4799,13 @@
 	# really was required.
 
 	# Nullify the symbol file.
-	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
-	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
+	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
       fi
 
       if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
 	# Replace the output file specification.
-	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
 	link_command="$compile_command$compile_rpath"
 
 	# We have no uninstalled library dependencies, so finalize right now.
@@ -4809,7 +4892,7 @@
 	if test "$fast_install" != no; then
 	  link_command="$finalize_var$compile_command$finalize_rpath"
 	  if test "$fast_install" = yes; then
-	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
 	  else
 	    # fast_install is set to needless
 	    relink_command=
@@ -4846,7 +4929,7 @@
 	  fi
 	done
 	relink_command="(cd `pwd`; $relink_command)"
-	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+	relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
       fi
 
       # Quote $echo for shipping.
@@ -5253,6 +5336,20 @@
 Xsed='${SED} -e 1s/^X//'
 sed_quote_subst='$sed_quote_subst'
 
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
 # The HP-UX ksh and POSIX shell print the target directory to stdout
 # if CDPATH is set.
 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
@@ -5395,7 +5492,7 @@
 	  ;;
 	esac
 	$echo >> $output "\
-      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+      \$echo \"\$0: cannot exec \$program \$*\"
       exit $EXIT_FAILURE
     fi
   else
@@ -5581,7 +5678,7 @@
       done
       # Quote the link command for shipping.
       relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
-      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
       if test "$hardcode_automatic" = yes ; then
 	relink_command=
       fi
@@ -5926,9 +6023,9 @@
 
 	  if test -n "$inst_prefix_dir"; then
 	    # Stick the inst_prefix_dir data into the link command.
-	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
 	  else
-	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
 	  fi
 
 	  $echo "$modename: warning: relinking \`$file'" 1>&2
@@ -6137,7 +6234,7 @@
 	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
 	      outputname="$tmpdir/$file"
 	      # Replace the output file specification.
-	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+	      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
 
 	      $show "$relink_command"
 	      if $run eval "$relink_command"; then :
@@ -6348,8 +6445,10 @@
 	if test -f "$dir/$objdir/$dlname"; then
 	  dir="$dir/$objdir"
 	else
-	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
-	  exit $EXIT_FAILURE
+	  if test ! -f "$dir/$dlname"; then
+	    $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
 	fi
 	;;
 
@@ -6413,12 +6512,12 @@
       fi
 
       # Restore saved environment variables
-      if test "${save_LC_ALL+set}" = set; then
-	LC_ALL="$save_LC_ALL"; export LC_ALL
-      fi
-      if test "${save_LANG+set}" = set; then
-	LANG="$save_LANG"; export LANG
-      fi
+      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+      do
+	eval "if test \"\${save_$lt_var+set}\" = set; then
+		$lt_var=\$save_$lt_var; export $lt_var
+	      fi"
+      done
 
       # Now prepare to actually exec the command.
       exec_cmd="\$cmd$args"
@@ -6775,9 +6874,9 @@
   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
   -export-symbols SYMFILE
-		    try to export only the symbols listed in SYMFILE
+                    try to export only the symbols listed in SYMFILE
   -export-symbols-regex REGEX
-		    try to export only the symbols matching REGEX
+                    try to export only the symbols matching REGEX
   -LLIBDIR          search LIBDIR for required installed libraries
   -lNAME            OUTPUT-FILE requires the installed library libNAME
   -module           build a library that can dlopened
@@ -6791,9 +6890,11 @@
   -release RELEASE  specify package release information
   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
   -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
-  -static           do not do any dynamic linking of libtool libraries
+  -static           do not do any dynamic linking of uninstalled libtool libraries
+  -static-libtool-libs
+                    do not do any dynamic linking of libtool libraries
   -version-info CURRENT[:REVISION[:AGE]]
-		    specify library version info [each variable defaults to 0]
+                    specify library version info [each variable defaults to 0]
 
 All other options (arguments beginning with \`-') are ignored.
 

Modified: lighttpd/trunk/src/Makefile.am
===================================================================
--- lighttpd/trunk/src/Makefile.am	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/Makefile.am	2009-03-18 10:20:09 UTC (rev 355)
@@ -3,7 +3,7 @@
 noinst_PROGRAMS=proc_open lemon # simple-fcgi #graphic evalo bench ajp ssl error_test adserver gen-license
 sbin_PROGRAMS=lighttpd lighttpd-angel
 bin_PROGRAMS=spawn-fcgi
-LEMON=$(top_builddir)/src/lemon
+LEMON=$(top_builddir)/src/lemon$(EXEEXT)
 
 lemon_SOURCES=lemon.c
 
@@ -15,21 +15,26 @@
 if CROSS_COMPILING
 configparser.c configparser.h:
 mod_ssi_exprparser.c mod_ssi_exprparser.h:
+
+.PHONY: parsers
+parsers:
 else
-$(srcdir)/configparser.y: lemon
-$(srcdir)/mod_ssi_exprparser.y: lemon
-
-configparser.c configparser.h: $(srcdir)/configparser.y
+configparser.h: configparser.c
+configparser.c: $(srcdir)/configparser.y $(srcdir)/lempar.c lemon$(EXEEXT)
 	rm -f configparser.h
 	$(LEMON) -q $(srcdir)/configparser.y $(srcdir)/lempar.c
 
-mod_ssi_exprparser.c mod_ssi_exprparser.h: $(srcdir)/mod_ssi_exprparser.y
+mod_ssi_exprparser.h: mod_ssi_exprparser.c
+mod_ssi_exprparser.c: $(srcdir)/mod_ssi_exprparser.y $(srcdir)/lempar.c lemon$(EXEEXT)
 	rm -f mod_ssi_exprparser.h
 	$(LEMON) -q $(srcdir)/mod_ssi_exprparser.y $(srcdir)/lempar.c
+
+.PHONY: parsers
+parsers: configparser.c mod_ssi_exprparser.c
 endif
 
-$(srcdir)/configfile.c: configparser.h
-$(srcdir)/mod_ssi_expr.c: mod_ssi_exprparser.h
+BUILT_SOURCES = parsers
+MAINTAINERCLEANFILES = configparser.c configparser.h mod_ssi_exprparser.c mod_ssi_exprparser.h
 
 common_src=buffer.c log.c \
       keyvalue.c chunk.c  \

Modified: lighttpd/trunk/src/Makefile.in
===================================================================
--- lighttpd/trunk/src/Makefile.in	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/Makefile.in	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -383,7 +383,7 @@
 am_spawn_fcgi_OBJECTS = spawn-fcgi.$(OBJEXT)
 spawn_fcgi_OBJECTS = $(am_spawn_fcgi_OBJECTS)
 spawn_fcgi_LDADD = $(LDADD)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -461,6 +461,7 @@
 DEFS = @DEFS@ -DLIBRARY_DIR="\"$(libdir)\"" -DSBIN_DIR="\"$(sbindir)\""
 DEPDIR = @DEPDIR@
 DL_LIB = @DL_LIB@
+DSYMUTIL = @DSYMUTIL@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -495,6 +496,7 @@
 MYSQL_CONFIG = @MYSQL_CONFIG@
 MYSQL_INCLUDE = @MYSQL_INCLUDE@
 MYSQL_LIBS = @MYSQL_LIBS@
+NMEDIT = @NMEDIT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -507,6 +509,7 @@
 PCRE_LIB = @PCRE_LIB@
 PKG_CONFIG = @PKG_CONFIG@
 RANLIB = @RANLIB@
+SED = @SED@
 SENDFILE_LIB = @SENDFILE_LIB@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
@@ -576,9 +579,11 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 AM_CFLAGS = $(FAM_CFLAGS)
-LEMON = $(top_builddir)/src/lemon
+LEMON = $(top_builddir)/src/lemon$(EXEEXT)
 lemon_SOURCES = lemon.c
 lighttpd_angel_SOURCES = lighttpd-angel.c
+BUILT_SOURCES = parsers
+MAINTAINERCLEANFILES = configparser.c configparser.h mod_ssi_exprparser.c mod_ssi_exprparser.h
 common_src = buffer.c log.c \
       keyvalue.c chunk.c  \
       http_chunk.c stream.c fdevent.c \
@@ -756,7 +761,8 @@
 #ajp_SOURCES = ajp.c
 noinst_HEADERS = $(hdr)
 EXTRA_DIST = mod_skeleton.c configparser.y mod_ssi_exprparser.y lempar.c SConscript
-all: all-am
+all: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) all-am
 
 .SUFFIXES:
 .SUFFIXES: .c .lo .o .obj
@@ -795,8 +801,8 @@
 	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
 	  if test -f $$p; then \
 	    f=$(am__strip_dir) \
-	    echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
-	    $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
 	  else :; fi; \
 	done
 
@@ -804,8 +810,8 @@
 	@$(NORMAL_UNINSTALL)
 	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
 	  p=$(am__strip_dir) \
-	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
-	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
 	done
 
 clean-libLTLIBRARIES:
@@ -891,8 +897,8 @@
 	     || test -f $$p1 \
 	  ; then \
 	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
-	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
 	  else :; fi; \
 	done
 
@@ -926,8 +932,8 @@
 	     || test -f $$p1 \
 	  ; then \
 	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
-	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
 	  else :; fi; \
 	done
 
@@ -1480,8 +1486,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -1493,8 +1499,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -1504,13 +1510,12 @@
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique
@@ -1550,7 +1555,8 @@
 	  fi; \
 	done
 check-am: all-am
-check: check-am
+check: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) check-am
 all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
 install-binPROGRAMS: install-libLTLIBRARIES
 
@@ -1558,7 +1564,8 @@
 	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
-install: install-am
+install: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) install-am
 install-exec: install-exec-am
 install-data: install-data-am
 uninstall: uninstall-am
@@ -1582,6 +1589,8 @@
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
+	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+	-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
 clean: clean-am
 
 clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
@@ -1669,19 +1678,21 @@
 
 @CROSS_COMPILING_TRUE at configparser.c configparser.h:
 @CROSS_COMPILING_TRUE at mod_ssi_exprparser.c mod_ssi_exprparser.h:
- at CROSS_COMPILING_FALSE@$(srcdir)/configparser.y: lemon
- at CROSS_COMPILING_FALSE@$(srcdir)/mod_ssi_exprparser.y: lemon
 
- at CROSS_COMPILING_FALSE@configparser.c configparser.h: $(srcdir)/configparser.y
+ at CROSS_COMPILING_TRUE@.PHONY: parsers
+ at CROSS_COMPILING_TRUE@parsers:
+ at CROSS_COMPILING_FALSE@configparser.h: configparser.c
+ at CROSS_COMPILING_FALSE@configparser.c: $(srcdir)/configparser.y $(srcdir)/lempar.c lemon$(EXEEXT)
 @CROSS_COMPILING_FALSE@	rm -f configparser.h
 @CROSS_COMPILING_FALSE@	$(LEMON) -q $(srcdir)/configparser.y $(srcdir)/lempar.c
 
- at CROSS_COMPILING_FALSE@mod_ssi_exprparser.c mod_ssi_exprparser.h: $(srcdir)/mod_ssi_exprparser.y
+ at CROSS_COMPILING_FALSE@mod_ssi_exprparser.h: mod_ssi_exprparser.c
+ at CROSS_COMPILING_FALSE@mod_ssi_exprparser.c: $(srcdir)/mod_ssi_exprparser.y $(srcdir)/lempar.c lemon$(EXEEXT)
 @CROSS_COMPILING_FALSE@	rm -f mod_ssi_exprparser.h
 @CROSS_COMPILING_FALSE@	$(LEMON) -q $(srcdir)/mod_ssi_exprparser.y $(srcdir)/lempar.c
 
-$(srcdir)/configfile.c: configparser.h
-$(srcdir)/mod_ssi_expr.c: mod_ssi_exprparser.h
+ at CROSS_COMPILING_FALSE@.PHONY: parsers
+ at CROSS_COMPILING_FALSE@parsers: configparser.c mod_ssi_exprparser.c
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:

Modified: lighttpd/trunk/src/SConscript
===================================================================
--- lighttpd/trunk/src/SConscript	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/SConscript	2009-03-18 10:20:09 UTC (rev 355)
@@ -43,6 +43,7 @@
 	'mod_cgi' : { 'src' : [ 'mod_cgi.c' ] },
 	'mod_fastcgi' : { 'src' : [ 'mod_fastcgi.c' ] },
 	'mod_scgi' : { 'src' : [ 'mod_scgi.c' ] },
+	'mod_extforward' : { 'src' : [ 'mod_extforward.c' ] },
 	'mod_staticfile' : { 'src' : [ 'mod_staticfile.c' ] },
 	'mod_dirlisting' : { 'src' : [ 'mod_dirlisting.c' ], 'lib' : [ env['LIBPCRE'] ] },
 	'mod_indexfile' : { 'src' : [ 'mod_indexfile.c' ] },

Modified: lighttpd/trunk/src/array.c
===================================================================
--- lighttpd/trunk/src/array.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/array.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -330,30 +330,30 @@
 	a = array_init();
 
 	ds = data_string_init();
-	buffer_copy_string(ds->key, "abc");
-	buffer_copy_string(ds->value, "alfrag");
+	buffer_copy_string_len(ds->key, CONST_STR_LEN("abc"));
+	buffer_copy_string_len(ds->value, CONST_STR_LEN("alfrag"));
 
 	array_insert_unique(a, (data_unset *)ds);
 
 	ds = data_string_init();
-	buffer_copy_string(ds->key, "abc");
-	buffer_copy_string(ds->value, "hameplman");
+	buffer_copy_string_len(ds->key, CONST_STR_LEN("abc"));
+	buffer_copy_string_len(ds->value, CONST_STR_LEN("hameplman"));
 
 	array_insert_unique(a, (data_unset *)ds);
 
 	ds = data_string_init();
-	buffer_copy_string(ds->key, "123");
-	buffer_copy_string(ds->value, "alfrag");
+	buffer_copy_string_len(ds->key, CONST_STR_LEN("123"));
+	buffer_copy_string_len(ds->value, CONST_STR_LEN("alfrag"));
 
 	array_insert_unique(a, (data_unset *)ds);
 
 	dc = data_count_init();
-	buffer_copy_string(dc->key, "def");
+	buffer_copy_string_len(dc->key, CONST_STR_LEN("def"));
 
 	array_insert_unique(a, (data_unset *)dc);
 
 	dc = data_count_init();
-	buffer_copy_string(dc->key, "def");
+	buffer_copy_string_len(dc->key, CONST_STR_LEN("def"));
 
 	array_insert_unique(a, (data_unset *)dc);
 

Modified: lighttpd/trunk/src/array.h
===================================================================
--- lighttpd/trunk/src/array.h	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/array.h	2009-03-18 10:20:09 UTC (rev 355)
@@ -87,6 +87,7 @@
 	COMP_HTTP_HOST,
 	COMP_HTTP_REFERER,
 	COMP_HTTP_USER_AGENT,
+	COMP_HTTP_LANGUAGE,
 	COMP_HTTP_COOKIE,
 	COMP_HTTP_REMOTE_IP,
 	COMP_HTTP_QUERY_STRING,

Modified: lighttpd/trunk/src/base.h
===================================================================
--- lighttpd/trunk/src/base.h	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/base.h	2009-03-18 10:20:09 UTC (rev 355)
@@ -259,6 +259,8 @@
 	unsigned short log_request_handling;
 	unsigned short log_response_header;
 	unsigned short log_condition_handling;
+	unsigned short log_ssl_noise;
+	unsigned short log_timeouts;
 
 
 	/* server wide */
@@ -490,12 +492,13 @@
 
 	enum { STAT_CACHE_ENGINE_UNSET,
 			STAT_CACHE_ENGINE_NONE,
-			STAT_CACHE_ENGINE_SIMPLE,
+			STAT_CACHE_ENGINE_SIMPLE
 #ifdef HAVE_FAM_H
-			STAT_CACHE_ENGINE_FAM
+			, STAT_CACHE_ENGINE_FAM
 #endif
 	} stat_cache_engine;
 	unsigned short enable_cores;
+	unsigned short reject_expect_100_with_417;
 } server_config;
 
 typedef struct {

Modified: lighttpd/trunk/src/buffer.c
===================================================================
--- lighttpd/trunk/src/buffer.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/buffer.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -55,6 +55,8 @@
 		free(b->ptr);
 		b->ptr = NULL;
 		b->size = 0;
+	} else if (b->size) {
+		b->ptr[0] = '\0';
 	}
 
 	b->used = 0;
@@ -157,7 +159,7 @@
 	if (!src) return -1;
 
 	if (src->used == 0) {
-		b->used = 0;
+		buffer_reset(b);
 		return 0;
 	}
 	return buffer_copy_string_len(b, src->ptr, src->used - 1);
@@ -185,6 +187,7 @@
 	if (!s || !b) return -1;
 
 	s_len = strlen(s);
+	if (s_len > maxlen)  s_len = maxlen;
 	buffer_prepare_append(b, maxlen + 1);
 	if (b->used == 0)
 		b->used++;
@@ -626,6 +629,7 @@
 	return 0;
 }
 
+/* everything except: ! ( ) * - . 0-9 A-Z _ a-z */
 const char encoded_chars_rel_uri_part[] = {
 	/*
 	0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
@@ -633,11 +637,11 @@
 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /*  00 -  0F control chars */
 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /*  10 -  1F */
 	1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1,  /*  20 -  2F space " # $ % & ' + , / */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,  /*  30 -  3F : ; = ? @ < > */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /*  40 -  4F */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /*  50 -  5F */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /*  60 -  6F */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,  /*  70 -  7F DEL */
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,  /*  30 -  3F : ; < = > ? */
+	1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /*  40 -  4F @ */
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0,  /*  50 -  5F [ \ ] ^ */
+	1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /*  60 -  6F ` */
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,  /*  70 -  7F { | } ~ DEL */
 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /*  80 -  8F */
 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /*  90 -  9F */
 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /*  A0 -  AF */
@@ -648,18 +652,19 @@
 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /*  F0 -  FF */
 };
 
+/* everything except: ! ( ) * - . / 0-9 A-Z _ a-z */
 const char encoded_chars_rel_uri[] = {
 	/*
 	0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
 	*/
 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /*  00 -  0F control chars */
 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /*  10 -  1F */
-	1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0,  /*  20 -  2F space " # $ % & ' + , / */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,  /*  30 -  3F : ; = ? @ < > */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /*  40 -  4F */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /*  50 -  5F */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /*  60 -  6F */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,  /*  70 -  7F DEL */
+	1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0,  /*  20 -  2F space " # $ % & ' + , */
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,  /*  30 -  3F : ; < = > ? */
+	1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /*  40 -  4F @ */
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0,  /*  50 -  5F [ \ ] ^ */
+	1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /*  60 -  6F ` */
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,  /*  70 -  7F { | } ~ DEL */
 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /*  80 -  8F */
 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /*  90 -  9F */
 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /*  A0 -  AF */

Modified: lighttpd/trunk/src/chunk.c
===================================================================
--- lighttpd/trunk/src/chunk.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/chunk.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -296,7 +296,7 @@
 
 			buffer_copy_string_buffer(template, ds->value);
 			BUFFER_APPEND_SLASH(template);
-			BUFFER_APPEND_STRING_CONST(template, "lighttpd-upload-XXXXXX");
+			buffer_append_string_len(template, CONST_STR_LEN("lighttpd-upload-XXXXXX"));
 
 			if (-1 != (c->file.fd = mkstemp(template->ptr))) {
 				/* only trigger the unlink if we created the temp-file successfully */

Modified: lighttpd/trunk/src/configfile-glue.c
===================================================================
--- lighttpd/trunk/src/configfile-glue.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/configfile-glue.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <stdlib.h>
 
 #include "base.h"
 #include "buffer.h"
@@ -90,6 +91,22 @@
 			case TYPE_STRING: {
 				data_string *ds = (data_string *)du;
 
+				/* If the value came from an environment variable, then it is a
+				 * data_string, although it may contain a number in ASCII
+				 * decimal format.  We try to interpret the string as a decimal
+				 * short before giving up, in order to support setting numeric
+				 * values with environment variables (eg, port number).
+				 */
+				if (ds->value->ptr && *ds->value->ptr) {
+					char *e;
+					long l = strtol(ds->value->ptr, &e, 10);
+					if (e != ds->value->ptr && !*e && l >=0 && l <= 65535) {
+						*((unsigned short *)(cv[i].destination)) = l;
+						break;
+
+					}
+				}
+
 				log_error_write(srv, __FILE__, __LINE__, "ssb", "got a string but expected a short:", cv[i].key, ds->value);
 
 				return -1;
@@ -155,7 +172,7 @@
 		/* touched */
 		touched = data_string_init();
 
-		buffer_copy_string(touched->value, "");
+		buffer_copy_string_len(touched->value, CONST_STR_LEN(""));
 		buffer_copy_string_buffer(touched->key, du->key);
 
 		array_insert_unique(srv->config_touched, (data_unset *)touched);
@@ -260,7 +277,7 @@
 				if (ck_colon) {
 					/* condition "host:port" but client send "host" */
 					buffer_copy_string_buffer(srv->cond_check_buf, l);
-					BUFFER_APPEND_STRING_CONST(srv->cond_check_buf, ":");
+					buffer_append_string_len(srv->cond_check_buf, CONST_STR_LEN(":"));
 					buffer_append_long(srv->cond_check_buf, sock_addr_get_port(&(srv_sock->addr)));
 					l = srv->cond_check_buf;
 				} else if (!ck_colon) {
@@ -396,6 +413,15 @@
 
 		break;
 	}
+	case COMP_HTTP_LANGUAGE: {
+		data_string *ds;
+		if (NULL != (ds = (data_string *)array_get_element(con->request.headers, "Accept-Language"))) {
+			l = ds->value;
+		} else {
+			l = srv->empty_string;
+		}
+		break;
+	}
 	default:
 		return COND_RESULT_FALSE;
 	}
@@ -529,7 +555,7 @@
 int config_append_cond_match_buffer(connection *con, data_config *dc, buffer *buf, int n)
 {
 	cond_cache_t *cache = &con->cond_cache[dc->context_ndx];
-	if (n > cache->patterncount) {
+	if (n >= cache->patterncount) {
 		return 0;
 	}
 

Modified: lighttpd/trunk/src/configfile.c
===================================================================
--- lighttpd/trunk/src/configfile.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/configfile.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -7,6 +7,7 @@
 #include <string.h>
 #include <stdio.h>
 #include <ctype.h>
+#include <limits.h>
 #include <assert.h>
 
 #include "server.h"
@@ -74,24 +75,27 @@
 		{ "debug.log-request-handling",  NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER },     /* 32 */
 		{ "debug.log-response-header",   NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER },     /* 33 */
 		{ "debug.log-request-header",    NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER },     /* 34 */
+		{ "debug.log-ssl-noise",         NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER },     /* 35 */
 
-		{ "server.protocol-http11",      NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER },     /* 35 */
-		{ "debug.log-request-header-on-error", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 36 */
-		{ "debug.log-state-handling",    NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER },     /* 37 */
-		{ "ssl.ca-file",                 NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER },      /* 38 */
+		{ "server.protocol-http11",      NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER },     /* 36 */
+		{ "debug.log-request-header-on-error", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 37 */
+		{ "debug.log-state-handling",    NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER },     /* 38 */
+		{ "ssl.ca-file",                 NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER },      /* 39 */
 
-		{ "server.errorlog-use-syslog",  NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER },     /* 39 */
-		{ "server.range-requests",       NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 40 */
-		{ "server.stat-cache-engine",    NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },  /* 41 */
-		{ "server.max-connections",      NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_SERVER },       /* 42 */
-		{ "server.network-backend",      NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },  /* 43 */
-		{ "server.upload-dirs",          NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION },   /* 44 */
-		{ "server.core-files",           NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 45 */
-		{ "ssl.cipher-list",             NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER },      /* 46 */
-		{ "ssl.use-sslv2",               NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 47 */
-		{ "etag.use-inode",             NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 48 */
-		{ "etag.use-mtime",             NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 49 */
-		{ "etag.use-size",             NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 50 */
+		{ "server.errorlog-use-syslog",  NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER },     /* 40 */
+		{ "server.range-requests",       NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 41 */
+		{ "server.stat-cache-engine",    NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },  /* 42 */
+		{ "server.max-connections",      NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_SERVER },       /* 43 */
+		{ "server.network-backend",      NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },  /* 44 */
+		{ "server.upload-dirs",          NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION },   /* 45 */
+		{ "server.core-files",           NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 46 */
+		{ "ssl.cipher-list",             NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER },      /* 47 */
+		{ "ssl.use-sslv2",               NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 48 */
+		{ "etag.use-inode",              NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 49 */
+		{ "etag.use-mtime",              NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 50 */
+		{ "etag.use-size",               NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 51 */
+		{ "server.reject-expect-100-with-417",  NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 52 */
+		{ "debug.log-timeouts",          NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 53 */
 		{ "server.host",                 "use server.bind instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
 		{ "server.docroot",              "use server.document-root instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
 		{ "server.virtual-root",         "load mod_simple_vhost and use simple-vhost.server-root instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
@@ -120,19 +124,20 @@
 
 	cv[13].destination = &(srv->srvconf.max_worker);
 	cv[23].destination = &(srv->srvconf.max_fds);
-	cv[36].destination = &(srv->srvconf.log_request_header_on_error);
-	cv[37].destination = &(srv->srvconf.log_state_handling);
+	cv[37].destination = &(srv->srvconf.log_request_header_on_error);
+	cv[38].destination = &(srv->srvconf.log_state_handling);
 
-	cv[39].destination = &(srv->srvconf.errorlog_use_syslog);
+	cv[40].destination = &(srv->srvconf.errorlog_use_syslog);
 
 	stat_cache_string = buffer_init();
-	cv[41].destination = stat_cache_string;
-	cv[43].destination = srv->srvconf.network_backend;
-	cv[44].destination = srv->srvconf.upload_tempdirs;
-	cv[45].destination = &(srv->srvconf.enable_cores);
+	cv[42].destination = stat_cache_string;
+	cv[44].destination = srv->srvconf.network_backend;
+	cv[45].destination = srv->srvconf.upload_tempdirs;
+	cv[46].destination = &(srv->srvconf.enable_cores);
 
-	cv[42].destination = &(srv->srvconf.max_conns);
+	cv[43].destination = &(srv->srvconf.max_conns);
 	cv[12].destination = &(srv->srvconf.max_request_size);
+	cv[52].destination = &(srv->srvconf.reject_expect_100_with_417);
 	srv->config_storage = calloc(1, srv->config_context->used * sizeof(specific_config *));
 
 	assert(srv->config_storage);
@@ -157,7 +162,7 @@
 		s->max_write_idle = 360;
 		s->use_xattr     = 0;
 		s->is_ssl        = 0;
-		s->ssl_use_sslv2 = 1;
+		s->ssl_use_sslv2 = 0;
 		s->use_ipv6      = 0;
 #ifdef HAVE_LSTAT
 		s->follow_symlink = 1;
@@ -204,16 +209,18 @@
 		cv[32].destination = &(s->log_request_handling);
 		cv[33].destination = &(s->log_response_header);
 		cv[34].destination = &(s->log_request_header);
+		cv[35].destination = &(s->log_ssl_noise);
+		cv[53].destination = &(s->log_timeouts);
 
-		cv[35].destination = &(s->allow_http11);
-		cv[38].destination = s->ssl_ca_file;
-		cv[40].destination = &(s->range_requests);
+		cv[36].destination = &(s->allow_http11);
+		cv[39].destination = s->ssl_ca_file;
+		cv[41].destination = &(s->range_requests);
 
-		cv[46].destination = s->ssl_cipher_list;
-		cv[47].destination = &(s->ssl_use_sslv2);
-		cv[48].destination = &(s->etag_use_inode);
-		cv[49].destination = &(s->etag_use_mtime);
-		cv[50].destination = &(s->etag_use_size);
+		cv[47].destination = s->ssl_cipher_list;
+		cv[48].destination = &(s->ssl_use_sslv2);
+		cv[49].destination = &(s->etag_use_inode);
+		cv[50].destination = &(s->etag_use_mtime);
+		cv[51].destination = &(s->etag_use_size);
 
 		srv->config_storage[i] = s;
 
@@ -279,6 +286,7 @@
 	PATCH(log_request_handling);
 	PATCH(log_condition_handling);
 	PATCH(log_file_not_found);
+	PATCH(log_ssl_noise);
 
 	PATCH(range_requests);
 	PATCH(force_lowercase_filenames);
@@ -305,9 +313,6 @@
 		data_config *dc = (data_config *)srv->config_context->data[i];
 		specific_config *s = srv->config_storage[i];
 
-		/* not our stage */
-		if (comp != dc->comp) continue;
-
 		/* condition didn't match */
 		if (!config_check_cond(srv, con, dc)) continue;
 
@@ -371,6 +376,10 @@
 				PATCH(log_condition_handling);
 			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("debug.log-file-not-found"))) {
 				PATCH(log_file_not_found);
+			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("debug.log-ssl-noise"))) {
+				PATCH(log_ssl_noise);
+			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("debug.log-timeouts"))) {
+				PATCH(log_timeouts);
 			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.protocol-http11"))) {
 				PATCH(allow_http11);
 			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.force-lowercase-filenames"))) {
@@ -410,8 +419,8 @@
 
 #if 0
 static int tokenizer_open(server *srv, tokenizer_t *t, buffer *basedir, const char *fn) {
-	if (buffer_is_empty(basedir) &&
-			(fn[0] == '/' || fn[0] == '\\') &&
+	if (buffer_is_empty(basedir) ||
+			(fn[0] == '/' || fn[0] == '\\') ||
 			(fn[0] == '.' && (fn[1] == '/' || fn[1] == '\\'))) {
 		t->file = buffer_init_string(fn);
 	} else {
@@ -480,7 +489,7 @@
 				if (t->input[t->offset + 1] == '>') {
 					t->offset += 2;
 
-					buffer_copy_string(token, "=>");
+					buffer_copy_string_len(token, CONST_STR_LEN("=>"));
 
 					tid = TK_ARRAY_ASSIGN;
 				} else {
@@ -494,13 +503,13 @@
 				if (t->input[t->offset + 1] == '=') {
 					t->offset += 2;
 
-					buffer_copy_string(token, "==");
+					buffer_copy_string_len(token, CONST_STR_LEN("=="));
 
 					tid = TK_EQ;
 				} else if (t->input[t->offset + 1] == '~') {
 					t->offset += 2;
 
-					buffer_copy_string(token, "=~");
+					buffer_copy_string_len(token, CONST_STR_LEN("=~"));
 
 					tid = TK_MATCH;
 				} else {
@@ -533,13 +542,13 @@
 				if (t->input[t->offset + 1] == '=') {
 					t->offset += 2;
 
-					buffer_copy_string(token, "!=");
+					buffer_copy_string_len(token, CONST_STR_LEN("!="));
 
 					tid = TK_NE;
 				} else if (t->input[t->offset + 1] == '~') {
 					t->offset += 2;
 
-					buffer_copy_string(token, "!~");
+					buffer_copy_string_len(token, CONST_STR_LEN("!~"));
 
 					tid = TK_NOMATCH;
 				} else {
@@ -594,7 +603,7 @@
 				}
 				t->in_key = 1;
 				tid = TK_EOL;
-				buffer_copy_string(token, "(EOL)");
+				buffer_copy_string_len(token, CONST_STR_LEN("(EOL)"));
 			} else {
 				config_skip_newline(t);
 				t->line_pos = 1;
@@ -605,7 +614,7 @@
 			if (t->in_brace > 0) {
 				tid = TK_COMMA;
 
-				buffer_copy_string(token, "(COMMA)");
+				buffer_copy_string_len(token, CONST_STR_LEN("(COMMA)"));
 			}
 
 			t->offset++;
@@ -614,7 +623,7 @@
 		case '"':
 			/* search for the terminating " */
 			start = t->input + t->offset + 1;
-			buffer_copy_string(token, "");
+			buffer_copy_string_len(token, CONST_STR_LEN(""));
 
 			for (i = 1; t->input[t->offset + i]; i++) {
 				if (t->input[t->offset + i] == '\\' &&
@@ -660,7 +669,7 @@
 
 			tid = TK_LPARAN;
 
-			buffer_copy_string(token, "(");
+			buffer_copy_string_len(token, CONST_STR_LEN("("));
 			break;
 		case ')':
 			t->offset++;
@@ -668,7 +677,7 @@
 
 			tid = TK_RPARAN;
 
-			buffer_copy_string(token, ")");
+			buffer_copy_string_len(token, CONST_STR_LEN(")"));
 			break;
 		case '$':
 			t->offset++;
@@ -677,19 +686,19 @@
 			t->in_cond = 1;
 			t->in_key = 0;
 
-			buffer_copy_string(token, "$");
+			buffer_copy_string_len(token, CONST_STR_LEN("$"));
 
 			break;
 
 		case '+':
 			if (t->input[t->offset + 1] == '=') {
 				t->offset += 2;
-				buffer_copy_string(token, "+=");
+				buffer_copy_string_len(token, CONST_STR_LEN("+="));
 				tid = TK_APPEND;
 			} else {
 				t->offset++;
 				tid = TK_PLUS;
-				buffer_copy_string(token, "+");
+				buffer_copy_string_len(token, CONST_STR_LEN("+"));
 			}
 			break;
 
@@ -698,7 +707,7 @@
 
 			tid = TK_LCURLY;
 
-			buffer_copy_string(token, "{");
+			buffer_copy_string_len(token, CONST_STR_LEN("{"));
 
 			break;
 
@@ -707,7 +716,7 @@
 
 			tid = TK_RCURLY;
 
-			buffer_copy_string(token, "}");
+			buffer_copy_string_len(token, CONST_STR_LEN("}"));
 
 			break;
 
@@ -716,7 +725,7 @@
 
 			tid = TK_LBRACKET;
 
-			buffer_copy_string(token, "[");
+			buffer_copy_string_len(token, CONST_STR_LEN("["));
 
 			break;
 
@@ -725,7 +734,7 @@
 
 			tid = TK_RBRACKET;
 
-			buffer_copy_string(token, "]");
+			buffer_copy_string_len(token, CONST_STR_LEN("]"));
 
 			break;
 		case '#':
@@ -884,8 +893,8 @@
 	int ret;
 	buffer *filename;
 
-	if (buffer_is_empty(context->basedir) &&
-			(fn[0] == '/' || fn[0] == '\\') &&
+	if (buffer_is_empty(context->basedir) ||
+			(fn[0] == '/' || fn[0] == '\\') ||
 			(fn[0] == '.' && (fn[1] == '/' || fn[1] == '\\'))) {
 		filename = buffer_init_string(fn);
 	} else {
@@ -912,15 +921,38 @@
 	return ret;
 }
 
+static char* getCWD() {
+	char *s, *s1;
+	size_t len;
+#ifdef PATH_MAX
+	len = PATH_MAX;
+#else
+	len = 4096;
+#endif
+
+	s = malloc(len);
+	if (!s) return NULL;
+	while (NULL == getcwd(s, len)) {
+		if (errno != ERANGE || SSIZE_MAX - len < len) return NULL;
+		len *= 2;
+		s1 = realloc(s, len);
+		if (!s1) {
+			free(s);
+			return NULL;
+		}
+		s = s1;
+	}
+	return s;
+}
+
 int config_parse_cmd(server *srv, config_t *context, const char *cmd) {
-	proc_handler_t proc;
 	tokenizer_t t;
 	int ret;
 	buffer *source;
 	buffer *out;
-	char oldpwd[PATH_MAX];
+	char *oldpwd;
 
-	if (NULL == getcwd(oldpwd, sizeof(oldpwd))) {
+	if (NULL == (oldpwd = getCWD())) {
 		log_error_write(srv, __FILE__, __LINE__, "s",
 				"cannot get cwd", strerror(errno));
 		return -1;
@@ -933,7 +965,7 @@
 		chdir(context->basedir->ptr);
 	}
 
-	if (0 != proc_open_buffer(&proc, cmd, NULL, out, NULL)) {
+	if (0 != proc_open_buffer(cmd, NULL, out, NULL)) {
 		log_error_write(srv, __FILE__, __LINE__, "sbss",
 				"opening", source, "failed:", strerror(errno));
 		ret = -1;
@@ -945,6 +977,7 @@
 	buffer_free(source);
 	buffer_free(out);
 	chdir(oldpwd);
+	free(oldpwd);
 	return ret;
 }
 
@@ -973,20 +1006,18 @@
 	context_init(srv, &context);
 	context.all_configs = srv->config_context;
 
-	pos = strrchr(fn,
 #ifdef __WIN32
-			'\\'
+	pos = strrchr(fn, '\\');
 #else
-			'/'
+	pos = strrchr(fn, '/');
 #endif
-			);
 	if (pos) {
 		buffer_copy_string_len(context.basedir, fn, pos - fn + 1);
 		fn = pos + 1;
 	}
 
 	dc = data_config_init();
-	buffer_copy_string(dc->key, "global");
+	buffer_copy_string_len(dc->key, CONST_STR_LEN("global"));
 
 	assert(context.all_configs->used == 0);
 	dc->context_ndx = context.all_configs->used;
@@ -997,14 +1028,14 @@
 	srv->config = dc->value;
 	dpid = data_integer_init();
 	dpid->value = getpid();
-	buffer_copy_string(dpid->key, "var.PID");
+	buffer_copy_string_len(dpid->key, CONST_STR_LEN("var.PID"));
 	array_insert_unique(srv->config, (data_unset *)dpid);
 
 	dcwd = data_string_init();
 	buffer_prepare_copy(dcwd->value, 1024);
 	if (NULL != getcwd(dcwd->value->ptr, dcwd->value->size - 1)) {
 		dcwd->value->used = strlen(dcwd->value->ptr) + 1;
-		buffer_copy_string(dcwd->key, "var.CWD");
+		buffer_copy_string_len(dcwd->key, CONST_STR_LEN("var.CWD"));
 		array_insert_unique(srv->config, (data_unset *)dcwd);
 	}
 
@@ -1038,7 +1069,7 @@
 		/* prepend default modules */
 		if (NULL == array_get_element(modules->value, "mod_indexfile")) {
 			ds = data_string_init();
-			buffer_copy_string(ds->value, "mod_indexfile");
+			buffer_copy_string_len(ds->value, CONST_STR_LEN("mod_indexfile"));
 			array_insert_unique(prepends->value, (data_unset *)ds);
 		}
 
@@ -1051,13 +1082,13 @@
 		/* append default modules */
 		if (NULL == array_get_element(modules->value, "mod_dirlisting")) {
 			ds = data_string_init();
-			buffer_copy_string(ds->value, "mod_dirlisting");
+			buffer_copy_string_len(ds->value, CONST_STR_LEN("mod_dirlisting"));
 			array_insert_unique(modules->value, (data_unset *)ds);
 		}
 
 		if (NULL == array_get_element(modules->value, "mod_staticfile")) {
 			ds = data_string_init();
-			buffer_copy_string(ds->value, "mod_staticfile");
+			buffer_copy_string_len(ds->value, CONST_STR_LEN("mod_staticfile"));
 			array_insert_unique(modules->value, (data_unset *)ds);
 		}
 	} else {
@@ -1067,18 +1098,18 @@
 
 		/* server.modules is not set */
 		ds = data_string_init();
-		buffer_copy_string(ds->value, "mod_indexfile");
+		buffer_copy_string_len(ds->value, CONST_STR_LEN("mod_indexfile"));
 		array_insert_unique(modules->value, (data_unset *)ds);
 
 		ds = data_string_init();
-		buffer_copy_string(ds->value, "mod_dirlisting");
+		buffer_copy_string_len(ds->value, CONST_STR_LEN("mod_dirlisting"));
 		array_insert_unique(modules->value, (data_unset *)ds);
 
 		ds = data_string_init();
-		buffer_copy_string(ds->value, "mod_staticfile");
+		buffer_copy_string_len(ds->value, CONST_STR_LEN("mod_staticfile"));
 		array_insert_unique(modules->value, (data_unset *)ds);
 
-		buffer_copy_string(modules->key, "server.modules");
+		buffer_copy_string_len(modules->key, CONST_STR_LEN("server.modules"));
 		array_insert_unique(srv->config, (data_unset *)modules);
 	}
 

Modified: lighttpd/trunk/src/configparser.c
===================================================================
--- lighttpd/trunk/src/configparser.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/configparser.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -4,7 +4,7 @@
 /* First off, code is include which follows the "include" declaration
 ** in the input file. */
 #include <stdio.h>
-#line 5 "./configparser.y"
+#line 5 "../../src/configparser.y"
 
 #include <assert.h>
 #include <stdio.h>
@@ -24,6 +24,10 @@
     dc->parent = ctx->current;
     array_insert_unique(dc->parent->childs, (data_unset *)dc);
   }
+  if (ctx->configs_stack->used > 0 && ctx->current->context_ndx == 0) {
+    fprintf(stderr, "Cannot use conditionals inside a global { ... } block\n");
+    exit(-1);
+  }
   array_insert_unique(ctx->configs_stack, (data_unset *)ctx->current);
   ctx->current = dc;
 }
@@ -105,7 +109,7 @@
 }
 
 
-#line 109 "configparser.c"
+#line 113 "configparser.c"
 /* Next is all token values, in a form suitable for use by makeheaders.
 ** This section will be null unless lemon is run with the -m switch.
 */
@@ -359,12 +363,14 @@
 ** Outputs:
 ** None.
 */
+#if 0
 void configparserTrace(FILE *TraceFILE, char *zTracePrompt){
   yyTraceFILE = TraceFILE;
   yyTracePrompt = zTracePrompt;
   if( yyTraceFILE==0 ) yyTracePrompt = 0;
   else if( yyTracePrompt==0 ) yyTraceFILE = 0;
 }
+#endif
 #endif /* NDEBUG */
 
 #ifndef NDEBUG
@@ -437,9 +443,10 @@
 ** This function returns the symbolic name associated with a token
 ** value.
 */
+#if 0
 const char *configparserTokenName(int tokenType){
 #ifndef NDEBUG
-  if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){
+  if( tokenType>0 && (size_t)tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){
     return yyTokenName[tokenType];
   }else{
     return "Unknown";
@@ -448,6 +455,7 @@
   return "";
 #endif
 }
+#endif
 
 /*
 ** This function allocates a new parser.
@@ -512,44 +520,44 @@
     case 23:
     case 24:
     case 25:
-#line 142 "./configparser.y"
+#line 146 "../../src/configparser.y"
 { buffer_free((yypminor->yy0)); }
-#line 517 "configparser.c"
+#line 525 "configparser.c"
       break;
     case 35:
-#line 133 "./configparser.y"
+#line 137 "../../src/configparser.y"
 { (yypminor->yy41)->free((yypminor->yy41)); }
-#line 522 "configparser.c"
+#line 530 "configparser.c"
       break;
     case 36:
-#line 134 "./configparser.y"
+#line 138 "../../src/configparser.y"
 { (yypminor->yy41)->free((yypminor->yy41)); }
-#line 527 "configparser.c"
+#line 535 "configparser.c"
       break;
     case 37:
-#line 135 "./configparser.y"
+#line 139 "../../src/configparser.y"
 { (yypminor->yy41)->free((yypminor->yy41)); }
-#line 532 "configparser.c"
+#line 540 "configparser.c"
       break;
     case 39:
-#line 136 "./configparser.y"
+#line 140 "../../src/configparser.y"
 { array_free((yypminor->yy40)); }
-#line 537 "configparser.c"
+#line 545 "configparser.c"
       break;
     case 40:
-#line 137 "./configparser.y"
+#line 141 "../../src/configparser.y"
 { array_free((yypminor->yy40)); }
-#line 542 "configparser.c"
+#line 550 "configparser.c"
       break;
     case 41:
-#line 138 "./configparser.y"
+#line 142 "../../src/configparser.y"
 { buffer_free((yypminor->yy43)); }
-#line 547 "configparser.c"
+#line 555 "configparser.c"
       break;
     case 42:
-#line 139 "./configparser.y"
+#line 143 "../../src/configparser.y"
 { buffer_free((yypminor->yy43)); }
-#line 552 "configparser.c"
+#line 560 "configparser.c"
       break;
     default:  break;   /* If no destructor action specified: do nothing */
   }
@@ -627,7 +635,7 @@
     return YY_NO_ACTION;
   }
   i += iLookAhead;
-  if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
+  if( i<0 || (size_t)i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
 #ifdef YYFALLBACK
     int iFallback;            /* Fallback token */
     if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
@@ -670,7 +678,7 @@
     return YY_NO_ACTION;
   }
   i += iLookAhead;
-  if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
+  if( i<0 || (size_t)i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
     return yy_default[stateno];
   }else{
     return yy_action[i];
@@ -786,7 +794,7 @@
   yymsp = &yypParser->yystack[yypParser->yyidx];
 #ifndef NDEBUG
   if( yyTraceFILE && yyruleno>=0
-        && yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){
+        && (size_t)yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){
     fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
       yyRuleName[yyruleno]);
   }
@@ -817,9 +825,9 @@
         /* No destructor defined for global */
         break;
       case 5:
-#line 115 "./configparser.y"
+#line 119 "../../src/configparser.y"
 { yymsp[-1].minor.yy78 = NULL; }
-#line 822 "configparser.c"
+#line 830 "configparser.c"
   yy_destructor(1,&yymsp[0].minor);
         break;
       case 6:
@@ -832,7 +840,7 @@
   yy_destructor(1,&yymsp[0].minor);
         break;
       case 9:
-#line 144 "./configparser.y"
+#line 148 "../../src/configparser.y"
 {
   if (ctx->ok) {
     buffer_copy_string_buffer(yymsp[0].minor.yy41->key, yymsp[-2].minor.yy43);
@@ -856,11 +864,11 @@
   buffer_free(yymsp[-2].minor.yy43);
   yymsp[-2].minor.yy43 = NULL;
 }
-#line 859 "configparser.c"
+#line 867 "configparser.c"
   yy_destructor(2,&yymsp[-1].minor);
         break;
       case 10:
-#line 168 "./configparser.y"
+#line 172 "../../src/configparser.y"
 {
   array *vars = ctx->current->value;
   data_unset *du;
@@ -900,11 +908,11 @@
   yymsp[-2].minor.yy43 = NULL;
   yymsp[0].minor.yy41 = NULL;
 }
-#line 903 "configparser.c"
+#line 911 "configparser.c"
   yy_destructor(3,&yymsp[-1].minor);
         break;
       case 11:
-#line 208 "./configparser.y"
+#line 212 "../../src/configparser.y"
 {
   if (strchr(yymsp[0].minor.yy0->ptr, '.') == NULL) {
     yygotominor.yy43 = buffer_init_string("var.");
@@ -916,10 +924,10 @@
     yymsp[0].minor.yy0 = NULL;
   }
 }
-#line 919 "configparser.c"
+#line 927 "configparser.c"
         break;
       case 12:
-#line 220 "./configparser.y"
+#line 224 "../../src/configparser.y"
 {
   yygotominor.yy41 = configparser_merge_data(yymsp[-2].minor.yy41, yymsp[0].minor.yy41);
   if (NULL == yygotominor.yy41) {
@@ -929,19 +937,19 @@
   yymsp[0].minor.yy41->free(yymsp[0].minor.yy41);
   yymsp[0].minor.yy41 = NULL;
 }
-#line 932 "configparser.c"
+#line 940 "configparser.c"
   yy_destructor(5,&yymsp[-1].minor);
         break;
       case 13:
-#line 230 "./configparser.y"
+#line 234 "../../src/configparser.y"
 {
   yygotominor.yy41 = yymsp[0].minor.yy41;
   yymsp[0].minor.yy41 = NULL;
 }
-#line 941 "configparser.c"
+#line 949 "configparser.c"
         break;
       case 14:
-#line 235 "./configparser.y"
+#line 239 "../../src/configparser.y"
 {
   yygotominor.yy41 = NULL;
   if (strncmp(yymsp[0].minor.yy43->ptr, "env.", sizeof("env.") - 1) == 0) {
@@ -968,59 +976,59 @@
   buffer_free(yymsp[0].minor.yy43);
   yymsp[0].minor.yy43 = NULL;
 }
-#line 971 "configparser.c"
+#line 979 "configparser.c"
         break;
       case 15:
-#line 262 "./configparser.y"
+#line 266 "../../src/configparser.y"
 {
   yygotominor.yy41 = (data_unset *)data_string_init();
   buffer_copy_string_buffer(((data_string *)(yygotominor.yy41))->value, yymsp[0].minor.yy0);
   buffer_free(yymsp[0].minor.yy0);
   yymsp[0].minor.yy0 = NULL;
 }
-#line 981 "configparser.c"
+#line 989 "configparser.c"
         break;
       case 16:
-#line 269 "./configparser.y"
+#line 273 "../../src/configparser.y"
 {
   yygotominor.yy41 = (data_unset *)data_integer_init();
   ((data_integer *)(yygotominor.yy41))->value = strtol(yymsp[0].minor.yy0->ptr, NULL, 10);
   buffer_free(yymsp[0].minor.yy0);
   yymsp[0].minor.yy0 = NULL;
 }
-#line 991 "configparser.c"
+#line 999 "configparser.c"
         break;
       case 17:
-#line 275 "./configparser.y"
+#line 279 "../../src/configparser.y"
 {
   yygotominor.yy41 = (data_unset *)data_array_init();
   array_free(((data_array *)(yygotominor.yy41))->value);
   ((data_array *)(yygotominor.yy41))->value = yymsp[0].minor.yy40;
   yymsp[0].minor.yy40 = NULL;
 }
-#line 1001 "configparser.c"
+#line 1009 "configparser.c"
         break;
       case 18:
-#line 281 "./configparser.y"
+#line 285 "../../src/configparser.y"
 {
   yygotominor.yy40 = array_init();
 }
-#line 1008 "configparser.c"
+#line 1016 "configparser.c"
   yy_destructor(8,&yymsp[-1].minor);
   yy_destructor(9,&yymsp[0].minor);
         break;
       case 19:
-#line 284 "./configparser.y"
+#line 288 "../../src/configparser.y"
 {
   yygotominor.yy40 = yymsp[-1].minor.yy40;
   yymsp[-1].minor.yy40 = NULL;
 }
-#line 1018 "configparser.c"
+#line 1026 "configparser.c"
   yy_destructor(8,&yymsp[-2].minor);
   yy_destructor(9,&yymsp[0].minor);
         break;
       case 20:
-#line 289 "./configparser.y"
+#line 293 "../../src/configparser.y"
 {
   if (buffer_is_empty(yymsp[0].minor.yy41->key) ||
       NULL == array_get_element(yymsp[-2].minor.yy40, yymsp[0].minor.yy41->key->ptr)) {
@@ -1037,37 +1045,37 @@
   yygotominor.yy40 = yymsp[-2].minor.yy40;
   yymsp[-2].minor.yy40 = NULL;
 }
-#line 1040 "configparser.c"
+#line 1048 "configparser.c"
   yy_destructor(10,&yymsp[-1].minor);
         break;
       case 21:
-#line 306 "./configparser.y"
+#line 310 "../../src/configparser.y"
 {
   yygotominor.yy40 = yymsp[-1].minor.yy40;
   yymsp[-1].minor.yy40 = NULL;
 }
-#line 1049 "configparser.c"
+#line 1057 "configparser.c"
   yy_destructor(10,&yymsp[0].minor);
         break;
       case 22:
-#line 311 "./configparser.y"
+#line 315 "../../src/configparser.y"
 {
   yygotominor.yy40 = array_init();
   array_insert_unique(yygotominor.yy40, yymsp[0].minor.yy41);
   yymsp[0].minor.yy41 = NULL;
 }
-#line 1059 "configparser.c"
+#line 1067 "configparser.c"
         break;
       case 23:
-#line 317 "./configparser.y"
+#line 321 "../../src/configparser.y"
 {
   yygotominor.yy41 = yymsp[0].minor.yy41;
   yymsp[0].minor.yy41 = NULL;
 }
-#line 1067 "configparser.c"
+#line 1075 "configparser.c"
         break;
       case 24:
-#line 321 "./configparser.y"
+#line 325 "../../src/configparser.y"
 {
   buffer_copy_string_buffer(yymsp[0].minor.yy41->key, yymsp[-2].minor.yy43);
   buffer_free(yymsp[-2].minor.yy43);
@@ -1076,7 +1084,7 @@
   yygotominor.yy41 = yymsp[0].minor.yy41;
   yymsp[0].minor.yy41 = NULL;
 }
-#line 1079 "configparser.c"
+#line 1087 "configparser.c"
   yy_destructor(11,&yymsp[-1].minor);
         break;
       case 25:
@@ -1085,18 +1093,18 @@
       case 26:
         break;
       case 27:
-#line 333 "./configparser.y"
+#line 337 "../../src/configparser.y"
 {
   data_config *dc;
   dc = (data_config *)array_get_element(ctx->srv->config_context, "global");
   assert(dc);
   configparser_push(ctx, dc, 0);
 }
-#line 1095 "configparser.c"
+#line 1103 "configparser.c"
   yy_destructor(12,&yymsp[0].minor);
         break;
       case 28:
-#line 340 "./configparser.y"
+#line 344 "../../src/configparser.y"
 {
   data_config *cur;
 
@@ -1107,14 +1115,14 @@
 
   yygotominor.yy78 = cur;
 }
-#line 1110 "configparser.c"
+#line 1118 "configparser.c"
         /* No destructor defined for globalstart */
   yy_destructor(13,&yymsp[-2].minor);
         /* No destructor defined for metalines */
   yy_destructor(14,&yymsp[0].minor);
         break;
       case 29:
-#line 351 "./configparser.y"
+#line 355 "../../src/configparser.y"
 {
   assert(yymsp[-3].minor.yy78->context_ndx < yymsp[0].minor.yy78->context_ndx);
   yymsp[0].minor.yy78->prev = yymsp[-3].minor.yy78;
@@ -1123,20 +1131,20 @@
   yymsp[-3].minor.yy78 = NULL;
   yymsp[0].minor.yy78 = NULL;
 }
-#line 1126 "configparser.c"
+#line 1134 "configparser.c"
         /* No destructor defined for eols */
   yy_destructor(15,&yymsp[-1].minor);
         break;
       case 30:
-#line 360 "./configparser.y"
+#line 364 "../../src/configparser.y"
 {
   yygotominor.yy78 = yymsp[0].minor.yy78;
   yymsp[0].minor.yy78 = NULL;
 }
-#line 1136 "configparser.c"
+#line 1144 "configparser.c"
         break;
       case 31:
-#line 365 "./configparser.y"
+#line 369 "../../src/configparser.y"
 {
   data_config *cur;
 
@@ -1147,14 +1155,14 @@
 
   yygotominor.yy78 = cur;
 }
-#line 1150 "configparser.c"
+#line 1158 "configparser.c"
         /* No destructor defined for context */
   yy_destructor(13,&yymsp[-2].minor);
         /* No destructor defined for metalines */
   yy_destructor(14,&yymsp[0].minor);
         break;
       case 32:
-#line 376 "./configparser.y"
+#line 380 "../../src/configparser.y"
 {
   data_config *dc;
   buffer *b, *rvalue, *op;
@@ -1205,6 +1213,7 @@
       { COMP_HTTP_REFERER,       CONST_STR_LEN("HTTP[\"referer\"]"    ) },
       { COMP_HTTP_USER_AGENT,    CONST_STR_LEN("HTTP[\"useragent\"]"  ) },
       { COMP_HTTP_USER_AGENT,    CONST_STR_LEN("HTTP[\"user-agent\"]"  ) },
+      { COMP_HTTP_LANGUAGE,      CONST_STR_LEN("HTTP[\"language\"]"   ) },
       { COMP_HTTP_COOKIE,        CONST_STR_LEN("HTTP[\"cookie\"]"     ) },
       { COMP_HTTP_REMOTE_IP,     CONST_STR_LEN("HTTP[\"remoteip\"]"   ) },
       { COMP_HTTP_REMOTE_IP,     CONST_STR_LEN("HTTP[\"remote-ip\"]"   ) },
@@ -1295,45 +1304,45 @@
   yymsp[0].minor.yy41->free(yymsp[0].minor.yy41);
   yymsp[0].minor.yy41 = NULL;
 }
-#line 1298 "configparser.c"
+#line 1307 "configparser.c"
   yy_destructor(16,&yymsp[-6].minor);
   yy_destructor(18,&yymsp[-4].minor);
   yy_destructor(19,&yymsp[-2].minor);
         break;
       case 33:
-#line 516 "./configparser.y"
+#line 521 "../../src/configparser.y"
 {
   yygotominor.yy27 = CONFIG_COND_EQ;
 }
-#line 1308 "configparser.c"
+#line 1317 "configparser.c"
   yy_destructor(20,&yymsp[0].minor);
         break;
       case 34:
-#line 519 "./configparser.y"
+#line 524 "../../src/configparser.y"
 {
   yygotominor.yy27 = CONFIG_COND_MATCH;
 }
-#line 1316 "configparser.c"
+#line 1325 "configparser.c"
   yy_destructor(21,&yymsp[0].minor);
         break;
       case 35:
-#line 522 "./configparser.y"
+#line 527 "../../src/configparser.y"
 {
   yygotominor.yy27 = CONFIG_COND_NE;
 }
-#line 1324 "configparser.c"
+#line 1333 "configparser.c"
   yy_destructor(22,&yymsp[0].minor);
         break;
       case 36:
-#line 525 "./configparser.y"
+#line 530 "../../src/configparser.y"
 {
   yygotominor.yy27 = CONFIG_COND_NOMATCH;
 }
-#line 1332 "configparser.c"
+#line 1341 "configparser.c"
   yy_destructor(23,&yymsp[0].minor);
         break;
       case 37:
-#line 529 "./configparser.y"
+#line 534 "../../src/configparser.y"
 {
   yygotominor.yy43 = NULL;
   if (ctx->ok) {
@@ -1350,10 +1359,10 @@
   yymsp[0].minor.yy41->free(yymsp[0].minor.yy41);
   yymsp[0].minor.yy41 = NULL;
 }
-#line 1353 "configparser.c"
+#line 1362 "configparser.c"
         break;
       case 38:
-#line 546 "./configparser.y"
+#line 551 "../../src/configparser.y"
 {
   if (ctx->ok) {
     if (0 != config_parse_file(ctx->srv, ctx, yymsp[0].minor.yy43->ptr)) {
@@ -1363,11 +1372,11 @@
     yymsp[0].minor.yy43 = NULL;
   }
 }
-#line 1366 "configparser.c"
+#line 1375 "configparser.c"
   yy_destructor(24,&yymsp[-1].minor);
         break;
       case 39:
-#line 556 "./configparser.y"
+#line 561 "../../src/configparser.y"
 {
   if (ctx->ok) {
     if (0 != config_parse_cmd(ctx->srv, ctx, yymsp[0].minor.yy43->ptr)) {
@@ -1377,7 +1386,7 @@
     yymsp[0].minor.yy43 = NULL;
   }
 }
-#line 1380 "configparser.c"
+#line 1389 "configparser.c"
   yy_destructor(25,&yymsp[-1].minor);
         break;
   };
@@ -1407,11 +1416,11 @@
   while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
   /* Here code is inserted which will be executed whenever the
   ** parser fails */
-#line 106 "./configparser.y"
+#line 110 "../../src/configparser.y"
 
   ctx->ok = 0;
 
-#line 1414 "configparser.c"
+#line 1423 "configparser.c"
   configparserARG_STORE; /* Suppress warning about unused %extra_argument variable */
 }
 
@@ -1424,6 +1433,8 @@
   YYMINORTYPE yyminor            /* The minor type of the error token */
 ){
   configparserARG_FETCH;
+  UNUSED(yymajor);
+  UNUSED(yyminor);
 #define TOKEN (yyminor.yy0)
   configparserARG_STORE; /* Suppress warning about unused %extra_argument variable */
 }

Modified: lighttpd/trunk/src/configparser.y
===================================================================
--- lighttpd/trunk/src/configparser.y	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/configparser.y	2009-03-18 10:20:09 UTC (rev 355)
@@ -21,6 +21,10 @@
     dc->parent = ctx->current;
     array_insert_unique(dc->parent->childs, (data_unset *)dc);
   }
+  if (ctx->configs_stack->used > 0 && ctx->current->context_ndx == 0) {
+    fprintf(stderr, "Cannot use conditionals inside a global { ... } block\n");
+    exit(-1);
+  }
   array_insert_unique(ctx->configs_stack, (data_unset *)ctx->current);
   ctx->current = dc;
 }
@@ -423,6 +427,7 @@
       { COMP_HTTP_REFERER,       CONST_STR_LEN("HTTP[\"referer\"]"    ) },
       { COMP_HTTP_USER_AGENT,    CONST_STR_LEN("HTTP[\"useragent\"]"  ) },
       { COMP_HTTP_USER_AGENT,    CONST_STR_LEN("HTTP[\"user-agent\"]"  ) },
+      { COMP_HTTP_LANGUAGE,      CONST_STR_LEN("HTTP[\"language\"]"   ) },
       { COMP_HTTP_COOKIE,        CONST_STR_LEN("HTTP[\"cookie\"]"     ) },
       { COMP_HTTP_REMOTE_IP,     CONST_STR_LEN("HTTP[\"remoteip\"]"   ) },
       { COMP_HTTP_REMOTE_IP,     CONST_STR_LEN("HTTP[\"remote-ip\"]"   ) },

Modified: lighttpd/trunk/src/connections-glue.c
===================================================================
--- lighttpd/trunk/src/connections-glue.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/connections-glue.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,4 +1,5 @@
 #include "base.h"
+#include "connections.h"
 
 const char *connection_get_state(connection_state_t state) {
 	switch (state) {

Modified: lighttpd/trunk/src/connections.c
===================================================================
--- lighttpd/trunk/src/connections.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/connections.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -199,6 +199,7 @@
 
 	/* don't resize the buffer if we were in SSL_ERROR_WANT_* */
 
+	ERR_clear_error();
 	do {
 		if (!con->ssl_error_want_reuse_buffer) {
 			b = buffer_init();
@@ -275,9 +276,19 @@
 			/* fall thourgh */
 		default:
 			while((ssl_err = ERR_get_error())) {
+				switch (ERR_GET_REASON(ssl_err)) {
+				case SSL_R_SSL_HANDSHAKE_FAILURE:
+				case SSL_R_TLSV1_ALERT_UNKNOWN_CA:
+				case SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN:
+				case SSL_R_SSLV3_ALERT_BAD_CERTIFICATE:
+					if (!con->conf.log_ssl_noise) continue;
+					break;
+				default:
+					break;
+				}
 				/* get all errors from the error-queue */
 				log_error_write(srv, __FILE__, __LINE__, "sds", "SSL:",
-						r, ERR_error_string(ssl_err, NULL));
+				                r, ERR_error_string(ssl_err, NULL));
 			}
 			break;
 		}
@@ -299,6 +310,8 @@
 
 	return 0;
 #else
+	UNUSED(srv);
+	UNUSED(con);
 	return -1;
 #endif
 }
@@ -317,15 +330,13 @@
 	buffer_prepare_copy(b, 4 * 1024);
 	len = recv(con->fd, b->ptr, b->size - 1, 0);
 #else
-	if (ioctl(con->fd, FIONREAD, &toread)) {
-		log_error_write(srv, __FILE__, __LINE__, "sd",
-				"unexpected end-of-file:",
-				con->fd);
-		return -1;
+	if (ioctl(con->fd, FIONREAD, &toread) || toread == 0) {
+		b = chunkqueue_get_append_buffer(con->read_queue);
+		buffer_prepare_copy(b, 4 * 1024);
+	} else {
+		b = chunkqueue_get_append_buffer(con->read_queue);
+		buffer_prepare_copy(b, toread + 1);
 	}
-	b = chunkqueue_get_append_buffer(con->read_queue);
-	buffer_prepare_copy(b, toread + 1);
-
 	len = read(con->fd, b->ptr, b->size - 1);
 #endif
 
@@ -427,21 +438,22 @@
 	}
 
 	switch(con->http_status) {
-	case 400: /* class: header + custom body */
-	case 401:
-	case 403:
-	case 404:
-	case 408:
-	case 409:
-	case 411:
-	case 416:
-	case 423:
-	case 500:
-	case 501:
-	case 503:
-	case 505:
+	case 204: /* class: header only */
+	case 205:
+	case 304:
+		/* disable chunked encoding again as we have no body */
+		con->response.transfer_encoding &= ~HTTP_TRANSFER_ENCODING_CHUNKED;
+		con->parsed_response &= ~HTTP_CONTENT_LENGTH;
+		chunkqueue_reset(con->write_queue);
+
+		con->file_finished = 1;
+		break;
+	default: /* class: header + body */
 		if (con->mode != DIRECT) break;
 
+		/* only custom body for 4xx and 5xx */
+		if (con->http_status < 400 || con->http_status >= 600) break;
+
 		con->file_finished = 0;
 
 		buffer_reset(con->physical.path);
@@ -451,7 +463,8 @@
 			stat_cache_entry *sce = NULL;
 
 			buffer_copy_string_buffer(con->physical.path, con->conf.errorfile_prefix);
-			buffer_append_string(con->physical.path, get_http_status_body_name(con->http_status));
+			buffer_append_long(con->physical.path, con->http_status);
+			buffer_append_string_len(con->physical.path, CONST_STR_LEN(".html"));
 
 			if (HANDLER_ERROR != stat_cache_get_entry(srv, con, con->physical.path, &sce)) {
 				con->file_finished = 1;
@@ -470,57 +483,34 @@
 			b = chunkqueue_get_append_buffer(con->write_queue);
 
 			/* build default error-page */
-			buffer_copy_string(b,
+			buffer_copy_string_len(b, CONST_STR_LEN(
 					   "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"
 					   "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n"
 					   "         \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"
 					   "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n"
 					   " <head>\n"
-					   "  <title>");
+					   "  <title>"));
 			buffer_append_long(b, con->http_status);
-			buffer_append_string(b, " - ");
+			buffer_append_string_len(b, CONST_STR_LEN(" - "));
 			buffer_append_string(b, get_http_status_name(con->http_status));
 
-			buffer_append_string(b,
+			buffer_append_string_len(b, CONST_STR_LEN(
 					     "</title>\n"
 					     " </head>\n"
 					     " <body>\n"
-					     "  <h1>");
+					     "  <h1>"));
 			buffer_append_long(b, con->http_status);
-			buffer_append_string(b, " - ");
+			buffer_append_string_len(b, CONST_STR_LEN(" - "));
 			buffer_append_string(b, get_http_status_name(con->http_status));
 
-			buffer_append_string(b,"</h1>\n"
+			buffer_append_string_len(b, CONST_STR_LEN("</h1>\n"
 					     " </body>\n"
 					     "</html>\n"
-					     );
+					     ));
 
 			response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_STR_LEN("text/html"));
 		}
-		/* fall through */
-	case 207:
-	case 200: /* class: header + body */
-	case 201:
-	case 300:
-	case 301:
-	case 302:
-	case 303:
-	case 307:
 		break;
-
-	case 206: /* write_queue is already prepared */
-		break;
-	case 204:
-	case 205: /* class: header only */
-	case 304:
-	default:
-		/* disable chunked encoding again as we have no body */
-		con->response.transfer_encoding &= ~HTTP_TRANSFER_ENCODING_CHUNKED;
-		con->parsed_response &= ~HTTP_CONTENT_LENGTH;
-		chunkqueue_reset(con->write_queue);
-
-		con->file_finished = 1;
-		break;
 	}
 
 	if (con->file_finished) {
@@ -544,7 +534,7 @@
 				data_string *ds;
 				/* no Content-Body, no Content-Length */
 				if (NULL != (ds = (data_string*) array_get_element(con->response.headers, "Content-Length"))) {
-					buffer_reset(ds->value); // Headers with empty values are ignored for output
+					buffer_reset(ds->value); /* Headers with empty values are ignored for output */
 				}
 			} else if (qlen > 0 || con->request.http_method != HTTP_METHOD_HEAD) {
 				/* qlen = 0 is important for Redirects (301, ...) as they MAY have
@@ -846,7 +836,7 @@
 	}
 
 	/* The cond_cache gets reset in response.c */
-//	config_cond_cache_reset(srv, con);
+	/* config_cond_cache_reset(srv, con); */
 
 #ifdef USE_OPENSSL
 	if (con->ssl_error_want_reuse_buffer) {
@@ -1074,6 +1064,9 @@
 						if (dst_c->file.fd == -1) {
 							/* this should not happen as we cache the fd, but you never know */
 							dst_c->file.fd = open(dst_c->file.name->ptr, O_WRONLY | O_APPEND);
+#ifdef FD_CLOEXEC
+							fcntl(dst_c->file.fd, F_SETFD, FD_CLOEXEC);
+#endif
 						}
 					} else {
 						/* the chunk is too large now, close it */
@@ -1668,21 +1661,51 @@
 			}
 #ifdef USE_OPENSSL
 			if (srv_sock->is_ssl) {
-				int ret;
+				int ret, ssl_r;
+				unsigned long err;
+				ERR_clear_error();
 				switch ((ret = SSL_shutdown(con->ssl))) {
 				case 1:
 					/* ok */
 					break;
 				case 0:
-					SSL_shutdown(con->ssl);
-					break;
+					ERR_clear_error();
+					if (-1 != (ret = SSL_shutdown(con->ssl))) break;
+
+					/* fall through */
 				default:
-					log_error_write(srv, __FILE__, __LINE__, "sds", "SSL:",
-							SSL_get_error(con->ssl, ret),
-							ERR_error_string(ERR_get_error(), NULL));
-					return -1;
+
+					switch ((ssl_r = SSL_get_error(con->ssl, ret))) {
+					case SSL_ERROR_WANT_WRITE:
+					case SSL_ERROR_WANT_READ:
+						break;
+					case SSL_ERROR_SYSCALL:
+						/* perhaps we have error waiting in our error-queue */
+						if (0 != (err = ERR_get_error())) {
+							do {
+								log_error_write(srv, __FILE__, __LINE__, "sdds", "SSL:",
+										ssl_r, ret,
+										ERR_error_string(err, NULL));
+							} while((err = ERR_get_error()));
+						} else {
+							log_error_write(srv, __FILE__, __LINE__, "sddds", "SSL (error):",
+									ssl_r, ret, errno,
+									strerror(errno));
+						}
+	
+						break;
+					default:
+						while((err = ERR_get_error())) {
+							log_error_write(srv, __FILE__, __LINE__, "sdds", "SSL:",
+									ssl_r, ret,
+									ERR_error_string(err, NULL));
+						}
+	
+						break;
+					}
 				}
 			}
+			ERR_clear_error();
 #endif
 
 			switch(con->mode) {

Modified: lighttpd/trunk/src/data_string.c
===================================================================
--- lighttpd/trunk/src/data_string.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/data_string.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -37,7 +37,7 @@
 	data_string *ds_src = (data_string *)src;
 
 	if (ds_dst->value->used) {
-		buffer_append_string(ds_dst->value, ", ");
+		buffer_append_string_len(ds_dst->value, CONST_STR_LEN(", "));
 		buffer_append_string_buffer(ds_dst->value, ds_src->value);
 	} else {
 		buffer_copy_string_buffer(ds_dst->value, ds_src->value);
@@ -53,9 +53,9 @@
 	data_string *ds_src = (data_string *)src;
 
 	if (ds_dst->value->used) {
-		buffer_append_string(ds_dst->value, "\r\n");
+		buffer_append_string_len(ds_dst->value, CONST_STR_LEN("\r\n"));
 		buffer_append_string_buffer(ds_dst->value, ds_dst->key);
-		buffer_append_string(ds_dst->value, ": ");
+		buffer_append_string_len(ds_dst->value, CONST_STR_LEN(": "));
 		buffer_append_string_buffer(ds_dst->value, ds_src->value);
 	} else {
 		buffer_copy_string_buffer(ds_dst->value, ds_src->value);

Modified: lighttpd/trunk/src/fdevent_linux_sysepoll.c
===================================================================
--- lighttpd/trunk/src/fdevent_linux_sysepoll.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/fdevent_linux_sysepoll.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -91,7 +91,7 @@
 	if (e & EPOLLHUP) events |= FDEVENT_HUP;
 	if (e & EPOLLPRI) events |= FDEVENT_PRI;
 
-	return e;
+	return events;
 }
 
 static int fdevent_linux_sysepoll_event_get_fd(fdevents *ev, size_t ndx) {

Modified: lighttpd/trunk/src/http-header-glue.c
===================================================================
--- lighttpd/trunk/src/http-header-glue.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/http-header-glue.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -9,6 +9,7 @@
 #include "buffer.h"
 #include "log.h"
 #include "etag.h"
+#include "response.h"
 
 /*
  * This was 'borrowed' from tcpdump.
@@ -109,9 +110,9 @@
 	o = buffer_init();
 
 	if (con->conf.is_ssl) {
-		buffer_copy_string(o, "https://");
+		buffer_copy_string_len(o, CONST_STR_LEN("https://"));
 	} else {
-		buffer_copy_string(o, "http://");
+		buffer_copy_string_len(o, CONST_STR_LEN("http://"));
 	}
 	if (con->uri.authority->used) {
 		buffer_append_string_buffer(o, con->uri.authority);
@@ -180,14 +181,14 @@
 
 		if (!((con->conf.is_ssl == 0 && srv->srvconf.port == 80) ||
 		      (con->conf.is_ssl == 1 && srv->srvconf.port == 443))) {
-			buffer_append_string(o, ":");
+			buffer_append_string_len(o, CONST_STR_LEN(":"));
 			buffer_append_long(o, srv->srvconf.port);
 		}
 	}
 	buffer_append_string_buffer(o, con->uri.path);
-	buffer_append_string(o, "/");
+	buffer_append_string_len(o, CONST_STR_LEN("/"));
 	if (!buffer_is_empty(con->uri.query)) {
-		buffer_append_string(o, "?");
+		buffer_append_string_len(o, CONST_STR_LEN("?"));
 		buffer_append_string_buffer(o, con->uri.query);
 	}
 
@@ -272,6 +273,7 @@
 									con->request.http_if_modified_since, used_len, sizeof(buf) - 1);
 
 							con->http_status = 412;
+							con->mode = DIRECT;
 							return HANDLER_FINISHED;
 						}
 
@@ -279,8 +281,10 @@
 						strncpy(buf, con->request.http_if_modified_since, used_len);
 						buf[used_len] = '\0';
 
+						tm.tm_isdst = 0;
 						if (NULL == strptime(buf, "%a, %d %b %Y %H:%M:%S GMT", &tm)) {
 							con->http_status = 412;
+							con->mode = DIRECT;
 							return HANDLER_FINISHED;
 						}
 						t_header = mktime(&tm);
@@ -299,6 +303,7 @@
 				}
 			} else {
 				con->http_status = 412;
+				con->mode = DIRECT;
 				return HANDLER_FINISHED;
 			}
 		}
@@ -326,6 +331,7 @@
 			strncpy(buf, con->request.http_if_modified_since, used_len);
 			buf[used_len] = '\0';
 
+			tm.tm_isdst = 0;
 			if (NULL == strptime(buf, "%a, %d %b %Y %H:%M:%S GMT", &tm)) {
 				/**
 				 * parsing failed, let's get out of here 

Modified: lighttpd/trunk/src/http_auth.c
===================================================================
--- lighttpd/trunk/src/http_auth.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/http_auth.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -57,22 +57,25 @@
 
 static const char base64_pad = '=';
 
+/* "A-Z a-z 0-9 + /" maps to 0-63 */
 static const short base64_reverse_table[256] = {
-	        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-		        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-		        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
-		        52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
-		        -1,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14,
-		        15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
-		        -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
-		        41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1,
-		        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-		        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-		        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-		        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-		        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-		        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-		        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+/*	 0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F */
+	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x00 - 0x0F */
+	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x10 - 0x1F */
+	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, /* 0x20 - 0x2F */
+	52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, /* 0x30 - 0x3F */
+	-1,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, /* 0x40 - 0x4F */
+	15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, /* 0x50 - 0x5F */
+	-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, /* 0x60 - 0x6F */
+	41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, /* 0x70 - 0x7F */
+	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x80 - 0x8F */
+	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x90 - 0x9F */
+	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xA0 - 0xAF */
+	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xB0 - 0xBF */
+	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xC0 - 0xCF */
+	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xD0 - 0xDF */
+	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xE0 - 0xEF */
+	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xF0 - 0xFF */
 };
 
 
@@ -744,20 +747,26 @@
 
 
 		/* 2. */
-		if (p->conf.ldap == NULL ||
-		    LDAP_SUCCESS != (ret = ldap_search_s(p->conf.ldap, p->conf.auth_ldap_basedn->ptr, LDAP_SCOPE_SUBTREE, p->ldap_filter->ptr, attrs, 0, &lm))) {
-			if (auth_ldap_init(srv, &p->conf) != HANDLER_GO_ON)
-				return -1;
-			if (LDAP_SUCCESS != (ret = ldap_search_s(p->conf.ldap, p->conf.auth_ldap_basedn->ptr, LDAP_SCOPE_SUBTREE, p->ldap_filter->ptr, attrs, 0, &lm))) {
+		if (p->anon_conf->ldap == NULL ||
+		    LDAP_SUCCESS != (ret = ldap_search_s(p->anon_conf->ldap, p->conf.auth_ldap_basedn->ptr, LDAP_SCOPE_SUBTREE, p->ldap_filter->ptr, attrs, 0, &lm))) {
 
-			log_error_write(srv, __FILE__, __LINE__, "sssb",
-					"ldap:", ldap_err2string(ret), "filter:", p->ldap_filter);
+			/* try again; the ldap library sometimes fails for the first call but reconnects */
+			if (p->anon_conf->ldap == NULL || ret != LDAP_SERVER_DOWN ||
+			    LDAP_SUCCESS != (ret = ldap_search_s(p->anon_conf->ldap, p->conf.auth_ldap_basedn->ptr, LDAP_SCOPE_SUBTREE, p->ldap_filter->ptr, attrs, 0, &lm))) {
 
-			return -1;
+				if (auth_ldap_init(srv, p->anon_conf) != HANDLER_GO_ON)
+					return -1;
+
+				if (p->anon_conf->ldap == NULL ||
+				    LDAP_SUCCESS != (ret = ldap_search_s(p->anon_conf->ldap, p->conf.auth_ldap_basedn->ptr, LDAP_SCOPE_SUBTREE, p->ldap_filter->ptr, attrs, 0, &lm))) {
+					log_error_write(srv, __FILE__, __LINE__, "sssb",
+							"ldap:", ldap_err2string(ret), "filter:", p->ldap_filter);
+					return -1;
+				}
 			}
 		}
 
-		if (NULL == (first = ldap_first_entry(p->conf.ldap, lm))) {
+		if (NULL == (first = ldap_first_entry(p->anon_conf->ldap, lm))) {
 			log_error_write(srv, __FILE__, __LINE__, "s", "ldap ...");
 
 			ldap_msgfree(lm);
@@ -765,7 +774,7 @@
 			return -1;
 		}
 
-		if (NULL == (dn = ldap_get_dn(p->conf.ldap, first))) {
+		if (NULL == (dn = ldap_get_dn(p->anon_conf->ldap, first))) {
 			log_error_write(srv, __FILE__, __LINE__, "s", "ldap ...");
 
 			ldap_msgfree(lm);

Modified: lighttpd/trunk/src/http_auth.h
===================================================================
--- lighttpd/trunk/src/http_auth.h	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/http_auth.h	2009-03-18 10:20:09 UTC (rev 355)
@@ -63,7 +63,7 @@
 
 	mod_auth_plugin_config **config_storage;
 
-	mod_auth_plugin_config conf; /* this is only used as long as no handler_ctx is setup */
+	mod_auth_plugin_config conf, *anon_conf; /* this is only used as long as no handler_ctx is setup */
 } mod_auth_plugin_data;
 
 int http_auth_basic_check(server *srv, connection *con, mod_auth_plugin_data *p, array *req, buffer *url, const char *realm_str);

Modified: lighttpd/trunk/src/http_chunk.c
===================================================================
--- lighttpd/trunk/src/http_chunk.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/http_chunk.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -27,7 +27,7 @@
 	b = srv->tmp_chunk_len;
 
 	if (len == 0) {
-		buffer_copy_string(b, "0");
+		buffer_copy_string_len(b, CONST_STR_LEN("0"));
 	} else {
 		for (i = 0; i < 8 && len; i++) {
 			len >>= 4;
@@ -44,7 +44,7 @@
 		b->ptr[b->used++] = '\0';
 	}
 
-	buffer_append_string(b, "\r\n");
+	buffer_append_string_len(b, CONST_STR_LEN("\r\n"));
 	chunkqueue_append_buffer(con->write_queue, b);
 
 	return 0;

Modified: lighttpd/trunk/src/inet_ntop_cache.c
===================================================================
--- lighttpd/trunk/src/inet_ntop_cache.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/inet_ntop_cache.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -11,7 +11,7 @@
 #ifdef HAVE_IPV6
 	size_t ndx = 0, i;
 	for (i = 0; i < INET_NTOP_CACHE_MAX; i++) {
-		if (srv->inet_ntop_cache[i].ts != 0) {
+		if (srv->inet_ntop_cache[i].ts != 0 && srv->inet_ntop_cache[i].family == addr->plain.sa_family) {
 			if (srv->inet_ntop_cache[i].family == AF_INET6 &&
 			    0 == memcmp(srv->inet_ntop_cache[i].addr.ipv6.s6_addr, addr->ipv6.sin6_addr.s6_addr, 16)) {
 				/* IPv6 found in cache */

Modified: lighttpd/trunk/src/lemon.c
===================================================================
--- lighttpd/trunk/src/lemon.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/lemon.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -12,6 +12,19 @@
 #include <ctype.h>
 #include <stdlib.h>
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+
+#define UNUSED(x) ( (void)(x) )
+
 extern void qsort();
 extern double strtod();
 extern long strtol();
@@ -983,6 +996,7 @@
 {
   struct symbol *spx, *spy;
   int errcnt = 0;
+  UNUSED(errsym);
   assert( apx->sp==apy->sp );  /* Otherwise there would be no conflict */
   if( apx->type==SHIFT && apy->type==REDUCE ){
     spx = apx->sp;
@@ -1347,6 +1361,7 @@
   struct lemon lem;
   char *def_tmpl_name = "lempar.c";
 
+  UNUSED(argc);
   OptInit(argv,options,stderr);
   if( version ){
      printf("Lemon version 1.0\n");
@@ -1651,7 +1666,7 @@
   }else if( op[j].type==OPT_FLAG ){
     *((int*)op[j].arg) = v;
   }else if( op[j].type==OPT_FFLAG ){
-    (*(void(*)())(op[j].arg))(v);
+    (*(void(*)())(intptr_t)(op[j].arg))(v);
   }else{
     if( err ){
       fprintf(err,"%smissing argument on switch.\n",emsg);
@@ -1733,19 +1748,19 @@
         *(double*)(op[j].arg) = dv;
         break;
       case OPT_FDBL:
-        (*(void(*)())(op[j].arg))(dv);
+        (*(void(*)())(intptr_t)(op[j].arg))(dv);
         break;
       case OPT_INT:
         *(int*)(op[j].arg) = lv;
         break;
       case OPT_FINT:
-        (*(void(*)())(op[j].arg))((int)lv);
+        (*(void(*)())(intptr_t)(op[j].arg))((int)lv);
         break;
       case OPT_STR:
         *(char**)(op[j].arg) = sv;
         break;
       case OPT_FSTR:
-        (*(void(*)())(op[j].arg))(sv);
+        (*(void(*)())(intptr_t)(op[j].arg))(sv);
         break;
     }
   }
@@ -2286,10 +2301,10 @@
 ** token is passed to the function "parseonetoken" which builds all
 ** the appropriate data structures in the global state vector "gp".
 */
+struct pstate ps;
 void Parse(gp)
 struct lemon *gp;
 {
-  struct pstate ps;
   FILE *fp;
   char *filebuf;
   size_t filesize;

Modified: lighttpd/trunk/src/lempar.c
===================================================================
--- lighttpd/trunk/src/lempar.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/lempar.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -180,12 +180,14 @@
 ** Outputs:
 ** None.
 */
+#if 0
 void ParseTrace(FILE *TraceFILE, char *zTracePrompt){
   yyTraceFILE = TraceFILE;
   yyTracePrompt = zTracePrompt;
   if( yyTraceFILE==0 ) yyTracePrompt = 0;
   else if( yyTracePrompt==0 ) yyTraceFILE = 0;
 }
+#endif
 #endif /* NDEBUG */
 
 #ifndef NDEBUG
@@ -208,9 +210,10 @@
 ** This function returns the symbolic name associated with a token
 ** value.
 */
+#if 0
 const char *ParseTokenName(int tokenType){
 #ifndef NDEBUG
-  if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){
+  if( tokenType>0 && (size_t)tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){
     return yyTokenName[tokenType];
   }else{
     return "Unknown";
@@ -219,6 +222,7 @@
   return "";
 #endif
 }
+#endif
 
 /*
 ** This function allocates a new parser.
@@ -335,7 +339,7 @@
     return YY_NO_ACTION;
   }
   i += iLookAhead;
-  if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
+  if( i<0 || (size_t)i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
 #ifdef YYFALLBACK
     int iFallback;            /* Fallback token */
     if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
@@ -378,7 +382,7 @@
     return YY_NO_ACTION;
   }
   i += iLookAhead;
-  if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
+  if( i<0 || (size_t)i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
     return yy_default[stateno];
   }else{
     return yy_action[i];
@@ -456,7 +460,7 @@
   yymsp = &yypParser->yystack[yypParser->yyidx];
 #ifndef NDEBUG
   if( yyTraceFILE && yyruleno>=0
-        && yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){
+        && (size_t)yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){
     fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
       yyRuleName[yyruleno]);
   }
@@ -512,6 +516,8 @@
   YYMINORTYPE yyminor            /* The minor type of the error token */
 ){
   ParseARG_FETCH;
+  UNUSED(yymajor);
+  UNUSED(yyminor);
 #define TOKEN (yyminor.yy0)
 %%
   ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */

Modified: lighttpd/trunk/src/lighttpd-angel.c
===================================================================
--- lighttpd/trunk/src/lighttpd-angel.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/lighttpd-angel.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -28,9 +28,12 @@
 static volatile sig_atomic_t graceful_restart = 0;
 static volatile pid_t pid = -1;
 
+#define UNUSED(x) ( (void)(x) )
+
 static void sigaction_handler(int sig, siginfo_t *si, void *context) {
 	int exitcode;
 
+	UNUSED(context);
 	switch (sig) {
 	case SIGINT: 
 	case SIGTERM:
@@ -60,6 +63,8 @@
 	int is_shutdown = 0;
 	struct sigaction act;
 
+	UNUSED(argc);
+
 	/**
 	 * we are running as root BEWARE
 	 */

Modified: lighttpd/trunk/src/log.c
===================================================================
--- lighttpd/trunk/src/log.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/log.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -31,6 +31,29 @@
 # define O_LARGEFILE 0
 #endif
 
+/* Close fd and _try_ to get a /dev/null for it instead.
+ * close() alone may trigger some bugs when a
+ * process opens another file and gets fd = STDOUT_FILENO or STDERR_FILENO
+ * and later tries to just print on stdout/stderr
+ *
+ * Returns 0 on success and -1 on failure (fd gets closed in all cases)
+ */
+int openDevNull(int fd) {
+	int tmpfd;
+	close(fd);
+#if defined(__WIN32)
+	/* Cygwin should work with /dev/null */
+	tmpfd = open("nul", O_RDWR);
+#else
+	tmpfd = open("/dev/null", O_RDWR);
+#endif
+	if (tmpfd != -1 && tmpfd != fd) {
+		dup2(tmpfd, fd);
+		close(tmpfd);
+	}
+	return (tmpfd != -1) ? 0 : -1;
+}
+
 /**
  * open the errorlog
  *
@@ -44,7 +67,6 @@
  */
 
 int log_error_open(server *srv) {
-	int fd;
 	int close_stderr = 1;
 
 #ifdef HAVE_SYSLOG_H
@@ -78,15 +100,16 @@
 	/* don't close stderr for debugging purposes if run in valgrind */
 	if (RUNNING_ON_VALGRIND) close_stderr = 0;
 #endif
-	if (srv->errorlog_mode == ERRORLOG_STDERR) close_stderr = 0;
 
+	if (srv->errorlog_mode == ERRORLOG_STDERR && srv->srvconf.dont_daemonize) {
+		/* We can only log to stderr in dont-daemonize mode;
+		 * if we do daemonize and no errorlog file is specified, we log into /dev/null
+		 */
+		close_stderr = 0;
+	}
+
 	/* move stderr to /dev/null */
-	if (close_stderr &&
-	    -1 != (fd = open("/dev/null", O_WRONLY))) {
-		close(STDERR_FILENO);
-		dup2(fd, STDERR_FILENO);
-		close(fd);
-	}
+	if (close_stderr) openDevNull(STDERR_FILENO);
 	return 0;
 }
 
@@ -123,6 +146,10 @@
 			/* ok, new log is open, close the old one */
 			close(srv->errorlog_fd);
 			srv->errorlog_fd = new_fd;
+#ifdef FD_CLOEXEC
+			/* close fd on exec (cgi) */
+			fcntl(srv->errorlog_fd, F_SETFD, FD_CLOEXEC);
+#endif
 		}
 	}
 
@@ -162,18 +189,18 @@
 		}
 
 		buffer_copy_string_buffer(srv->errorlog_buf, srv->ts_debug_str);
-		BUFFER_APPEND_STRING_CONST(srv->errorlog_buf, ": (");
+		buffer_append_string_len(srv->errorlog_buf, CONST_STR_LEN(": ("));
 		break;
 	case ERRORLOG_SYSLOG:
 		/* syslog is generating its own timestamps */
-		BUFFER_COPY_STRING_CONST(srv->errorlog_buf, "(");
+		buffer_copy_string_len(srv->errorlog_buf, CONST_STR_LEN("("));
 		break;
 	}
 
 	buffer_append_string(srv->errorlog_buf, filename);
-	BUFFER_APPEND_STRING_CONST(srv->errorlog_buf, ".");
+	buffer_append_string_len(srv->errorlog_buf, CONST_STR_LEN("."));
 	buffer_append_long(srv->errorlog_buf, line);
-	BUFFER_APPEND_STRING_CONST(srv->errorlog_buf, ") ");
+	buffer_append_string_len(srv->errorlog_buf, CONST_STR_LEN(") "));
 
 
 	for(va_start(ap, fmt); *fmt; fmt++) {
@@ -186,28 +213,28 @@
 		case 's':           /* string */
 			s = va_arg(ap, char *);
 			buffer_append_string(srv->errorlog_buf, s);
-			BUFFER_APPEND_STRING_CONST(srv->errorlog_buf, " ");
+			buffer_append_string_len(srv->errorlog_buf, CONST_STR_LEN(" "));
 			break;
 		case 'b':           /* buffer */
 			b = va_arg(ap, buffer *);
 			buffer_append_string_buffer(srv->errorlog_buf, b);
-			BUFFER_APPEND_STRING_CONST(srv->errorlog_buf, " ");
+			buffer_append_string_len(srv->errorlog_buf, CONST_STR_LEN(" "));
 			break;
 		case 'd':           /* int */
 			d = va_arg(ap, int);
 			buffer_append_long(srv->errorlog_buf, d);
-			BUFFER_APPEND_STRING_CONST(srv->errorlog_buf, " ");
+			buffer_append_string_len(srv->errorlog_buf, CONST_STR_LEN(" "));
 			break;
 		case 'o':           /* off_t */
 			o = va_arg(ap, off_t);
 			buffer_append_off_t(srv->errorlog_buf, o);
-			BUFFER_APPEND_STRING_CONST(srv->errorlog_buf, " ");
+			buffer_append_string_len(srv->errorlog_buf, CONST_STR_LEN(" "));
 			break;
 		case 'x':           /* int (hex) */
 			d = va_arg(ap, int);
-			BUFFER_APPEND_STRING_CONST(srv->errorlog_buf, "0x");
+			buffer_append_string_len(srv->errorlog_buf, CONST_STR_LEN("0x"));
 			buffer_append_long_hex(srv->errorlog_buf, d);
-			BUFFER_APPEND_STRING_CONST(srv->errorlog_buf, " ");
+			buffer_append_string_len(srv->errorlog_buf, CONST_STR_LEN(" "));
 			break;
 		case 'S':           /* string */
 			s = va_arg(ap, char *);
@@ -221,6 +248,15 @@
 			d = va_arg(ap, int);
 			buffer_append_long(srv->errorlog_buf, d);
 			break;
+		case 'O':           /* off_t */
+			o = va_arg(ap, off_t);
+			buffer_append_off_t(srv->errorlog_buf, o);
+			break;
+		case 'X':           /* int (hex) */
+			d = va_arg(ap, int);
+			buffer_append_string_len(srv->errorlog_buf, CONST_STR_LEN("0x"));
+			buffer_append_long_hex(srv->errorlog_buf, d);
+			break;
 		case '(':
 		case ')':
 		case '<':
@@ -235,11 +271,11 @@
 
 	switch(srv->errorlog_mode) {
 	case ERRORLOG_FILE:
-		BUFFER_APPEND_STRING_CONST(srv->errorlog_buf, "\n");
+		buffer_append_string_len(srv->errorlog_buf, CONST_STR_LEN("\n"));
 		write(srv->errorlog_fd, srv->errorlog_buf->ptr, srv->errorlog_buf->used - 1);
 		break;
 	case ERRORLOG_STDERR:
-		BUFFER_APPEND_STRING_CONST(srv->errorlog_buf, "\n");
+		buffer_append_string_len(srv->errorlog_buf, CONST_STR_LEN("\n"));
 		write(STDERR_FILENO, srv->errorlog_buf->ptr, srv->errorlog_buf->used - 1);
 		break;
 	case ERRORLOG_SYSLOG:

Modified: lighttpd/trunk/src/log.h
===================================================================
--- lighttpd/trunk/src/log.h	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/log.h	2009-03-18 10:20:09 UTC (rev 355)
@@ -3,6 +3,11 @@
 
 #include "server.h"
 
+/* Close fd and _try_ to get a /dev/null for it instead.
+ * Returns 0 on success and -1 on failure (fd gets closed in all cases)
+ */
+int openDevNull(int fd);
+
 #define WP() log_error_write(srv, __FILE__, __LINE__, "");
 
 int log_error_open(server *srv);

Modified: lighttpd/trunk/src/md5.c
===================================================================
--- lighttpd/trunk/src/md5.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/md5.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -52,9 +52,9 @@
 #define S43 15
 #define S44 21
 
-static void MD5Transform (UINT4 [4], unsigned char [64]);
+static void MD5Transform (UINT4 [4], const unsigned char [64]);
 static void Encode (unsigned char *, UINT4 *, unsigned int);
-static void Decode (UINT4 *, unsigned char *, unsigned int);
+static void Decode (UINT4 *, const unsigned char *, unsigned int);
 
 #ifdef HAVE_MEMCPY
 #define MD5_memcpy(output, input, len) memcpy((output), (input), (len))
@@ -126,12 +126,13 @@
   operation, processing another message block, and updating the
   context.
  */
-void MD5_Update (context, input, inputLen)
+void MD5_Update (context, _input, inputLen)
 MD5_CTX *context;                                        /* context */
-unsigned char *input;                                /* input block */
+const void *_input;                                /* input block */
 unsigned int inputLen;                     /* length of input block */
 {
   unsigned int i, ndx, partLen;
+  const unsigned char *input = (const unsigned char*) _input;
 
   /* Compute number of bytes mod 64 */
   ndx = (unsigned int)((context->count[0] >> 3) & 0x3F);
@@ -200,7 +201,7 @@
  */
 static void MD5Transform (state, block)
 UINT4 state[4];
-unsigned char block[64];
+const unsigned char block[64];
 {
   UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
 
@@ -313,7 +314,7 @@
  */
 static void Decode (output, input, len)
 UINT4 *output;
-unsigned char *input;
+const unsigned char *input;
 unsigned int len;
 {
   unsigned int i, j;

Modified: lighttpd/trunk/src/md5.h
===================================================================
--- lighttpd/trunk/src/md5.h	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/md5.h	2009-03-18 10:20:09 UTC (rev 355)
@@ -42,6 +42,6 @@
 } MD5_CTX;
 
 void MD5_Init (MD5_CTX *);
-void MD5_Update (MD5_CTX *, unsigned char *, unsigned int);
+void MD5_Update (MD5_CTX *, const void *, unsigned int);
 void MD5_Final (unsigned char [16], MD5_CTX *);
 

Modified: lighttpd/trunk/src/mod_access.c
===================================================================
--- lighttpd/trunk/src/mod_access.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_access.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -159,6 +159,7 @@
 
 		if (denied) {
 			con->http_status = 403;
+			con->mode = DIRECT;
 
 			if (con->conf.log_request_handling) {
 	 			log_error_write(srv, __FILE__, __LINE__, "sb", 

Modified: lighttpd/trunk/src/mod_accesslog.c
===================================================================
--- lighttpd/trunk/src/mod_accesslog.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_accesslog.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -169,13 +169,13 @@
 				if (fields->size == 0) {
 					fields->size = 16;
 					fields->used = 0;
-					fields->ptr = malloc(fields->size * sizeof(format_fields * ));
+					fields->ptr = malloc(fields->size * sizeof(format_field * ));
 				} else if (fields->used == fields->size) {
 					fields->size += 16;
-					fields->ptr = realloc(fields->ptr, fields->size * sizeof(format_fields * ));
+					fields->ptr = realloc(fields->ptr, fields->size * sizeof(format_field * ));
 				}
 
-				fields->ptr[fields->used] = malloc(sizeof(format_fields));
+				fields->ptr[fields->used] = malloc(sizeof(format_field));
 				fields->ptr[fields->used]->type = FIELD_STRING;
 				fields->ptr[fields->used]->string = buffer_init();
 
@@ -189,10 +189,10 @@
 			if (fields->size == 0) {
 				fields->size = 16;
 				fields->used = 0;
-				fields->ptr = malloc(fields->size * sizeof(format_fields * ));
+				fields->ptr = malloc(fields->size * sizeof(format_field * ));
 			} else if (fields->used == fields->size) {
 				fields->size += 16;
-				fields->ptr = realloc(fields->ptr, fields->size * sizeof(format_fields * ));
+				fields->ptr = realloc(fields->ptr, fields->size * sizeof(format_field * ));
 			}
 
 			/* search for the terminating command */
@@ -211,7 +211,7 @@
 
 					/* found key */
 
-					fields->ptr[fields->used] = malloc(sizeof(format_fields));
+					fields->ptr[fields->used] = malloc(sizeof(format_field));
 					fields->ptr[fields->used]->type = FIELD_FORMAT;
 					fields->ptr[fields->used]->field = fmap[j].type;
 					fields->ptr[fields->used]->string = NULL;
@@ -258,7 +258,7 @@
 
 					/* found key */
 
-					fields->ptr[fields->used] = malloc(sizeof(format_fields));
+					fields->ptr[fields->used] = malloc(sizeof(format_field));
 					fields->ptr[fields->used]->type = FIELD_FORMAT;
 					fields->ptr[fields->used]->field = fmap[j].type;
 					fields->ptr[fields->used]->string = buffer_init();
@@ -291,7 +291,7 @@
 
 					/* found key */
 
-					fields->ptr[fields->used] = malloc(sizeof(format_fields));
+					fields->ptr[fields->used] = malloc(sizeof(format_field));
 					fields->ptr[fields->used]->type = FIELD_FORMAT;
 					fields->ptr[fields->used]->field = fmap[j].type;
 					fields->ptr[fields->used]->string = NULL;
@@ -321,13 +321,13 @@
 		if (fields->size == 0) {
 			fields->size = 16;
 			fields->used = 0;
-			fields->ptr = malloc(fields->size * sizeof(format_fields * ));
+			fields->ptr = malloc(fields->size * sizeof(format_field * ));
 		} else if (fields->used == fields->size) {
 			fields->size += 16;
-			fields->ptr = realloc(fields->ptr, fields->size * sizeof(format_fields * ));
+			fields->ptr = realloc(fields->ptr, fields->size * sizeof(format_field * ));
 		}
 
-		fields->ptr[fields->used] = malloc(sizeof(format_fields));
+		fields->ptr[fields->used] = malloc(sizeof(format_field));
 		fields->ptr[fields->used]->type = FIELD_STRING;
 		fields->ptr[fields->used]->string = buffer_init();
 
@@ -356,7 +356,7 @@
 				if (s->use_syslog) {
 # ifdef HAVE_SYSLOG_H
 					if (s->access_logbuffer->used > 2) {
-						syslog(LOG_INFO, "%*s", s->access_logbuffer->used - 2, s->access_logbuffer->ptr);
+						syslog(LOG_INFO, "%*s", (int) s->access_logbuffer->used - 2, s->access_logbuffer->ptr);
 					}
 # endif
 				} else if (s->log_access_fd != -1) {
@@ -433,7 +433,7 @@
 		if (i == 0 && buffer_is_empty(s->format)) {
 			/* set a default logfile string */
 
-			buffer_copy_string(s->format, "%h %V %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"");
+			buffer_copy_string_len(s->format, CONST_STR_LEN("%h %V %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""));
 		}
 
 		/* parse */
@@ -473,7 +473,7 @@
 			continue;
 		}
 
-		if (buffer_is_empty(s->access_logfile)) continue;
+		if (s->access_logfile->used < 2) continue;
 
 		if (s->access_logfile->ptr[0] == '|') {
 #ifdef HAVE_FORK
@@ -498,6 +498,8 @@
 				/* not needed */
 				close(to_log_fds[1]);
 
+				openDevNull(STDERR_FILENO);
+
 				/* we don't need the client socket */
 				for (i = 3; i < 256; i++) {
 					close(i);
@@ -538,8 +540,9 @@
 
 			return HANDLER_ERROR;
 		}
+#ifdef FD_CLOEXEC
 		fcntl(s->log_access_fd, F_SETFD, FD_CLOEXEC);
-
+#endif
 	}
 
 	return HANDLER_GO_ON;
@@ -559,7 +562,7 @@
 #ifdef HAVE_SYSLOG_H
 				if (s->access_logbuffer->used > 2) {
 					/* syslog appends a \n on its own */
-					syslog(LOG_INFO, "%*s", s->access_logbuffer->used - 2, s->access_logbuffer->ptr);
+					syslog(LOG_INFO, "%*s", (int) s->access_logbuffer->used - 2, s->access_logbuffer->ptr);
 				}
 #endif
 			} else if (s->log_access_fd != -1) {
@@ -570,7 +573,7 @@
 		}
 
 		if (s->use_syslog == 0 &&
-		    !buffer_is_empty(s->access_logfile) &&
+		    s->access_logfile->used > 1 &&
 		    s->access_logfile->ptr[0] != '|') {
 
 			close(s->log_access_fd);
@@ -582,6 +585,9 @@
 
 				return HANDLER_ERROR;
 			}
+#ifdef FD_CLOEXEC
+			fcntl(s->log_access_fd, F_SETFD, FD_CLOEXEC);
+#endif
 		}
 	}
 
@@ -647,9 +653,12 @@
 
 	mod_accesslog_patch_connection(srv, con, p);
 
+	/* No output device, nothing to do */
+	if (!p->conf.use_syslog && p->conf.log_access_fd == -1) return HANDLER_GO_ON;
+
 	b = p->conf.access_logbuffer;
 	if (b->used == 0) {
-		buffer_copy_string(b, "");
+		buffer_copy_string_len(b, CONST_STR_LEN(""));
 	}
 
 	for (j = 0; j < p->conf.parsed_format->used; j++) {
@@ -674,23 +683,23 @@
 					localtime_r(&(srv->cur_ts), &tm);
 					strftime(p->conf.ts_accesslog_str->ptr, p->conf.ts_accesslog_str->size - 1, "[%d/%b/%Y:%H:%M:%S ", &tm);
 # else
-					strftime(p->conf.ts_accesslog_str->ptr, p->conf.ts_accesslog_str->size - 1, "[%d/%b/%Y:%H:%M:%S ", localtime_r(&(srv->cur_ts)));
+					strftime(p->conf.ts_accesslog_str->ptr, p->conf.ts_accesslog_str->size - 1, "[%d/%b/%Y:%H:%M:%S ", localtime(&(srv->cur_ts)));
 # endif
 					p->conf.ts_accesslog_str->used = strlen(p->conf.ts_accesslog_str->ptr) + 1;
 
-					buffer_append_string(p->conf.ts_accesslog_str, tm.tm_gmtoff >= 0 ? "+" : "-");
+					buffer_append_string_len(p->conf.ts_accesslog_str, tm.tm_gmtoff >= 0 ? "+" : "-", 1);
 
 					scd = abs(tm.tm_gmtoff);
 					hrs = scd / 3600;
 					min = (scd % 3600) / 60;
 
 					/* hours */
-					if (hrs < 10) buffer_append_string(p->conf.ts_accesslog_str, "0");
+					if (hrs < 10) buffer_append_string_len(p->conf.ts_accesslog_str, CONST_STR_LEN("0"));
 					buffer_append_long(p->conf.ts_accesslog_str, hrs);
 
-					if (min < 10) buffer_append_string(p->conf.ts_accesslog_str, "0");
+					if (min < 10) buffer_append_string_len(p->conf.ts_accesslog_str, CONST_STR_LEN("0"));
 					buffer_append_long(p->conf.ts_accesslog_str, min);
-					BUFFER_APPEND_STRING_CONST(p->conf.ts_accesslog_str, "]");
+					buffer_append_string_len(p->conf.ts_accesslog_str, CONST_STR_LEN("]"));
 #else
 #ifdef HAVE_GMTIME_R
 					gmtime_r(&(srv->cur_ts), &tm);
@@ -717,13 +726,13 @@
 				break;
 			case FORMAT_REMOTE_IDENT:
 				/* ident */
-				BUFFER_APPEND_STRING_CONST(b, "-");
+				buffer_append_string_len(b, CONST_STR_LEN("-"));
 				break;
 			case FORMAT_REMOTE_USER:
 				if (con->authed_user->used > 1) {
 					buffer_append_string_buffer(b, con->authed_user);
 				} else {
-					BUFFER_APPEND_STRING_CONST(b, "-");
+					buffer_append_string_len(b, CONST_STR_LEN("-"));
 				}
 				break;
 			case FORMAT_REQUEST_LINE:
@@ -740,42 +749,42 @@
 					buffer_append_off_t(b,
 							    con->bytes_written - con->bytes_header <= 0 ? 0 : con->bytes_written - con->bytes_header);
 				} else {
-					BUFFER_APPEND_STRING_CONST(b, "-");
+					buffer_append_string_len(b, CONST_STR_LEN("-"));
 				}
 				break;
 			case FORMAT_HEADER:
 				if (NULL != (ds = (data_string *)array_get_element(con->request.headers, p->conf.parsed_format->ptr[j]->string->ptr))) {
 					buffer_append_string_buffer(b, ds->value);
 				} else {
-					BUFFER_APPEND_STRING_CONST(b, "-");
+					buffer_append_string_len(b, CONST_STR_LEN("-"));
 				}
 				break;
 			case FORMAT_RESPONSE_HEADER:
 				if (NULL != (ds = (data_string *)array_get_element(con->response.headers, p->conf.parsed_format->ptr[j]->string->ptr))) {
 					buffer_append_string_buffer(b, ds->value);
 				} else {
-					BUFFER_APPEND_STRING_CONST(b, "-");
+					buffer_append_string_len(b, CONST_STR_LEN("-"));
 				}
 				break;
 			case FORMAT_FILENAME:
 				if (con->physical.path->used > 1) {
 					buffer_append_string_buffer(b, con->physical.path);
 				} else {
-					BUFFER_APPEND_STRING_CONST(b, "-");
+					buffer_append_string_len(b, CONST_STR_LEN("-"));
 				}
 				break;
 			case FORMAT_BYTES_OUT:
 				if (con->bytes_written > 0) {
 					buffer_append_off_t(b, con->bytes_written);
 				} else {
-					BUFFER_APPEND_STRING_CONST(b, "-");
+					buffer_append_string_len(b, CONST_STR_LEN("-"));
 				}
 				break;
 			case FORMAT_BYTES_IN:
 				if (con->bytes_read > 0) {
 					buffer_append_off_t(b, con->bytes_read);
 				} else {
-					BUFFER_APPEND_STRING_CONST(b, "-");
+					buffer_append_string_len(b, CONST_STR_LEN("-"));
 				}
 				break;
 			case FORMAT_TIME_USED:
@@ -785,28 +794,35 @@
 				if (con->server_name->used > 1) {
 					buffer_append_string_buffer(b, con->server_name);
 				} else {
-					BUFFER_APPEND_STRING_CONST(b, "-");
+					buffer_append_string_len(b, CONST_STR_LEN("-"));
 				}
 				break;
 			case FORMAT_HTTP_HOST:
 				if (con->uri.authority->used > 1) {
 					buffer_append_string_buffer(b, con->uri.authority);
 				} else {
-					BUFFER_APPEND_STRING_CONST(b, "-");
+					buffer_append_string_len(b, CONST_STR_LEN("-"));
 				}
 				break;
 			case FORMAT_REQUEST_PROTOCOL:
-				buffer_append_string(b,
-						     con->request.http_version == HTTP_VERSION_1_1 ? "HTTP/1.1" : "HTTP/1.0");
+				buffer_append_string_len(b,
+						     con->request.http_version == HTTP_VERSION_1_1 ? "HTTP/1.1" : "HTTP/1.0", 8);
 				break;
 			case FORMAT_REQUEST_METHOD:
 				buffer_append_string(b, get_http_method_name(con->request.http_method));
 				break;
 			case FORMAT_PERCENT:
-				buffer_append_string(b, "%");
+				buffer_append_string_len(b, CONST_STR_LEN("%"));
 				break;
 			case FORMAT_SERVER_PORT:
-				buffer_append_long(b, srv->srvconf.port);
+				{
+					char *colon = strchr(((server_socket*)(con->srv_socket))->srv_token->ptr, ':');
+					if (colon) {
+						buffer_append_string(b, colon+1);
+					} else {
+						buffer_append_long(b, srv->srvconf.port);
+					}
+				}
 				break;
 			case FORMAT_QUERY_STRING:
 				buffer_append_string_buffer(b, con->uri.query);
@@ -816,8 +832,8 @@
 				break;
 			case FORMAT_CONNECTION_STATUS:
 				switch(con->keep_alive) {
-				case 0: buffer_append_string(b, "-"); break;
-				default: buffer_append_string(b, "+"); break;
+				case 0: buffer_append_string_len(b, CONST_STR_LEN("-")); break;
+				default: buffer_append_string_len(b, CONST_STR_LEN("+")); break;
 				}
 				break;
 			default:
@@ -837,7 +853,7 @@
 		}
 	}
 
-	BUFFER_APPEND_STRING_CONST(b, "\n");
+	buffer_append_string_len(b, CONST_STR_LEN("\n"));
 
 	if (p->conf.use_syslog ||  /* syslog doesn't cache */
 	    (p->conf.access_logfile->used && p->conf.access_logfile->ptr[0] == '|') || /* pipes don't cache */
@@ -847,7 +863,7 @@
 #ifdef HAVE_SYSLOG_H
 			if (b->used > 2) {
 				/* syslog appends a \n on its own */
-				syslog(LOG_INFO, "%*s", b->used - 2, b->ptr);
+				syslog(LOG_INFO, "%*s", (int) b->used - 2, b->ptr);
 			}
 #endif
 		} else if (p->conf.log_access_fd != -1) {

Modified: lighttpd/trunk/src/mod_alias.c
===================================================================
--- lighttpd/trunk/src/mod_alias.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_alias.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -103,9 +103,8 @@
 					}
 					/* ok, they have same prefix. check position */
 					if (a->sorted[j] < a->sorted[k]) {
-						fprintf(stderr, "url.alias: `%s' will never match as `%s' matched first\n",
-								key->ptr,
-								prefix->ptr);
+						log_error_write(srv, __FILE__, __LINE__, "SBSBS",
+							"url.alias: `", key, "' will never match as `", prefix, "' matched first");
 						return HANDLER_ERROR;
 					}
 				}

Modified: lighttpd/trunk/src/mod_auth.c
===================================================================
--- lighttpd/trunk/src/mod_auth.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_auth.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -115,7 +115,7 @@
 	PATCH(auth_ldap_starttls);
 	PATCH(auth_ldap_allow_empty_pw);
 #ifdef USE_LDAP
-	PATCH(ldap);
+	p->anon_conf = s;
 	PATCH(ldap_filter_pre);
 	PATCH(ldap_filter_post);
 #endif
@@ -149,18 +149,24 @@
 			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("auth.backend.ldap.hostname"))) {
 				PATCH(auth_ldap_hostname);
 #ifdef USE_LDAP
-				PATCH(ldap);
-				PATCH(ldap_filter_pre);
-				PATCH(ldap_filter_post);
+				p->anon_conf = s;
 #endif
 			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("auth.backend.ldap.base-dn"))) {
 				PATCH(auth_ldap_basedn);
 			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("auth.backend.ldap.filter"))) {
 				PATCH(auth_ldap_filter);
+#ifdef USE_LDAP
+				PATCH(ldap_filter_pre);
+				PATCH(ldap_filter_post);
+#endif
 			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("auth.backend.ldap.ca-file"))) {
 				PATCH(auth_ldap_cafile);
 			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("auth.backend.ldap.starttls"))) {
 				PATCH(auth_ldap_starttls);
+			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("auth.backend.ldap.bind-dn"))) {
+				PATCH(auth_ldap_binddn);
+			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("auth.backend.ldap.bind-pw"))) {
+				PATCH(auth_ldap_bindpw);
 			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("auth.backend.ldap.allow-empty-pw"))) {
 				PATCH(auth_ldap_allow_empty_pw);
 			}
@@ -248,6 +254,7 @@
 				if (0 == strcmp(method->value->ptr, "digest")) {
 					if (-1 == (auth_satisfied = http_auth_digest_check(srv, con, p, req, con->uri.path, auth_realm+1))) {
 						con->http_status = 400;
+						con->mode = DIRECT;
 
 						/* a field was missing */
 
@@ -268,22 +275,23 @@
 		realm = (data_string *)array_get_element(req, "realm");
 
 		con->http_status = 401;
+		con->mode = DIRECT;
 
 		if (0 == strcmp(method->value->ptr, "basic")) {
-			buffer_copy_string(p->tmp_buf, "Basic realm=\"");
+			buffer_copy_string_len(p->tmp_buf, CONST_STR_LEN("Basic realm=\""));
 			buffer_append_string_buffer(p->tmp_buf, realm->value);
-			buffer_append_string(p->tmp_buf, "\"");
+			buffer_append_string_len(p->tmp_buf, CONST_STR_LEN("\""));
 
 			response_header_insert(srv, con, CONST_STR_LEN("WWW-Authenticate"), CONST_BUF_LEN(p->tmp_buf));
 		} else if (0 == strcmp(method->value->ptr, "digest")) {
 			char hh[33];
 			http_auth_digest_generate_nonce(srv, p, srv->tmp_buf, hh);
 
-			buffer_copy_string(p->tmp_buf, "Digest realm=\"");
+			buffer_copy_string_len(p->tmp_buf, CONST_STR_LEN("Digest realm=\""));
 			buffer_append_string_buffer(p->tmp_buf, realm->value);
-			buffer_append_string(p->tmp_buf, "\", nonce=\"");
+			buffer_append_string_len(p->tmp_buf, CONST_STR_LEN("\", nonce=\""));
 			buffer_append_string(p->tmp_buf, hh);
-			buffer_append_string(p->tmp_buf, "\", qop=\"auth\"");
+			buffer_append_string_len(p->tmp_buf, CONST_STR_LEN("\", qop=\"auth\""));
 
 			response_header_insert(srv, con, CONST_STR_LEN("WWW-Authenticate"), CONST_BUF_LEN(p->tmp_buf));
 		} else {
@@ -393,6 +401,23 @@
 			}
 		}
 
+#ifdef USE_LDAP
+		if (s->auth_ldap_filter->used) {
+			char *dollar;
+
+			/* parse filter */
+
+			if (NULL == (dollar = strchr(s->auth_ldap_filter->ptr, '$'))) {
+				log_error_write(srv, __FILE__, __LINE__, "s", "ldap: auth.backend.ldap.filter is missing a replace-operator '$'");
+
+				return HANDLER_ERROR;
+			}
+
+			buffer_copy_string_len(s->ldap_filter_pre, s->auth_ldap_filter->ptr, dollar - s->auth_ldap_filter->ptr);
+			buffer_copy_string(s->ldap_filter_post, dollar+1);
+		}
+#endif
+
 		/* no auth.require for this section */
 		if (NULL == (da = (data_array *)array_get_element(ca, "auth.require"))) continue;
 
@@ -479,21 +504,21 @@
 
 				ds = data_string_init();
 
-				buffer_copy_string(ds->key, "method");
+				buffer_copy_string_len(ds->key, CONST_STR_LEN("method"));
 				buffer_copy_string(ds->value, method);
 
 				array_insert_unique(a->value, (data_unset *)ds);
 
 				ds = data_string_init();
 
-				buffer_copy_string(ds->key, "realm");
+				buffer_copy_string_len(ds->key, CONST_STR_LEN("realm"));
 				buffer_copy_string(ds->value, realm);
 
 				array_insert_unique(a->value, (data_unset *)ds);
 
 				ds = data_string_init();
 
-				buffer_copy_string(ds->key, "require");
+				buffer_copy_string_len(ds->key, CONST_STR_LEN("require"));
 				buffer_copy_string(ds->value, require);
 
 				array_insert_unique(a->value, (data_unset *)ds);
@@ -502,102 +527,91 @@
 			}
 		}
 
-		switch(s->auth_backend) {
+		switch(s->auth_ldap_hostname->used) {
 		case AUTH_BACKEND_LDAP: {
 			handler_t ret = auth_ldap_init(srv, s);
 			if (ret == HANDLER_ERROR)
 				return (ret);
-                        break;
+			break;
 		}
-                default:
-                        break;
-                }
-        }
+		default:
+			break;
+		}
+	}
 
-        return HANDLER_GO_ON;
+	return HANDLER_GO_ON;
 }
 
 handler_t auth_ldap_init(server *srv, mod_auth_plugin_config *s) {
 #ifdef USE_LDAP
-			int ret;
+	int ret;
 #if 0
-			if (s->auth_ldap_basedn->used == 0) {
-				log_error_write(srv, __FILE__, __LINE__, "s", "ldap: auth.backend.ldap.base-dn has to be set");
+	if (s->auth_ldap_basedn->used == 0) {
+		log_error_write(srv, __FILE__, __LINE__, "s", "ldap: auth.backend.ldap.base-dn has to be set");
 
-				return HANDLER_ERROR;
-			}
+		return HANDLER_ERROR;
+	}
 #endif
 
-			if (s->auth_ldap_filter->used) {
-				char *dollar;
+	if (s->auth_ldap_hostname->used) {
+		/* free old context */
+		if (NULL != s->ldap) ldap_unbind_s(s->ldap);
 
-				/* parse filter */
+		if (NULL == (s->ldap = ldap_init(s->auth_ldap_hostname->ptr, LDAP_PORT))) {
+			log_error_write(srv, __FILE__, __LINE__, "ss", "ldap ...", strerror(errno));
 
-				if (NULL == (dollar = strchr(s->auth_ldap_filter->ptr, '$'))) {
-					log_error_write(srv, __FILE__, __LINE__, "s", "ldap: auth.backend.ldap.filter is missing a replace-operator '$'");
+			return HANDLER_ERROR;
+		}
 
-					return HANDLER_ERROR;
-				}
+		ret = LDAP_VERSION3;
+		if (LDAP_OPT_SUCCESS != (ret = ldap_set_option(s->ldap, LDAP_OPT_PROTOCOL_VERSION, &ret))) {
+			log_error_write(srv, __FILE__, __LINE__, "ss", "ldap:", ldap_err2string(ret));
 
-				buffer_copy_string_len(s->ldap_filter_pre, s->auth_ldap_filter->ptr, dollar - s->auth_ldap_filter->ptr);
-				buffer_copy_string(s->ldap_filter_post, dollar+1);
-			}
+			return HANDLER_ERROR;
+		}
 
-			if (s->auth_ldap_hostname->used) {
-				if (NULL == (s->ldap = ldap_init(s->auth_ldap_hostname->ptr, LDAP_PORT))) {
-					log_error_write(srv, __FILE__, __LINE__, "ss", "ldap ...", strerror(errno));
+		if (s->auth_ldap_starttls) {
+			/* if no CA file is given, it is ok, as we will use encryption
+				* if the server requires a CAfile it will tell us */
+			if (!buffer_is_empty(s->auth_ldap_cafile)) {
+				if (LDAP_OPT_SUCCESS != (ret = ldap_set_option(NULL, LDAP_OPT_X_TLS_CACERTFILE,
+								s->auth_ldap_cafile->ptr))) {
+					log_error_write(srv, __FILE__, __LINE__, "ss",
+							"Loading CA certificate failed:", ldap_err2string(ret));
 
 					return HANDLER_ERROR;
 				}
+			}
 
-				ret = LDAP_VERSION3;
-				if (LDAP_OPT_SUCCESS != (ret = ldap_set_option(s->ldap, LDAP_OPT_PROTOCOL_VERSION, &ret))) {
-					log_error_write(srv, __FILE__, __LINE__, "ss", "ldap:", ldap_err2string(ret));
+			if (LDAP_OPT_SUCCESS != (ret = ldap_start_tls_s(s->ldap, NULL,  NULL))) {
+				log_error_write(srv, __FILE__, __LINE__, "ss", "ldap startTLS failed:", ldap_err2string(ret));
 
-					return HANDLER_ERROR;
-				}
+				return HANDLER_ERROR;
+			}
+		}
 
-				if (s->auth_ldap_starttls) {
-					/* if no CA file is given, it is ok, as we will use encryption
-					 * if the server requires a CAfile it will tell us */
-					if (!buffer_is_empty(s->auth_ldap_cafile)) {
-						if (LDAP_OPT_SUCCESS != (ret = ldap_set_option(NULL, LDAP_OPT_X_TLS_CACERTFILE,
-										s->auth_ldap_cafile->ptr))) {
-							log_error_write(srv, __FILE__, __LINE__, "ss",
-									"Loading CA certificate failed:", ldap_err2string(ret));
 
-							return HANDLER_ERROR;
-						}
-					}
+		/* 1. */
+		if (s->auth_ldap_binddn->used) {
+			if (LDAP_SUCCESS != (ret = ldap_simple_bind_s(s->ldap, s->auth_ldap_binddn->ptr, s->auth_ldap_bindpw->ptr))) {
+				log_error_write(srv, __FILE__, __LINE__, "ss", "ldap:", ldap_err2string(ret));
 
-					if (LDAP_OPT_SUCCESS != (ret = ldap_start_tls_s(s->ldap, NULL,  NULL))) {
-						log_error_write(srv, __FILE__, __LINE__, "ss", "ldap startTLS failed:", ldap_err2string(ret));
+				return HANDLER_ERROR;
+			}
+		} else {
+			if (LDAP_SUCCESS != (ret = ldap_simple_bind_s(s->ldap, NULL, NULL))) {
+				log_error_write(srv, __FILE__, __LINE__, "ss", "ldap:", ldap_err2string(ret));
 
-						return HANDLER_ERROR;
-					}
-				}
-
-
-				/* 1. */
-				if (s->auth_ldap_binddn->used) {
-					if (LDAP_SUCCESS != (ret = ldap_simple_bind_s(s->ldap, s->auth_ldap_binddn->ptr, s->auth_ldap_bindpw->ptr))) {
-						log_error_write(srv, __FILE__, __LINE__, "ss", "ldap:", ldap_err2string(ret));
-
-						return HANDLER_ERROR;
-					}
-				} else {
-					if (LDAP_SUCCESS != (ret = ldap_simple_bind_s(s->ldap, NULL, NULL))) {
-						log_error_write(srv, __FILE__, __LINE__, "ss", "ldap:", ldap_err2string(ret));
-
-						return HANDLER_ERROR;
-					}
-				}
+				return HANDLER_ERROR;
 			}
+		}
+	}
+	return HANDLER_GO_ON;
 #else
-			log_error_write(srv, __FILE__, __LINE__, "s", "no ldap support available");
-			return HANDLER_ERROR;
+	UNUSED(s);
+	log_error_write(srv, __FILE__, __LINE__, "s", "no ldap support available");
+	return HANDLER_ERROR;
 #endif
-		return HANDLER_GO_ON;
 }
 
 int mod_auth_plugin_init(plugin *p) {

Modified: lighttpd/trunk/src/mod_cgi.c
===================================================================
--- lighttpd/trunk/src/mod_cgi.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_cgi.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -822,15 +822,27 @@
 			);
 		cgi_env_add(&env, CONST_STR_LEN("SERVER_PORT"), buf, strlen(buf));
 
+		switch (srv_sock->addr.plain.sa_family) {
 #ifdef HAVE_IPV6
-		s = inet_ntop(srv_sock->addr.plain.sa_family,
-			      srv_sock->addr.plain.sa_family == AF_INET6 ?
-			      (const void *) &(srv_sock->addr.ipv6.sin6_addr) :
-			      (const void *) &(srv_sock->addr.ipv4.sin_addr),
-			      b2, sizeof(b2)-1);
+		case AF_INET6:
+			s = inet_ntop(srv_sock->addr.plain.sa_family,
+			              (const void *) &(srv_sock->addr.ipv6.sin6_addr),
+			              b2, sizeof(b2)-1);
+			break;
+		case AF_INET:
+			s = inet_ntop(srv_sock->addr.plain.sa_family,
+			              (const void *) &(srv_sock->addr.ipv4.sin_addr),
+			              b2, sizeof(b2)-1);
+			break;
 #else
-		s = inet_ntoa(srv_sock->addr.ipv4.sin_addr);
+		case AF_INET:
+			s = inet_ntoa(srv_sock->addr.ipv4.sin_addr);
+			break;
 #endif
+		default:
+			s = "";
+			break;
+		}
 		cgi_env_add(&env, CONST_STR_LEN("SERVER_ADDR"), s, strlen(s));
 
 		s = get_http_method_name(con->request.http_method);
@@ -848,15 +860,27 @@
 		}
 
 
+		switch (con->dst_addr.plain.sa_family) {
 #ifdef HAVE_IPV6
-		s = inet_ntop(con->dst_addr.plain.sa_family,
-			      con->dst_addr.plain.sa_family == AF_INET6 ?
-			      (const void *) &(con->dst_addr.ipv6.sin6_addr) :
-			      (const void *) &(con->dst_addr.ipv4.sin_addr),
-			      b2, sizeof(b2)-1);
+		case AF_INET6:
+			s = inet_ntop(con->dst_addr.plain.sa_family,
+			              (const void *) &(con->dst_addr.ipv6.sin6_addr),
+			              b2, sizeof(b2)-1);
+			break;
+		case AF_INET:
+			s = inet_ntop(con->dst_addr.plain.sa_family,
+			              (const void *) &(con->dst_addr.ipv4.sin_addr),
+			              b2, sizeof(b2)-1);
+			break;
 #else
-		s = inet_ntoa(con->dst_addr.ipv4.sin_addr);
+		case AF_INET:
+			s = inet_ntoa(con->dst_addr.ipv4.sin_addr);
+			break;
 #endif
+		default:
+			s = "";
+			break;
+		}
 		cgi_env_add(&env, CONST_STR_LEN("REMOTE_ADDR"), s, strlen(s));
 
 		LI_ltostr(buf,
@@ -912,7 +936,7 @@
 				buffer_reset(p->tmp_buf);
 
 				if (0 != strcasecmp(ds->key->ptr, "CONTENT-TYPE")) {
-					buffer_copy_string(p->tmp_buf, "HTTP_");
+					buffer_copy_string_len(p->tmp_buf, CONST_STR_LEN("HTTP_"));
 					p->tmp_buf->used--; /* strip \0 after HTTP_ */
 				}
 
@@ -949,7 +973,7 @@
 
 				for (j = 0; j < ds->key->used - 1; j++) {
 					p->tmp_buf->ptr[p->tmp_buf->used++] =
-						isalpha((unsigned char)ds->key->ptr[j]) ?
+						light_isalnum((unsigned char)ds->key->ptr[j]) ?
 						toupper((unsigned char)ds->key->ptr[j]) : '_';
 				}
 				p->tmp_buf->ptr[p->tmp_buf->used++] = '\0';
@@ -987,6 +1011,8 @@
 			*c = '/';
 		}
 
+		openDevNull(STDERR_FILENO);
+
 		/* we don't need the client socket */
 		for (i = 3; i < 256; i++) {
 			if (i != srv->errorlog_fd) close(i);
@@ -995,7 +1021,7 @@
 		/* exec the cgi */
 		execve(args[0], args, env.ptr);
 
-		log_error_write(srv, __FILE__, __LINE__, "sss", "CGI failed:", strerror(errno), args[0]);
+		/* log_error_write(srv, __FILE__, __LINE__, "sss", "CGI failed:", strerror(errno), args[0]); */
 
 		/* */
 		SEGFAULT();
@@ -1058,8 +1084,9 @@
 						switch(errno) {
 						case ENOSPC:
 							con->http_status = 507;
-
 							break;
+						case EINTR:
+							continue;
 						default:
 							con->http_status = 403;
 							break;
@@ -1071,8 +1098,9 @@
 						switch(errno) {
 						case ENOSPC:
 							con->http_status = 507;
-
 							break;
+						case EINTR:
+							continue;
 						default:
 							con->http_status = 403;
 							break;
@@ -1087,6 +1115,8 @@
 					c->offset += r;
 					cq->bytes_out += r;
 				} else {
+					log_error_write(srv, __FILE__, __LINE__, "ss", "write() failed due to: ", strerror(errno)); 
+					con->http_status = 500;
 					break;
 				}
 				chunkqueue_remove_finished_chunks(cq);
@@ -1174,6 +1204,8 @@
 	plugin_data *p = p_d;
 	buffer *fn = con->physical.path;
 
+	if (con->mode != DIRECT) return HANDLER_GO_ON;
+
 	if (fn->used == 0) return HANDLER_GO_ON;
 
 	mod_cgi_patch_connection(srv, con, p);
@@ -1189,6 +1221,7 @@
 
 		if (0 == strncmp(fn->ptr + s_len - ct_len, ds->key->ptr, ct_len)) {
 			if (cgi_create_env(srv, con, p, ds->value)) {
+				con->mode = DIRECT;
 				con->http_status = 500;
 
 				buffer_reset(con->physical.path);

Modified: lighttpd/trunk/src/mod_cml_lua.c
===================================================================
--- lighttpd/trunk/src/mod_cml_lua.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_cml_lua.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -282,11 +282,11 @@
 
 	/* 2 default constants */
 	lua_pushliteral(L, "CACHE_HIT");
-	lua_pushboolean(L, 0);
+	lua_pushnumber(L, 0);
 	lua_settable(L, LUA_GLOBALSINDEX);
 
 	lua_pushliteral(L, "CACHE_MISS");
-	lua_pushboolean(L, 1);
+	lua_pushnumber(L, 1);
 	lua_settable(L, LUA_GLOBALSINDEX);
 
 	/* load lua program */

Modified: lighttpd/trunk/src/mod_compress.c
===================================================================
--- lighttpd/trunk/src/mod_compress.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_compress.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -49,6 +49,7 @@
 	buffer *compress_cache_dir;
 	array  *compress;
 	off_t   compress_max_filesize; /** max filesize in kb */
+	int     allowed_encodings;
 } plugin_config;
 
 typedef struct {
@@ -102,7 +103,7 @@
 	return HANDLER_GO_ON;
 }
 
-// 0 on success, -1 for error
+/* 0 on success, -1 for error */
 int mkdir_recursive(char *dir) {
 	char *p = dir;
 
@@ -118,13 +119,13 @@
 		}
 
 		*p++ = '/';
-		if (!*p) return 0; // Ignore trailing slash
+		if (!*p) return 0; /* Ignore trailing slash */
 	}
 
 	return (mkdir(dir, 0700) != 0) && (errno != EEXIST) ? -1 : 0;
 }
 
-// 0 on success, -1 for error
+/* 0 on success, -1 for error */
 int mkdir_for_file(char *filename) {
 	char *p = filename;
 
@@ -140,7 +141,7 @@
 		}
 
 		*p++ = '/';
-		if (!*p) return -1; // Unexpected trailing slash in filename
+		if (!*p) return -1; /* Unexpected trailing slash in filename */
 	}
 
 	return 0;
@@ -154,6 +155,7 @@
 		{ "compress.cache-dir",             NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },
 		{ "compress.filetype",              NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION },
 		{ "compress.max-filesize",          NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION },
+		{ "compress.allowed-encodings",     NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION },
 		{ NULL,                             NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
 	};
 
@@ -161,15 +163,18 @@
 
 	for (i = 0; i < srv->config_context->used; i++) {
 		plugin_config *s;
+		array  *encodings_arr = array_init();
 
 		s = calloc(1, sizeof(plugin_config));
 		s->compress_cache_dir = buffer_init();
 		s->compress = array_init();
 		s->compress_max_filesize = 0;
+		s->allowed_encodings = 0;
 
 		cv[0].destination = s->compress_cache_dir;
 		cv[1].destination = s->compress;
 		cv[2].destination = &(s->compress_max_filesize);
+		cv[3].destination = encodings_arr; /* temp array for allowed encodings list */
 
 		p->config_storage[i] = s;
 
@@ -177,10 +182,43 @@
 			return HANDLER_ERROR;
 		}
 
+		if (encodings_arr->used) {
+			size_t j = 0;
+			for (j = 0; j < encodings_arr->used; j++) {
+				data_string *ds = (data_string *)encodings_arr->data[j];
+#ifdef USE_ZLIB
+				if (NULL != strstr(ds->value->ptr, "gzip"))
+					s->allowed_encodings |= HTTP_ACCEPT_ENCODING_GZIP;
+				if (NULL != strstr(ds->value->ptr, "deflate"))
+					s->allowed_encodings |= HTTP_ACCEPT_ENCODING_DEFLATE;
+				/*
+				if (NULL != strstr(ds->value->ptr, "compress"))
+					s->allowed_encodings |= HTTP_ACCEPT_ENCODING_COMPRESS;
+				*/
+#endif
+#ifdef USE_BZ2LIB
+				if (NULL != strstr(ds->value->ptr, "bzip2"))
+					s->allowed_encodings |= HTTP_ACCEPT_ENCODING_BZIP2;
+#endif
+			}
+		} else {
+			/* default encodings */
+			s->allowed_encodings = 0
+#ifdef USE_ZLIB
+				| HTTP_ACCEPT_ENCODING_GZIP | HTTP_ACCEPT_ENCODING_DEFLATE
+#endif
+#ifdef USE_BZ2LIB
+				| HTTP_ACCEPT_ENCODING_BZIP2
+#endif
+				;
+		}
+
+		array_free(encodings_arr);
+
 		if (!buffer_is_empty(s->compress_cache_dir)) {
+			struct stat st;
 			mkdir_recursive(s->compress_cache_dir->ptr);
 
-			struct stat st;
 			if (0 != stat(s->compress_cache_dir->ptr, &st)) {
 				log_error_write(srv, __FILE__, __LINE__, "sbs", "can't stat compress.cache-dir",
 						s->compress_cache_dir, strerror(errno));
@@ -396,13 +434,13 @@
 
 	switch(type) {
 	case HTTP_ACCEPT_ENCODING_GZIP:
-		buffer_append_string(p->ofn, "-gzip-");
+		buffer_append_string_len(p->ofn, CONST_STR_LEN("-gzip-"));
 		break;
 	case HTTP_ACCEPT_ENCODING_DEFLATE:
-		buffer_append_string(p->ofn, "-deflate-");
+		buffer_append_string_len(p->ofn, CONST_STR_LEN("-deflate-"));
 		break;
 	case HTTP_ACCEPT_ENCODING_BZIP2:
-		buffer_append_string(p->ofn, "-bzip2-");
+		buffer_append_string_len(p->ofn, CONST_STR_LEN("-bzip2-"));
 		break;
 	default:
 		log_error_write(srv, __FILE__, __LINE__, "sd", "unknown compression type", type);
@@ -587,6 +625,7 @@
 	PATCH(compress_cache_dir);
 	PATCH(compress);
 	PATCH(compress_max_filesize);
+	PATCH(allowed_encodings);
 
 	/* skip the first, the global context */
 	for (i = 1; i < srv->config_context->used; i++) {
@@ -606,6 +645,8 @@
 				PATCH(compress);
 			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("compress.max-filesize"))) {
 				PATCH(compress_max_filesize);
+			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("compress.allowed-encodings"))) {
+				PATCH(allowed_encodings);
 			}
 		}
 	}
@@ -619,6 +660,7 @@
 	size_t m;
 	off_t max_fsize;
 	stat_cache_entry *sce = NULL;
+	buffer *mtime = NULL;
 
 	if (con->mode != DIRECT || con->http_status) return HANDLER_GO_ON;
 
@@ -636,8 +678,30 @@
 
 	max_fsize = p->conf.compress_max_filesize;
 
-	stat_cache_get_entry(srv, con, con->physical.path, &sce);
+	if (con->conf.log_request_handling) {
+		log_error_write(srv, __FILE__, __LINE__,  "s",  "-- handling file as static file");
+	}
 
+	if (HANDLER_ERROR == stat_cache_get_entry(srv, con, con->physical.path, &sce)) {
+		con->http_status = 403;
+
+		log_error_write(srv, __FILE__, __LINE__, "sbsb",
+				"not a regular file:", con->uri.path,
+				"->", con->physical.path);
+
+		return HANDLER_FINISHED;
+	}
+
+	/* we only handle regular files */
+#ifdef HAVE_LSTAT
+	if ((sce->is_symlink == 1) && !con->conf.follow_symlink) {
+		return HANDLER_GO_ON;
+	}
+#endif
+	if (!S_ISREG(sce->st.st_mode)) {
+		return HANDLER_GO_ON;
+	}
+
 	/* don't compress files that are too large as we need to much time to handle them */
 	if (max_fsize && (sce->st.st_size >> 10) > max_fsize) return HANDLER_GO_ON;
 
@@ -668,27 +732,21 @@
 			if (NULL != (ds = (data_string *)array_get_element(con->request.headers, "Accept-Encoding"))) {
 				int accept_encoding = 0;
 				char *value = ds->value->ptr;
-				int srv_encodings = 0;
 				int matched_encodings = 0;
 
 				/* get client side support encodings */
+#ifdef USE_ZLIB
 				if (NULL != strstr(value, "gzip")) accept_encoding |= HTTP_ACCEPT_ENCODING_GZIP;
 				if (NULL != strstr(value, "deflate")) accept_encoding |= HTTP_ACCEPT_ENCODING_DEFLATE;
 				if (NULL != strstr(value, "compress")) accept_encoding |= HTTP_ACCEPT_ENCODING_COMPRESS;
+#endif
+#ifdef USE_BZ2LIB
 				if (NULL != strstr(value, "bzip2")) accept_encoding |= HTTP_ACCEPT_ENCODING_BZIP2;
+#endif
 				if (NULL != strstr(value, "identity")) accept_encoding |= HTTP_ACCEPT_ENCODING_IDENTITY;
 
-				/* get server side supported ones */
-#ifdef USE_BZ2LIB
-				srv_encodings |= HTTP_ACCEPT_ENCODING_BZIP2;
-#endif
-#ifdef USE_ZLIB
-				srv_encodings |= HTTP_ACCEPT_ENCODING_GZIP;
-				srv_encodings |= HTTP_ACCEPT_ENCODING_DEFLATE;
-#endif
-
 				/* find matching entries */
-				matched_encodings = accept_encoding & srv_encodings;
+				matched_encodings = accept_encoding & p->conf.allowed_encodings;
 
 				if (matched_encodings) {
 					const char *dflt_gzip = "gzip";
@@ -698,6 +756,17 @@
 					const char *compression_name = NULL;
 					int compression_type = 0;
 
+					mtime = strftime_cache_get(srv, sce->st.st_mtime);
+
+					/* try matching original etag of uncompressed version */
+					etag_mutate(con->physical.etag, sce->etag);
+					if (HANDLER_FINISHED == http_response_handle_cachable(srv, con, mtime)) {
+						response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(sce->content_type));
+						response_header_overwrite(srv, con, CONST_STR_LEN("Last-Modified"), CONST_BUF_LEN(mtime));
+						response_header_overwrite(srv, con, CONST_STR_LEN("ETag"), CONST_BUF_LEN(con->physical.etag));
+						return HANDLER_FINISHED;
+					}
+
 					/* select best matching encoding */
 					if (matched_encodings & HTTP_ACCEPT_ENCODING_BZIP2) {
 						compression_type = HTTP_ACCEPT_ENCODING_BZIP2;
@@ -710,41 +779,34 @@
 						compression_name = dflt_deflate;
 					}
 
-					/* deflate it */
-					if (p->conf.compress_cache_dir->used) {
-						if (0 == deflate_file_to_file(srv, con, p,
-									      con->physical.path, sce, compression_type)) {
-							buffer *mtime;
+					/* try matching etag of compressed version */
+					buffer_copy_string_buffer(srv->tmp_buf, sce->etag);
+					buffer_append_string_len(srv->tmp_buf, CONST_STR_LEN("-"));
+					buffer_append_string(srv->tmp_buf, compression_name);
+					etag_mutate(con->physical.etag, srv->tmp_buf);
 
-							response_header_overwrite(srv, con, CONST_STR_LEN("Content-Encoding"), compression_name, strlen(compression_name));
-
-							mtime = strftime_cache_get(srv, sce->st.st_mtime);
-							response_header_overwrite(srv, con, CONST_STR_LEN("Last-Modified"), CONST_BUF_LEN(mtime));
-
-							etag_mutate(con->physical.etag, sce->etag);
-							response_header_overwrite(srv, con, CONST_STR_LEN("ETag"), CONST_BUF_LEN(con->physical.etag));
-
-							response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(sce->content_type));
-
-							return HANDLER_GO_ON;
-						}
-					} else if (0 == deflate_file_to_buffer(srv, con, p,
-									       con->physical.path, sce, compression_type)) {
-						buffer *mtime;
-
+					if (HANDLER_FINISHED == http_response_handle_cachable(srv, con, mtime)) {
 						response_header_overwrite(srv, con, CONST_STR_LEN("Content-Encoding"), compression_name, strlen(compression_name));
-
-						mtime = strftime_cache_get(srv, sce->st.st_mtime);
+						response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(sce->content_type));
 						response_header_overwrite(srv, con, CONST_STR_LEN("Last-Modified"), CONST_BUF_LEN(mtime));
-
-						etag_mutate(con->physical.etag, sce->etag);
 						response_header_overwrite(srv, con, CONST_STR_LEN("ETag"), CONST_BUF_LEN(con->physical.etag));
-
-						response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(sce->content_type));
-
 						return HANDLER_FINISHED;
 					}
-					break;
+
+					/* deflate it */
+					if (p->conf.compress_cache_dir->used) {
+						if (0 != deflate_file_to_file(srv, con, p, con->physical.path, sce, compression_type))
+							return HANDLER_GO_ON;
+					} else {
+						if (0 != deflate_file_to_buffer(srv, con, p, con->physical.path, sce, compression_type))
+							return HANDLER_GO_ON;
+					}
+					response_header_overwrite(srv, con, CONST_STR_LEN("Content-Encoding"), compression_name, strlen(compression_name));
+					response_header_overwrite(srv, con, CONST_STR_LEN("Last-Modified"), CONST_BUF_LEN(mtime));
+					response_header_overwrite(srv, con, CONST_STR_LEN("ETag"), CONST_BUF_LEN(con->physical.etag));
+					response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(sce->content_type));
+					/* let mod_staticfile handle the cached compressed files, physical path was modified */
+					return p->conf.compress_cache_dir->used ? HANDLER_GO_ON : HANDLER_FINISHED;
 				}
 			}
 		}

Modified: lighttpd/trunk/src/mod_dirlisting.c
===================================================================
--- lighttpd/trunk/src/mod_dirlisting.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_dirlisting.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -454,21 +454,21 @@
 static void http_list_directory_header(server *srv, connection *con, plugin_data *p, buffer *out) {
 	UNUSED(srv);
 
-	BUFFER_APPEND_STRING_CONST(out,
+	buffer_append_string_len(out, CONST_STR_LEN(
 		"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n"
 		"<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n"
 		"<head>\n"
 		"<title>Index of "
-	);
+	));
 	buffer_append_string_encoded(out, CONST_BUF_LEN(con->uri.path), ENCODING_MINIMAL_XML);
-	BUFFER_APPEND_STRING_CONST(out, "</title>\n");
+	buffer_append_string_len(out, CONST_STR_LEN("</title>\n"));
 
 	if (p->conf.external_css->used > 1) {
-		BUFFER_APPEND_STRING_CONST(out, "<link rel=\"stylesheet\" type=\"text/css\" href=\"");
+		buffer_append_string_len(out, CONST_STR_LEN("<link rel=\"stylesheet\" type=\"text/css\" href=\""));
 		buffer_append_string_buffer(out, p->conf.external_css);
-		BUFFER_APPEND_STRING_CONST(out, "\" />\n");
+		buffer_append_string_len(out, CONST_STR_LEN("\" />\n"));
 	} else {
-		BUFFER_APPEND_STRING_CONST(out,
+		buffer_append_string_len(out, CONST_STR_LEN(
 			"<style type=\"text/css\">\n"
 			"a, a:active {text-decoration: none; color: blue;}\n"
 			"a:visited {color: #48468F;}\n"
@@ -485,8 +485,6 @@
 			" padding-right: 14px;"
 			" padding-bottom: 3px;"
 			"}\n"
-		);
-		BUFFER_APPEND_STRING_CONST(out,
 			"td {padding-right: 14px;}\n"
 			"td.s, th.s {text-align: right;}\n"
 			"div.list {"
@@ -502,10 +500,10 @@
 			" padding-top: 4px;"
 			"}\n"
 			"</style>\n"
-		);
+		));
 	}
 
-	BUFFER_APPEND_STRING_CONST(out, "</head>\n<body>\n");
+	buffer_append_string_len(out, CONST_STR_LEN("</head>\n<body>\n"));
 
 	/* HEADER.txt */
 	if (p->conf.show_header) {
@@ -514,19 +512,19 @@
 
 		buffer_copy_string_buffer(p->tmp_buf, con->physical.path);
 		BUFFER_APPEND_SLASH(p->tmp_buf);
-		BUFFER_APPEND_STRING_CONST(p->tmp_buf, "HEADER.txt");
+		buffer_append_string_len(p->tmp_buf, CONST_STR_LEN("HEADER.txt"));
 
 		if (-1 != stream_open(&s, p->tmp_buf)) {
-			BUFFER_APPEND_STRING_CONST(out, "<pre class=\"header\">");
+			buffer_append_string_len(out, CONST_STR_LEN("<pre class=\"header\">"));
 			buffer_append_string_encoded(out, s.start, s.size, ENCODING_MINIMAL_XML);
-			BUFFER_APPEND_STRING_CONST(out, "</pre>");
+			buffer_append_string_len(out, CONST_STR_LEN("</pre>"));
 		}
 		stream_close(&s);
 	}
 
-	BUFFER_APPEND_STRING_CONST(out, "<h2>Index of ");
+	buffer_append_string_len(out, CONST_STR_LEN("<h2>Index of "));
 	buffer_append_string_encoded(out, CONST_BUF_LEN(con->uri.path), ENCODING_MINIMAL_XML);
-	BUFFER_APPEND_STRING_CONST(out,
+	buffer_append_string_len(out, CONST_STR_LEN(
 		"</h2>\n"
 		"<div class=\"list\">\n"
 		"<table summary=\"Directory Listing\" cellpadding=\"0\" cellspacing=\"0\">\n"
@@ -545,17 +543,17 @@
 			"<td class=\"s\">-  </td>"
 			"<td class=\"t\">Directory</td>"
 		"</tr>\n"
-	);
+	));
 }
 
 static void http_list_directory_footer(server *srv, connection *con, plugin_data *p, buffer *out) {
 	UNUSED(srv);
 
-	BUFFER_APPEND_STRING_CONST(out,
+	buffer_append_string_len(out, CONST_STR_LEN(
 		"</tbody>\n"
 		"</table>\n"
 		"</div>\n"
-	);
+	));
 
 	if (p->conf.show_readme) {
 		stream s;
@@ -563,33 +561,33 @@
 
 		buffer_copy_string_buffer(p->tmp_buf,  con->physical.path);
 		BUFFER_APPEND_SLASH(p->tmp_buf);
-		BUFFER_APPEND_STRING_CONST(p->tmp_buf, "README.txt");
+		buffer_append_string_len(p->tmp_buf, CONST_STR_LEN("README.txt"));
 
 		if (-1 != stream_open(&s, p->tmp_buf)) {
-			BUFFER_APPEND_STRING_CONST(out, "<pre class=\"readme\">");
+			buffer_append_string_len(out, CONST_STR_LEN("<pre class=\"readme\">"));
 			buffer_append_string_encoded(out, s.start, s.size, ENCODING_MINIMAL_XML);
-			BUFFER_APPEND_STRING_CONST(out, "</pre>");
+			buffer_append_string_len(out, CONST_STR_LEN("</pre>"));
 		}
 		stream_close(&s);
 	}
 
-	BUFFER_APPEND_STRING_CONST(out,
+	buffer_append_string_len(out, CONST_STR_LEN(
 		"<div class=\"foot\">"
-	);
+	));
 
 	if (p->conf.set_footer->used > 1) {
 		buffer_append_string_buffer(out, p->conf.set_footer);
 	} else if (buffer_is_empty(con->conf.server_tag)) {
-		BUFFER_APPEND_STRING_CONST(out, PACKAGE_NAME "/" PACKAGE_VERSION);
+		buffer_append_string_len(out, CONST_STR_LEN(PACKAGE_NAME "/" PACKAGE_VERSION));
 	} else {
 		buffer_append_string_buffer(out, con->conf.server_tag);
 	}
 
-	BUFFER_APPEND_STRING_CONST(out,
+	buffer_append_string_len(out, CONST_STR_LEN(
 		"</div>\n"
 		"</body>\n"
 		"</html>\n"
-	);
+	));
 }
 
 static int http_list_directory(server *srv, connection *con, plugin_data *p, buffer *dir) {
@@ -742,13 +740,13 @@
 	if (files.used) http_dirls_sort(files.ent, files.used);
 
 	out = chunkqueue_get_append_buffer(con->write_queue);
-	BUFFER_COPY_STRING_CONST(out, "<?xml version=\"1.0\" encoding=\"");
+	buffer_copy_string_len(out, CONST_STR_LEN("<?xml version=\"1.0\" encoding=\""));
 	if (buffer_is_empty(p->conf.encoding)) {
-		BUFFER_APPEND_STRING_CONST(out, "iso-8859-1");
+		buffer_append_string_len(out, CONST_STR_LEN("iso-8859-1"));
 	} else {
 		buffer_append_string_buffer(out, p->conf.encoding);
 	}
-	BUFFER_APPEND_STRING_CONST(out, "\"?>\n");
+	buffer_append_string_len(out, CONST_STR_LEN("\"?>\n"));
 	http_list_directory_header(srv, con, p, out);
 
 	/* directories */
@@ -762,13 +760,13 @@
 		strftime(datebuf, sizeof(datebuf), "%Y-%b-%d %H:%M:%S", localtime(&(tmp->mtime)));
 #endif
 
-		BUFFER_APPEND_STRING_CONST(out, "<tr><td class=\"n\"><a href=\"");
+		buffer_append_string_len(out, CONST_STR_LEN("<tr><td class=\"n\"><a href=\""));
 		buffer_append_string_encoded(out, DIRLIST_ENT_NAME(tmp), tmp->namelen, ENCODING_REL_URI_PART);
-		BUFFER_APPEND_STRING_CONST(out, "/\">");
+		buffer_append_string_len(out, CONST_STR_LEN("/\">"));
 		buffer_append_string_encoded(out, DIRLIST_ENT_NAME(tmp), tmp->namelen, ENCODING_MINIMAL_XML);
-		BUFFER_APPEND_STRING_CONST(out, "</a>/</td><td class=\"m\">");
+		buffer_append_string_len(out, CONST_STR_LEN("</a>/</td><td class=\"m\">"));
 		buffer_append_string_len(out, datebuf, sizeof(datebuf) - 1);
-		BUFFER_APPEND_STRING_CONST(out, "</td><td class=\"s\">-  </td><td class=\"t\">Directory</td></tr>\n");
+		buffer_append_string_len(out, CONST_STR_LEN("</td><td class=\"s\">-  </td><td class=\"t\">Directory</td></tr>\n"));
 
 		free(tmp);
 	}
@@ -818,17 +816,17 @@
 #endif
 		http_list_directory_sizefmt(sizebuf, tmp->size);
 
-		BUFFER_APPEND_STRING_CONST(out, "<tr><td class=\"n\"><a href=\"");
+		buffer_append_string_len(out, CONST_STR_LEN("<tr><td class=\"n\"><a href=\""));
 		buffer_append_string_encoded(out, DIRLIST_ENT_NAME(tmp), tmp->namelen, ENCODING_REL_URI_PART);
-		BUFFER_APPEND_STRING_CONST(out, "\">");
+		buffer_append_string_len(out, CONST_STR_LEN("\">"));
 		buffer_append_string_encoded(out, DIRLIST_ENT_NAME(tmp), tmp->namelen, ENCODING_MINIMAL_XML);
-		BUFFER_APPEND_STRING_CONST(out, "</a></td><td class=\"m\">");
+		buffer_append_string_len(out, CONST_STR_LEN("</a></td><td class=\"m\">"));
 		buffer_append_string_len(out, datebuf, sizeof(datebuf) - 1);
-		BUFFER_APPEND_STRING_CONST(out, "</td><td class=\"s\">");
+		buffer_append_string_len(out, CONST_STR_LEN("</td><td class=\"s\">"));
 		buffer_append_string(out, sizebuf);
-		BUFFER_APPEND_STRING_CONST(out, "</td><td class=\"t\">");
+		buffer_append_string_len(out, CONST_STR_LEN("</td><td class=\"t\">"));
 		buffer_append_string(out, content_type);
-		BUFFER_APPEND_STRING_CONST(out, "</td></tr>\n");
+		buffer_append_string_len(out, CONST_STR_LEN("</td></tr>\n"));
 
 		free(tmp);
 	}
@@ -841,11 +839,11 @@
 
 	/* Insert possible charset to Content-Type */
 	if (buffer_is_empty(p->conf.encoding)) {
-		response_header_insert(srv, con, CONST_STR_LEN("Content-Type"), CONST_STR_LEN("text/html"));
+		response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_STR_LEN("text/html"));
 	} else {
-		buffer_copy_string(p->content_charset, "text/html; charset=");
+		buffer_copy_string_len(p->content_charset, CONST_STR_LEN("text/html; charset="));
 		buffer_append_string_buffer(p->content_charset, p->conf.encoding);
-		response_header_insert(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(p->content_charset));
+		response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(p->content_charset));
 	}
 
 	con->file_finished = 1;
@@ -861,6 +859,18 @@
 
 	UNUSED(srv);
 
+	/* we only handle GET, POST and HEAD */
+	switch(con->request.http_method) {
+	case HTTP_METHOD_GET:
+	case HTTP_METHOD_POST:
+	case HTTP_METHOD_HEAD:
+		break;
+	default:
+		return HANDLER_GO_ON;
+	}
+
+	if (con->mode != DIRECT) return HANDLER_GO_ON;
+
 	if (con->physical.path->used == 0) return HANDLER_GO_ON;
 	if (con->uri.path->used == 0) return HANDLER_GO_ON;
 	if (con->uri.path->ptr[con->uri.path->used - 2] != '/') return HANDLER_GO_ON;

Modified: lighttpd/trunk/src/mod_evasive.c
===================================================================
--- lighttpd/trunk/src/mod_evasive.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_evasive.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -138,24 +138,47 @@
 	/* no limit set, nothing to block */
 	if (p->conf.max_conns == 0) return HANDLER_GO_ON;
 
+	switch (con->dst_addr.plain.sa_family) {
+		case AF_INET:
+#ifdef HAVE_IPV6
+		case AF_INET6:
+#endif
+			break;
+		default: /* Address family not supported */
+			return HANDLER_GO_ON;
+	};
+
 	for (j = 0; j < srv->conns->used; j++) {
 		connection *c = srv->conns->ptr[j];
 
 		/* check if other connections are already actively serving data for the same IP
 		 * we can only ban connections which are already behind the 'read request' state
 		 * */
-		if (c->dst_addr.ipv4.sin_addr.s_addr == con->dst_addr.ipv4.sin_addr.s_addr &&
-		    c->state > CON_STATE_REQUEST_END) {
-			conns_by_ip++;
+		if (c->dst_addr.plain.sa_family != con->dst_addr.plain.sa_family) continue;
+		if (c->state <= CON_STATE_REQUEST_END) continue;
 
-			if (conns_by_ip > p->conf.max_conns) {
-				log_error_write(srv, __FILE__, __LINE__, "ss",
-					inet_ntop_cache_get_ip(srv, &(con->dst_addr)),
-					"turned away. Too many connections.");
+		switch (con->dst_addr.plain.sa_family) {
+			case AF_INET:
+				if (c->dst_addr.ipv4.sin_addr.s_addr != con->dst_addr.ipv4.sin_addr.s_addr) continue;
+				break;
+#ifdef HAVE_IPV6
+			case AF_INET6:
+				if (0 != memcmp(c->dst_addr.ipv6.sin6_addr.s6_addr, con->dst_addr.ipv6.sin6_addr.s6_addr, 16)) continue;
+				break;
+#endif
+			default: /* Address family not supported, should never be reached */
+				continue;
+		};
+		conns_by_ip++;
 
-				con->http_status = 403;
-				return HANDLER_FINISHED;
-			}
+		if (conns_by_ip > p->conf.max_conns) {
+			log_error_write(srv, __FILE__, __LINE__, "ss",
+				inet_ntop_cache_get_ip(srv, &(con->dst_addr)),
+				"turned away. Too many connections.");
+
+			con->http_status = 403;
+			con->mode = DIRECT;
+			return HANDLER_FINISHED;
 		}
 	}
 

Modified: lighttpd/trunk/src/mod_evhost.c
===================================================================
--- lighttpd/trunk/src/mod_evhost.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_evhost.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -95,7 +95,7 @@
 		s->path_pieces = realloc(s->path_pieces,(s->len+1) * sizeof(*s->path_pieces));
 		s->path_pieces[s->len] = buffer_init();
 
-		buffer_append_memory(s->path_pieces[s->len],pos,ptr-pos);
+		buffer_copy_string_len(s->path_pieces[s->len],pos,ptr-pos);
 
 		s->len += 1;
 	}
@@ -181,7 +181,7 @@
 	}
 
 	ds = data_string_init();
-	buffer_copy_string(ds->key,"%0");
+	buffer_copy_string_len(ds->key,CONST_STR_LEN("%0"));
 
 	/* if we stopped at a dot, skip the dot */
 	if (*ptr == '.') ptr++;
@@ -197,7 +197,7 @@
 				if (ptr != colon - 1) {
 					/* is something between the dots */
 					ds = data_string_init();
-					buffer_copy_string(ds->key,"%");
+					buffer_copy_string_len(ds->key,CONST_STR_LEN("%"));
 					buffer_append_long(ds->key, i++);
 					buffer_copy_string_len(ds->value,ptr+1,colon-ptr-1);
 
@@ -210,7 +210,7 @@
 		/* if the . is not the first charactor of the hostname */
 		if (colon != ptr) {
 			ds = data_string_init();
-			buffer_copy_string(ds->key,"%");
+			buffer_copy_string_len(ds->key,CONST_STR_LEN("%"));
 			buffer_append_long(ds->key, i++);
 			buffer_copy_string_len(ds->value,ptr,colon-ptr);
 
@@ -286,7 +286,7 @@
 
 			if (*(ptr+1) == '%') {
 				/* %% */
-				BUFFER_APPEND_STRING_CONST(p->tmp_buf,"%");
+				buffer_append_string_len(p->tmp_buf,CONST_STR_LEN("%"));
 			} else if (NULL != (ds = (data_string *)array_get_element(parsed_host,p->conf.path_pieces[i]->ptr))) {
 				if (ds->value->used) {
 					buffer_append_string_buffer(p->tmp_buf,ds->value);

Modified: lighttpd/trunk/src/mod_expire.c
===================================================================
--- lighttpd/trunk/src/mod_expire.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_expire.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -339,7 +339,7 @@
 			response_header_overwrite(srv, con, CONST_STR_LEN("Expires"), CONST_BUF_LEN(p->expire_tstmp));
 
 			/* HTTP/1.1 */
-			buffer_copy_string(p->expire_tstmp, "max-age=");
+			buffer_copy_string_len(p->expire_tstmp, CONST_STR_LEN("max-age="));
 			buffer_append_long(p->expire_tstmp, ts);
 
 			response_header_overwrite(srv, con, CONST_STR_LEN("Cache-Control"), CONST_BUF_LEN(p->expire_tstmp));

Modified: lighttpd/trunk/src/mod_extforward.c
===================================================================
--- lighttpd/trunk/src/mod_extforward.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_extforward.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -281,8 +281,9 @@
 static const char *last_not_in_array(array *a, plugin_data *p)
 {
 	array *forwarder = p->conf.forwarder;
+	int i;
 
-	for (int i = a->used - 1; i >= 0; i--) {
+	for (i = a->used - 1; i >= 0; i--) {
 		data_string *ds = (data_string *)a->data[i];
 		const char *ip = ds->value->ptr;
 

Modified: lighttpd/trunk/src/mod_fastcgi.c
===================================================================
--- lighttpd/trunk/src/mod_fastcgi.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_fastcgi.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -236,6 +236,16 @@
 	unsigned short break_scriptfilename_for_php;
 
 	/*
+	 * workaround for program when prefix="/"
+	 *
+	 * rule to build PATH_INFO is hardcoded for when check_local is disabled
+	 * enable this option to use the workaround
+	 *
+	 */
+
+	unsigned short fix_root_path_name;
+
+	/*
 	 * If the backend includes X-LIGHTTPD-send-file in the response
 	 * we use the value as filename and ignore the content.
 	 *
@@ -380,10 +390,10 @@
 static handler_t fcgi_handle_fdevent(void *s, void *ctx, int revents);
 
 int fastcgi_status_copy_procname(buffer *b, fcgi_extension_host *host, fcgi_proc *proc) {
-	buffer_copy_string(b, "fastcgi.backend.");
+	buffer_copy_string_len(b, CONST_STR_LEN("fastcgi.backend."));
 	buffer_append_string_buffer(b, host->id);
 	if (proc) {
-		buffer_append_string(b, ".");
+		buffer_append_string_len(b, CONST_STR_LEN("."));
 		buffer_append_long(b, proc->id);
 	}
 
@@ -393,7 +403,7 @@
 int fastcgi_status_init(server *srv, buffer *b, fcgi_extension_host *host, fcgi_proc *proc) {
 #define CLEAN(x) \
 	fastcgi_status_copy_procname(b, host, proc); \
-	buffer_append_string(b, x); \
+	buffer_append_string_len(b, CONST_STR_LEN(x)); \
 	status_counter_set(srv, CONST_BUF_LEN(b), 0);
 
 	CLEAN(".disabled");
@@ -406,7 +416,7 @@
 
 #define CLEAN(x) \
 	fastcgi_status_copy_procname(b, host, NULL); \
-	buffer_append_string(b, x); \
+	buffer_append_string_len(b, CONST_STR_LEN(x)); \
 	status_counter_set(srv, CONST_BUF_LEN(b), 0);
 
 	CLEAN(".load");
@@ -693,6 +703,7 @@
 
 static int env_add(char_array *env, const char *key, size_t key_len, const char *val, size_t val_len) {
 	char *dst;
+	size_t i;
 
 	if (!key || !val) return -1;
 
@@ -702,6 +713,15 @@
 	/* add the \0 from the value */
 	memcpy(dst + key_len + 1, val, val_len + 1);
 
+	for (i = 0; i < env->used; i++) {
+		if (0 == strncmp(dst, env->ptr[i], key_len + 1)) {
+			/* don't care about free as we are in a forked child which is going to exec(...) */
+			/* free(env->ptr[i]); */
+			env->ptr[i] = dst;
+			return 0;
+		}
+	}
+
 	if (env->size == 0) {
 		env->size = 16;
 		env->ptr = malloc(env->size * sizeof(*env->ptr));
@@ -811,7 +831,7 @@
 		socket_type = AF_UNIX;
 		fcgi_addr = (struct sockaddr *) &fcgi_addr_un;
 
-		buffer_copy_string(proc->connection_name, "unix:");
+		buffer_copy_string_len(proc->connection_name, CONST_STR_LEN("unix:"));
 		buffer_append_string_buffer(proc->connection_name, proc->unixsocket);
 
 #else
@@ -857,13 +877,13 @@
 		socket_type = AF_INET;
 		fcgi_addr = (struct sockaddr *) &fcgi_addr_in;
 
-		buffer_copy_string(proc->connection_name, "tcp:");
+		buffer_copy_string_len(proc->connection_name, CONST_STR_LEN("tcp:"));
 		if (!buffer_is_empty(host->host)) {
 			buffer_append_string_buffer(proc->connection_name, host->host);
 		} else {
-			buffer_append_string(proc->connection_name, "localhost");
+			buffer_append_string_len(proc->connection_name, CONST_STR_LEN("localhost"));
 		}
-		buffer_append_string(proc->connection_name, ":");
+		buffer_append_string_len(proc->connection_name, CONST_STR_LEN(":"));
 		buffer_append_long(proc->connection_name, proc->port);
 	}
 
@@ -937,6 +957,8 @@
 				close(fcgi_fd);
 			}
 
+			openDevNull(STDERR_FILENO);
+
 			/* we don't need the client socket */
 			for (i = 3; i < 256; i++) {
 				close(i);
@@ -1000,8 +1022,8 @@
 			/* exec the cgi */
 			execve(arg.ptr[0], arg.ptr, env.ptr);
 
-			log_error_write(srv, __FILE__, __LINE__, "sbs",
-					"execve failed for:", host->bin_path, strerror(errno));
+			/* log_error_write(srv, __FILE__, __LINE__, "sbs",
+					"execve failed for:", host->bin_path, strerror(errno)); */
 
 			exit(errno);
 
@@ -1193,6 +1215,7 @@
 						{ "allow-x-send-file",  NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION },      /* 15 */
 						{ "strip-request-uri",  NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },      /* 16 */
 						{ "kill-signal",        NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION },      /* 17 */
+						{ "fix-root-scriptname",   NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION },  /* 18 */
 
 						{ NULL,                NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
 					};
@@ -1220,6 +1243,7 @@
 					host->break_scriptfilename_for_php = 0;
 					host->allow_xsendfile = 0; /* handle X-LIGHTTPD-send-file */
 					host->kill_signal = SIGTERM;
+					host->fix_root_path_name = 0;
 
 					fcv[0].destination = host->host;
 					fcv[1].destination = host->docroot;
@@ -1241,6 +1265,7 @@
 					fcv[15].destination = &(host->allow_xsendfile);
 					fcv[16].destination = host->strip_request_uri;
 					fcv[17].destination = &(host->kill_signal);
+					fcv[18].destination = &(host->fix_root_path_name);
 
 					if (0 != config_insert_values_internal(srv, da_host->value, fcv)) {
 						return HANDLER_ERROR;
@@ -1324,7 +1349,7 @@
 								proc->port = host->port + pno;
 							} else {
 								buffer_copy_string_buffer(proc->unixsocket, host->unixsocket);
-								buffer_append_string(proc->unixsocket, "-");
+								buffer_append_string_len(proc->unixsocket, CONST_STR_LEN("-"));
 								buffer_append_long(proc->unixsocket, pno);
 							}
 
@@ -1482,7 +1507,7 @@
 			status_counter_dec(srv, CONST_STR_LEN("fastcgi.active-requests"));
 
 			fastcgi_status_copy_procname(p->statuskey, hctx->host, hctx->proc);
-			buffer_append_string(p->statuskey, ".load");
+			buffer_append_string_len(p->statuskey, CONST_STR_LEN(".load"));
 
 			status_counter_set(srv, CONST_BUF_LEN(p->statuskey), hctx->proc->load);
 
@@ -1683,7 +1708,7 @@
 
 		if (buffer_is_empty(proc->connection_name)) {
 			/* on remote spawing we have to set the connection-name now */
-			buffer_copy_string(proc->connection_name, "unix:");
+			buffer_copy_string_len(proc->connection_name, CONST_STR_LEN("unix:"));
 			buffer_append_string_buffer(proc->connection_name, proc->unixsocket);
 		}
 #else
@@ -1709,13 +1734,13 @@
 
 		if (buffer_is_empty(proc->connection_name)) {
 			/* on remote spawing we have to set the connection-name now */
-			buffer_copy_string(proc->connection_name, "tcp:");
+			buffer_copy_string_len(proc->connection_name, CONST_STR_LEN("tcp:"));
 			if (!buffer_is_empty(host->host)) {
 				buffer_append_string_buffer(proc->connection_name, host->host);
 			} else {
-				buffer_append_string(proc->connection_name, "localhost");
+				buffer_append_string_len(proc->connection_name, CONST_STR_LEN("localhost"));
 			}
-			buffer_append_string(proc->connection_name, ":");
+			buffer_append_string_len(proc->connection_name, CONST_STR_LEN(":"));
 			buffer_append_long(proc->connection_name, proc->port);
 		}
 	}
@@ -1771,7 +1796,7 @@
 			buffer_reset(srv->tmp_buf);
 
 			if (0 != strcasecmp(ds->key->ptr, "CONTENT-TYPE")) {
-				BUFFER_COPY_STRING_CONST(srv->tmp_buf, "HTTP_");
+				buffer_copy_string_len(srv->tmp_buf, CONST_STR_LEN("HTTP_"));
 				srv->tmp_buf->used--;
 			}
 
@@ -2026,7 +2051,7 @@
 		 */
 		if ('/' != host->strip_request_uri->ptr[host->strip_request_uri->used - 2]) {
 			/* fix the user-input to have / as last char */
-			buffer_append_string(host->strip_request_uri, "/");
+			buffer_append_string_len(host->strip_request_uri, CONST_STR_LEN("/"));
 		}
 
 		if (con->request.orig_uri->used >= host->strip_request_uri->used &&
@@ -2094,12 +2119,12 @@
 			hctx->wb->bytes_in += sizeof(header);
 
 			if (p->conf.debug > 10) {
-				fprintf(stderr, "%s.%d: tosend: %lld / %lld\n", __FILE__, __LINE__, offset, req_cq->bytes_in);
+				log_error_write(srv, __FILE__, __LINE__, "soso", "tosend:", offset, "/", req_cq->bytes_in);
 			}
 
 			for (written = 0; written != weWant; ) {
 				if (p->conf.debug > 10) {
-					fprintf(stderr, "%s.%d: chunk: %lld / %lld\n", __FILE__, __LINE__, written, weWant);
+					log_error_write(srv, __FILE__, __LINE__, "soso", "chunk:", written, "/", weWant);
 				}
 
 				switch (req_c->type) {
@@ -2109,12 +2134,10 @@
 					if (weHave > weWant - written) weHave = weWant - written;
 
 					if (p->conf.debug > 10) {
-						fprintf(stderr, "%s.%d: sending %lld bytes from (%lld / %lld) %s\n",
-								__FILE__, __LINE__,
-								weHave,
-								req_c->offset,
-								req_c->file.length,
-								req_c->file.name->ptr);
+						log_error_write(srv, __FILE__, __LINE__, "soSosOsb",
+							"sending", weHave, "bytes from (",
+							req_c->offset, "/", req_c->file.length, ")",
+							req_c->file.name);
 					}
 
 					assert(weHave != 0);
@@ -2143,7 +2166,7 @@
 						chunk *c;
 
 						if (p->conf.debug > 10) {
-							fprintf(stderr, "%s.%d: next chunk\n", __FILE__, __LINE__);
+							log_error_write(srv, __FILE__, __LINE__, "s", "next chunk");
 						}
 						c = hctx->wb->last;
 
@@ -2173,7 +2196,7 @@
 
 					hctx->wb->bytes_in += weHave;
 
-					if (req_c->offset == req_c->mem->used - 1) {
+					if (req_c->offset == (off_t) req_c->mem->used - 1) {
 						chunkqueue_remove_finished_chunks(req_cq);
 
 						req_c = req_cq->first;
@@ -2368,7 +2391,7 @@
 	offset = sizeof(*header);
 
 	/* ->b should only be the content */
-	buffer_copy_string(packet->b, ""); /* used == 1 */
+	buffer_copy_string_len(packet->b, CONST_STR_LEN("")); /* used == 1 */
 
 	if (packet->len) {
 		/* copy the content */
@@ -2544,7 +2567,10 @@
 					stat_cache_entry *sce;
 
 					if (HANDLER_ERROR != stat_cache_get_entry(srv, con, ds->value, &sce)) {
-						data_string *dcls = data_string_init();
+						data_string *dcls;
+						if (NULL == (dcls = (data_string *)array_get_unused_element(con->response.headers, TYPE_STRING))) {
+							dcls = data_response_init();
+						}
 						/* found */
 						http_chunk_append_file(srv, con, ds->value, 0, sce->st.st_size);
 						hctx->send_content_body = 0; /* ignore the content */
@@ -2663,30 +2689,48 @@
 
 			/* the child should not terminate at all */
 
-			switch(waitpid(proc->pid, &status, WNOHANG)) {
-			case 0:
-				/* child is still alive */
-				break;
-			case -1:
-				break;
-			default:
-				if (WIFEXITED(status)) {
+			for ( ;; ) {
+				switch(waitpid(proc->pid, &status, WNOHANG)) {
+				case 0:
+					/* child is still alive */
+					if (srv->cur_ts <= proc->disabled_until) break;
+					
+					proc->state = PROC_STATE_RUNNING;
+					host->active_procs++;
+		
+					log_error_write(srv, __FILE__, __LINE__,  "sbdb",
+							"fcgi-server re-enabled:",
+							host->host, host->port,
+							host->unixsocket);
+					break;
+				case -1:
+					if (errno == EINTR) continue;
+
+					log_error_write(srv, __FILE__, __LINE__, "sd",
+							"child died somehow, waitpid failed:",
+							errno);
+					proc->state = PROC_STATE_DIED;
+					break;
+				default:
+					if (WIFEXITED(status)) {
 #if 0
-					log_error_write(srv, __FILE__, __LINE__, "sdsd",
-							"child exited, pid:", proc->pid,
-							"status:", WEXITSTATUS(status));
+						log_error_write(srv, __FILE__, __LINE__, "sdsd",
+								"child exited, pid:", proc->pid,
+								"status:", WEXITSTATUS(status));
 #endif
-				} else if (WIFSIGNALED(status)) {
-					log_error_write(srv, __FILE__, __LINE__, "sd",
-							"child signaled:",
-							WTERMSIG(status));
-				} else {
-					log_error_write(srv, __FILE__, __LINE__, "sd",
-							"child died somehow:",
-							status);
+					} else if (WIFSIGNALED(status)) {
+						log_error_write(srv, __FILE__, __LINE__, "sd",
+								"child signaled:",
+								WTERMSIG(status));
+					} else {
+						log_error_write(srv, __FILE__, __LINE__, "sd",
+								"child died somehow:",
+								status);
+					}
+	
+					proc->state = PROC_STATE_DIED;
+					break;
 				}
-
-				proc->state = PROC_STATE_DIED;
 				break;
 			}
 
@@ -2797,7 +2841,7 @@
 			hctx->proc->state = PROC_STATE_DIED;
 
 			fastcgi_status_copy_procname(p->statuskey, hctx->host, hctx->proc);
-			buffer_append_string(p->statuskey, ".died");
+			buffer_append_string_len(p->statuskey, CONST_STR_LEN(".died"));
 
 			status_counter_inc(srv, CONST_BUF_LEN(p->statuskey));
 
@@ -2889,7 +2933,7 @@
 			hctx->proc->state = PROC_STATE_OVERLOADED;
 
 			fastcgi_status_copy_procname(p->statuskey, hctx->host, hctx->proc);
-			buffer_append_string(p->statuskey, ".overloaded");
+			buffer_append_string_len(p->statuskey, CONST_STR_LEN(".overloaded"));
 
 			status_counter_inc(srv, CONST_BUF_LEN(p->statuskey));
 
@@ -2915,7 +2959,7 @@
 				"load:", host->load);
 
 			fastcgi_status_copy_procname(p->statuskey, hctx->host, hctx->proc);
-			buffer_append_string(p->statuskey, ".died");
+			buffer_append_string_len(p->statuskey, CONST_STR_LEN(".died"));
 
 			status_counter_inc(srv, CONST_BUF_LEN(p->statuskey));
 
@@ -2941,19 +2985,19 @@
 		status_counter_inc(srv, CONST_STR_LEN("fastcgi.active-requests"));
 
 		fastcgi_status_copy_procname(p->statuskey, hctx->host, hctx->proc);
-		buffer_append_string(p->statuskey, ".connected");
+		buffer_append_string_len(p->statuskey, CONST_STR_LEN(".connected"));
 
 		status_counter_inc(srv, CONST_BUF_LEN(p->statuskey));
 
 		/* the proc-load */
 		fastcgi_status_copy_procname(p->statuskey, hctx->host, hctx->proc);
-		buffer_append_string(p->statuskey, ".load");
+		buffer_append_string_len(p->statuskey, CONST_STR_LEN(".load"));
 
 		status_counter_set(srv, CONST_BUF_LEN(p->statuskey), hctx->proc->load);
 
 		/* the host-load */
 		fastcgi_status_copy_procname(p->statuskey, hctx->host, NULL);
-		buffer_append_string(p->statuskey, ".load");
+		buffer_append_string_len(p->statuskey, CONST_STR_LEN(".load"));
 
 		status_counter_set(srv, CONST_BUF_LEN(p->statuskey), hctx->host->load);
 
@@ -3074,7 +3118,7 @@
 
 		/* check if the next server has no load. */
 		ndx = hctx->ext->last_used_ndx + 1;
-		if(ndx >= hctx->ext->used || ndx < 0) ndx = 0;
+		if(ndx >= (int) hctx->ext->used || ndx < 0) ndx = 0;
 		host = hctx->ext->hosts[ndx];
 		if (host->load > 0) {
 			/* get backend with the least load. */
@@ -3208,6 +3252,7 @@
 				fcgi_connection_close(srv, hctx);
 
 				con->mode = DIRECT;
+				con->http_status = 0;
 				con->file_started = 1; /* fcgi_extension won't touch the request afterwards */
 			} else {
 				/* we are done */
@@ -3418,6 +3463,8 @@
 	fcgi_extension *extension = NULL;
 	fcgi_extension_host *host = NULL;
 
+	if (con->mode != DIRECT) return HANDLER_GO_ON;
+
 	/* Possibly, we processed already this request */
 	if (con->file_started == 1) return HANDLER_GO_ON;
 
@@ -3480,13 +3527,12 @@
 
 			ct_len = extension->key->used - 1;
 
-			if (s_len < ct_len) continue;
-
-			/* check extension in the form "/fcgi_pattern" */
-			if (*(extension->key->ptr) == '/') {
-				if (strncmp(fn->ptr, extension->key->ptr, ct_len) == 0)
+			/* check _url_ in the form "/fcgi_pattern" */
+			if (extension->key->ptr[0] == '/') {
+				if ((ct_len <= con->uri.path->used -1) &&
+				    (strncmp(con->uri.path->ptr, extension->key->ptr, ct_len) == 0))
 					break;
-			} else if (0 == strncmp(fn->ptr + s_len - ct_len, extension->key->ptr, ct_len)) {
+			} else if ((ct_len <= s_len) && (0 == strncmp(fn->ptr + s_len - ct_len, extension->key->ptr, ct_len))) {
 				/* check extension in the form ".fcg" */
 				break;
 			}
@@ -3499,16 +3545,15 @@
 
 	/* check if we have at least one server for this extension up and running */
 	for (k = 0; k < extension->used; k++) {
-		host = extension->hosts[k];
+		fcgi_extension_host *h = extension->hosts[k];
 
 		/* we should have at least one proc that can do something */
-		if (host->active_procs == 0) {
-			host = NULL;
-
+		if (h->active_procs == 0) {
 			continue;
 		}
 
 		/* we found one host that is alive */
+		host = h;
 		break;
 	}
 
@@ -3564,36 +3609,50 @@
 				"handling it in mod_fastcgi");
 			}
 
-			/* the prefix is the SCRIPT_NAME,
-			 * everything from start to the next slash
-			 * this is important for check-local = "disable"
-			 *
-			 * if prefix = /admin.fcgi
-			 *
-			 * /admin.fcgi/foo/bar
-			 *
-			 * SCRIPT_NAME = /admin.fcgi
-			 * PATH_INFO   = /foo/bar
-			 *
-			 * if prefix = /fcgi-bin/
-			 *
-			 * /fcgi-bin/foo/bar
-			 *
-			 * SCRIPT_NAME = /fcgi-bin/foo
-			 * PATH_INFO   = /bar
-			 *
-			 */
+			/* do not split path info for authorizer */
+			if (host->mode != FCGI_AUTHORIZER) {
+				/* the prefix is the SCRIPT_NAME,
+				* everything from start to the next slash
+				* this is important for check-local = "disable"
+				*
+				* if prefix = /admin.fcgi
+				*
+				* /admin.fcgi/foo/bar
+				*
+				* SCRIPT_NAME = /admin.fcgi
+				* PATH_INFO   = /foo/bar
+				*
+				* if prefix = /fcgi-bin/
+				*
+				* /fcgi-bin/foo/bar
+				*
+				* SCRIPT_NAME = /fcgi-bin/foo
+				* PATH_INFO   = /bar
+				*
+				* if prefix = /, and fix-root-path-name is enable
+				*
+				* /fcgi-bin/foo/bar
+				*
+				* SCRIPT_NAME = /fcgi-bin/foo
+				* PATH_INFO   = /bar
+				*
+				*/
 
-			/* the rewrite is only done for /prefix/? matches */
-			if (extension->key->ptr[0] == '/' &&
-			    con->uri.path->used > extension->key->used &&
-			    NULL != (pathinfo = strchr(con->uri.path->ptr + extension->key->used - 1, '/'))) {
-				/* rewrite uri.path and pathinfo */
+				/* the rewrite is only done for /prefix/? matches */
+				if (extension->key->ptr[0] == '/' &&
+					con->uri.path->used > extension->key->used &&
+					NULL != (pathinfo = strchr(con->uri.path->ptr + extension->key->used - 1, '/'))) {
+					/* rewrite uri.path and pathinfo */
 
-				buffer_copy_string(con->request.pathinfo, pathinfo);
+					buffer_copy_string(con->request.pathinfo, pathinfo);
 
-				con->uri.path->used -= con->request.pathinfo->used - 1;
-				con->uri.path->ptr[con->uri.path->used - 1] = '\0';
+					con->uri.path->used -= con->request.pathinfo->used - 1;
+					con->uri.path->ptr[con->uri.path->used - 1] = '\0';
+				} else if (host->fix_root_path_name && extension->key->ptr[0] == '/' && extension->key->ptr[1] == '\0') {
+					buffer_copy_string(con->request.pathinfo, con->uri.path->ptr);
+					con->uri.path->used = 1;
+					con->uri.path->ptr[con->uri.path->used - 1] = '\0';
+				}
 			}
 		}
 	} else {
@@ -3738,7 +3797,7 @@
 						proc->port = host->port + proc->id;
 					} else {
 						buffer_copy_string_buffer(proc->unixsocket, host->unixsocket);
-						buffer_append_string(proc->unixsocket, "-");
+						buffer_append_string_len(proc->unixsocket, CONST_STR_LEN("-"));
 						buffer_append_long(proc->unixsocket, proc->id);
 					}
 

Modified: lighttpd/trunk/src/mod_flv_streaming.c
===================================================================
--- lighttpd/trunk/src/mod_flv_streaming.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_flv_streaming.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -193,6 +193,8 @@
 
 	UNUSED(srv);
 
+	if (con->mode != DIRECT) return HANDLER_GO_ON;
+
 	if (buffer_is_empty(con->physical.path)) return HANDLER_GO_ON;
 
 	mod_flv_streaming_patch_connection(srv, con, p);
@@ -245,7 +247,7 @@
 
 			/* we are safe now, let's build a flv header */
 			b = chunkqueue_get_append_buffer(con->write_queue);
-			BUFFER_COPY_STRING_CONST(b, "FLV\x1\x1\0\0\0\x9\0\0\0\x9");
+			buffer_copy_string_len(b, CONST_STR_LEN("FLV\x1\x1\0\0\0\x9\0\0\0\x9"));
 
 			http_chunk_append_file(srv, con, con->physical.path, start, sce->st.st_size - start);
 

Modified: lighttpd/trunk/src/mod_indexfile.c
===================================================================
--- lighttpd/trunk/src/mod_indexfile.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_indexfile.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -140,6 +140,8 @@
 	size_t k;
 	stat_cache_entry *sce = NULL;
 
+	if (con->mode != DIRECT) return HANDLER_GO_ON;
+
 	if (con->uri.path->used == 0) return HANDLER_GO_ON;
 	if (con->uri.path->ptr[con->uri.path->used - 2] != '/') return HANDLER_GO_ON;
 

Modified: lighttpd/trunk/src/mod_magnet.c
===================================================================
--- lighttpd/trunk/src/mod_magnet.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_magnet.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -414,10 +414,16 @@
 	case MAGNET_ENV_URI_AUTHORITY: dest = con->uri.authority; break;
 	case MAGNET_ENV_URI_QUERY: dest = con->uri.query; break;
 
-	case MAGNET_ENV_REQUEST_METHOD:   break;
+	case MAGNET_ENV_REQUEST_METHOD:
+		buffer_copy_string(srv->tmp_buf, get_http_method_name(con->request.http_method));
+		dest = srv->tmp_buf;
+		break;
 	case MAGNET_ENV_REQUEST_URI:      dest = con->request.uri; break;
 	case MAGNET_ENV_REQUEST_ORIG_URI: dest = con->request.orig_uri; break;
-	case MAGNET_ENV_REQUEST_PROTOCOL: break;
+	case MAGNET_ENV_REQUEST_PROTOCOL:
+		buffer_copy_string(srv->tmp_buf, get_http_version_name(con->request.http_version));
+		dest = srv->tmp_buf;
+		break;
 
 	case MAGNET_ENV_UNSET: break;
 	}
@@ -647,6 +653,7 @@
 		assert(lua_gettop(L) == 0); /* only the function should be on the stack */
 
 		con->http_status = 500;
+		con->mode = DIRECT;
 
 		return HANDLER_FINISHED;
 	}
@@ -744,6 +751,7 @@
 		assert(lua_gettop(L) == 1); /* only the function should be on the stack */
 
 		con->http_status = 500;
+		con->mode = DIRECT;
 
 		return HANDLER_FINISHED;
 	}
@@ -766,9 +774,13 @@
 		/* try { ...*/
 		if (0 == setjmp(exceptionjmp)) {
 			magnet_attach_content(srv, con, p, L);
+			if (!chunkqueue_is_empty(con->write_queue)) {
+				con->mode = p->id;
+			}
 		} else {
 			/* } catch () { */
 			con->http_status = 500;
+			con->mode = DIRECT;
 		}
 
 		assert(lua_gettop(L) == 1); /* only the function should be on the stack */

Modified: lighttpd/trunk/src/mod_mysql_vhost.c
===================================================================
--- lighttpd/trunk/src/mod_mysql_vhost.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_mysql_vhost.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -245,7 +245,6 @@
 		if (!(buffer_is_empty(s->myuser) ||
 		      buffer_is_empty(s->mydb))) {
 			my_bool reconnect = 1;
-			int fd;
 
 			if (NULL == (s->mysql = mysql_init(NULL))) {
 				log_error_write(srv, __FILE__, __LINE__, "s", "mysql_init() failed, exiting...");
@@ -267,19 +266,27 @@
 				return HANDLER_ERROR;
 			}
 #undef FOO
+
+#if 0
 			/* set close_on_exec for mysql the hard way */
 			/* Note: this only works as it is done during startup, */
 			/* otherwise we cannot be sure that mysql is fd i-1 */
-			if (-1 == (fd = open("/dev/null", 0))) {
+			{ int fd;
+			if (-1 != (fd = open("/dev/null", 0))) {
 				close(fd);
+#ifdef FD_CLOEXEC
 				fcntl(fd-1, F_SETFD, FD_CLOEXEC);
-			}
+#endif
+			} }
+#else
+#ifdef FD_CLOEXEC
+			fcntl(s->mysql->net.fd, F_SETFD, FD_CLOEXEC);
+#endif
+#endif
 		}
 	}
 
-
-
-        return HANDLER_GO_ON;
+	return HANDLER_GO_ON;
 }
 
 #define PATCH(x) \
@@ -410,6 +417,7 @@
 
 ERR500:	if (result) mysql_free_result(result);
 	con->http_status = 500; /* Internal Error */
+	con->mode = DIRECT;
 	return HANDLER_FINISHED;
 }
 

Modified: lighttpd/trunk/src/mod_proxy.c
===================================================================
--- lighttpd/trunk/src/mod_proxy.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_proxy.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -432,10 +432,10 @@
 
 	/* request line */
 	buffer_copy_string(b, get_http_method_name(con->request.http_method));
-	BUFFER_APPEND_STRING_CONST(b, " ");
+	buffer_append_string_len(b, CONST_STR_LEN(" "));
 
 	buffer_append_string_buffer(b, con->request.uri);
-	BUFFER_APPEND_STRING_CONST(b, " HTTP/1.0\r\n");
+	buffer_append_string_len(b, CONST_STR_LEN(" HTTP/1.0\r\n"));
 
 	proxy_append_header(con, "X-Forwarded-For", (char *)inet_ntop_cache_get_ip(srv, &(con->dst_addr)));
 	/* http_host is NOT is just a pointer to a buffer
@@ -454,15 +454,16 @@
 
 		if (ds->value->used && ds->key->used) {
 			if (buffer_is_equal_string(ds->key, CONST_STR_LEN("Connection"))) continue;
+			if (buffer_is_equal_string(ds->key, CONST_STR_LEN("Proxy-Connection"))) continue;
 
 			buffer_append_string_buffer(b, ds->key);
-			BUFFER_APPEND_STRING_CONST(b, ": ");
+			buffer_append_string_len(b, CONST_STR_LEN(": "));
 			buffer_append_string_buffer(b, ds->value);
-			BUFFER_APPEND_STRING_CONST(b, "\r\n");
+			buffer_append_string_len(b, CONST_STR_LEN("\r\n"));
 		}
 	}
 
-	BUFFER_APPEND_STRING_CONST(b, "\r\n");
+	buffer_append_string_len(b, CONST_STR_LEN("\r\n"));
 
 	hctx->wb->bytes_in += b->used - 1;
 	/* body */
@@ -652,7 +653,7 @@
 			buffer_prepare_append(hctx->response, b + 1);
 			hctx->response->used = 1;
 		} else {
-			buffer_prepare_append(hctx->response, hctx->response->used + b);
+			buffer_prepare_append(hctx->response, b);
 		}
 
 		if (-1 == (r = read(hctx->fd, hctx->response->ptr + hctx->response->used - 1, b))) {
@@ -1060,6 +1061,8 @@
 	data_array *extension = NULL;
 	size_t path_info_offset;
 
+	if (con->mode != DIRECT) return HANDLER_GO_ON;
+
 	/* Possibly, we processed already this request */
 	if (con->file_started == 1) return HANDLER_GO_ON;
 
@@ -1118,7 +1121,13 @@
 		log_error_write(srv, __FILE__, __LINE__,  "s", "proxy - ext found");
 	}
 
-	switch(p->conf.balance) {
+	if (extension->value->used == 1) {
+		if ( ((data_proxy *)extension->value->data[0])->is_disabled ) {
+			ndx = -1;
+		} else {
+			ndx = 0;
+		}
+	} else if (extension->value->used != 0) switch(p->conf.balance) {
 	case PROXY_BALANCE_HASH:
 		/* hash balancing */
 
@@ -1175,7 +1184,9 @@
 		}
 
 		break;
-	case PROXY_BALANCE_RR:
+	case PROXY_BALANCE_RR: {
+		data_proxy *host;
+
 		/* round robin */
 		if (p->conf.debug) {
 			log_error_write(srv, __FILE__, __LINE__,  "s",
@@ -1185,31 +1196,33 @@
 		/* just to be sure */
 		assert(extension->value->used < INT_MAX);
 
-		for (k = 0, ndx = -1, max_usage = INT_MAX; k < extension->value->used; k++) {
-			data_proxy *host = (data_proxy *)extension->value->data[k];
+		host = (data_proxy *)extension->value->data[0];
 
-			if (host->is_disabled) continue;
+		/* Use last_used_ndx from first host in list */
+		k = host->last_used_ndx;
+		ndx = k + 1; /* use next host after the last one */
+		if (ndx < 0) ndx = 0;
 
-			/* first usable ndx */
-			if (max_usage == INT_MAX) {
-				max_usage = k;
-			}
+		/* Search first active host after last_used_ndx */
+		while ( ndx < (int) extension->value->used
+				&& (host = (data_proxy *)extension->value->data[ndx])->is_disabled ) ndx++;
 
-			/* get next ndx */
-			if ((int)k > host->last_used_ndx) {
-				ndx = k;
-				host->last_used_ndx = k;
-
-				break;
+		if (ndx >= (int) extension->value->used) {
+			/* didn't found a higher id, wrap to the start */
+			for (ndx = 0; ndx < (int) k; ndx++) {
+				host = (data_proxy *)extension->value->data[ndx];
+				if (!host->is_disabled) break;
 			}
-		}
 
-		/* didn't found a higher id, wrap to the start */
-		if (ndx == -1 && max_usage != INT_MAX) {
-			ndx = max_usage;
+			/* No active host found */
+			if (host->is_disabled) ndx = -1;
 		}
 
+		/* Save new index for next round */
+		((data_proxy *)extension->value->data[0])->last_used_ndx = ndx;
+
 		break;
+	}
 	default:
 		break;
 	}

Modified: lighttpd/trunk/src/mod_redirect.c
===================================================================
--- lighttpd/trunk/src/mod_redirect.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_redirect.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -215,8 +215,7 @@
 
 			start = 0; end = pattern_len;
 			for (k = 0; k < pattern_len; k++) {
-				if ((pattern[k] == '$' || pattern[k] == '%') &&
-				    isdigit((unsigned char)pattern[k + 1])) {
+				if (pattern[k] == '$' || pattern[k] == '%') {
 					/* got one */
 
 					size_t num = pattern[k + 1] - '0';
@@ -225,7 +224,10 @@
 
 					buffer_append_string_len(p->location, pattern + start, end - start);
 
-					if (pattern[k] == '$') {
+					if (!isdigit((unsigned char)pattern[k + 1])) {
+						/* enable escape: "%%" => "%", "%a" => "%a", "$$" => "$" */
+						buffer_append_string_len(p->location, pattern+k, pattern[k] == pattern[k+1] ? 1 : 2);
+					} else if (pattern[k] == '$') {
 						/* n is always > 0 */
 						if (num < (size_t)n) {
 							buffer_append_string(p->location, list[num]);
@@ -251,6 +253,7 @@
 			response_header_insert(srv, con, CONST_STR_LEN("Location"), CONST_BUF_LEN(p->location));
 
 			con->http_status = 301;
+			con->mode = DIRECT;
 			con->file_finished = 1;
 
 			return HANDLER_FINISHED;

Modified: lighttpd/trunk/src/mod_rewrite.c
===================================================================
--- lighttpd/trunk/src/mod_rewrite.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_rewrite.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -385,8 +385,7 @@
 
 			start = 0; end = pattern_len;
 			for (k = 0; k < pattern_len; k++) {
-				if ((pattern[k] == '$' || pattern[k] == '%') &&
-				    isdigit((unsigned char)pattern[k + 1])) {
+				if (pattern[k] == '$' || pattern[k] == '%') {
 					/* got one */
 
 					size_t num = pattern[k + 1] - '0';
@@ -395,7 +394,10 @@
 
 					buffer_append_string_len(con->request.uri, pattern + start, end - start);
 
-					if (pattern[k] == '$') {
+					if (!isdigit((unsigned char)pattern[k + 1])) {
+						/* enable escape: "%%" => "%", "%a" => "%a", "$$" => "$" */
+						buffer_append_string_len(con->request.uri, pattern+k, pattern[k] == pattern[k+1] ? 1 : 2);
+					} else if (pattern[k] == '$') {
 						/* n is always > 0 */
 						if (num < (size_t)n) {
 							buffer_append_string(con->request.uri, list[num]);
@@ -419,10 +421,13 @@
 
 			pcre_free(list);
 
-			hctx = handler_ctx_init();
+			if (con->plugin_ctx[p->id] == NULL) {
+				hctx = handler_ctx_init();
+				con->plugin_ctx[p->id] = hctx;
+			} else {
+				hctx = con->plugin_ctx[p->id];
+			}
 
-			con->plugin_ctx[p->id] = hctx;
-
 			if (rule->once) hctx->state = REWRITE_STATE_FINISHED;
 
 			return HANDLER_COMEBACK;

Modified: lighttpd/trunk/src/mod_rrdtool.c
===================================================================
--- lighttpd/trunk/src/mod_rrdtool.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_rrdtool.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -92,11 +92,11 @@
 }
 
 int mod_rrd_create_pipe(server *srv, plugin_data *p) {
+#ifdef HAVE_FORK
 	pid_t pid;
 
 	int to_rrdtool_fds[2];
 	int from_rrdtool_fds[2];
-#ifdef HAVE_FORK
 	if (pipe(to_rrdtool_fds)) {
 		log_error_write(srv, __FILE__, __LINE__, "ss",
 				"pipe failed: ", strerror(errno));
@@ -132,13 +132,6 @@
 		/* not needed */
 		close(to_rrdtool_fds[1]);
 
-		close(STDERR_FILENO);
-
-		if (srv->errorlog_mode == ERRORLOG_FILE) {
-			dup2(srv->errorlog_fd, STDERR_FILENO);
-			close(srv->errorlog_fd);
-		}
-
 		/* set up args */
 		argc = 3;
 		args = malloc(sizeof(*args) * argc);
@@ -148,6 +141,8 @@
 		args[i++] = dash;
 		args[i++] = NULL;
 
+		openDevNull(STDERR_FILENO);
+
 		/* we don't need the client socket */
 		for (i = 3; i < 256; i++) {
 			close(i);
@@ -156,7 +151,7 @@
 		/* exec the cgi */
 		execv(args[0], args);
 
-		log_error_write(srv, __FILE__, __LINE__, "sss", "spawing rrdtool failed: ", strerror(errno), args[0]);
+		/* log_error_write(srv, __FILE__, __LINE__, "sss", "spawing rrdtool failed: ", strerror(errno), args[0]); */
 
 		/* */
 		SEGFAULT();
@@ -177,6 +172,11 @@
 		p->read_fd = from_rrdtool_fds[0];
 		p->rrdtool_pid = pid;
 
+#ifdef FD_CLOEXEC
+		fcntl(p->write_fd, F_SETFD, FD_CLOEXEC);
+		fcntl(p->read_fd, F_SETFD, FD_CLOEXEC);
+#endif
+
 		break;
 	}
 	}
@@ -187,6 +187,47 @@
 #endif
 }
 
+/* read/write wrappers to catch EINTR */
+
+/* write to blocking socket; blocks until all data is sent, write returns 0 or an error (apart from EINTR) occurs. */
+static ssize_t safe_write(int fd, const void *buf, size_t count) {
+	ssize_t res, sum = 0;
+
+	for (;;) {
+		res = write(fd, buf, count);
+		if (res >= 0) {
+			sum += res;
+			/* do not try again if res == 0 */
+			if (res == 0 || (size_t) res == count) return sum;
+			count -= res;
+			buf = (const char*) buf + res;
+			continue;
+		}
+		switch (errno) {
+		case EINTR:
+			continue;
+		default:
+			return -1;
+		}
+	}
+}
+
+/* this assumes we get enough data on a successful read */
+static ssize_t safe_read(int fd, void *buf, size_t count) {
+	ssize_t res;
+
+	for (;;) {
+		res = read(fd, buf, count);
+		if (res >= 0) return res;
+		switch (errno) {
+		case EINTR:
+			continue;
+		default:
+			return -1;
+		}
+	}
+}
+
 static int mod_rrdtool_create_rrd(server *srv, plugin_data *p, plugin_config *s) {
 	struct stat st;
 
@@ -202,26 +243,27 @@
 		int r ;
 		/* create a new one */
 
-		BUFFER_COPY_STRING_CONST(p->cmd, "create ");
+		buffer_copy_string_len(p->cmd, CONST_STR_LEN("create "));
 		buffer_append_string_buffer(p->cmd, s->path_rrd);
-		buffer_append_string(p->cmd, " --step 60 ");
-		buffer_append_string(p->cmd, "DS:InOctets:ABSOLUTE:600:U:U ");
-		buffer_append_string(p->cmd, "DS:OutOctets:ABSOLUTE:600:U:U ");
-		buffer_append_string(p->cmd, "DS:Requests:ABSOLUTE:600:U:U ");
-		buffer_append_string(p->cmd, "RRA:AVERAGE:0.5:1:600 ");
-		buffer_append_string(p->cmd, "RRA:AVERAGE:0.5:6:700 ");
-		buffer_append_string(p->cmd, "RRA:AVERAGE:0.5:24:775 ");
-		buffer_append_string(p->cmd, "RRA:AVERAGE:0.5:288:797 ");
-		buffer_append_string(p->cmd, "RRA:MAX:0.5:1:600 ");
-		buffer_append_string(p->cmd, "RRA:MAX:0.5:6:700 ");
-		buffer_append_string(p->cmd, "RRA:MAX:0.5:24:775 ");
-		buffer_append_string(p->cmd, "RRA:MAX:0.5:288:797 ");
-		buffer_append_string(p->cmd, "RRA:MIN:0.5:1:600 ");
-		buffer_append_string(p->cmd, "RRA:MIN:0.5:6:700 ");
-		buffer_append_string(p->cmd, "RRA:MIN:0.5:24:775 ");
-		buffer_append_string(p->cmd, "RRA:MIN:0.5:288:797\n");
+		buffer_append_string_len(p->cmd, CONST_STR_LEN(
+			" --step 60 "
+			"DS:InOctets:ABSOLUTE:600:U:U "
+			"DS:OutOctets:ABSOLUTE:600:U:U "
+			"DS:Requests:ABSOLUTE:600:U:U "
+			"RRA:AVERAGE:0.5:1:600 "
+			"RRA:AVERAGE:0.5:6:700 "
+			"RRA:AVERAGE:0.5:24:775 "
+			"RRA:AVERAGE:0.5:288:797 "
+			"RRA:MAX:0.5:1:600 "
+			"RRA:MAX:0.5:6:700 "
+			"RRA:MAX:0.5:24:775 "
+			"RRA:MAX:0.5:288:797 "
+			"RRA:MIN:0.5:1:600 "
+			"RRA:MIN:0.5:6:700 "
+			"RRA:MIN:0.5:24:775 "
+			"RRA:MIN:0.5:288:797\n"));
 
-		if (-1 == (r = write(p->write_fd, p->cmd->ptr, p->cmd->used - 1))) {
+		if (-1 == (r = safe_write(p->write_fd, p->cmd->ptr, p->cmd->used - 1))) {
 			log_error_write(srv, __FILE__, __LINE__, "ss",
 				"rrdtool-write: failed", strerror(errno));
 
@@ -229,7 +271,7 @@
 		}
 
 		buffer_prepare_copy(p->resp, 4096);
-		if (-1 == (r = read(p->read_fd, p->resp->ptr, p->resp->size))) {
+		if (-1 == (r = safe_read(p->read_fd, p->resp->ptr, p->resp->size))) {
 			log_error_write(srv, __FILE__, __LINE__, "ss",
 				"rrdtool-read: failed", strerror(errno));
 
@@ -372,17 +414,17 @@
 
 		if (HANDLER_GO_ON != mod_rrdtool_create_rrd(srv, p, s)) return HANDLER_ERROR;
 
-		BUFFER_COPY_STRING_CONST(p->cmd, "update ");
+		buffer_copy_string_len(p->cmd, CONST_STR_LEN("update "));
 		buffer_append_string_buffer(p->cmd, s->path_rrd);
-		BUFFER_APPEND_STRING_CONST(p->cmd, " N:");
+		buffer_append_string_len(p->cmd, CONST_STR_LEN(" N:"));
 		buffer_append_off_t(p->cmd, s->bytes_read);
-		BUFFER_APPEND_STRING_CONST(p->cmd, ":");
+		buffer_append_string_len(p->cmd, CONST_STR_LEN(":"));
 		buffer_append_off_t(p->cmd, s->bytes_written);
-		BUFFER_APPEND_STRING_CONST(p->cmd, ":");
+		buffer_append_string_len(p->cmd, CONST_STR_LEN(":"));
 		buffer_append_long(p->cmd, s->requests);
-		BUFFER_APPEND_STRING_CONST(p->cmd, "\n");
+		buffer_append_string_len(p->cmd, CONST_STR_LEN("\n"));
 
-		if (-1 == (r = write(p->write_fd, p->cmd->ptr, p->cmd->used - 1))) {
+		if (-1 == (r = safe_write(p->write_fd, p->cmd->ptr, p->cmd->used - 1))) {
 			p->rrdtool_running = 0;
 
 			log_error_write(srv, __FILE__, __LINE__, "ss",
@@ -392,7 +434,7 @@
 		}
 
 		buffer_prepare_copy(p->resp, 4096);
-		if (-1 == (r = read(p->read_fd, p->resp->ptr, p->resp->size))) {
+		if (-1 == (r = safe_read(p->read_fd, p->resp->ptr, p->resp->size))) {
 			p->rrdtool_running = 0;
 
 			log_error_write(srv, __FILE__, __LINE__, "ss",
@@ -405,12 +447,15 @@
 
 		if (p->resp->ptr[0] != 'O' ||
 		    p->resp->ptr[1] != 'K') {
-			p->rrdtool_running = 0;
+			/* don't fail on this error if we just started (graceful restart, the old one might have just updated too) */
+			if (!(strstr(p->resp->ptr, "(minimum one second step)") && (srv->cur_ts - srv->startup_ts < 3))) {
+				p->rrdtool_running = 0;
 
-			log_error_write(srv, __FILE__, __LINE__, "sbb",
+				log_error_write(srv, __FILE__, __LINE__, "sbb",
 					"rrdtool-response:", p->cmd, p->resp);
 
-			return HANDLER_ERROR;
+				return HANDLER_ERROR;
+			}
 		}
 		s->requests = 0;
 		s->bytes_written = 0;

Modified: lighttpd/trunk/src/mod_scgi.c
===================================================================
--- lighttpd/trunk/src/mod_scgi.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_scgi.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -202,6 +202,15 @@
 	 *
 	 */
 
+	/*
+	 * workaround for program when prefix="/"
+	 *
+	 * rule to build PATH_INFO is hardcoded for when check_local is disabled
+	 * enable this option to use the workaround
+	 *
+	 */
+
+	unsigned short fix_root_path_name;
 	ssize_t load; /* replace by host->load */
 
 	size_t max_id; /* corresponds most of the time to
@@ -233,6 +242,7 @@
 typedef struct {
 	buffer *key; /* like .php */
 
+	int note_is_sent;
 	scgi_extension_host **hosts;
 
 	size_t used;
@@ -583,6 +593,7 @@
 
 static int env_add(char_array *env, const char *key, size_t key_len, const char *val, size_t val_len) {
 	char *dst;
+	size_t i;
 
 	if (!key || !val) return -1;
 
@@ -592,6 +603,15 @@
 	/* add the \0 from the value */
 	memcpy(dst + key_len + 1, val, val_len + 1);
 
+	for (i = 0; i < env->used; i++) {
+		if (0 == strncmp(dst, env->ptr[i], key_len + 1)) {
+			/* don't care about free as we are in a forked child which is going to exec(...) */
+			/* free(env->ptr[i]); */
+			env->ptr[i] = dst;
+			return 0;
+		}
+	}
+
 	if (env->size == 0) {
 		env->size = 16;
 		env->ptr = malloc(env->size * sizeof(*env->ptr));
@@ -749,11 +769,20 @@
 			env.size = 0;
 			env.used = 0;
 
+			if (scgi_fd != 0) {
+				close(0);
+				dup2(scgi_fd, 0);
+				close(scgi_fd);
+				scgi_fd = 0;
+			}
+
 			/* we don't need the client socket */
 			for (fd = 3; fd < 256; fd++) {
-				if (fd != 2 && fd != scgi_fd) close(fd);
+				close(fd);
 			}
 
+			openDevNull(STDERR_FILENO);
+
 			/* build clean environment */
 			if (host->bin_env_copy->used) {
 				for (i = 0; i < host->bin_env_copy->used; i++) {
@@ -794,7 +823,7 @@
 			env.ptr[env.used] = NULL;
 
 			b = buffer_init();
-			buffer_copy_string(b, "exec ");
+			buffer_copy_string_len(b, CONST_STR_LEN("exec "));
 			buffer_append_string_buffer(b, host->bin_path);
 
 			/* exec the cgi */
@@ -968,6 +997,7 @@
 
 						{ "bin-environment",   NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION },        /* 11 */
 						{ "bin-copy-environment", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION },     /* 12 */
+						{ "fix-root-scriptname",  NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION },   /* 13 */
 
 
 						{ NULL,                NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
@@ -990,6 +1020,7 @@
 					df->max_load_per_proc = 1;
 					df->idle_timeout = 60;
 					df->disable_time = 60;
+					df->fix_root_path_name = 0;
 
 					fcv[0].destination = df->host;
 					fcv[1].destination = df->docroot;
@@ -1006,6 +1037,7 @@
 
 					fcv[11].destination = df->bin_env;
 					fcv[12].destination = df->bin_env_copy;
+					fcv[13].destination = &(df->fix_root_path_name);
 
 
 					if (0 != config_insert_values_internal(srv, da_host->value, fcv)) {
@@ -1084,7 +1116,7 @@
 								proc->port = df->port + pno;
 							} else {
 								buffer_copy_string_buffer(proc->socket, df->unixsocket);
-								buffer_append_string(proc->socket, "-");
+								buffer_append_string_len(proc->socket, CONST_STR_LEN("-"));
 								buffer_append_long(proc->socket, pno);
 							}
 
@@ -1155,11 +1187,6 @@
 	p    = hctx->plugin_data;
 	con  = hctx->remote_conn;
 
-	if (con->mode != p->id) {
-		WP();
-		return;
-	}
-
 	if (hctx->fd != -1) {
 		fdevent_event_del(srv->ev, &(hctx->fde_ndx), hctx->fd);
 		fdevent_unregister(srv->ev, hctx->fd);
@@ -1366,7 +1393,7 @@
 			buffer_reset(srv->tmp_buf);
 
 			if (0 != strcasecmp(ds->key->ptr, "CONTENT-TYPE")) {
-				BUFFER_COPY_STRING_CONST(srv->tmp_buf, "HTTP_");
+				buffer_copy_string_len(srv->tmp_buf, CONST_STR_LEN("HTTP_"));
 				srv->tmp_buf->used--;
 			}
 
@@ -1394,7 +1421,7 @@
 			buffer_prepare_append(srv->tmp_buf, ds->key->used + 2);
 			for (j = 0; j < ds->key->used - 1; j++) {
 				srv->tmp_buf->ptr[srv->tmp_buf->used++] =
-					isalpha((unsigned char)ds->key->ptr[j]) ?
+					light_isalnum((unsigned char)ds->key->ptr[j]) ?
 					toupper((unsigned char)ds->key->ptr[j]) : '_';
 			}
 			srv->tmp_buf->ptr[srv->tmp_buf->used++] = '\0';
@@ -1673,9 +1700,8 @@
 
 				status = strtol(s+9, NULL, 10);
 
-				if (con->http_status >= 100 &&
-				    con->http_status < 1000) {
-					/* we expected 3 digits and didn't got them */
+				if (status >= 100 && status < 1000) {
+					/* we expected 3 digits got them */
 					con->parsed_response |= HTTP_STATUS;
 					con->http_status = status;
 				}
@@ -1788,6 +1814,7 @@
 			int header_end = 0;
 			int cp, eol = EOL_UNSET;
 			size_t used = 0;
+			size_t hlen = 0;
 
 			buffer_append_string_buffer(hctx->response_header, hctx->response);
 
@@ -1810,6 +1837,7 @@
 
 					if (*(c+1) == '\n') {
 						header_end = 1;
+						hlen = cp + 2;
 						break;
 					}
 
@@ -1828,6 +1856,7 @@
 					    *(c+2) == '\r' &&
 					    *(c+3) == '\n') {
 						header_end = 1;
+						hlen = cp + 4;
 						break;
 					}
 
@@ -1849,12 +1878,11 @@
 					http_chunk_append_mem(srv, con, hctx->response_header->ptr, hctx->response_header->used);
 					joblist_append(srv, con);
 				} else {
-					size_t hlen = c - hctx->response_header->ptr + (eol == EOL_RN ? 4 : 2);
 					size_t blen = hctx->response_header->used - hlen - 1;
 
 					/* a small hack: terminate after at the second \r */
-					hctx->response_header->used = hlen + 1 - (eol == EOL_RN ? 2 : 1);
-					hctx->response_header->ptr[hlen - (eol == EOL_RN ? 2 : 1)] = '\0';
+					hctx->response_header->used = hlen;
+					hctx->response_header->ptr[hlen - 1] = '\0';
 
 					/* parse the response header */
 					scgi_response_parse(srv, con, p, hctx->response_header, eol);
@@ -1866,7 +1894,7 @@
 					}
 
 					if ((hctx->response->used != hlen) && blen > 0) {
-						http_chunk_append_mem(srv, con, c + (eol == EOL_RN ? 4: 2), blen + 1);
+						http_chunk_append_mem(srv, con, hctx->response_header->ptr + hlen, blen + 1);
 						joblist_append(srv, con);
 					}
 				}
@@ -2438,15 +2466,11 @@
 	p    = hctx->plugin_data;
 	con  = hctx->remote_conn;
 
-	if (con->mode != p->id) return HANDLER_GO_ON;
-
 	log_error_write(srv, __FILE__, __LINE__, "ssdsd",
 			"emergency exit: scgi:",
 			"connection-fd:", con->fd,
 			"fcgi-fd:", hctx->fd);
 
-
-
 	scgi_connection_cleanup(srv, hctx);
 
 	return HANDLER_FINISHED;
@@ -2548,13 +2572,13 @@
 				con->mode = DIRECT;
 			} else {
 				/* response might have been already started, kill the connection */
-				scgi_connection_cleanup(srv, hctx);
-
 				log_error_write(srv, __FILE__, __LINE__, "ssdsd",
 						"response already sent out, termination connection",
 						"connection-fd:", con->fd,
 						"fcgi-fd:", hctx->fd);
 
+				scgi_connection_cleanup(srv, hctx);
+
 				connection_set_state(srv, con, CON_STATE_ERROR);
 			}
 
@@ -2668,11 +2692,13 @@
 	plugin_data *p = p_d;
 	size_t s_len;
 	int used = -1;
-	int ndx;
 	size_t k;
 	buffer *fn;
 	scgi_extension *extension = NULL;
+	scgi_extension_host *host = NULL;
 
+	if (con->mode != DIRECT) return HANDLER_GO_ON;
+
 	/* Possibly, we processed already this request */
 	if (con->file_started == 1) return HANDLER_GO_ON;
 
@@ -2712,95 +2738,59 @@
 	}
 
 	/* get best server */
-	for (k = 0, ndx = -1; k < extension->used; k++) {
-		scgi_extension_host *host = extension->hosts[k];
+	for (k = 0; k < extension->used; k++) {
+		scgi_extension_host *h = extension->hosts[k];
 
-		/* we should have at least one proc that can do somthing */
-		if (host->active_procs == 0) continue;
+		/* we should have at least one proc that can do something */
+		if (h->active_procs == 0) {
+			continue;
+		}
 
-		if (used == -1 || host->load < used) {
-			used = host->load;
+		if (used == -1 || h->load < used) {
+			used = h->load;
 
-			ndx = k;
+			host = h;
 		}
 	}
 
-	/* found a server */
-	if (ndx != -1) {
-		scgi_extension_host *host = extension->hosts[ndx];
+	if (!host) {
+		/* sorry, we don't have a server alive for this ext */
+		buffer_reset(con->physical.path);
+		con->http_status = 500;
 
-		/*
-		 * if check-local is disabled, use the uri.path handler
-		 *
-		 */
+		/* only send the 'no handler' once */
+		if (!extension->note_is_sent) {
+			extension->note_is_sent = 1;
 
-		/* init handler-context */
-		if (uri_path_handler) {
-			if (host->check_local == 0) {
-				handler_ctx *hctx;
-				char *pathinfo;
+			log_error_write(srv, __FILE__, __LINE__, "sbsbs",
+					"all handlers for ", con->uri.path,
+					"on", extension->key,
+					"are down.");
+		}
 
-				hctx = handler_ctx_init();
+		return HANDLER_FINISHED;
+	}
 
-				hctx->remote_conn      = con;
-				hctx->plugin_data      = p;
-				hctx->host             = host;
-				hctx->proc	       = NULL;
+	/* a note about no handler is not sent yet */
+	extension->note_is_sent = 0;
 
-				hctx->conf.exts        = p->conf.exts;
-				hctx->conf.debug       = p->conf.debug;
+	/*
+	 * if check-local is disabled, use the uri.path handler
+	 *
+	 */
 
-				con->plugin_ctx[p->id] = hctx;
+	/* init handler-context */
+	if (uri_path_handler) {
+		if (host->check_local == 0) {
+			handler_ctx *hctx;
+			char *pathinfo;
 
-				host->load++;
-
-				con->mode = p->id;
-
-				if (con->conf.log_request_handling) {
-					log_error_write(srv, __FILE__, __LINE__, "s", "handling it in mod_scgi");
-				}
-
-				/* the prefix is the SCRIPT_NAME,
-				 * everthing from start to the next slash
-				 * this is important for check-local = "disable"
-				 *
-				 * if prefix = /admin.fcgi
-				 *
-				 * /admin.fcgi/foo/bar
-				 *
-				 * SCRIPT_NAME = /admin.fcgi
-				 * PATH_INFO   = /foo/bar
-				 *
-				 * if prefix = /fcgi-bin/
-				 *
-				 * /fcgi-bin/foo/bar
-				 *
-				 * SCRIPT_NAME = /fcgi-bin/foo
-				 * PATH_INFO   = /bar
-				 *
-				 */
-
-				/* the rewrite is only done for /prefix/? matches */
-				if (extension->key->ptr[0] == '/' &&
-				    con->uri.path->used > extension->key->used &&
-				    NULL != (pathinfo = strchr(con->uri.path->ptr + extension->key->used - 1, '/'))) {
-					/* rewrite uri.path and pathinfo */
-
-					buffer_copy_string(con->request.pathinfo, pathinfo);
-
-					con->uri.path->used -= con->request.pathinfo->used - 1;
-					con->uri.path->ptr[con->uri.path->used - 1] = '\0';
-				}
-			}
-			return HANDLER_GO_ON;
-		} else {
-			handler_ctx *hctx;
 			hctx = handler_ctx_init();
 
 			hctx->remote_conn      = con;
 			hctx->plugin_data      = p;
 			hctx->host             = host;
-			hctx->proc             = NULL;
+			hctx->proc	       = NULL;
 
 			hctx->conf.exts        = p->conf.exts;
 			hctx->conf.debug       = p->conf.debug;
@@ -2812,22 +2802,69 @@
 			con->mode = p->id;
 
 			if (con->conf.log_request_handling) {
-				log_error_write(srv, __FILE__, __LINE__, "s", "handling it in mod_fastcgi");
+				log_error_write(srv, __FILE__, __LINE__, "s",
+				"handling it in mod_fastcgi");
 			}
 
-			return HANDLER_GO_ON;
+			/* the prefix is the SCRIPT_NAME,
+			 * everything from start to the next slash
+			 * this is important for check-local = "disable"
+			 *
+			 * if prefix = /admin.fcgi
+			 *
+			 * /admin.fcgi/foo/bar
+			 *
+			 * SCRIPT_NAME = /admin.fcgi
+			 * PATH_INFO   = /foo/bar
+			 *
+			 * if prefix = /fcgi-bin/
+			 *
+			 * /fcgi-bin/foo/bar
+			 *
+			 * SCRIPT_NAME = /fcgi-bin/foo
+			 * PATH_INFO   = /bar
+			 *
+			 */
+
+			/* the rewrite is only done for /prefix/? matches */
+			if (extension->key->ptr[0] == '/' &&
+			    con->uri.path->used > extension->key->used &&
+			    NULL != (pathinfo = strchr(con->uri.path->ptr + extension->key->used - 1, '/'))) {
+				/* rewrite uri.path and pathinfo */
+
+				buffer_copy_string(con->request.pathinfo, pathinfo);
+
+				con->uri.path->used -= con->request.pathinfo->used - 1;
+				con->uri.path->ptr[con->uri.path->used - 1] = '\0';
+			} else if (host->fix_root_path_name && extension->key->ptr[0] == '/' && extension->key->ptr[1] == '\0') {
+				buffer_copy_string(con->request.pathinfo, con->uri.path->ptr);
+				con->uri.path->used = 1;
+				con->uri.path->ptr[con->uri.path->used - 1] = '\0';
+			}
 		}
 	} else {
-		/* no handler found */
-		buffer_reset(con->physical.path);
-		con->http_status = 500;
+		handler_ctx *hctx;
+		hctx = handler_ctx_init();
 
-		log_error_write(srv, __FILE__, __LINE__,  "sb",
-				"no fcgi-handler found for:",
-				fn);
+		hctx->remote_conn      = con;
+		hctx->plugin_data      = p;
+		hctx->host             = host;
+		hctx->proc             = NULL;
 
-		return HANDLER_FINISHED;
+		hctx->conf.exts        = p->conf.exts;
+		hctx->conf.debug       = p->conf.debug;
+
+		con->plugin_ctx[p->id] = hctx;
+
+		host->load++;
+
+		con->mode = p->id;
+
+		if (con->conf.log_request_handling) {
+			log_error_write(srv, __FILE__, __LINE__, "s", "handling it in mod_fastcgi");
+		}
 	}
+
 	return HANDLER_GO_ON;
 }
 
@@ -2949,7 +2986,7 @@
 						fp->port = host->port + fp->id;
 					} else {
 						buffer_copy_string_buffer(fp->socket, host->unixsocket);
-						buffer_append_string(fp->socket, "-");
+						buffer_append_string_len(fp->socket, CONST_STR_LEN("-"));
 						buffer_append_long(fp->socket, fp->id);
 					}
 

Modified: lighttpd/trunk/src/mod_secure_download.c
===================================================================
--- lighttpd/trunk/src/mod_secure_download.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_secure_download.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -204,6 +204,8 @@
 	time_t ts = 0;
 	size_t i;
 
+	if (con->mode != DIRECT) return HANDLER_GO_ON;
+
 	if (con->uri.path->used == 0) return HANDLER_GO_ON;
 
 	mod_secdownload_patch_connection(srv, con, p);
@@ -243,8 +245,8 @@
 	}
 
 	/* timed-out */
-	if (srv->cur_ts - ts > p->conf.timeout ||
-	    srv->cur_ts - ts < -p->conf.timeout) {
+	if ( (srv->cur_ts > ts && srv->cur_ts - ts > p->conf.timeout) ||
+	     (srv->cur_ts < ts && ts - srv->cur_ts > p->conf.timeout) ) {
 		/* "Gone" as the url will never be valid again instead of "408 - Timeout" where the request may be repeated */
 		con->http_status = 410;
 
@@ -268,7 +270,7 @@
 
 	buffer_copy_string_hex(p->md5, (char *)HA1, 16);
 
-	if (0 != strncmp(md5_str, p->md5->ptr, 32)) {
+	if (0 != strncasecmp(md5_str, p->md5->ptr, 32)) {
 		con->http_status = 403;
 
 		log_error_write(srv, __FILE__, __LINE__, "sss",

Modified: lighttpd/trunk/src/mod_simple_vhost.c
===================================================================
--- lighttpd/trunk/src/mod_simple_vhost.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_simple_vhost.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -249,6 +249,10 @@
 				return HANDLER_GO_ON;
 			} else {
 				buffer_copy_string_buffer(con->server_name, p->conf.default_host);
+				buffer_copy_string_buffer(con->physical.doc_root, p->doc_root);
+
+				/* do not cache default host */
+				return HANDLER_GO_ON;
 			}
 		} else {
 			buffer_copy_string_buffer(con->server_name, con->uri.authority);

Modified: lighttpd/trunk/src/mod_skeleton.c
===================================================================
--- lighttpd/trunk/src/mod_skeleton.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_skeleton.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -169,6 +169,8 @@
 
 	UNUSED(srv);
 
+	if (con->mode != DIRECT) return HANDLER_GO_ON;
+
 	if (con->uri.path->used == 0) return HANDLER_GO_ON;
 
 	mod_skeleton_patch_connection(srv, con, p);

Modified: lighttpd/trunk/src/mod_ssi.c
===================================================================
--- lighttpd/trunk/src/mod_ssi.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_ssi.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -177,7 +177,7 @@
 			}
 
 			if (0 != strcasecmp(ds->key->ptr, "CONTENT-TYPE")) {
-				buffer_copy_string(srv->tmp_buf, "HTTP_");
+				buffer_copy_string_len(srv->tmp_buf, CONST_STR_LEN("HTTP_"));
 				srv->tmp_buf->used--;
 			}
 
@@ -419,7 +419,7 @@
 
 			b = chunkqueue_get_append_buffer(con->write_queue);
 			if (0 == strftime(buf, sizeof(buf), p->timefmt->ptr, localtime(&t))) {
-				buffer_copy_string(b, "(none)");
+				buffer_copy_string_len(b, CONST_STR_LEN("(none)"));
 			} else {
 				buffer_copy_string(b, buf);
 			}
@@ -430,7 +430,7 @@
 
 			b = chunkqueue_get_append_buffer(con->write_queue);
 			if (0 == strftime(buf, sizeof(buf), p->timefmt->ptr, localtime(&t))) {
-				buffer_copy_string(b, "(none)");
+				buffer_copy_string_len(b, CONST_STR_LEN("(none)"));
 			} else {
 				buffer_copy_string(b, buf);
 			}
@@ -441,7 +441,7 @@
 
 			b = chunkqueue_get_append_buffer(con->write_queue);
 			if (0 == strftime(buf, sizeof(buf), p->timefmt->ptr, gmtime(&t))) {
-				buffer_copy_string(b, "(none)");
+				buffer_copy_string_len(b, CONST_STR_LEN("(none)"));
 			} else {
 				buffer_copy_string(b, buf);
 			}
@@ -472,7 +472,7 @@
 			if (NULL != (ds = (data_string *)array_get_element(p->ssi_cgi_env, var_val))) {
 				buffer_copy_string_buffer(b, ds->value);
 			} else {
-				buffer_copy_string(b, "(none)");
+				buffer_copy_string_len(b, CONST_STR_LEN("(none)"));
 			}
 
 			break;
@@ -519,7 +519,7 @@
 		if (file_path) {
 			/* current doc-root */
 			if (NULL == (sl = strrchr(con->physical.path->ptr, '/'))) {
-				buffer_copy_string(p->stat_fn, "/");
+				buffer_copy_string_len(p->stat_fn, CONST_STR_LEN("/"));
 			} else {
 				buffer_copy_string_len(p->stat_fn, con->physical.path->ptr, sl - con->physical.path->ptr + 1);
 			}
@@ -573,7 +573,7 @@
 			case SSI_FLASTMOD:
 				b = chunkqueue_get_append_buffer(con->write_queue);
 				if (0 == strftime(buf, sizeof(buf), p->timefmt->ptr, localtime(&t))) {
-					buffer_copy_string(b, "(none)");
+					buffer_copy_string_len(b, CONST_STR_LEN("(none)"));
 				} else {
 					buffer_copy_string(b, buf);
 				}
@@ -656,17 +656,17 @@
 		if (p->if_is_false) break;
 
 		b = chunkqueue_get_append_buffer(con->write_queue);
-		buffer_copy_string(b, "<pre>");
+		buffer_copy_string_len(b, CONST_STR_LEN("<pre>"));
 		for (i = 0; i < p->ssi_vars->used; i++) {
 			data_string *ds = (data_string *)p->ssi_vars->data[p->ssi_vars->sorted[i]];
 
 			buffer_append_string_buffer(b, ds->key);
-			buffer_append_string(b, ": ");
+			buffer_append_string_len(b, CONST_STR_LEN(": "));
 			buffer_append_string_buffer(b, ds->value);
-			buffer_append_string(b, "<br />");
+			buffer_append_string_len(b, CONST_STR_LEN("<br />"));
 
 		}
-		buffer_append_string(b, "</pre>");
+		buffer_append_string_len(b, CONST_STR_LEN("</pre>"));
 
 		break;
 	case SSI_EXEC: {
@@ -924,7 +924,7 @@
 
 	array_reset(p->ssi_vars);
 	array_reset(p->ssi_cgi_env);
-	buffer_copy_string(p->timefmt, "%a, %d %b %Y %H:%M:%S %Z");
+	buffer_copy_string_len(p->timefmt, CONST_STR_LEN("%a, %d %b %Y %H:%M:%S %Z"));
 	p->sizefmt = 0;
 	build_ssi_cgi_vars(srv, con, p);
 	p->if_is_false = 0;
@@ -1027,6 +1027,7 @@
 
 	con->file_started  = 1;
 	con->file_finished = 1;
+	con->mode = p->id;
 
 	response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_STR_LEN("text/html"));
 
@@ -1094,6 +1095,8 @@
 	plugin_data *p = p_d;
 	size_t k;
 
+	if (con->mode != DIRECT) return HANDLER_GO_ON;
+
 	if (con->physical.path->used == 0) return HANDLER_GO_ON;
 
 	mod_ssi_patch_connection(srv, con, p);
@@ -1109,6 +1112,7 @@
 			if (mod_ssi_handle_request(srv, con, p)) {
 				/* on error */
 				con->http_status = 500;
+				con->mode = DIRECT;
 			}
 
 			return HANDLER_FINISHED;

Modified: lighttpd/trunk/src/mod_ssi_expr.c
===================================================================
--- lighttpd/trunk/src/mod_ssi_expr.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_ssi_expr.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -59,7 +59,7 @@
 			t->offset++;
 			t->line_pos++;
 
-			buffer_copy_string(token, "(=)");
+			buffer_copy_string_len(token, CONST_STR_LEN("(=)"));
 
 			break;
 		case '>':
@@ -69,14 +69,14 @@
 
 				tid = TK_GE;
 
-				buffer_copy_string(token, "(>=)");
+				buffer_copy_string_len(token, CONST_STR_LEN("(>=)"));
 			} else {
 				t->offset += 1;
 				t->line_pos += 1;
 
 				tid = TK_GT;
 
-				buffer_copy_string(token, "(>)");
+				buffer_copy_string_len(token, CONST_STR_LEN("(>)"));
 			}
 
 			break;
@@ -87,14 +87,14 @@
 
 				tid = TK_LE;
 
-				buffer_copy_string(token, "(<=)");
+				buffer_copy_string_len(token, CONST_STR_LEN("(<=)"));
 			} else {
 				t->offset += 1;
 				t->line_pos += 1;
 
 				tid = TK_LT;
 
-				buffer_copy_string(token, "(<)");
+				buffer_copy_string_len(token, CONST_STR_LEN("(<)"));
 			}
 
 			break;
@@ -106,14 +106,14 @@
 
 				tid = TK_NE;
 
-				buffer_copy_string(token, "(!=)");
+				buffer_copy_string_len(token, CONST_STR_LEN("(!=)"));
 			} else {
 				t->offset += 1;
 				t->line_pos += 1;
 
 				tid = TK_NOT;
 
-				buffer_copy_string(token, "(!)");
+				buffer_copy_string_len(token, CONST_STR_LEN("(!)"));
 			}
 
 			break;
@@ -124,7 +124,7 @@
 
 				tid = TK_AND;
 
-				buffer_copy_string(token, "(&&)");
+				buffer_copy_string_len(token, CONST_STR_LEN("(&&)"));
 			} else {
 				log_error_write(srv, __FILE__, __LINE__, "sds",
 						"pos:", t->line_pos,
@@ -140,7 +140,7 @@
 
 				tid = TK_OR;
 
-				buffer_copy_string(token, "(||)");
+				buffer_copy_string_len(token, CONST_STR_LEN("(||)"));
 			} else {
 				log_error_write(srv, __FILE__, __LINE__, "sds",
 						"pos:", t->line_pos,
@@ -183,7 +183,7 @@
 
 			tid = TK_LPARAN;
 
-			buffer_copy_string(token, "(");
+			buffer_copy_string_len(token, CONST_STR_LEN("("));
 			break;
 		case ')':
 			t->offset++;
@@ -191,7 +191,7 @@
 
 			tid = TK_RPARAN;
 
-			buffer_copy_string(token, ")");
+			buffer_copy_string_len(token, CONST_STR_LEN(")"));
 			break;
 		case '$':
 			if (t->input[t->offset + 1] == '{') {
@@ -219,7 +219,7 @@
 			} else if (NULL != (ds = (data_string *)array_get_element(p->ssi_vars, token->ptr))) {
 				buffer_copy_string_buffer(token, ds->value);
 			} else {
-				buffer_copy_string(token, "");
+				buffer_copy_string_len(token, CONST_STR_LEN(""));
 			}
 
 			t->offset += i;

Modified: lighttpd/trunk/src/mod_ssi_exprparser.c
===================================================================
--- lighttpd/trunk/src/mod_ssi_exprparser.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_ssi_exprparser.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -4,7 +4,7 @@
 /* First off, code is include which follows the "include" declaration
 ** in the input file. */
 #include <stdio.h>
-#line 6 "./mod_ssi_exprparser.y"
+#line 6 "../../src/mod_ssi_exprparser.y"
 
 #include <assert.h>
 #include <string.h>
@@ -236,12 +236,14 @@
 ** Outputs:
 ** None.
 */
+#if 0
 void ssiexprparserTrace(FILE *TraceFILE, char *zTracePrompt){
   yyTraceFILE = TraceFILE;
   yyTracePrompt = zTracePrompt;
   if( yyTraceFILE==0 ) yyTracePrompt = 0;
   else if( yyTracePrompt==0 ) yyTraceFILE = 0;
 }
+#endif
 #endif /* NDEBUG */
 
 #ifndef NDEBUG
@@ -283,9 +285,10 @@
 ** This function returns the symbolic name associated with a token
 ** value.
 */
+#if 0
 const char *ssiexprparserTokenName(int tokenType){
 #ifndef NDEBUG
-  if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){
+  if( tokenType>0 && (size_t)tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){
     return yyTokenName[tokenType];
   }else{
     return "Unknown";
@@ -294,6 +297,7 @@
   return "";
 #endif
 }
+#endif
 
 /*
 ** This function allocates a new parser.
@@ -345,9 +349,9 @@
     case 10:
     case 11:
     case 12:
-#line 24 "./mod_ssi_exprparser.y"
+#line 24 "../../src/mod_ssi_exprparser.y"
 { buffer_free((yypminor->yy0)); }
-#line 350 "mod_ssi_exprparser.c"
+#line 354 "mod_ssi_exprparser.c"
       break;
     default:  break;   /* If no destructor action specified: do nothing */
   }
@@ -425,7 +429,7 @@
     return YY_NO_ACTION;
   }
   i += iLookAhead;
-  if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
+  if( i<0 || (size_t)i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
 #ifdef YYFALLBACK
     int iFallback;            /* Fallback token */
     if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
@@ -468,7 +472,7 @@
     return YY_NO_ACTION;
   }
   i += iLookAhead;
-  if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
+  if( i<0 || (size_t)i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
     return yy_default[stateno];
   }else{
     return yy_action[i];
@@ -560,7 +564,7 @@
   yymsp = &yypParser->yystack[yypParser->yyidx];
 #ifndef NDEBUG
   if( yyTraceFILE && yyruleno>=0
-        && yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){
+        && (size_t)yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){
     fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
       yyRuleName[yyruleno]);
   }
@@ -576,17 +580,17 @@
   **     break;
   */
       case 0:
-#line 31 "./mod_ssi_exprparser.y"
+#line 31 "../../src/mod_ssi_exprparser.y"
 {
   ctx->val.bo = ssi_val_tobool(yymsp[0].minor.yy29);
   ctx->val.type = SSI_TYPE_BOOL;
 
   ssi_val_free(yymsp[0].minor.yy29);
 }
-#line 586 "mod_ssi_exprparser.c"
+#line 590 "mod_ssi_exprparser.c"
         break;
       case 1:
-#line 38 "./mod_ssi_exprparser.y"
+#line 38 "../../src/mod_ssi_exprparser.y"
 {
   int cmp;
 
@@ -612,17 +616,17 @@
 
   ssi_val_free(yymsp[0].minor.yy29);
 }
-#line 615 "mod_ssi_exprparser.c"
+#line 619 "mod_ssi_exprparser.c"
         break;
       case 2:
-#line 63 "./mod_ssi_exprparser.y"
+#line 63 "../../src/mod_ssi_exprparser.y"
 {
   yygotominor.yy29 = yymsp[0].minor.yy29;
 }
-#line 622 "mod_ssi_exprparser.c"
+#line 626 "mod_ssi_exprparser.c"
         break;
       case 3:
-#line 66 "./mod_ssi_exprparser.y"
+#line 66 "../../src/mod_ssi_exprparser.y"
 {
   int e;
 
@@ -633,11 +637,11 @@
   yygotominor.yy29->type = SSI_TYPE_BOOL;
   ssi_val_free(yymsp[0].minor.yy29);
 }
-#line 636 "mod_ssi_exprparser.c"
+#line 640 "mod_ssi_exprparser.c"
   yy_destructor(1,&yymsp[-1].minor);
         break;
       case 4:
-#line 77 "./mod_ssi_exprparser.y"
+#line 77 "../../src/mod_ssi_exprparser.y"
 {
   int e;
 
@@ -648,11 +652,11 @@
   yygotominor.yy29->type = SSI_TYPE_BOOL;
   ssi_val_free(yymsp[0].minor.yy29);
 }
-#line 651 "mod_ssi_exprparser.c"
+#line 655 "mod_ssi_exprparser.c"
   yy_destructor(2,&yymsp[-1].minor);
         break;
       case 5:
-#line 88 "./mod_ssi_exprparser.y"
+#line 88 "../../src/mod_ssi_exprparser.y"
 {
   int e;
 
@@ -662,76 +666,77 @@
   yygotominor.yy29->bo = e;
   yygotominor.yy29->type = SSI_TYPE_BOOL;
 }
-#line 665 "mod_ssi_exprparser.c"
+#line 669 "mod_ssi_exprparser.c"
   yy_destructor(9,&yymsp[-1].minor);
         break;
       case 6:
-#line 97 "./mod_ssi_exprparser.y"
+#line 97 "../../src/mod_ssi_exprparser.y"
 {
   yygotominor.yy29 = yymsp[-1].minor.yy29;
 }
-#line 673 "mod_ssi_exprparser.c"
+#line 677 "mod_ssi_exprparser.c"
   yy_destructor(10,&yymsp[-2].minor);
   yy_destructor(11,&yymsp[0].minor);
         break;
       case 7:
-#line 101 "./mod_ssi_exprparser.y"
+#line 101 "../../src/mod_ssi_exprparser.y"
 {
   yygotominor.yy29 = ssi_val_init();
   yygotominor.yy29->str = yymsp[0].minor.yy19;
   yygotominor.yy29->type = SSI_TYPE_STRING;
 }
-#line 684 "mod_ssi_exprparser.c"
+#line 688 "mod_ssi_exprparser.c"
         break;
       case 8:
-#line 107 "./mod_ssi_exprparser.y"
+#line 107 "../../src/mod_ssi_exprparser.y"
 {
-  yygotominor.yy19 = buffer_init_string(yymsp[0].minor.yy0->ptr);
+  yygotominor.yy19 = yymsp[0].minor.yy0;
 }
-#line 691 "mod_ssi_exprparser.c"
+#line 695 "mod_ssi_exprparser.c"
         break;
       case 9:
-#line 111 "./mod_ssi_exprparser.y"
+#line 111 "../../src/mod_ssi_exprparser.y"
 {
   yygotominor.yy19 = yymsp[-1].minor.yy19;
   buffer_append_string_buffer(yygotominor.yy19, yymsp[0].minor.yy0);
+  buffer_free(yymsp[0].minor.yy0);
 }
-#line 699 "mod_ssi_exprparser.c"
+#line 704 "mod_ssi_exprparser.c"
         break;
       case 10:
-#line 116 "./mod_ssi_exprparser.y"
+#line 117 "../../src/mod_ssi_exprparser.y"
 { yygotominor.yy8 = SSI_COND_EQ; }
-#line 704 "mod_ssi_exprparser.c"
+#line 709 "mod_ssi_exprparser.c"
   yy_destructor(3,&yymsp[0].minor);
         break;
       case 11:
-#line 117 "./mod_ssi_exprparser.y"
+#line 118 "../../src/mod_ssi_exprparser.y"
 { yygotominor.yy8 = SSI_COND_NE; }
-#line 710 "mod_ssi_exprparser.c"
+#line 715 "mod_ssi_exprparser.c"
   yy_destructor(4,&yymsp[0].minor);
         break;
       case 12:
-#line 118 "./mod_ssi_exprparser.y"
+#line 119 "../../src/mod_ssi_exprparser.y"
 { yygotominor.yy8 = SSI_COND_LE; }
-#line 716 "mod_ssi_exprparser.c"
+#line 721 "mod_ssi_exprparser.c"
   yy_destructor(8,&yymsp[0].minor);
         break;
       case 13:
-#line 119 "./mod_ssi_exprparser.y"
+#line 120 "../../src/mod_ssi_exprparser.y"
 { yygotominor.yy8 = SSI_COND_GE; }
-#line 722 "mod_ssi_exprparser.c"
+#line 727 "mod_ssi_exprparser.c"
   yy_destructor(6,&yymsp[0].minor);
         break;
       case 14:
-#line 120 "./mod_ssi_exprparser.y"
+#line 121 "../../src/mod_ssi_exprparser.y"
 { yygotominor.yy8 = SSI_COND_LT; }
-#line 728 "mod_ssi_exprparser.c"
+#line 733 "mod_ssi_exprparser.c"
   yy_destructor(7,&yymsp[0].minor);
         break;
       case 15:
-#line 121 "./mod_ssi_exprparser.y"
+#line 122 "../../src/mod_ssi_exprparser.y"
 { yygotominor.yy8 = SSI_COND_GT; }
-#line 734 "mod_ssi_exprparser.c"
+#line 739 "mod_ssi_exprparser.c"
   yy_destructor(5,&yymsp[0].minor);
         break;
   };
@@ -761,11 +766,11 @@
   while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
   /* Here code is inserted which will be executed whenever the
   ** parser fails */
-#line 16 "./mod_ssi_exprparser.y"
+#line 16 "../../src/mod_ssi_exprparser.y"
 
   ctx->ok = 0;
 
-#line 768 "mod_ssi_exprparser.c"
+#line 773 "mod_ssi_exprparser.c"
   ssiexprparserARG_STORE; /* Suppress warning about unused %extra_argument variable */
 }
 
@@ -778,6 +783,8 @@
   YYMINORTYPE yyminor            /* The minor type of the error token */
 ){
   ssiexprparserARG_FETCH;
+  UNUSED(yymajor);
+  UNUSED(yyminor);
 #define TOKEN (yyminor.yy0)
   ssiexprparserARG_STORE; /* Suppress warning about unused %extra_argument variable */
 }

Modified: lighttpd/trunk/src/mod_ssi_exprparser.y
===================================================================
--- lighttpd/trunk/src/mod_ssi_exprparser.y	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_ssi_exprparser.y	2009-03-18 10:20:09 UTC (rev 355)
@@ -105,12 +105,13 @@
 }
 
 value(A) ::= VALUE(B). {
-  A = buffer_init_string(B->ptr);
+  A = B;
 }
 
 value(A) ::= value(B) VALUE(C). {
   A = B;
   buffer_append_string_buffer(A, C);
+  buffer_free(C);
 }
 
 cond(A) ::= EQ. { A = SSI_COND_EQ; }

Modified: lighttpd/trunk/src/mod_staticfile.c
===================================================================
--- lighttpd/trunk/src/mod_staticfile.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_staticfile.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -282,22 +282,22 @@
 
 				b = chunkqueue_get_append_buffer(con->write_queue);
 
-				buffer_copy_string(b, "\r\n--");
+				buffer_copy_string_len(b, CONST_STR_LEN("\r\n--"));
 				buffer_append_string(b, boundary);
 
 				/* write Content-Range */
-				buffer_append_string(b, "\r\nContent-Range: bytes ");
+				buffer_append_string_len(b, CONST_STR_LEN("\r\nContent-Range: bytes "));
 				buffer_append_off_t(b, start);
-				buffer_append_string(b, "-");
+				buffer_append_string_len(b, CONST_STR_LEN("-"));
 				buffer_append_off_t(b, end);
-				buffer_append_string(b, "/");
+				buffer_append_string_len(b, CONST_STR_LEN("/"));
 				buffer_append_off_t(b, sce->st.st_size);
 
-				buffer_append_string(b, "\r\nContent-Type: ");
+				buffer_append_string_len(b, CONST_STR_LEN("\r\nContent-Type: "));
 				buffer_append_string_buffer(b, content_type);
 
 				/* write END-OF-HEADER */
-				buffer_append_string(b, "\r\n\r\n");
+				buffer_append_string_len(b, CONST_STR_LEN("\r\n\r\n"));
 
 				con->response.content_length += b->used - 1;
 
@@ -325,7 +325,7 @@
 
 		/* set header-fields */
 
-		buffer_copy_string(p->range_buf, "multipart/byteranges; boundary=");
+		buffer_copy_string_len(p->range_buf, CONST_STR_LEN("multipart/byteranges; boundary="));
 		buffer_append_string(p->range_buf, boundary);
 
 		/* overwrite content-type */
@@ -333,11 +333,11 @@
 	} else {
 		/* add Content-Range-header */
 
-		buffer_copy_string(p->range_buf, "bytes ");
+		buffer_copy_string_len(p->range_buf, CONST_STR_LEN("bytes "));
 		buffer_append_off_t(p->range_buf, start);
-		buffer_append_string(p->range_buf, "-");
+		buffer_append_string_len(p->range_buf, CONST_STR_LEN("-"));
 		buffer_append_off_t(p->range_buf, end);
-		buffer_append_string(p->range_buf, "/");
+		buffer_append_string_len(p->range_buf, CONST_STR_LEN("/"));
 		buffer_append_off_t(p->range_buf, sce->st.st_size);
 
 		response_header_insert(srv, con, CONST_STR_LEN("Content-Range"), CONST_BUF_LEN(p->range_buf));

Modified: lighttpd/trunk/src/mod_status.c
===================================================================
--- lighttpd/trunk/src/mod_status.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_status.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -143,24 +143,24 @@
 
 
 static int mod_status_row_append(buffer *b, const char *key, const char *value) {
-	BUFFER_APPEND_STRING_CONST(b, "   <tr>\n");
-	BUFFER_APPEND_STRING_CONST(b, "    <td><b>");
+	buffer_append_string_len(b, CONST_STR_LEN("   <tr>\n"));
+	buffer_append_string_len(b, CONST_STR_LEN("    <td><b>"));
 	buffer_append_string(b, key);
-	BUFFER_APPEND_STRING_CONST(b, "</b></td>\n");
-	BUFFER_APPEND_STRING_CONST(b, "    <td>");
+	buffer_append_string_len(b, CONST_STR_LEN("</b></td>\n"));
+	buffer_append_string_len(b, CONST_STR_LEN("    <td>"));
 	buffer_append_string(b, value);
-	BUFFER_APPEND_STRING_CONST(b, "</td>\n");
-	BUFFER_APPEND_STRING_CONST(b, "   </tr>\n");
+	buffer_append_string_len(b, CONST_STR_LEN("</td>\n"));
+	buffer_append_string_len(b, CONST_STR_LEN("   </tr>\n"));
 
 	return 0;
 }
 
 static int mod_status_header_append(buffer *b, const char *key) {
-	BUFFER_APPEND_STRING_CONST(b, "   <tr>\n");
-	BUFFER_APPEND_STRING_CONST(b, "    <th colspan=\"2\">");
+	buffer_append_string_len(b, CONST_STR_LEN("   <tr>\n"));
+	buffer_append_string_len(b, CONST_STR_LEN("    <th colspan=\"2\">"));
 	buffer_append_string(b, key);
-	BUFFER_APPEND_STRING_CONST(b, "</th>\n");
-	BUFFER_APPEND_STRING_CONST(b, "   </tr>\n");
+	buffer_append_string_len(b, CONST_STR_LEN("</th>\n"));
+	buffer_append_string_len(b, CONST_STR_LEN("   </tr>\n"));
 
 	return 0;
 }
@@ -169,13 +169,13 @@
 	plugin_data *p = p_d;
 
 	if (p->conf.sort) {
-		BUFFER_APPEND_STRING_CONST(b, "<th class=\"status\"><a href=\"#\" class=\"sortheader\" onclick=\"resort(this);return false;\">");
+		buffer_append_string_len(b, CONST_STR_LEN("<th class=\"status\"><a href=\"#\" class=\"sortheader\" onclick=\"resort(this);return false;\">"));
 		buffer_append_string(b, key);
-		BUFFER_APPEND_STRING_CONST(b, "<span class=\"sortarrow\">:</span></a></th>\n");
+		buffer_append_string_len(b, CONST_STR_LEN("<span class=\"sortarrow\">:</span></a></th>\n"));
 	} else {
-		BUFFER_APPEND_STRING_CONST(b, "<th class=\"status\">");
+		buffer_append_string_len(b, CONST_STR_LEN("<th class=\"status\">"));
 		buffer_append_string(b, key);
-		BUFFER_APPEND_STRING_CONST(b, "</th>\n");
+		buffer_append_string_len(b, CONST_STR_LEN("</th>\n"));
 	}
 
 	return 0;
@@ -209,15 +209,14 @@
 
 	b = chunkqueue_get_append_buffer(con->write_queue);
 
-	BUFFER_COPY_STRING_CONST(b,
+	buffer_copy_string_len(b, CONST_STR_LEN(
 				 "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"
 				 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n"
 				 "         \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"
 				 "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n"
 				 " <head>\n"
-				 "  <title>Status</title>\n");
+				 "  <title>Status</title>\n"
 
-	BUFFER_APPEND_STRING_CONST(b,
 				   "  <style type=\"text/css\">\n"
 				   "    table.status { border: black solid thin; }\n"
 				   "    td { white-space: nowrap; }\n"
@@ -226,16 +225,15 @@
 				   "    th.status { background-color: black; color: white; font-weight: bold; }\n"
 				   "    a.sortheader { background-color: black; color: white; font-weight: bold; text-decoration: none; display: block; }\n"
 				   "    span.sortarrow { color: white; text-decoration: none; }\n"
-				   "  </style>\n");
+				   "  </style>\n"));
 
 	if (p->conf.sort) {
-		BUFFER_APPEND_STRING_CONST(b,
+		buffer_append_string_len(b, CONST_STR_LEN(
 					   "<script type=\"text/javascript\">\n"
 					   "// <!--\n"
 					   "var sort_column;\n"
-					   "var prev_span = null;\n");
+					   "var prev_span = null;\n"
 
-		BUFFER_APPEND_STRING_CONST(b,
 					   "function get_inner_text(el) {\n"
 					   " if((typeof el == 'string')||(typeof el == 'undefined'))\n"
 					   "  return el;\n"
@@ -251,9 +249,8 @@
 					   "  }\n"
 					   " }\n"
 					   " return str;\n"
-					   "}\n");
+					   "}\n"
 
-		BUFFER_APPEND_STRING_CONST(b,
 					   "function sortfn(a,b) {\n"
 					   " var at = get_inner_text(a.cells[sort_column]);\n"
 					   " var bt = get_inner_text(b.cells[sort_column]);\n"
@@ -266,9 +263,8 @@
 					   "  else if (aa<bb) return -1;\n"
 					   "  else return 1;\n"
 					   " }\n"
-					   "}\n");
+					   "}\n"
 
-		BUFFER_APPEND_STRING_CONST(b,
 					   "function resort(lnk) {\n"
 					   " var span = lnk.childNodes[1];\n"
 					   " var table = lnk.parentNode.parentNode.parentNode.parentNode;\n"
@@ -276,9 +272,8 @@
 					   " for (j=1;j<table.rows.length;j++)\n"
 					   "  rows[j-1] = table.rows[j];\n"
 					   " sort_column = lnk.parentNode.cellIndex;\n"
-					   " rows.sort(sortfn);\n");
+					   " rows.sort(sortfn);\n"
 
-		BUFFER_APPEND_STRING_CONST(b,
 					   " if (prev_span != null) prev_span.innerHTML = '';\n"
 					   " if (span.getAttribute('sortdir')=='down') {\n"
 					   "  span.innerHTML = '↑';\n"
@@ -293,25 +288,25 @@
 					   " prev_span = span;\n"
 					   "}\n"
 					   "// -->\n"
-					   "</script>\n");
+					   "</script>\n"));
 	}
 
-	BUFFER_APPEND_STRING_CONST(b,
+	buffer_append_string_len(b, CONST_STR_LEN(
 				 " </head>\n"
-				 " <body>\n");
+				 " <body>\n"));
 
 
 
 	/* connection listing */
-	BUFFER_APPEND_STRING_CONST(b, "<h1>Server-Status</h1>");
+	buffer_append_string_len(b, CONST_STR_LEN("<h1>Server-Status</h1>"));
 
-	BUFFER_APPEND_STRING_CONST(b, "<table summary=\"status\" class=\"status\">");
-	BUFFER_APPEND_STRING_CONST(b, "<tr><td>Hostname</td><td class=\"string\">");
+	buffer_append_string_len(b, CONST_STR_LEN("<table summary=\"status\" class=\"status\">"));
+	buffer_append_string_len(b, CONST_STR_LEN("<tr><td>Hostname</td><td class=\"string\">"));
 	buffer_append_string_buffer(b, con->uri.authority);
-	BUFFER_APPEND_STRING_CONST(b, " (");
+	buffer_append_string_len(b, CONST_STR_LEN(" ("));
 	buffer_append_string_buffer(b, con->server_name);
-	BUFFER_APPEND_STRING_CONST(b, ")</td></tr>\n");
-	BUFFER_APPEND_STRING_CONST(b, "<tr><td>Uptime</td><td class=\"string\">");
+	buffer_append_string_len(b, CONST_STR_LEN(")</td></tr>\n"));
+	buffer_append_string_len(b, CONST_STR_LEN("<tr><td>Uptime</td><td class=\"string\">"));
 
 	ts = srv->cur_ts - srv->startup_ts;
 
@@ -328,98 +323,98 @@
 
 	if (days) {
 		buffer_append_long(b, days);
-		BUFFER_APPEND_STRING_CONST(b, " days ");
+		buffer_append_string_len(b, CONST_STR_LEN(" days "));
 	}
 
 	if (hours) {
 		buffer_append_long(b, hours);
-		BUFFER_APPEND_STRING_CONST(b, " hours ");
+		buffer_append_string_len(b, CONST_STR_LEN(" hours "));
 	}
 
 	if (mins) {
 		buffer_append_long(b, mins);
-		BUFFER_APPEND_STRING_CONST(b, " min ");
+		buffer_append_string_len(b, CONST_STR_LEN(" min "));
 	}
 
 	buffer_append_long(b, seconds);
-	BUFFER_APPEND_STRING_CONST(b, " s");
+	buffer_append_string_len(b, CONST_STR_LEN(" s"));
 
-	BUFFER_APPEND_STRING_CONST(b, "</td></tr>\n");
-	BUFFER_APPEND_STRING_CONST(b, "<tr><td>Started at</td><td class=\"string\">");
+	buffer_append_string_len(b, CONST_STR_LEN("</td></tr>\n"));
+	buffer_append_string_len(b, CONST_STR_LEN("<tr><td>Started at</td><td class=\"string\">"));
 
 	ts = srv->startup_ts;
 
 	strftime(buf, sizeof(buf) - 1, "%Y-%m-%d %H:%M:%S", localtime(&ts));
 	buffer_append_string(b, buf);
-	BUFFER_APPEND_STRING_CONST(b, "</td></tr>\n");
+	buffer_append_string_len(b, CONST_STR_LEN("</td></tr>\n"));
 
 
-	BUFFER_APPEND_STRING_CONST(b, "<tr><th colspan=\"2\">absolute (since start)</th></tr>\n");
+	buffer_append_string_len(b, CONST_STR_LEN("<tr><th colspan=\"2\">absolute (since start)</th></tr>\n"));
 
-	BUFFER_APPEND_STRING_CONST(b, "<tr><td>Requests</td><td class=\"string\">");
+	buffer_append_string_len(b, CONST_STR_LEN("<tr><td>Requests</td><td class=\"string\">"));
 	avg = p->abs_requests;
 
 	mod_status_get_multiplier(&avg, &multiplier, 1000);
 
 	buffer_append_long(b, avg);
-	BUFFER_APPEND_STRING_CONST(b, " ");
+	buffer_append_string_len(b, CONST_STR_LEN(" "));
 	if (multiplier)	buffer_append_string_len(b, &multiplier, 1);
-	BUFFER_APPEND_STRING_CONST(b, "req</td></tr>\n");
+	buffer_append_string_len(b, CONST_STR_LEN("req</td></tr>\n"));
 
-	BUFFER_APPEND_STRING_CONST(b, "<tr><td>Traffic</td><td class=\"string\">");
+	buffer_append_string_len(b, CONST_STR_LEN("<tr><td>Traffic</td><td class=\"string\">"));
 	avg = p->abs_traffic_out;
 
 	mod_status_get_multiplier(&avg, &multiplier, 1024);
 
 	sprintf(buf, "%.2f", avg);
 	buffer_append_string(b, buf);
-	BUFFER_APPEND_STRING_CONST(b, " ");
+	buffer_append_string_len(b, CONST_STR_LEN(" "));
 	if (multiplier)	buffer_append_string_len(b, &multiplier, 1);
-	BUFFER_APPEND_STRING_CONST(b, "byte</td></tr>\n");
+	buffer_append_string_len(b, CONST_STR_LEN("byte</td></tr>\n"));
 
 
 
-	BUFFER_APPEND_STRING_CONST(b, "<tr><th colspan=\"2\">average (since start)</th></tr>\n");
+	buffer_append_string_len(b, CONST_STR_LEN("<tr><th colspan=\"2\">average (since start)</th></tr>\n"));
 
-	BUFFER_APPEND_STRING_CONST(b, "<tr><td>Requests</td><td class=\"string\">");
+	buffer_append_string_len(b, CONST_STR_LEN("<tr><td>Requests</td><td class=\"string\">"));
 	avg = p->abs_requests / (srv->cur_ts - srv->startup_ts);
 
 	mod_status_get_multiplier(&avg, &multiplier, 1000);
 
 	buffer_append_long(b, avg);
-	BUFFER_APPEND_STRING_CONST(b, " ");
+	buffer_append_string_len(b, CONST_STR_LEN(" "));
 	if (multiplier)	buffer_append_string_len(b, &multiplier, 1);
-	BUFFER_APPEND_STRING_CONST(b, "req/s</td></tr>\n");
+	buffer_append_string_len(b, CONST_STR_LEN("req/s</td></tr>\n"));
 
-	BUFFER_APPEND_STRING_CONST(b, "<tr><td>Traffic</td><td class=\"string\">");
+	buffer_append_string_len(b, CONST_STR_LEN("<tr><td>Traffic</td><td class=\"string\">"));
 	avg = p->abs_traffic_out / (srv->cur_ts - srv->startup_ts);
 
 	mod_status_get_multiplier(&avg, &multiplier, 1024);
 
 	sprintf(buf, "%.2f", avg);
 	buffer_append_string(b, buf);
-	BUFFER_APPEND_STRING_CONST(b, " ");
+	buffer_append_string_len(b, CONST_STR_LEN(" "));
 	if (multiplier)	buffer_append_string_len(b, &multiplier, 1);
-	BUFFER_APPEND_STRING_CONST(b, "byte/s</td></tr>\n");
+	buffer_append_string_len(b, CONST_STR_LEN("byte/s</td></tr>\n"));
 
 
 
-	BUFFER_APPEND_STRING_CONST(b, "<tr><th colspan=\"2\">average (5s sliding average)</th></tr>\n");
+	buffer_append_string_len(b, CONST_STR_LEN("<tr><th colspan=\"2\">average (5s sliding average)</th></tr>\n"));
 	for (j = 0, avg = 0; j < 5; j++) {
 		avg += p->mod_5s_requests[j];
 	}
 
 	avg /= 5;
 
-	BUFFER_APPEND_STRING_CONST(b, "<tr><td>Requests</td><td class=\"string\">");
+	buffer_append_string_len(b, CONST_STR_LEN("<tr><td>Requests</td><td class=\"string\">"));
 
 	mod_status_get_multiplier(&avg, &multiplier, 1000);
 
 	buffer_append_long(b, avg);
-	BUFFER_APPEND_STRING_CONST(b, " ");
+	buffer_append_string_len(b, CONST_STR_LEN(" "));
 	if (multiplier)	buffer_append_string_len(b, &multiplier, 1);
 
-	BUFFER_APPEND_STRING_CONST(b, "req/s</td></tr>\n");
+	buffer_append_string_len(b, CONST_STR_LEN("req/s</td></tr>\n"));
 
 	for (j = 0, avg = 0; j < 5; j++) {
 		avg += p->mod_5s_traffic_out[j];
@@ -427,28 +422,29 @@
 
 	avg /= 5;
 
-	BUFFER_APPEND_STRING_CONST(b, "<tr><td>Traffic</td><td class=\"string\">");
+	buffer_append_string_len(b, CONST_STR_LEN("<tr><td>Traffic</td><td class=\"string\">"));
 
 	mod_status_get_multiplier(&avg, &multiplier, 1024);
 
 	sprintf(buf, "%.2f", avg);
 	buffer_append_string(b, buf);
-	BUFFER_APPEND_STRING_CONST(b, " ");
+	buffer_append_string_len(b, CONST_STR_LEN(" "));
 	if (multiplier)	buffer_append_string_len(b, &multiplier, 1);
-	BUFFER_APPEND_STRING_CONST(b, "byte/s</td></tr>\n");
+	buffer_append_string_len(b, CONST_STR_LEN("byte/s</td></tr>\n"));
 
-	BUFFER_APPEND_STRING_CONST(b, "</table>\n");
+	buffer_append_string_len(b, CONST_STR_LEN("</table>\n"));
 
 
-	BUFFER_APPEND_STRING_CONST(b, "<hr />\n<pre><b>legend</b>\n");
-	BUFFER_APPEND_STRING_CONST(b, ". = connect, C = close, E = hard error\n");
-	BUFFER_APPEND_STRING_CONST(b, "r = read, R = read-POST, W = write, h = handle-request\n");
-	BUFFER_APPEND_STRING_CONST(b, "q = request-start,  Q = request-end\n");
-	BUFFER_APPEND_STRING_CONST(b, "s = response-start, S = response-end\n");
+	buffer_append_string_len(b, CONST_STR_LEN(
+		"<hr />\n<pre><b>legend</b>\n"
+		". = connect, C = close, E = hard error\n"
+		"r = read, R = read-POST, W = write, h = handle-request\n"
+		"q = request-start,  Q = request-end\n"
+		"s = response-start, S = response-end\n"));
 
-	BUFFER_APPEND_STRING_CONST(b, "<b>");
+	buffer_append_string_len(b, CONST_STR_LEN("<b>"));
 	buffer_append_long(b, srv->conns->used);
-	BUFFER_APPEND_STRING_CONST(b, " connections</b>\n");
+	buffer_append_string_len(b, CONST_STR_LEN(" connections</b>\n"));
 
 	for (j = 0; j < srv->conns->used; j++) {
 		connection *c = srv->conns->ptr[j];
@@ -457,14 +453,14 @@
 		buffer_append_string_len(b, state, 1);
 
 		if (((j + 1) % 50) == 0) {
-			BUFFER_APPEND_STRING_CONST(b, "\n");
+			buffer_append_string_len(b, CONST_STR_LEN("\n"));
 		}
 	}
 
-	BUFFER_APPEND_STRING_CONST(b, "\n</pre><hr />\n<h2>Connections</h2>\n");
+	buffer_append_string_len(b, CONST_STR_LEN("\n</pre><hr />\n<h2>Connections</h2>\n"));
 
-	BUFFER_APPEND_STRING_CONST(b, "<table summary=\"status\" class=\"status\">\n");
-	BUFFER_APPEND_STRING_CONST(b, "<tr>");
+	buffer_append_string_len(b, CONST_STR_LEN("<table summary=\"status\" class=\"status\">\n"));
+	buffer_append_string_len(b, CONST_STR_LEN("<tr>"));
 	mod_status_header_append_sort(b, p_d, "Client IP");
 	mod_status_header_append_sort(b, p_d, "Read");
 	mod_status_header_append_sort(b, p_d, "Written");
@@ -473,40 +469,40 @@
 	mod_status_header_append_sort(b, p_d, "Host");
 	mod_status_header_append_sort(b, p_d, "URI");
 	mod_status_header_append_sort(b, p_d, "File");
-	BUFFER_APPEND_STRING_CONST(b, "</tr>\n");
+	buffer_append_string_len(b, CONST_STR_LEN("</tr>\n"));
 
 	for (j = 0; j < srv->conns->used; j++) {
 		connection *c = srv->conns->ptr[j];
 
-		BUFFER_APPEND_STRING_CONST(b, "<tr><td class=\"string\">");
+		buffer_append_string_len(b, CONST_STR_LEN("<tr><td class=\"string\">"));
 
 		buffer_append_string(b, inet_ntop_cache_get_ip(srv, &(c->dst_addr)));
 
-		BUFFER_APPEND_STRING_CONST(b, "</td><td class=\"int\">");
+		buffer_append_string_len(b, CONST_STR_LEN("</td><td class=\"int\">"));
 
 		if (con->request.content_length) {
 			buffer_append_long(b, c->request_content_queue->bytes_in);
-			BUFFER_APPEND_STRING_CONST(b, "/");
+			buffer_append_string_len(b, CONST_STR_LEN("/"));
 			buffer_append_long(b, c->request.content_length);
 		} else {
-			BUFFER_APPEND_STRING_CONST(b, "0/0");
+			buffer_append_string_len(b, CONST_STR_LEN("0/0"));
 		}
 
-		BUFFER_APPEND_STRING_CONST(b, "</td><td class=\"int\">");
+		buffer_append_string_len(b, CONST_STR_LEN("</td><td class=\"int\">"));
 
 		buffer_append_off_t(b, chunkqueue_written(c->write_queue));
-		BUFFER_APPEND_STRING_CONST(b, "/");
+		buffer_append_string_len(b, CONST_STR_LEN("/"));
 		buffer_append_off_t(b, chunkqueue_length(c->write_queue));
 
-		BUFFER_APPEND_STRING_CONST(b, "</td><td class=\"string\">");
+		buffer_append_string_len(b, CONST_STR_LEN("</td><td class=\"string\">"));
 
 		buffer_append_string(b, connection_get_state(c->state));
 
-		BUFFER_APPEND_STRING_CONST(b, "</td><td class=\"int\">");
+		buffer_append_string_len(b, CONST_STR_LEN("</td><td class=\"int\">"));
 
 		buffer_append_long(b, srv->cur_ts - c->request_start);
 
-		BUFFER_APPEND_STRING_CONST(b, "</td><td class=\"string\">");
+		buffer_append_string_len(b, CONST_STR_LEN("</td><td class=\"string\">"));
 
 		if (buffer_is_empty(c->server_name)) {
 			buffer_append_string_buffer(b, c->uri.authority);
@@ -515,38 +511,38 @@
 			buffer_append_string_buffer(b, c->server_name);
 		}
 
-		BUFFER_APPEND_STRING_CONST(b, "</td><td class=\"string\">");
+		buffer_append_string_len(b, CONST_STR_LEN("</td><td class=\"string\">"));
 
 		if (!buffer_is_empty(c->uri.path)) {
 			buffer_append_string_encoded(b, CONST_BUF_LEN(c->uri.path), ENCODING_HTML);
 		}
 
 		if (!buffer_is_empty(c->uri.query)) {
-			BUFFER_APPEND_STRING_CONST(b, "?");
+			buffer_append_string_len(b, CONST_STR_LEN("?"));
 			buffer_append_string_encoded(b, CONST_BUF_LEN(c->uri.query), ENCODING_HTML);
 		}
 
 		if (!buffer_is_empty(c->request.orig_uri)) {
-			BUFFER_APPEND_STRING_CONST(b, " (");
+			buffer_append_string_len(b, CONST_STR_LEN(" ("));
 			buffer_append_string_encoded(b, CONST_BUF_LEN(c->request.orig_uri), ENCODING_HTML);
-			BUFFER_APPEND_STRING_CONST(b, ")");
+			buffer_append_string_len(b, CONST_STR_LEN(")"));
 		}
-		BUFFER_APPEND_STRING_CONST(b, "</td><td class=\"string\">");
+		buffer_append_string_len(b, CONST_STR_LEN("</td><td class=\"string\">"));
 
 		buffer_append_string_buffer(b, c->physical.path);
 
-		BUFFER_APPEND_STRING_CONST(b, "</td></tr>\n");
+		buffer_append_string_len(b, CONST_STR_LEN("</td></tr>\n"));
 	}
 
 
-	BUFFER_APPEND_STRING_CONST(b,
-		      "</table>\n");
+	buffer_append_string_len(b, CONST_STR_LEN(
+		      "</table>\n"));
 
 
-	BUFFER_APPEND_STRING_CONST(b,
+	buffer_append_string_len(b, CONST_STR_LEN(
 		      " </body>\n"
 		      "</html>\n"
-		      );
+		      ));
 
 	response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_STR_LEN("text/html"));
 
@@ -566,45 +562,45 @@
 	b = chunkqueue_get_append_buffer(con->write_queue);
 
 	/* output total number of requests */
-	BUFFER_APPEND_STRING_CONST(b, "Total Accesses: ");
+	buffer_append_string_len(b, CONST_STR_LEN("Total Accesses: "));
 	avg = p->abs_requests;
 	snprintf(buf, sizeof(buf) - 1, "%.0f", avg);
 	buffer_append_string(b, buf);
-	BUFFER_APPEND_STRING_CONST(b, "\n");
+	buffer_append_string_len(b, CONST_STR_LEN("\n"));
 
 	/* output total traffic out in kbytes */
-	BUFFER_APPEND_STRING_CONST(b, "Total kBytes: ");
+	buffer_append_string_len(b, CONST_STR_LEN("Total kBytes: "));
 	avg = p->abs_traffic_out / 1024;
 	snprintf(buf, sizeof(buf) - 1, "%.0f", avg);
 	buffer_append_string(b, buf);
-	BUFFER_APPEND_STRING_CONST(b, "\n");
+	buffer_append_string_len(b, CONST_STR_LEN("\n"));
 
 	/* output uptime */
-	BUFFER_APPEND_STRING_CONST(b, "Uptime: ");
+	buffer_append_string_len(b, CONST_STR_LEN("Uptime: "));
 	ts = srv->cur_ts - srv->startup_ts;
 	buffer_append_long(b, ts);
-	BUFFER_APPEND_STRING_CONST(b, "\n");
+	buffer_append_string_len(b, CONST_STR_LEN("\n"));
 
 	/* output busy servers */
-	BUFFER_APPEND_STRING_CONST(b, "BusyServers: ");
+	buffer_append_string_len(b, CONST_STR_LEN("BusyServers: "));
 	buffer_append_long(b, srv->conns->used);
-	BUFFER_APPEND_STRING_CONST(b, "\n");
+	buffer_append_string_len(b, CONST_STR_LEN("\n"));
 
-	BUFFER_APPEND_STRING_CONST(b, "IdleServers: ");
+	buffer_append_string_len(b, CONST_STR_LEN("IdleServers: "));
        buffer_append_long(b, srv->conns->size - srv->conns->used);
-       BUFFER_APPEND_STRING_CONST(b, "\n");
+       buffer_append_string_len(b, CONST_STR_LEN("\n"));
 
        /* output scoreboard */
-       BUFFER_APPEND_STRING_CONST(b, "Scoreboard: ");
+       buffer_append_string_len(b, CONST_STR_LEN("Scoreboard: "));
        for (k = 0; k < srv->conns->used; k++) {
         	connection *c = srv->conns->ptr[k];
 		const char *state = connection_get_short_state(c->state);
 		buffer_append_string_len(b, state, 1);
 	}
 	for (l = 0; l < srv->conns->size - srv->conns->used; l++) {
-		BUFFER_APPEND_STRING_CONST(b, "_");
+		buffer_append_string_len(b, CONST_STR_LEN("_"));
 	}
-	BUFFER_APPEND_STRING_CONST(b, "\n");
+	buffer_append_string_len(b, CONST_STR_LEN("\n"));
 
 	/* set text/plain output */
 
@@ -633,9 +629,9 @@
 		size_t ndx = st->sorted[i];
 
 		buffer_append_string_buffer(b, st->data[ndx]->key);
-		buffer_append_string(b, ": ");
+		buffer_append_string_len(b, CONST_STR_LEN(": "));
 		buffer_append_long(b, ((data_integer *)(st->data[ndx]))->value);
-		buffer_append_string(b, "\n");
+		buffer_append_string_len(b, CONST_STR_LEN("\n"));
 	}
 
 	response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_STR_LEN("text/plain"));
@@ -696,7 +692,7 @@
 
 	b = chunkqueue_get_append_buffer(con->write_queue);
 
-	BUFFER_COPY_STRING_CONST(b,
+	buffer_copy_string_len(b, CONST_STR_LEN(
 			   "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"
 			   "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n"
 			   "         \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"
@@ -706,7 +702,7 @@
 			   " </head>\n"
 			   " <body>\n"
 			   "  <h1>" PACKAGE_NAME " " PACKAGE_VERSION "</h1>\n"
-			   "  <table summary=\"status\" border=\"1\">\n");
+			   "  <table summary=\"status\" border=\"1\">\n"));
 
 	mod_status_header_append(b, "Server-Features");
 #ifdef HAVE_PCRE_H
@@ -733,19 +729,19 @@
 		if (i == 0) {
 			buffer_copy_string_buffer(m, pl->name);
 		} else {
-			BUFFER_APPEND_STRING_CONST(m, "<br />");
+			buffer_append_string_len(m, CONST_STR_LEN("<br />"));
 			buffer_append_string_buffer(m, pl->name);
 		}
 	}
 
 	mod_status_row_append(b, "Loaded Modules", m->ptr);
 
-	BUFFER_APPEND_STRING_CONST(b, "  </table>\n");
+	buffer_append_string_len(b, CONST_STR_LEN("  </table>\n"));
 
-	BUFFER_APPEND_STRING_CONST(b,
+	buffer_append_string_len(b, CONST_STR_LEN(
 		      " </body>\n"
 		      "</html>\n"
-		      );
+		      ));
 
 	response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_STR_LEN("text/html"));
 
@@ -796,6 +792,8 @@
 static handler_t mod_status_handler(server *srv, connection *con, void *p_d) {
 	plugin_data *p = p_d;
 
+	if (con->mode != DIRECT) return HANDLER_GO_ON;
+
 	mod_status_patch_connection(srv, con, p);
 
 	if (!buffer_is_empty(p->conf.status_url) &&

Modified: lighttpd/trunk/src/mod_trigger_b4_dl.c
===================================================================
--- lighttpd/trunk/src/mod_trigger_b4_dl.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_trigger_b4_dl.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,5 +1,6 @@
 #include <ctype.h>
 #include <stdlib.h>
+#include <fcntl.h>
 #include <string.h>
 
 #include "base.h"
@@ -180,6 +181,9 @@
 						"gdbm-open failed");
 				return HANDLER_ERROR;
 			}
+#ifdef FD_CLOEXEC
+			fcntl(gdbm_fdesc(s->db), F_SETFD, FD_CLOEXEC);
+#endif
 		}
 #endif
 #if defined(HAVE_PCRE_H)
@@ -316,6 +320,8 @@
 # define N 10
 	int ovec[N * 3];
 
+	if (con->mode != DIRECT) return HANDLER_GO_ON;
+
 	if (con->uri.path->used == 0) return HANDLER_GO_ON;
 
 	mod_trigger_b4_dl_patch_connection(srv, con, p);
@@ -425,8 +431,8 @@
 				/* not found, redirect */
 
 				response_header_insert(srv, con, CONST_STR_LEN("Location"), CONST_BUF_LEN(p->conf.deny_url));
-
 				con->http_status = 307;
+				con->file_finished = 1;
 
 				return HANDLER_FINISHED;
 			}
@@ -440,6 +446,7 @@
 
 				response_header_insert(srv, con, CONST_STR_LEN("Location"), CONST_BUF_LEN(p->conf.deny_url));
 				con->http_status = 307;
+				con->file_finished = 1;
 
 				if (p->conf.db) {
 					if (0 != gdbm_delete(p->conf.db, key)) {
@@ -490,6 +497,7 @@
 				response_header_insert(srv, con, CONST_STR_LEN("Location"), CONST_BUF_LEN(p->conf.deny_url));
 
 				con->http_status = 307;
+				con->file_finished = 1;
 
 				return HANDLER_FINISHED;
 			}

Modified: lighttpd/trunk/src/mod_userdir.c
===================================================================
--- lighttpd/trunk/src/mod_userdir.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_userdir.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -262,6 +262,9 @@
 				return HANDLER_GO_ON;
 			}
 		}
+		if (con->conf.force_lowercase_filenames) {
+			buffer_to_lower(p->username);
+		}
 
 		buffer_copy_string_buffer(p->temp_path, p->conf.basepath);
 		BUFFER_APPEND_SLASH(p->temp_path);
@@ -284,8 +287,24 @@
 		}
 	}
 
+	/* the physical rel_path is basically the same as uri.path;
+	 * but it is converted to lowercase in case of force_lowercase_filenames and some special handling
+	 * for trailing '.', ' ' and '/' on windows
+	 * we assume that no docroot/physical handler changed this
+	 * (docroot should only set the docroot/server name, phyiscal should only change the phyiscal.path;
+	 *  the exception mod_secure_download doesn't work with userdir anyway)
+	 */
 	BUFFER_APPEND_SLASH(p->temp_path);
-	buffer_append_string(p->temp_path, rel_url + 1); /* skip the / */
+	/* if no second '/' is found, we assume that it was stripped from the uri.path for the special handling
+	 * on windows.
+	 * we do not care about the trailing slash here on windows, as we already ensured it is a directory
+	 *
+	 * TODO: what to do with trailing dots in usernames on windows? they may result in the same directory
+	 *       as a username without them.
+	 */
+	if (NULL != (rel_url = strchr(con->physical.rel_path->ptr + 2, '/'))) {
+		buffer_append_string(p->temp_path, rel_url + 1); /* skip the / */
+	}
 	buffer_copy_string_buffer(con->physical.path, p->temp_path);
 
 	buffer_reset(p->temp_path);

Modified: lighttpd/trunk/src/mod_usertrack.c
===================================================================
--- lighttpd/trunk/src/mod_usertrack.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_usertrack.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -103,7 +103,7 @@
 		}
 
 		if (buffer_is_empty(s->cookie_name)) {
-			buffer_copy_string(s->cookie_name, "TRACKID");
+			buffer_copy_string_len(s->cookie_name, CONST_STR_LEN("TRACKID"));
 		} else {
 			size_t j;
 			for (j = 0; j < s->cookie_name->used - 1; j++) {
@@ -214,9 +214,9 @@
 	if (NULL == (ds = (data_string *)array_get_unused_element(con->response.headers, TYPE_STRING))) {
 		ds = data_response_init();
 	}
-	buffer_copy_string(ds->key, "Set-Cookie");
+	buffer_copy_string_len(ds->key, CONST_STR_LEN("Set-Cookie"));
 	buffer_copy_string_buffer(ds->value, p->conf.cookie_name);
-	buffer_append_string(ds->value, "=");
+	buffer_append_string_len(ds->value, CONST_STR_LEN("="));
 
 
 	/* taken from mod_auth.c */
@@ -235,16 +235,16 @@
 	MD5_Final(h, &Md5Ctx);
 
 	buffer_append_string_encoded(ds->value, (char *)h, 16, ENCODING_HEX);
-	buffer_append_string(ds->value, "; Path=/");
-	buffer_append_string(ds->value, "; Version=1");
+	buffer_append_string_len(ds->value, CONST_STR_LEN("; Path=/"));
+	buffer_append_string_len(ds->value, CONST_STR_LEN("; Version=1"));
 
 	if (!buffer_is_empty(p->conf.cookie_domain)) {
-		buffer_append_string(ds->value, "; Domain=");
+		buffer_append_string_len(ds->value, CONST_STR_LEN("; Domain="));
 		buffer_append_string_encoded(ds->value, CONST_BUF_LEN(p->conf.cookie_domain), ENCODING_REL_URI);
 	}
 
 	if (p->conf.cookie_max_age) {
-		buffer_append_string(ds->value, "; max-age=");
+		buffer_append_string_len(ds->value, CONST_STR_LEN("; max-age="));
 		buffer_append_long(ds->value, p->conf.cookie_max_age);
 	}
 

Modified: lighttpd/trunk/src/mod_webdav.c
===================================================================
--- lighttpd/trunk/src/mod_webdav.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/mod_webdav.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -485,23 +485,23 @@
 	UNUSED(con);
 
 	if (value) {
-		buffer_append_string(b,"<");
+		buffer_append_string_len(b,CONST_STR_LEN("<"));
 		buffer_append_string(b, prop_name);
-		buffer_append_string(b, " xmlns=\"");
+		buffer_append_string_len(b, CONST_STR_LEN(" xmlns=\""));
 		buffer_append_string(b, prop_ns);
-		buffer_append_string(b, "\">");
+		buffer_append_string_len(b, CONST_STR_LEN("\">"));
 
 		buffer_append_string(b, value);
 
-		buffer_append_string(b,"</");
+		buffer_append_string_len(b,CONST_STR_LEN("</"));
 		buffer_append_string(b, prop_name);
-		buffer_append_string(b, ">");
+		buffer_append_string_len(b, CONST_STR_LEN(">"));
 	} else {
-		buffer_append_string(b,"<");
+		buffer_append_string_len(b,CONST_STR_LEN("<"));
 		buffer_append_string(b, prop_name);
-		buffer_append_string(b, " xmlns=\"");
+		buffer_append_string_len(b, CONST_STR_LEN(" xmlns=\""));
 		buffer_append_string(b, prop_ns);
-		buffer_append_string(b, "\"/>");
+		buffer_append_string_len(b, CONST_STR_LEN("\"/>"));
 	}
 
 	return 0;
@@ -511,24 +511,24 @@
 static int webdav_gen_response_status_tag(server *srv, connection *con, physical *dst, int status, buffer *b) {
 	UNUSED(srv);
 
-	buffer_append_string(b,"<D:response xmlns:ns0=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\">\n");
+	buffer_append_string_len(b,CONST_STR_LEN("<D:response xmlns:ns0=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\">\n"));
 
-	buffer_append_string(b,"<D:href>\n");
+	buffer_append_string_len(b,CONST_STR_LEN("<D:href>\n"));
 	buffer_append_string_buffer(b, dst->rel_path);
-	buffer_append_string(b,"</D:href>\n");
-	buffer_append_string(b,"<D:status>\n");
+	buffer_append_string_len(b,CONST_STR_LEN("</D:href>\n"));
+	buffer_append_string_len(b,CONST_STR_LEN("<D:status>\n"));
 
 	if (con->request.http_version == HTTP_VERSION_1_1) {
-		BUFFER_COPY_STRING_CONST(b, "HTTP/1.1 ");
+		buffer_copy_string_len(b, CONST_STR_LEN("HTTP/1.1 "));
 	} else {
-		BUFFER_COPY_STRING_CONST(b, "HTTP/1.0 ");
+		buffer_copy_string_len(b, CONST_STR_LEN("HTTP/1.0 "));
 	}
 	buffer_append_long(b, status);
-	BUFFER_APPEND_STRING_CONST(b, " ");
+	buffer_append_string_len(b, CONST_STR_LEN(" "));
 	buffer_append_string(b, get_http_status_name(status));
 
-	buffer_append_string(b,"</D:status>\n");
-	buffer_append_string(b,"</D:response>\n");
+	buffer_append_string_len(b,CONST_STR_LEN("</D:status>\n"));
+	buffer_append_string_len(b,CONST_STR_LEN("</D:response>\n"));
 
 	return 0;
 }
@@ -570,6 +570,8 @@
 				/* */
 			}
 		}
+#else
+		UNUSED(p);
 #endif
 	}
 
@@ -730,6 +732,8 @@
 			}
 		}
 	}
+#else
+	UNUSED(p);
 #endif
 	return status;
 }
@@ -840,12 +844,12 @@
 
 		if (0 == strcmp(prop_name, "resourcetype")) {
 			if (S_ISDIR(sce->st.st_mode)) {
-				buffer_append_string(b, "<D:resourcetype><D:collection/></D:resourcetype>");
+				buffer_append_string_len(b, CONST_STR_LEN("<D:resourcetype><D:collection/></D:resourcetype>"));
 				found = 1;
 			}
 		} else if (0 == strcmp(prop_name, "getcontenttype")) {
 			if (S_ISDIR(sce->st.st_mode)) {
-				buffer_append_string(b, "<D:getcontenttype>httpd/unix-directory</D:getcontenttype>");
+				buffer_append_string_len(b, CONST_STR_LEN("<D:getcontenttype>httpd/unix-directory</D:getcontenttype>"));
 				found = 1;
 			} else if(S_ISREG(sce->st.st_mode)) {
 				for (k = 0; k < con->conf.mimetypes->used; k++) {
@@ -854,9 +858,9 @@
 					if (ds->key->used == 0) continue;
 
 					if (buffer_is_equal_right_len(dst->path, ds->key, ds->key->used - 1)) {
-						buffer_append_string(b,"<D:getcontenttype>");
+						buffer_append_string_len(b,CONST_STR_LEN("<D:getcontenttype>"));
 						buffer_append_string_buffer(b, ds->value);
-						buffer_append_string(b, "</D:getcontenttype>");
+						buffer_append_string_len(b, CONST_STR_LEN("</D:getcontenttype>"));
 						found = 1;
 
 						break;
@@ -864,26 +868,26 @@
 				}
 			}
 		} else if (0 == strcmp(prop_name, "creationdate")) {
-			buffer_append_string(b, "<D:creationdate ns0:dt=\"dateTime.tz\">");
+			buffer_append_string_len(b, CONST_STR_LEN("<D:creationdate ns0:dt=\"dateTime.tz\">"));
 			strftime(ctime_buf, sizeof(ctime_buf), "%Y-%m-%dT%H:%M:%SZ", gmtime(&(sce->st.st_ctime)));
 			buffer_append_string(b, ctime_buf);
-			buffer_append_string(b, "</D:creationdate>");
+			buffer_append_string_len(b, CONST_STR_LEN("</D:creationdate>"));
 			found = 1;
 		} else if (0 == strcmp(prop_name, "getlastmodified")) {
-			buffer_append_string(b,"<D:getlastmodified ns0:dt=\"dateTime.rfc1123\">");
+			buffer_append_string_len(b,CONST_STR_LEN("<D:getlastmodified ns0:dt=\"dateTime.rfc1123\">"));
 			strftime(mtime_buf, sizeof(mtime_buf), "%a, %d %b %Y %H:%M:%S GMT", gmtime(&(sce->st.st_mtime)));
 			buffer_append_string(b, mtime_buf);
-			buffer_append_string(b, "</D:getlastmodified>");
+			buffer_append_string_len(b, CONST_STR_LEN("</D:getlastmodified>"));
 			found = 1;
 		} else if (0 == strcmp(prop_name, "getcontentlength")) {
-			buffer_append_string(b,"<D:getcontentlength>");
+			buffer_append_string_len(b,CONST_STR_LEN("<D:getcontentlength>"));
 			buffer_append_off_t(b, sce->st.st_size);
-			buffer_append_string(b, "</D:getcontentlength>");
+			buffer_append_string_len(b, CONST_STR_LEN("</D:getcontentlength>"));
 			found = 1;
 		} else if (0 == strcmp(prop_name, "getcontentlanguage")) {
-			buffer_append_string(b,"<D:getcontentlanguage>");
-			buffer_append_string(b, "en");
-			buffer_append_string(b, "</D:getcontentlanguage>");
+			buffer_append_string_len(b,CONST_STR_LEN("<D:getcontentlanguage>"));
+			buffer_append_string_len(b, CONST_STR_LEN("en"));
+			buffer_append_string_len(b, CONST_STR_LEN("</D:getcontentlanguage>"));
 			found = 1;
 		}
 	}
@@ -1022,6 +1026,8 @@
 				if (MAP_FAILED == (c->file.mmap.start = mmap(0, c->file.length, PROT_READ, MAP_SHARED, c->file.fd, 0))) {
 					log_error_write(srv, __FILE__, __LINE__, "ssbd", "mmap failed: ",
 							strerror(errno), c->file.name,  c->file.fd);
+					close(c->file.fd);
+					c->file.fd = -1;
 
 					return -1;
 				}
@@ -1103,44 +1109,44 @@
 
 	b = chunkqueue_get_append_buffer(con->write_queue);
 
-	buffer_copy_string(b, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
+	buffer_copy_string_len(b, CONST_STR_LEN("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
 
-	buffer_append_string(b,"<D:prop xmlns:D=\"DAV:\" xmlns:ns0=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\">\n");
-	buffer_append_string(b,"<D:lockdiscovery>\n");
-	buffer_append_string(b,"<D:activelock>\n");
+	buffer_append_string_len(b,CONST_STR_LEN("<D:prop xmlns:D=\"DAV:\" xmlns:ns0=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\">\n"));
+	buffer_append_string_len(b,CONST_STR_LEN("<D:lockdiscovery>\n"));
+	buffer_append_string_len(b,CONST_STR_LEN("<D:activelock>\n"));
 
-	buffer_append_string(b,"<D:lockscope>");
-	buffer_append_string(b,"<D:");
+	buffer_append_string_len(b,CONST_STR_LEN("<D:lockscope>"));
+	buffer_append_string_len(b,CONST_STR_LEN("<D:"));
 	buffer_append_string(b, lockscope);
-	buffer_append_string(b, "/>");
-	buffer_append_string(b,"</D:lockscope>\n");
+	buffer_append_string_len(b, CONST_STR_LEN("/>"));
+	buffer_append_string_len(b,CONST_STR_LEN("</D:lockscope>\n"));
 
-	buffer_append_string(b,"<D:locktype>");
-	buffer_append_string(b,"<D:");
+	buffer_append_string_len(b,CONST_STR_LEN("<D:locktype>"));
+	buffer_append_string_len(b,CONST_STR_LEN("<D:"));
 	buffer_append_string(b, locktype);
-	buffer_append_string(b, "/>");
-	buffer_append_string(b,"</D:locktype>\n");
+	buffer_append_string_len(b, CONST_STR_LEN("/>"));
+	buffer_append_string_len(b,CONST_STR_LEN("</D:locktype>\n"));
 
-	buffer_append_string(b,"<D:depth>");
+	buffer_append_string_len(b,CONST_STR_LEN("<D:depth>"));
 	buffer_append_string(b, depth == 0 ? "0" : "infinity");
-	buffer_append_string(b,"</D:depth>\n");
+	buffer_append_string_len(b,CONST_STR_LEN("</D:depth>\n"));
 
-	buffer_append_string(b,"<D:timeout>");
-	buffer_append_string(b, "Second-600");
-	buffer_append_string(b,"</D:timeout>\n");
+	buffer_append_string_len(b,CONST_STR_LEN("<D:timeout>"));
+	buffer_append_string_len(b, CONST_STR_LEN("Second-600"));
+	buffer_append_string_len(b,CONST_STR_LEN("</D:timeout>\n"));
 
-	buffer_append_string(b,"<D:owner>");
-	buffer_append_string(b,"</D:owner>\n");
+	buffer_append_string_len(b,CONST_STR_LEN("<D:owner>"));
+	buffer_append_string_len(b,CONST_STR_LEN("</D:owner>\n"));
 
-	buffer_append_string(b,"<D:locktoken>");
-	buffer_append_string(b, "<D:href>");
+	buffer_append_string_len(b,CONST_STR_LEN("<D:locktoken>"));
+	buffer_append_string_len(b, CONST_STR_LEN("<D:href>"));
 	buffer_append_string_buffer(b, locktoken);
-	buffer_append_string(b, "</D:href>");
-	buffer_append_string(b,"</D:locktoken>\n");
+	buffer_append_string_len(b, CONST_STR_LEN("</D:href>"));
+	buffer_append_string_len(b,CONST_STR_LEN("</D:locktoken>\n"));
 
-	buffer_append_string(b,"</D:activelock>\n");
-	buffer_append_string(b,"</D:lockdiscovery>\n");
-	buffer_append_string(b,"</D:prop>\n");
+	buffer_append_string_len(b,CONST_STR_LEN("</D:activelock>\n"));
+	buffer_append_string_len(b,CONST_STR_LEN("</D:lockdiscovery>\n"));
+	buffer_append_string_len(b,CONST_STR_LEN("</D:prop>\n"));
 
 	return 0;
 }
@@ -1155,6 +1161,7 @@
 
 #ifdef USE_LOCKS
 	data_string *ds;
+	UNUSED(srv);
 
 	/**
 	 * This implementation is more fake than real
@@ -1192,6 +1199,11 @@
 			has_lock = 0;
 		}
 	}
+#else
+	UNUSED(srv);
+	UNUSED(con);
+	UNUSED(p);
+	UNUSED(uri);
 #endif
 
 	return has_lock;
@@ -1334,9 +1346,9 @@
 
 		b = chunkqueue_get_append_buffer(con->write_queue);
 
-		buffer_copy_string(b, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
+		buffer_copy_string_len(b, CONST_STR_LEN("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
 
-		buffer_append_string(b,"<D:multistatus xmlns:D=\"DAV:\" xmlns:ns0=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\">\n");
+		buffer_append_string_len(b,CONST_STR_LEN("<D:multistatus xmlns:D=\"DAV:\" xmlns:ns0=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\">\n"));
 
 		/* allprop */
 
@@ -1348,40 +1360,40 @@
 			/* Depth: 0 */
 			webdav_get_props(srv, con, p, &(con->physical), req_props, prop_200, prop_404);
 
-			buffer_append_string(b,"<D:response>\n");
-			buffer_append_string(b,"<D:href>");
+			buffer_append_string_len(b,CONST_STR_LEN("<D:response>\n"));
+			buffer_append_string_len(b,CONST_STR_LEN("<D:href>"));
 			buffer_append_string_buffer(b, con->uri.scheme);
-			buffer_append_string(b,"://");
+			buffer_append_string_len(b,CONST_STR_LEN("://"));
 			buffer_append_string_buffer(b, con->uri.authority);
 			buffer_append_string_encoded(b, CONST_BUF_LEN(con->uri.path), ENCODING_REL_URI);
-			buffer_append_string(b,"</D:href>\n");
+			buffer_append_string_len(b,CONST_STR_LEN("</D:href>\n"));
 
 			if (!buffer_is_empty(prop_200)) {
-				buffer_append_string(b,"<D:propstat>\n");
-				buffer_append_string(b,"<D:prop>\n");
+				buffer_append_string_len(b,CONST_STR_LEN("<D:propstat>\n"));
+				buffer_append_string_len(b,CONST_STR_LEN("<D:prop>\n"));
 
 				buffer_append_string_buffer(b, prop_200);
 
-				buffer_append_string(b,"</D:prop>\n");
+				buffer_append_string_len(b,CONST_STR_LEN("</D:prop>\n"));
 
-				buffer_append_string(b,"<D:status>HTTP/1.1 200 OK</D:status>\n");
+				buffer_append_string_len(b,CONST_STR_LEN("<D:status>HTTP/1.1 200 OK</D:status>\n"));
 
-				buffer_append_string(b,"</D:propstat>\n");
+				buffer_append_string_len(b,CONST_STR_LEN("</D:propstat>\n"));
 			}
 			if (!buffer_is_empty(prop_404)) {
-				buffer_append_string(b,"<D:propstat>\n");
-				buffer_append_string(b,"<D:prop>\n");
+				buffer_append_string_len(b,CONST_STR_LEN("<D:propstat>\n"));
+				buffer_append_string_len(b,CONST_STR_LEN("<D:prop>\n"));
 
 				buffer_append_string_buffer(b, prop_404);
 
-				buffer_append_string(b,"</D:prop>\n");
+				buffer_append_string_len(b,CONST_STR_LEN("</D:prop>\n"));
 
-				buffer_append_string(b,"<D:status>HTTP/1.1 404 Not Found</D:status>\n");
+				buffer_append_string_len(b,CONST_STR_LEN("<D:status>HTTP/1.1 404 Not Found</D:status>\n"));
 
-				buffer_append_string(b,"</D:propstat>\n");
+				buffer_append_string_len(b,CONST_STR_LEN("</D:propstat>\n"));
 			}
 
-			buffer_append_string(b,"</D:response>\n");
+			buffer_append_string_len(b,CONST_STR_LEN("</D:response>\n"));
 
 			break;
 		case 1:
@@ -1417,40 +1429,40 @@
 
 					webdav_get_props(srv, con, p, &d, req_props, prop_200, prop_404);
 
-					buffer_append_string(b,"<D:response>\n");
-					buffer_append_string(b,"<D:href>");
+					buffer_append_string_len(b,CONST_STR_LEN("<D:response>\n"));
+					buffer_append_string_len(b,CONST_STR_LEN("<D:href>"));
 					buffer_append_string_buffer(b, con->uri.scheme);
-					buffer_append_string(b,"://");
+					buffer_append_string_len(b,CONST_STR_LEN("://"));
 					buffer_append_string_buffer(b, con->uri.authority);
 					buffer_append_string_encoded(b, CONST_BUF_LEN(d.rel_path), ENCODING_REL_URI);
-					buffer_append_string(b,"</D:href>\n");
+					buffer_append_string_len(b,CONST_STR_LEN("</D:href>\n"));
 
 					if (!buffer_is_empty(prop_200)) {
-						buffer_append_string(b,"<D:propstat>\n");
-						buffer_append_string(b,"<D:prop>\n");
+						buffer_append_string_len(b,CONST_STR_LEN("<D:propstat>\n"));
+						buffer_append_string_len(b,CONST_STR_LEN("<D:prop>\n"));
 
 						buffer_append_string_buffer(b, prop_200);
 
-						buffer_append_string(b,"</D:prop>\n");
+						buffer_append_string_len(b,CONST_STR_LEN("</D:prop>\n"));
 
-						buffer_append_string(b,"<D:status>HTTP/1.1 200 OK</D:status>\n");
+						buffer_append_string_len(b,CONST_STR_LEN("<D:status>HTTP/1.1 200 OK</D:status>\n"));
 
-						buffer_append_string(b,"</D:propstat>\n");
+						buffer_append_string_len(b,CONST_STR_LEN("</D:propstat>\n"));
 					}
 					if (!buffer_is_empty(prop_404)) {
-						buffer_append_string(b,"<D:propstat>\n");
-						buffer_append_string(b,"<D:prop>\n");
+						buffer_append_string_len(b,CONST_STR_LEN("<D:propstat>\n"));
+						buffer_append_string_len(b,CONST_STR_LEN("<D:prop>\n"));
 
 						buffer_append_string_buffer(b, prop_404);
 
-						buffer_append_string(b,"</D:prop>\n");
+						buffer_append_string_len(b,CONST_STR_LEN("</D:prop>\n"));
 
-						buffer_append_string(b,"<D:status>HTTP/1.1 404 Not Found</D:status>\n");
+						buffer_append_string_len(b,CONST_STR_LEN("<D:status>HTTP/1.1 404 Not Found</D:status>\n"));
 
-						buffer_append_string(b,"</D:propstat>\n");
+						buffer_append_string_len(b,CONST_STR_LEN("</D:propstat>\n"));
 					}
 
-					buffer_append_string(b,"</D:response>\n");
+					buffer_append_string_len(b,CONST_STR_LEN("</D:response>\n"));
 				}
 				closedir(dir);
 				buffer_free(d.path);
@@ -1473,7 +1485,7 @@
 		buffer_free(prop_200);
 		buffer_free(prop_404);
 
-		buffer_append_string(b,"</D:multistatus>\n");
+		buffer_append_string_len(b,CONST_STR_LEN("</D:multistatus>\n"));
 
 		if (p->conf.log_xml) {
 			log_error_write(srv, __FILE__, __LINE__, "sb", "XML-response-body:", b);
@@ -1548,13 +1560,13 @@
 
 				b = chunkqueue_get_append_buffer(con->write_queue);
 
-				buffer_copy_string(b, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
+				buffer_copy_string_len(b, CONST_STR_LEN("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
 
-				buffer_append_string(b,"<D:multistatus xmlns:D=\"DAV:\">\n");
+				buffer_append_string_len(b,CONST_STR_LEN("<D:multistatus xmlns:D=\"DAV:\">\n"));
 
 				buffer_append_string_buffer(b, multi_status_resp);
 
-				buffer_append_string(b,"</D:multistatus>\n");
+				buffer_append_string_len(b,CONST_STR_LEN("</D:multistatus>\n"));
 
 				if (p->conf.log_xml) {
 					log_error_write(srv, __FILE__, __LINE__, "sb", "XML-response-body:", b);
@@ -1713,6 +1725,8 @@
 					if (MAP_FAILED == (c->file.mmap.start = mmap(0, c->file.length, PROT_READ, MAP_SHARED, c->file.fd, 0))) {
 						log_error_write(srv, __FILE__, __LINE__, "ssbd", "mmap failed: ",
 								strerror(errno), c->file.name,  c->file.fd);
+						close(c->file.fd);
+						c->file.fd = -1;
 
 						return HANDLER_ERROR;
 					}
@@ -2286,7 +2300,7 @@
 							uuid_generate(id);
 							uuid_unparse(id, uuid);
 
-							buffer_copy_string(p->tmp_buf, "opaquelocktoken:");
+							buffer_copy_string_len(p->tmp_buf, CONST_STR_LEN("opaquelocktoken:"));
 							buffer_append_string(p->tmp_buf, uuid);
 
 							/* "CREATE TABLE locks ("

Modified: lighttpd/trunk/src/network.c
===================================================================
--- lighttpd/trunk/src/network.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/network.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -494,7 +494,7 @@
 	b = buffer_init();
 
 	buffer_copy_string_buffer(b, srv->srvconf.bindhost);
-	buffer_append_string(b, ":");
+	buffer_append_string_len(b, CONST_STR_LEN(":"));
 	buffer_append_long(b, srv->srvconf.port);
 
 	if (0 != network_server_init(srv, b, srv->config_storage[0])) {

Modified: lighttpd/trunk/src/network_freebsd_sendfile.c
===================================================================
--- lighttpd/trunk/src/network_freebsd_sendfile.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/network_freebsd_sendfile.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -166,17 +166,17 @@
 			if (-1 == sendfile(c->file.fd, fd, offset, toSend, NULL, &r, 0)) {
 				switch(errno) {
 				case EAGAIN:
-					break;
+				case EINTR:
+					/* for EAGAIN/EINTR r still contains the sent bytes */
+					break; /* try again later */
+				case EPIPE:
 				case ENOTCONN:
 					return -2;
 				default:
 					log_error_write(srv, __FILE__, __LINE__, "ssd", "sendfile: ", strerror(errno), errno);
 					return -1;
 				}
-			}
-
-			if (r == 0) {
-				int oerrno = errno;
+			} else if (r == 0) {
 				/* We got an event to write but we wrote nothing
 				 *
 				 * - the file shrinked -> error
@@ -189,12 +189,9 @@
 
 				if (offset >= sce->st.st_size) {
 					/* file shrinked, close the connection */
-					errno = oerrno;
-
 					return -1;
 				}
 
-				errno = oerrno;
 				return -2;
 			}
 

Modified: lighttpd/trunk/src/network_openssl.c
===================================================================
--- lighttpd/trunk/src/network_openssl.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/network_openssl.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -85,6 +85,7 @@
 			 *
 			 */
 
+			ERR_clear_error();
 			if ((r = SSL_write(ssl, offset, toSend)) <= 0) {
 				unsigned long err;
 
@@ -187,6 +188,7 @@
 
 				close(ifd);
 
+				ERR_clear_error();
 				if ((r = SSL_write(ssl, s, toSend)) <= 0) {
 					unsigned long err;
 

Modified: lighttpd/trunk/src/plugin.c
===================================================================
--- lighttpd/trunk/src/plugin.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/plugin.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -131,12 +131,12 @@
 
 		buffer_copy_string_buffer(srv->tmp_buf, srv->srvconf.modules_dir);
 
-		buffer_append_string(srv->tmp_buf, "/");
+		buffer_append_string_len(srv->tmp_buf, CONST_STR_LEN("/"));
 		buffer_append_string(srv->tmp_buf, modules);
 #if defined(__WIN32) || defined(__CYGWIN__)
-		buffer_append_string(srv->tmp_buf, ".dll");
+		buffer_append_string_len(srv->tmp_buf, CONST_STR_LEN(".dll"));
 #else
-		buffer_append_string(srv->tmp_buf, ".so");
+		buffer_append_string_len(srv->tmp_buf, CONST_STR_LEN(".so"));
 #endif
 
 		p = plugin_init();
@@ -173,7 +173,7 @@
 #endif
 		buffer_reset(srv->tmp_buf);
 		buffer_copy_string(srv->tmp_buf, modules);
-		buffer_append_string(srv->tmp_buf, "_plugin_init");
+		buffer_append_string_len(srv->tmp_buf, CONST_STR_LEN("_plugin_init"));
 
 #ifdef __WIN32
 		init = GetProcAddress(p->lib, srv->tmp_buf->ptr);
@@ -197,7 +197,7 @@
 
 #else
 #if 1
-		init = (int (*)(plugin *))dlsym(p->lib, srv->tmp_buf->ptr);
+		init = (int (*)(plugin *))(intptr_t)dlsym(p->lib, srv->tmp_buf->ptr);
 #else
 		*(void **)(&init) = dlsym(p->lib, srv->tmp_buf->ptr);
 #endif

Modified: lighttpd/trunk/src/proc_open.c
===================================================================
--- lighttpd/trunk/src/proc_open.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/proc_open.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -184,7 +184,7 @@
 		buffer_append_string(cmdline, shell);
 	} else {
 		buffer_append_string(cmdline, windir);
-		buffer_append_string(cmdline, "\\system32\\cmd.exe");
+		buffer_append_string_len(cmdline, CONST_STR_LEN("\\system32\\cmd.exe"));
 	}
 	buffer_append_string_len(cmdline, CONST_STR_LEN(" /c "));
 	buffer_append_string(cmdline, command);
@@ -287,32 +287,33 @@
 }
 /* }}} */
 /* {{{ proc_open_buffer */
-int proc_open_buffer(proc_handler_t *proc, const char *command, buffer *in, buffer *out, buffer *err) {
+int proc_open_buffer(const char *command, buffer *in, buffer *out, buffer *err) {
+	proc_handler_t proc;
 
-	UNUSED(err);
-
-	if (proc_open(proc, command) != 0) {
+	if (proc_open(&proc, command) != 0) {
 		return -1;
 	}
 
 	if (in) {
-		if (write(proc->in.fd, (void *)in->ptr, in->used) < 0) {
+		if (write(proc.in.fd, (void *)in->ptr, in->used) < 0) {
 			perror("error writing pipe");
 			return -1;
 		}
 	}
-	pipe_close(&proc->in);
+	pipe_close(&proc.in);
 
 	if (out) {
-		proc_read_fd_to_buffer(proc->out.fd, out);
+		proc_read_fd_to_buffer(proc.out.fd, out);
 	}
-	pipe_close(&proc->out);
+	pipe_close(&proc.out);
 
 	if (err) {
-		proc_read_fd_to_buffer(proc->err.fd, err);
+		proc_read_fd_to_buffer(proc.err.fd, err);
 	}
-	pipe_close(&proc->err);
+	pipe_close(&proc.err);
 
+	proc_close(&proc);
+
 	return 0;
 }
 /* }}} */
@@ -366,7 +367,7 @@
 		RESET();
 
 		fprintf(stdout, "test: echo 321 with read\n"); fflush(stdout);
-		if (proc_open_buffer(&proc, "echo 321", NULL, out, err) != 0) {
+		if (proc_open_buffer("echo 321", NULL, out, err) != 0) {
 			ERROR_OUT();
 		}
 		fprintf(stdout, "result: ->%s<-\n\n", out->ptr); fflush(stdout);
@@ -374,7 +375,7 @@
 
 		fprintf(stdout, "test: echo 123 | " CMD_CAT "\n"); fflush(stdout);
 		buffer_copy_string_len(in, CONST_STR_LEN("123\n"));
-		if (proc_open_buffer(&proc, CMD_CAT, in, out, err) != 0) {
+		if (proc_open_buffer(CMD_CAT, in, out, err) != 0) {
 			ERROR_OUT();
 		}
 		fprintf(stdout, "result: ->%s<-\n\n", out->ptr); fflush(stdout);

Modified: lighttpd/trunk/src/proc_open.h
===================================================================
--- lighttpd/trunk/src/proc_open.h	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/proc_open.h	2009-03-18 10:20:09 UTC (rev 355)
@@ -22,4 +22,4 @@
 
 int proc_close(proc_handler_t *ht);
 int proc_open(proc_handler_t *ht, const char *command);
-int proc_open_buffer(proc_handler_t *ht, const char *command, buffer *in, buffer *out, buffer *err);
+int proc_open_buffer(const char *command, buffer *in, buffer *out, buffer *err);

Modified: lighttpd/trunk/src/request.c
===================================================================
--- lighttpd/trunk/src/request.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/request.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -825,6 +825,7 @@
 												"request-header:\n",
 												con->request.request);
 									}
+									array_insert_unique(con->request.headers, (data_unset *)ds);
 									return 0;
 								}
 
@@ -874,6 +875,7 @@
 												"request-header:\n",
 												con->request.request);
 									}
+									array_insert_unique(con->request.headers, (data_unset *)ds);
 									return 0;
 								}
 							} else if (cmp > 0 && 0 == (cmp = buffer_caseless_compare(CONST_BUF_LEN(ds->key), CONST_STR_LEN("Expect")))) {
@@ -892,11 +894,12 @@
 								 *
 								 */
 
-								con->http_status = 417;
-								con->keep_alive = 0;
-
-								array_insert_unique(con->request.headers, (data_unset *)ds);
-								return 0;
+								if (srv->srvconf.reject_expect_100_with_417 && 0 == buffer_caseless_compare(CONST_BUF_LEN(ds->value), CONST_STR_LEN("100-continue"))) {
+									con->http_status = 417;
+									con->keep_alive = 0;
+									array_insert_unique(con->request.headers, (data_unset *)ds);
+									return 0;
+								}
 							} else if (cmp > 0 && 0 == (cmp = buffer_caseless_compare(CONST_BUF_LEN(ds->key), CONST_STR_LEN("Host")))) {
 								if (!con->request.http_host) {
 									con->request.http_host = ds->value;
@@ -911,6 +914,7 @@
 												"request-header:\n",
 												con->request.request);
 									}
+									array_insert_unique(con->request.headers, (data_unset *)ds);
 									return 0;
 								}
 							} else if (cmp > 0 && 0 == (cmp = buffer_caseless_compare(CONST_BUF_LEN(ds->key), CONST_STR_LEN("If-Modified-Since")))) {
@@ -936,6 +940,7 @@
 												"request-header:\n",
 												con->request.request);
 									}
+									array_insert_unique(con->request.headers, (data_unset *)ds);
 									return 0;
 								}
 							} else if (cmp > 0 && 0 == (cmp = buffer_caseless_compare(CONST_BUF_LEN(ds->key), CONST_STR_LEN("If-None-Match")))) {
@@ -953,6 +958,7 @@
 												"request-header:\n",
 												con->request.request);
 									}
+									array_insert_unique(con->request.headers, (data_unset *)ds);
 									return 0;
 								}
 							} else if (cmp > 0 && 0 == (cmp = buffer_caseless_compare(CONST_BUF_LEN(ds->key), CONST_STR_LEN("Range")))) {
@@ -976,6 +982,7 @@
 												"request-header:\n",
 												con->request.request);
 									}
+									array_insert_unique(con->request.headers, (data_unset *)ds);
 									return 0;
 								}
 							}
@@ -1014,7 +1021,7 @@
 				/* strip leading WS */
 				if (value == cur) value = cur+1;
 			default:
-				if (*cur >= 0 && *cur < 32) {
+				if (*cur >= 0 && *cur < 32 && *cur != '\t') {
 					if (srv->srvconf.log_request_header_on_error) {
 						log_error_write(srv, __FILE__, __LINE__, "sds",
 								"invalid char in header", (int)*cur, "-> 400");
@@ -1129,8 +1136,8 @@
 			con->http_status = 413;
 			con->keep_alive = 0;
 
-			log_error_write(srv, __FILE__, __LINE__, "sds",
-					"request-size too long:", con->request.content_length, "-> 413");
+			log_error_write(srv, __FILE__, __LINE__, "sos",
+					"request-size too long:", (off_t) con->request.content_length, "-> 413");
 			return 0;
 		}
 
@@ -1144,8 +1151,8 @@
 			con->http_status = 413;
 			con->keep_alive = 0;
 
-			log_error_write(srv, __FILE__, __LINE__, "sds",
-					"request-size too long:", con->request.content_length, "-> 413");
+			log_error_write(srv, __FILE__, __LINE__, "sos",
+					"request-size too long:", (off_t) con->request.content_length, "-> 413");
 			return 0;
 		}
 

Modified: lighttpd/trunk/src/response.c
===================================================================
--- lighttpd/trunk/src/response.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/response.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -35,21 +35,24 @@
 	b = chunkqueue_get_prepend_buffer(con->write_queue);
 
 	if (con->request.http_version == HTTP_VERSION_1_1) {
-		BUFFER_COPY_STRING_CONST(b, "HTTP/1.1 ");
+		buffer_copy_string_len(b, CONST_STR_LEN("HTTP/1.1 "));
 	} else {
-		BUFFER_COPY_STRING_CONST(b, "HTTP/1.0 ");
+		buffer_copy_string_len(b, CONST_STR_LEN("HTTP/1.0 "));
 	}
 	buffer_append_long(b, con->http_status);
-	BUFFER_APPEND_STRING_CONST(b, " ");
+	buffer_append_string_len(b, CONST_STR_LEN(" "));
 	buffer_append_string(b, get_http_status_name(con->http_status));
 
 	if (con->request.http_version != HTTP_VERSION_1_1 || con->keep_alive == 0) {
-		BUFFER_APPEND_STRING_CONST(b, "\r\nConnection: ");
-		buffer_append_string(b, con->keep_alive ? "keep-alive" : "close");
+		if (con->keep_alive) {
+			response_header_overwrite(srv, con, CONST_STR_LEN("Connection"), CONST_STR_LEN("keep-alive"));
+		} else {
+			response_header_overwrite(srv, con, CONST_STR_LEN("Connection"), CONST_STR_LEN("close"));
+		}
 	}
 
 	if (con->response.transfer_encoding & HTTP_TRANSFER_ENCODING_CHUNKED) {
-		BUFFER_APPEND_STRING_CONST(b, "\r\nTransfer-Encoding: chunked");
+		response_header_overwrite(srv, con, CONST_STR_LEN("Transfer-Encoding"), CONST_STR_LEN("chunked"));
 	}
 
 
@@ -60,14 +63,15 @@
 		ds = (data_string *)con->response.headers->data[i];
 
 		if (ds->value->used && ds->key->used &&
-		    0 != strncmp(ds->key->ptr, "X-LIGHTTPD-", sizeof("X-LIGHTTPD-") - 1) &&
-			0 != strncmp(ds->key->ptr, "X-Sendfile", sizeof("X-Sendfile") - 1)) {
-			if (buffer_is_equal_string(ds->key, CONST_STR_LEN("Date"))) have_date = 1;
-			if (buffer_is_equal_string(ds->key, CONST_STR_LEN("Server"))) have_server = 1;
+		    0 != strncasecmp(ds->key->ptr, CONST_STR_LEN("X-LIGHTTPD-")) &&
+			0 != strcasecmp(ds->key->ptr, "X-Sendfile")) {
+			if (0 == strcasecmp(ds->key->ptr, "Date")) have_date = 1;
+			if (0 == strcasecmp(ds->key->ptr, "Server")) have_server = 1;
+			if (0 == strcasecmp(ds->key->ptr, "Content-Encoding") && 304 == con->http_status) continue;
 
-			BUFFER_APPEND_STRING_CONST(b, "\r\n");
+			buffer_append_string_len(b, CONST_STR_LEN("\r\n"));
 			buffer_append_string_buffer(b, ds->key);
-			BUFFER_APPEND_STRING_CONST(b, ": ");
+			buffer_append_string_len(b, CONST_STR_LEN(": "));
 #if 0
 			/** 
 			 * the value might contain newlines, encode them with at least one white-space
@@ -81,7 +85,7 @@
 
 	if (!have_date) {
 		/* HTTP/1.1 requires a Date: header */
-		BUFFER_APPEND_STRING_CONST(b, "\r\nDate: ");
+		buffer_append_string_len(b, CONST_STR_LEN("\r\nDate: "));
 
 		/* cache the generated timestamp */
 		if (srv->cur_ts != srv->last_generated_date_ts) {
@@ -100,14 +104,14 @@
 
 	if (!have_server) {
 		if (buffer_is_empty(con->conf.server_tag)) {
-			BUFFER_APPEND_STRING_CONST(b, "\r\nServer: " PACKAGE_NAME "/" PACKAGE_VERSION);
-		} else {
-			BUFFER_APPEND_STRING_CONST(b, "\r\nServer: ");
+			buffer_append_string_len(b, CONST_STR_LEN("\r\nServer: " PACKAGE_NAME "/" PACKAGE_VERSION));
+		} else if (con->conf.server_tag->used > 1) {
+			buffer_append_string_len(b, CONST_STR_LEN("\r\nServer: "));
 			buffer_append_string_encoded(b, CONST_BUF_LEN(con->conf.server_tag), ENCODING_HTTP_HEADER);
 		}
 	}
 
-	BUFFER_APPEND_STRING_CONST(b, "\r\n\r\n");
+	buffer_append_string_len(b, CONST_STR_LEN("\r\n\r\n"));
 
 
 	con->bytes_header = b->used - 1;
@@ -152,7 +156,7 @@
 		 *  */
 
 		config_cond_cache_reset(srv, con);
-		config_setup_connection(srv, con); // Perhaps this could be removed at other places.
+		config_setup_connection(srv, con); /* Perhaps this could be removed at other places. */
 
 		if (con->conf.log_condition_handling) {
 			log_error_write(srv, __FILE__, __LINE__,  "s",  "run condition");
@@ -181,7 +185,11 @@
 		 *
 		 */
 
-		buffer_copy_string(con->uri.scheme, con->conf.is_ssl ? "https" : "http");
+		if (con->conf.is_ssl) {
+			buffer_copy_string_len(con->uri.scheme, CONST_STR_LEN("https"));
+		} else {
+			buffer_copy_string_len(con->uri.scheme, CONST_STR_LEN("http"));
+		}
 		buffer_copy_string_buffer(con->uri.authority, con->request.http_host);
 		buffer_to_lower(con->uri.authority);
 
@@ -190,6 +198,7 @@
 		config_patch_connection(srv, con, COMP_HTTP_REMOTE_IP); /* Client-IP */
 		config_patch_connection(srv, con, COMP_HTTP_REFERER);   /* Referer:     */
 		config_patch_connection(srv, con, COMP_HTTP_USER_AGENT);/* User-Agent:  */
+		config_patch_connection(srv, con, COMP_HTTP_LANGUAGE);  /* Accept-Language:  */
 		config_patch_connection(srv, con, COMP_HTTP_COOKIE);    /* Cookie:  */
 		config_patch_connection(srv, con, COMP_HTTP_REQUEST_METHOD); /* REQUEST_METHOD */
 

Modified: lighttpd/trunk/src/server.c
===================================================================
--- lighttpd/trunk/src/server.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/server.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -75,12 +75,15 @@
 static volatile siginfo_t last_sighup_info;
 
 static void sigaction_handler(int sig, siginfo_t *si, void *context) {
+	static siginfo_t empty_siginfo;
 	UNUSED(context);
 
+	if (!si) si = &empty_siginfo;
+
 	switch (sig) {
 	case SIGTERM:
 		srv_shutdown = 1;
-		memcpy(&last_sigterm_info, si, sizeof(*si));
+		last_sigterm_info = *si;
 		break;
 	case SIGINT:
 		if (graceful_shutdown) {
@@ -88,7 +91,7 @@
 		} else {
 			graceful_shutdown = 1;
 		}
-		memcpy(&last_sigterm_info, si, sizeof(*si));
+		last_sigterm_info = *si;
 
 		break;
 	case SIGALRM: 
@@ -104,7 +107,7 @@
 		 */
 		if (!forwarded_sig_hup) {
 			handle_sig_hup = 1;
-			memcpy(&last_sighup_info, si, sizeof(*si));
+			last_sighup_info = *si;
 		} else {
 			forwarded_sig_hup = 0;
 		}
@@ -210,6 +213,7 @@
 	srv->srvconf.modules_dir = buffer_init_string(LIBRARY_DIR);
 	srv->srvconf.network_backend = buffer_init();
 	srv->srvconf.upload_tempdirs = array_init();
+	srv->srvconf.reject_expect_100_with_417 = 1;
 
 	/* use syslog */
 	srv->errorlog_fd = -1;
@@ -573,20 +577,9 @@
 	}
 
 	/* close stdin and stdout, as they are not needed */
-	/* move stdin to /dev/null */
-	if (-1 != (fd = open("/dev/null", O_RDONLY))) {
-		close(STDIN_FILENO);
-		dup2(fd, STDIN_FILENO);
-		close(fd);
-	}
+	openDevNull(STDIN_FILENO);
+	openDevNull(STDOUT_FILENO);
 
-	/* move stdout to /dev/null */
-	if (-1 != (fd = open("/dev/null", O_WRONLY))) {
-		close(STDOUT_FILENO);
-		dup2(fd, STDOUT_FILENO);
-		close(fd);
-	}
-
 	if (0 != config_set_defaults(srv)) {
 		log_error_write(srv, __FILE__, __LINE__, "s",
 				"setting default values failed");
@@ -855,15 +848,16 @@
 	}
 
 	/* set max-conns */
-	if (srv->srvconf.max_conns > srv->max_fds) {
-		/* we can't have more connections than max-fds */
-		srv->max_conns = srv->max_fds;
+	if (srv->srvconf.max_conns > srv->max_fds/2) {
+		/* we can't have more connections than max-fds/2 */
+		log_error_write(srv, __FILE__, __LINE__, "sdd", "can't have more connections than fds/2: ", srv->srvconf.max_conns, srv->max_fds);
+		srv->max_conns = srv->max_fds/2;
 	} else if (srv->srvconf.max_conns) {
 		/* otherwise respect the wishes of the user */
 		srv->max_conns = srv->srvconf.max_conns;
 	} else {
-		/* or use the default */
-		srv->max_conns = srv->max_fds;
+		/* or use the default: we really don't want to hit max-fds */
+		srv->max_conns = srv->max_fds/3;
 	}
 
 	if (HANDLER_GO_ON != plugins_call_init(srv)) {
@@ -887,14 +881,14 @@
 	/* write pid file */
 	if (pid_fd != -1) {
 		buffer_copy_long(srv->tmp_buf, getpid());
-		buffer_append_string(srv->tmp_buf, "\n");
+		buffer_append_string_len(srv->tmp_buf, CONST_STR_LEN("\n"));
 		write(pid_fd, srv->tmp_buf->ptr, srv->tmp_buf->used - 1);
 		close(pid_fd);
 		pid_fd = -1;
 	}
 
-	// Close stderr ASAP in the child process to make sure that nothing
-	// is being written to that fd which may not be valid anymore.
+	/* Close stderr ASAP in the child process to make sure that nothing
+	 * is being written to that fd which may not be valid anymore. */
 	if (-1 == log_error_open(srv)) {
 		log_error_write(srv, __FILE__, __LINE__, "s", "Opening errorlog failed. Going down.");
 
@@ -1254,8 +1248,8 @@
 
 						if (srv->cur_ts - con->write_request_ts > con->conf.max_write_idle) {
 							/* time - out */
-#if 1
-							log_error_write(srv, __FILE__, __LINE__, "sbsosds",
+							if (con->conf.log_timeouts) {
+								log_error_write(srv, __FILE__, __LINE__, "sbsosds",
 									"NOTE: a request for",
 									con->request.uri,
 									"timed out after writing",
@@ -1263,7 +1257,7 @@
 									"bytes. We waited",
 									(int)con->conf.max_write_idle,
 									"seconds. If this a problem increase server.max-write-idle");
-#endif
+							}
 							connection_set_state(srv, con, CON_STATE_ERROR);
 							changed = 1;
 						}
@@ -1306,8 +1300,8 @@
 		if (srv->sockets_disabled) {
 			/* our server sockets are disabled, why ? */
 
-			if ((srv->cur_fds + srv->want_fds < srv->max_fds * 0.8) && /* we have enough unused fds */
-			    (srv->conns->used < srv->max_conns * 0.9) &&
+			if ((srv->cur_fds + srv->want_fds < srv->max_fds * 8 / 10) && /* we have enough unused fds */
+			    (srv->conns->used <= srv->max_conns * 9 / 10) &&
 			    (0 == graceful_shutdown)) {
 				for (i = 0; i < srv->srv_sockets.used; i++) {
 					server_socket *srv_socket = srv->srv_sockets.ptr[i];
@@ -1319,8 +1313,8 @@
 				srv->sockets_disabled = 0;
 			}
 		} else {
-			if ((srv->cur_fds + srv->want_fds > srv->max_fds * 0.9) || /* out of fds */
-			    (srv->conns->used > srv->max_conns) || /* out of connections */
+			if ((srv->cur_fds + srv->want_fds > srv->max_fds * 9 / 10) || /* out of fds */
+			    (srv->conns->used >= srv->max_conns) || /* out of connections */
 			    (graceful_shutdown)) { /* graceful_shutdown */
 
 				/* disable server-fds */
@@ -1359,7 +1353,7 @@
 
 				if (graceful_shutdown) {
 					log_error_write(srv, __FILE__, __LINE__, "s", "[note] graceful shutdown started");
-				} else if (srv->conns->used > srv->max_conns) {
+				} else if (srv->conns->used >= srv->max_conns) {
 					log_error_write(srv, __FILE__, __LINE__, "s", "[note] sockets disabled, connection limit reached");
 				} else {
 					log_error_write(srv, __FILE__, __LINE__, "s", "[note] sockets disabled, out-of-fds");

Modified: lighttpd/trunk/src/spawn-fcgi.c
===================================================================
--- lighttpd/trunk/src/spawn-fcgi.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/spawn-fcgi.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -37,9 +37,9 @@
 #endif
 
 #ifdef HAVE_SYS_UN_H
-int fcgi_spawn_connection(char *appPath, char **appArgv, char *addr, unsigned short port, const char *unixsocket, int child_count, int pid_fd, int nofork) {
+int fcgi_spawn_connection(char *appPath, char **appArgv, char *addr, unsigned short port, const char *unixsocket, int fork_count, int child_count, int pid_fd, int nofork) {
 	int fcgi_fd;
-	int socket_type, status;
+	int socket_type, status, rc = 0;
 	struct timeval tv = { 0, 100 * 1000 };
 
 	struct sockaddr_un fcgi_addr_un;
@@ -48,9 +48,6 @@
 
 	socklen_t servlen;
 
-	pid_t child;
-	int val;
-
 	if (child_count < 2) {
 		child_count = 5;
 	}
@@ -61,7 +58,7 @@
 
 
 	if (unixsocket) {
-		memset(&fcgi_addr, 0, sizeof(fcgi_addr));
+		memset(&fcgi_addr_un, 0, sizeof(fcgi_addr_un));
 
 		fcgi_addr_un.sun_family = AF_UNIX;
 		strcpy(fcgi_addr_un.sun_path, unixsocket);
@@ -74,32 +71,14 @@
 #endif
 		socket_type = AF_UNIX;
 		fcgi_addr = (struct sockaddr *) &fcgi_addr_un;
-
-		/* check if some backend is listening on the socket
-		 * as if we delete the socket-file and rebind there will be no "socket already in use" error
-		 */
-		if (-1 == (fcgi_fd = socket(socket_type, SOCK_STREAM, 0))) {
-			fprintf(stderr, "%s.%d\n",
-				__FILE__, __LINE__);
-			return -1;
-		}
-
-		if (-1 != connect(fcgi_fd, fcgi_addr, servlen)) {
-			fprintf(stderr, "%s.%d: socket is already used, can't spawn\n",
-				__FILE__, __LINE__);
-			return -1;
-		}
-
-		/* cleanup previous socket if it exists */
-		unlink(unixsocket);
-		close(fcgi_fd);
 	} else {
+		memset(&fcgi_addr_in, 0, sizeof(fcgi_addr_in));
 		fcgi_addr_in.sin_family = AF_INET;
-                if (addr != NULL) {
-                        fcgi_addr_in.sin_addr.s_addr = inet_addr(addr);
-                } else {
-                        fcgi_addr_in.sin_addr.s_addr = htonl(INADDR_ANY);
-                }
+		if (addr != NULL) {
+			fcgi_addr_in.sin_addr.s_addr = inet_addr(addr);
+		} else {
+			fcgi_addr_in.sin_addr.s_addr = htonl(INADDR_ANY);
+		}
 		fcgi_addr_in.sin_port = htons(port);
 		servlen = sizeof(fcgi_addr_in);
 
@@ -107,133 +86,176 @@
 		fcgi_addr = (struct sockaddr *) &fcgi_addr_in;
 	}
 
-	/* open socket */
 	if (-1 == (fcgi_fd = socket(socket_type, SOCK_STREAM, 0))) {
 		fprintf(stderr, "%s.%d\n",
 			__FILE__, __LINE__);
 		return -1;
 	}
 
-	val = 1;
-	if (setsockopt(fcgi_fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) < 0) {
-		fprintf(stderr, "%s.%d\n",
-			__FILE__, __LINE__);
-		return -1;
-	}
+	if (-1 == connect(fcgi_fd, fcgi_addr, servlen)) {
+		/* server is not up, spawn in  */
+		pid_t child;
+		int val;
 
-	/* create socket */
-	if (-1 == bind(fcgi_fd, fcgi_addr, servlen)) {
-		fprintf(stderr, "%s.%d: bind failed: %s\n",
-			__FILE__, __LINE__,
-			strerror(errno));
-		return -1;
-	}
+		if (unixsocket) unlink(unixsocket);
 
-	if (-1 == listen(fcgi_fd, 1024)) {
-		fprintf(stderr, "%s.%d: fd = -1\n",
-			__FILE__, __LINE__);
-		return -1;
-	}
+		close(fcgi_fd);
 
-	if (!nofork) {
-		child = fork();
-	} else {
-		child = 0;
-	}
+		/* reopen socket */
+		if (-1 == (fcgi_fd = socket(socket_type, SOCK_STREAM, 0))) {
+			fprintf(stderr, "%s.%d\n",
+				__FILE__, __LINE__);
+			return -1;
+		}
 
-	switch (child) {
-	case 0: {
-		char cgi_childs[64];
+		val = 1;
+		if (setsockopt(fcgi_fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) < 0) {
+			fprintf(stderr, "%s.%d\n",
+				__FILE__, __LINE__);
+			return -1;
+		}
 
-		int i = 0;
-
-		/* is safe as we limit to 256 childs */
-		sprintf(cgi_childs, "PHP_FCGI_CHILDREN=%d", child_count);
-
-		if(fcgi_fd != FCGI_LISTENSOCK_FILENO) {
-			close(FCGI_LISTENSOCK_FILENO);
-			dup2(fcgi_fd, FCGI_LISTENSOCK_FILENO);
-			close(fcgi_fd);
+		/* create socket */
+		if (-1 == bind(fcgi_fd, fcgi_addr, servlen)) {
+			fprintf(stderr, "%s.%d: bind failed: %s\n",
+				__FILE__, __LINE__,
+				strerror(errno));
+			return -1;
 		}
 
-		/* we don't need the client socket */
-		for (i = 3; i < 256; i++) {
-			close(i);
+		if (-1 == listen(fcgi_fd, 1024)) {
+			fprintf(stderr, "%s.%d: fd = -1\n",
+				__FILE__, __LINE__);
+			return -1;
 		}
 
-		/* create environment */
+		while (fork_count-- > 0) {
 
-		putenv(cgi_childs);
+			if (!nofork) {
+				child = fork();
+			} else {
+				child = 0;
+			}
 
-		/* fork and replace shell */
-		if (appArgv) {
-			execv(appArgv[0], appArgv);
+			switch (child) {
+			case 0: {
+				char cgi_childs[64];
+				int max_fd = 0;
 
-		} else {
-			char *b = malloc(strlen("exec ") + strlen(appPath) + 1);
-			strcpy(b, "exec ");
-			strcat(b, appPath);
+				int i = 0;
 
-			/* exec the cgi */
-			execl("/bin/sh", "sh", "-c", b, (char *)NULL);
-		}
+				/* loose control terminal */
+				setsid();
 
-		exit(errno);
+				/* is safe as we limit to 256 childs */
+				sprintf(cgi_childs, "PHP_FCGI_CHILDREN=%d", child_count);
 
-		break;
-	}
-	case -1:
-		/* error */
-		break;
-	default:
-		/* father */
+				if(fcgi_fd != FCGI_LISTENSOCK_FILENO) {
+					close(FCGI_LISTENSOCK_FILENO);
+					dup2(fcgi_fd, FCGI_LISTENSOCK_FILENO);
+					close(fcgi_fd);
+				}
 
-		/* wait */
-		select(0, NULL, NULL, NULL, &tv);
+				max_fd = open("/dev/null", O_RDWR);
+				close(STDERR_FILENO);
+				dup2(max_fd, STDERR_FILENO);
+				close(max_fd);
 
-		switch (waitpid(child, &status, WNOHANG)) {
-		case 0:
-			fprintf(stderr, "%s.%d: child spawned successfully: PID: %d\n",
-				__FILE__, __LINE__,
-				child);
+				max_fd = open("/dev/null", O_RDWR);
+				close(STDOUT_FILENO);
+				dup2(max_fd, STDOUT_FILENO);
+				close(max_fd);
 
-			/* write pid file */
-			if (pid_fd != -1) {
-				/* assume a 32bit pid_t */
-				char pidbuf[12];
+				/* we don't need the client socket */
+				for (i = 3; i < max_fd; i++) {
+					if (i != FCGI_LISTENSOCK_FILENO) close(i);
+				}
 
-				snprintf(pidbuf, sizeof(pidbuf) - 1, "%d", child);
+				/* create environment */
 
-				write(pid_fd, pidbuf, strlen(pidbuf));
-				close(pid_fd);
-				pid_fd = -1;
+				putenv(cgi_childs);
+
+				/* fork and replace shell */
+				if (appArgv) {
+					execv(appArgv[0], appArgv);
+
+				} else {
+					char *b = malloc(strlen("exec ") + strlen(appPath) + 1);
+					strcpy(b, "exec ");
+					strcat(b, appPath);
+
+					/* exec the cgi */
+					execl("/bin/sh", "sh", "-c", b, (char *)NULL);
+				}
+
+				exit(errno);
+
+				break;
 			}
+			case -1:
+				/* error */
+				break;
+			default:
+				/* father */
 
-			break;
-		case -1:
-			break;
-		default:
-			if (WIFEXITED(status)) {
-				fprintf(stderr, "%s.%d: child exited with: %d, %s\n",
-					__FILE__, __LINE__,
-					WEXITSTATUS(status), strerror(WEXITSTATUS(status)));
-			} else if (WIFSIGNALED(status)) {
-				fprintf(stderr, "%s.%d: child signaled: %d\n",
-					__FILE__, __LINE__,
-					WTERMSIG(status));
-			} else {
-				fprintf(stderr, "%s.%d: child died somehow: %d\n",
-					__FILE__, __LINE__,
-					status);
+				/* wait */
+				select(0, NULL, NULL, NULL, &tv);
+
+				switch (waitpid(child, &status, WNOHANG)) {
+				case 0:
+					fprintf(stdout, "%s.%d: child spawned successfully: PID: %d\n",
+						__FILE__, __LINE__,
+						child);
+
+					/* write pid file */
+					if (pid_fd != -1) {
+						/* assume a 32bit pid_t */
+						char pidbuf[12];
+
+						snprintf(pidbuf, sizeof(pidbuf) - 1, "%d", child);
+
+						write(pid_fd, pidbuf, strlen(pidbuf));
+						/* avoid eol for the last one */
+						if (fork_count != 0) {
+							write(pid_fd, "\n", 1);
+						}
+					}
+
+					break;
+				case -1:
+					break;
+				default:
+					if (WIFEXITED(status)) {
+						fprintf(stderr, "%s.%d: child exited with: %d\n",
+							__FILE__, __LINE__, WEXITSTATUS(status));
+						rc = WEXITSTATUS(status);
+					} else if (WIFSIGNALED(status)) {
+						fprintf(stderr, "%s.%d: child signaled: %d\n",
+							__FILE__, __LINE__,
+							WTERMSIG(status));
+						rc = 1;
+					} else {
+						fprintf(stderr, "%s.%d: child died somehow: %d\n",
+							__FILE__, __LINE__,
+							status);
+						rc = status;
+					}
+				}
+
+				break;
 			}
 		}
-
-		break;
+		close(pid_fd);
+		pid_fd = -1;
+	} else {
+		fprintf(stderr, "%s.%d: socket is already used, can't spawn\n",
+			__FILE__, __LINE__);
+		return -1;
 	}
 
 	close(fcgi_fd);
 
-	return 0;
+	return rc;
 }
 
 
@@ -256,6 +278,7 @@
 " -p <port>    bind to tcp-port\n" \
 " -s <path>    bind to unix-domain socket\n" \
 " -C <childs>  (PHP only) numbers of childs to spawn (default 5)\n" \
+" -F <childs>  numbers of childs to fork (default 1)\n" \
 " -P <path>    name of PID-file for spawed process\n" \
 " -n           no fork (for daemontools)\n" \
 " -v           show version\n" \
@@ -276,20 +299,21 @@
 	char **fcgi_app_argv = { NULL };
 	unsigned short port = 0;
 	int child_count = 5;
+	int fork_count = 1;
 	int i_am_root, o;
 	int pid_fd = -1;
 	int nofork = 0;
 	struct sockaddr_un un;
-	const size_t sun_path_len = sizeof(un.sun_path);
 
 	i_am_root = (getuid() == 0);
 
-	while(-1 != (o = getopt(argc, argv, "c:f:g:hna:p:u:vC:s:P:"))) {
+	while (-1 != (o = getopt(argc, argv, "c:f:g:hna:p:u:vC:F:s:P:"))) {
 		switch(o) {
 		case 'f': fcgi_app = optarg; break;
 		case 'a': addr = optarg;/* ip addr */ break;
 		case 'p': port = strtol(optarg, NULL, 10);/* port */ break;
 		case 'C': child_count = strtol(optarg, NULL, 10);/*  */ break;
+		case 'F': fork_count = strtol(optarg, NULL, 10);/*  */ break;
 		case 's': unixsocket = optarg; /* unix-domain socket */ break;
 		case 'c': if (i_am_root) { changeroot = optarg; }/* chroot() */ break;
 		case 'u': if (i_am_root) { username = optarg; } /* set user */ break;
@@ -321,7 +345,7 @@
 		return -1;
 	}
 
-	if (unixsocket && strlen(unixsocket) > sun_path_len - 1) {
+	if (unixsocket && strlen(unixsocket) > sizeof(un.sun_path) - 1) {
 		fprintf(stderr, "%s.%d: %s\n",
 			__FILE__, __LINE__,
 			"path of the unix socket is too long\n");
@@ -416,18 +440,15 @@
 					"I will not set gid to 0\n");
 				return -1;
 			}
-		}
 
-		/*
-		 * Change group before chroot, when we have access
-		 * to /etc/group
-		 */
-		if (groupname) {
+			/* do the change before we do the chroot() */
 			setgid(grp->gr_gid);
-			setgroups(0, NULL);
+			setgroups(0, NULL); 
+
 			if (username) {
 				initgroups(username, grp->gr_gid);
 			}
+
 		}
 
 		if (changeroot) {
@@ -451,7 +472,7 @@
 		}
 	}
 
-       return fcgi_spawn_connection(fcgi_app, fcgi_app_argv, addr, port, unixsocket, child_count, pid_fd, nofork);
+       return fcgi_spawn_connection(fcgi_app, fcgi_app_argv, addr, port, unixsocket, fork_count, child_count, pid_fd, nofork);
 }
 #else
 int main() {

Modified: lighttpd/trunk/src/stat_cache.c
===================================================================
--- lighttpd/trunk/src/stat_cache.c	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/src/stat_cache.c	2009-03-18 10:20:09 UTC (rev 355)
@@ -445,7 +445,9 @@
 	/* dir-check */
 	if (srv->srvconf.stat_cache_engine == STAT_CACHE_ENGINE_FAM) {
 		if (0 != buffer_copy_dirname(sc->dir_name, name)) {
-			SEGFAULT();
+			log_error_write(srv, __FILE__, __LINE__, "sb",
+				"no '/' found in filename:", name);
+			return HANDLER_ERROR;
 		}
 
 		buffer_copy_string_buffer(sc->hash_key, sc->dir_name);

Modified: lighttpd/trunk/tests/404-handler.conf
===================================================================
--- lighttpd/trunk/tests/404-handler.conf	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/404-handler.conf	2009-03-18 10:20:09 UTC (rev 355)
@@ -3,7 +3,6 @@
 debug.log-request-header   = "enable"
 
 server.document-root         = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
-server.pid-file              = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid"
 
 ## bind to port (default: 80)
 server.port                 = 2048

Modified: lighttpd/trunk/tests/LightyTest.pm
===================================================================
--- lighttpd/trunk/tests/LightyTest.pm	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/LightyTest.pm	2009-03-18 10:20:09 UTC (rev 355)
@@ -6,6 +6,7 @@
 use Test::More;
 use Socket;
 use Cwd 'abs_path';
+use POSIX ":sys_wait_h";
 
 sub mtime {
 	my $file = shift;
@@ -30,14 +31,17 @@
 
 
 	if (mtime($self->{BASEDIR}.'/src/lighttpd') > mtime($self->{BASEDIR}.'/build/lighttpd')) {
-		$self->{LIGHTTPD_PATH} = $self->{BASEDIR}.'/src/lighttpd';
-		$self->{MODULES_PATH} = $self->{BASEDIR}.'/src/.libs';
+		$self->{BINDIR} = $self->{BASEDIR}.'/src';
+		if (mtime($self->{BASEDIR}.'/src/.libs')) {
+			$self->{MODULES_PATH} = $self->{BASEDIR}.'/src/.libs';
+		} else {
+			$self->{MODULES_PATH} = $self->{BASEDIR}.'/src';
+		}
 	} else {
-		$self->{LIGHTTPD_PATH} = $self->{BASEDIR}.'/build/lighttpd';
+		$self->{BINDIR} = $self->{BASEDIR}.'/build';
 		$self->{MODULES_PATH} = $self->{BASEDIR}.'/build';
 	}
-	$self->{LIGHTTPD_PIDFILE} = $self->{TESTDIR}.'/tmp/lighttpd/lighttpd.pid';
-	$self->{PIDOF_PIDFILE} = $self->{TESTDIR}.'/tmp/lighttpd/pidof.pid';
+	$self->{LIGHTTPD_PATH} = $self->{BINDIR}.'/lighttpd';
 	$self->{PORT} = 2048;
 
 	my ($name, $aliases, $addrtype, $net) = gethostbyaddr(inet_aton("127.0.0.1"), AF_INET);
@@ -66,59 +70,73 @@
 sub stop_proc {
 	my $self = shift;
 
-	open F, $self->{LIGHTTPD_PIDFILE} or return -1;
-	my $pid = <F>;
-	close F;
+	my $pid = $self->{LIGHTTPD_PID};
+	if (defined $pid && $pid != -1) {
+		kill('TERM', $pid) or return -1;
+		return -1 if ($pid != waitpid($pid, 0));
+	} else {
+		diag("Process not started, nothing to stop");
+		return -1;
+	}
 
-	if (defined $pid) {
-		kill('TERM',$pid) or return -1;
+	return 0;
+}
+
+sub wait_for_port_with_proc {
+	my $self = shift;
+	my $port = shift;
+	my $child = shift;
+
+	while (0 == $self->listening_on($port)) {
 		select(undef, undef, undef, 0.1);
+
+		# the process is gone, we failed
+		if (0 != waitpid($child, WNOHANG)) {
+			return -1;
+		}
 	}
 
 	return 0;
 }
 
-
 sub start_proc {
 	my $self = shift;
 	# kill old proc if necessary
-	$self->stop_proc;
+	#$self->stop_proc;
 
 	# pre-process configfile if necessary
 	#
 
 	$ENV{'SRCDIR'} = $self->{BASEDIR}.'/tests';
+	$ENV{'PORT'} = $self->{PORT};
 
-	unlink($self->{LIGHTTPD_PIDFILE});
+	my $cmdline = $self->{LIGHTTPD_PATH}." -D -f ".$self->{SRCDIR}."/".$self->{CONFIGFILE}." -m ".$self->{MODULES_PATH};
 	if (defined $ENV{"TRACEME"} && $ENV{"TRACEME"} eq 'strace') {
-		system("strace -tt -s 512 -o strace ".$self->{LIGHTTPD_PATH}." -D -f ".$self->{SRCDIR}."/".$self->{CONFIGFILE}." -m ".$self->{MODULES_PATH}." &");
+		$cmdline = "strace -tt -s 512 -o strace ".$cmdline;
 	} elsif (defined $ENV{"TRACEME"} && $ENV{"TRACEME"} eq 'truss') {
-		system("/usr/dtrctkit/bin/dtruss -d -e ".$self->{LIGHTTPD_PATH}." -D -f ".$self->{SRCDIR}."/".$self->{CONFIGFILE}." -m ".$self->{MODULES_PATH}." 2> strace &");
+		$cmdline = "truss -a -l -w all -v all -o strace ".$cmdline;
+	} elsif (defined $ENV{"TRACEME"} && $ENV{"TRACEME"} eq 'gdb') {
+		$cmdline = "gdb --batch --ex 'run' --ex 'bt' --args ".$cmdline." > gdb.out";
 	} elsif (defined $ENV{"TRACEME"} && $ENV{"TRACEME"} eq 'valgrind') {
-		system("valgrind --tool=memcheck --show-reachable=yes --leak-check=yes --log-file=valgrind ".$self->{LIGHTTPD_PATH}." -D -f ".$self->{SRCDIR}."/".$self->{CONFIGFILE}." -m ".$self->{MODULES_PATH}." &");
-	} else {
-		system($self->{LIGHTTPD_PATH}." -f ".$self->{SRCDIR}."/".$self->{CONFIGFILE}." -m ".$self->{MODULES_PATH});
+		$cmdline = "valgrind --tool=memcheck --show-reachable=yes --leak-check=yes --log-file=valgrind ".$cmdline;
 	}
-
-	select(undef, undef, undef, 0.1);
-	if (not -e $self->{LIGHTTPD_PIDFILE} or 0 == kill 0, `cat $self->{LIGHTTPD_PIDFILE}`) {
-		select(undef, undef, undef, 2);	
-	}
-
-	unlink($self->{TESTDIR}."/tmp/cfg.file");
-
-	# no pidfile, we failed
-	if (not -e $self->{LIGHTTPD_PIDFILE}) {
-		diag(sprintf('Could not find pidfile: %s', $self->{LIGHTTPD_PIDFILE}));
+	# diag("starting lighttpd at :".$self->{PORT}.", cmdline: ".$cmdline );
+	my $child = fork();
+	if (not defined $child) {
+		diag("Fork failed");
 		return -1;
 	}
+	if ($child == 0) {
+		exec $cmdline or die($?);
+	}
 
-	# the process is gone, we failed
-	if (0 == kill 0, `cat $self->{LIGHTTPD_PIDFILE}`) {
-		diag(sprintf('the process referenced by %s is not up', $self->{LIGHTTPD_PIDFILE}));
+	if (0 != $self->wait_for_port_with_proc($self->{PORT}, $child)) {
+		diag(sprintf('The process %i is not up', $child));
 		return -1;
 	}
 
+	$self->{LIGHTTPD_PID} = $child;
+
 	0;
 }
 
@@ -131,6 +149,7 @@
 
 	my @request = $t->{REQUEST};
 	my @response = $t->{RESPONSE};
+	my $is_debug = $ENV{"TRACE_HTTP"};
 
 	my $remote = 
  	  IO::Socket::INET->new(Proto    => "tcp",
@@ -144,20 +163,27 @@
 
 	$remote->autoflush(1);
 
+	diag("sending request header to ".$host.":".$self->{PORT}) if $is_debug;
 	foreach(@request) {
 		# pipeline requests
 		s/\r//g;
 		s/\n/$EOL/g;
 
-		print $remote $_.$BLANK;	
+		print $remote $_.$BLANK;
+		diag("<< ".$_) if $is_debug;
 	}
+	shutdown($remote, 1); # I've stopped writing data
+	diag("... done") if $is_debug;
 
 	my $lines = "";
 
+	diag("receiving response") if $is_debug;
 	# read everything
 	while(<$remote>) {
 		$lines .= $_;
+		diag(">> ".$_) if $is_debug;
 	}
+	diag("... done") if $is_debug;
 	
 	close $remote;
 
@@ -187,18 +213,24 @@
 					(my $h = $1) =~ tr/[A-Z]/[a-z]/;
 
 					if (defined $resp_hdr{$h}) {
-						diag(sprintf("header %s is duplicated: %s and %s\n",
-						             $h, $resp_hdr{$h}, $2));
+# 						diag(sprintf("header '%s' is duplicated: '%s' and '%s'\n",
+# 						             $h, $resp_hdr{$h}, $2));
+						$resp_hdr{$h} .= ', '.$2;
 					} else {
 						$resp_hdr{$h} = $2;
 					}
 				} else {
-					diag(sprintf("unexpected line '$line'\n"));
+					diag(sprintf("unexpected line '%s'\n", $line));
 					return -1;
 				}
 			}
 		}
 
+		if (not defined($resp_line)) {
+			diag(sprintf("empty response\n"));
+			return -1;
+		}
+
 		$t->{etag} = $resp_hdr{'etag'};
 		$t->{date} = $resp_hdr{'date'};
 
@@ -227,7 +259,7 @@
 				return -1;
 			}
 		} else {
-			diag(sprintf("unexpected resp_line '$resp_line'\n"));
+			diag(sprintf("unexpected resp_line '%s'\n", $resp_line));
 			return -1;
 		}
 
@@ -237,7 +269,9 @@
 				diag(sprintf("body failed: expected '%s', got '%s'\n", $href->{'HTTP-Content'}, $resp_body));
 				return -1;
 			}
-		} elsif (defined $href->{'-HTTP-Content'}) {
+		}
+		
+		if (defined $href->{'-HTTP-Content'}) {
 			if (defined $resp_body && $resp_body ne '') {
 				diag(sprintf("body failed: expected empty body, got '%s'\n", $resp_body));
 				return -1;
@@ -245,7 +279,6 @@
 		}
 
 		foreach (keys %{ $href }) {
-			## filter special keys
 			next if $_ eq 'HTTP-Protocol';
 			next if $_ eq 'HTTP-Status';
 			next if $_ eq 'HTTP-Content';
@@ -257,7 +290,6 @@
 			my $key_inverted = 0;
 
 			if (substr($k, 0, 1) eq '+') {
-				## the key has to exist, but the value is ignored
 				$k = substr($k, 1);
 				$verify_value = 0;
 			} elsif (substr($k, 0, 1) eq '-') {
@@ -265,11 +297,11 @@
 				$k = substr($k, 1);
 				$key_inverted = 1;
 				$verify_value = 0; ## skip the value check
-			}
+                        }
 
 			if ($key_inverted) {
 				if (defined $resp_hdr{$k}) {
-					diag(sprintf("required header '%s' is missing\n", $k));
+					diag(sprintf("header '%s' MUST not be set\n", $k));
 					return -1;
 				}
 			} else {
@@ -297,12 +329,38 @@
 
 	# we should have sucked up everything
 	if (defined $lines) {
-		diag(sprintf("unexpected lines '$lines'\n"));
+		diag(sprintf("unexpected lines '%s'\n", $lines));
 		return -1;
 	}
 
 	return 0;
 }
-    
+
+sub spawnfcgi {
+	my ($self, $binary, $port) = @_;
+	my $child = fork();
+	if (not defined $child) {
+		diag("Couldn't fork\n");
+		return -1;
+	}
+	if ($child == 0) {
+		my $cmd = $self->{BINDIR}.'/spawn-fcgi -n -p '.$port.' -f "'.$binary.'"';
+		exec $cmd or die($?);
+	} else {
+		if (0 != $self->wait_for_port_with_proc($port, $child)) {
+			diag(sprintf('The process %i is not up (port %i, %s)', $child, $port, $binary));
+			return -1;
+		}
+		return $child;
+	}
+}
+
+sub endspawnfcgi {
+	my ($self, $pid) = @_;
+	return -1 if (-1 == $pid);
+	kill(2, $pid);
+	waitpid($pid, 0);
+	return 0;
+}
+
 1;
-

Modified: lighttpd/trunk/tests/Makefile.am
===================================================================
--- lighttpd/trunk/tests/Makefile.am	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/Makefile.am	2009-03-18 10:20:09 UTC (rev 355)
@@ -38,12 +38,11 @@
       mod-auth.t \
       mod-cgi.t \
       mod-compress.t \
+      mod-compress.conf \
       mod-fastcgi.t \
       mod-redirect.t \
       mod-rewrite.t \
       mod-userdir.t \
-	  env-variables.t \
-	  env-variables.conf \
 	  symlink.t \
       request.t \
       mod-ssi.t \

Modified: lighttpd/trunk/tests/Makefile.in
===================================================================
--- lighttpd/trunk/tests/Makefile.in	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/Makefile.in	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -52,7 +52,7 @@
 @CHECK_WITH_FASTCGI_TRUE@	fcgi-responder.$(OBJEXT)
 fcgi_responder_OBJECTS = $(am_fcgi_responder_OBJECTS)
 fcgi_responder_DEPENDENCIES =
-DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -103,6 +103,7 @@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DL_LIB = @DL_LIB@
+DSYMUTIL = @DSYMUTIL@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -137,6 +138,7 @@
 MYSQL_CONFIG = @MYSQL_CONFIG@
 MYSQL_INCLUDE = @MYSQL_INCLUDE@
 MYSQL_LIBS = @MYSQL_LIBS@
+NMEDIT = @NMEDIT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -149,6 +151,7 @@
 PCRE_LIB = @PCRE_LIB@
 PKG_CONFIG = @PKG_CONFIG@
 RANLIB = @RANLIB@
+SED = @SED@
 SENDFILE_LIB = @SENDFILE_LIB@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
@@ -251,12 +254,11 @@
       mod-auth.t \
       mod-cgi.t \
       mod-compress.t \
+      mod-compress.conf \
       mod-fastcgi.t \
       mod-redirect.t \
       mod-rewrite.t \
       mod-userdir.t \
-	  env-variables.t \
-	  env-variables.conf \
 	  symlink.t \
       request.t \
       mod-ssi.t \
@@ -435,8 +437,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -461,8 +463,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -472,13 +474,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: lighttpd/trunk/tests/SConscript
===================================================================
--- lighttpd/trunk/tests/SConscript	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/SConscript	2009-03-18 10:20:09 UTC (rev 355)
@@ -23,6 +23,7 @@
       mod-auth.t \
       mod-cgi.t \
       mod-compress.t \
+      mod-compress.conf \
       mod-fastcgi.t \
       mod-redirect.t \
       mod-userdir.t \

Modified: lighttpd/trunk/tests/bug-06.conf
===================================================================
--- lighttpd/trunk/tests/bug-06.conf	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/bug-06.conf	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,5 +1,4 @@
 server.document-root         = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
-server.pid-file              = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid"
 
 ## bind to port (default: 80)
 server.port                 = 2048

Modified: lighttpd/trunk/tests/bug-12.conf
===================================================================
--- lighttpd/trunk/tests/bug-12.conf	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/bug-12.conf	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,5 +1,4 @@
 server.document-root         = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
-server.pid-file              = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid"
 
 ## bind to port (default: 80)
 server.port                 = 2048

Modified: lighttpd/trunk/tests/condition.conf
===================================================================
--- lighttpd/trunk/tests/condition.conf	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/condition.conf	2009-03-18 10:20:09 UTC (rev 355)
@@ -3,7 +3,6 @@
 debug.log-condition-handling = "enable"
 
 server.document-root         = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
-server.pid-file              = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid"
 
 ## bind to port (default: 80)
 server.port                 = 2048

Modified: lighttpd/trunk/tests/docroot/123/Makefile.in
===================================================================
--- lighttpd/trunk/tests/docroot/123/Makefile.in	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/docroot/123/Makefile.in	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -67,6 +67,7 @@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DL_LIB = @DL_LIB@
+DSYMUTIL = @DSYMUTIL@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -101,6 +102,7 @@
 MYSQL_CONFIG = @MYSQL_CONFIG@
 MYSQL_INCLUDE = @MYSQL_INCLUDE@
 MYSQL_LIBS = @MYSQL_LIBS@
+NMEDIT = @NMEDIT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -113,6 +115,7 @@
 PCRE_LIB = @PCRE_LIB@
 PKG_CONFIG = @PKG_CONFIG@
 RANLIB = @RANLIB@
+SED = @SED@
 SENDFILE_LIB = @SENDFILE_LIB@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@

Modified: lighttpd/trunk/tests/docroot/Makefile.in
===================================================================
--- lighttpd/trunk/tests/docroot/Makefile.in	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/docroot/Makefile.in	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -79,6 +79,7 @@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DL_LIB = @DL_LIB@
+DSYMUTIL = @DSYMUTIL@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -113,6 +114,7 @@
 MYSQL_CONFIG = @MYSQL_CONFIG@
 MYSQL_INCLUDE = @MYSQL_INCLUDE@
 MYSQL_LIBS = @MYSQL_LIBS@
+NMEDIT = @NMEDIT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -125,6 +127,7 @@
 PCRE_LIB = @PCRE_LIB@
 PKG_CONFIG = @PKG_CONFIG@
 RANLIB = @RANLIB@
+SED = @SED@
 SENDFILE_LIB = @SENDFILE_LIB@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
@@ -308,8 +311,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -334,8 +337,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -345,13 +348,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: lighttpd/trunk/tests/docroot/www/Makefile.am
===================================================================
--- lighttpd/trunk/tests/docroot/www/Makefile.am	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/docroot/www/Makefile.am	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,4 +1,4 @@
-EXTRA_DIST=cgi.php cgi.pl dummydir index.html index.txt phpinfo.php \
+EXTRA_DIST=cgi.php cgi.pl index.html index.txt phpinfo.php \
 	   redirect.php cgi-pathinfo.pl get-env.php get-server-env.php \
 	   nph-status.pl prefix.fcgi get-header.pl ssi.shtml get-post-len.pl \
 	   exec-date.shtml index.html~ 404.fcgi 404.html 404.pl send404.pl crlfcrash.pl

Modified: lighttpd/trunk/tests/docroot/www/Makefile.in
===================================================================
--- lighttpd/trunk/tests/docroot/www/Makefile.in	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/docroot/www/Makefile.in	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -79,6 +79,7 @@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DL_LIB = @DL_LIB@
+DSYMUTIL = @DSYMUTIL@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -113,6 +114,7 @@
 MYSQL_CONFIG = @MYSQL_CONFIG@
 MYSQL_INCLUDE = @MYSQL_INCLUDE@
 MYSQL_LIBS = @MYSQL_LIBS@
+NMEDIT = @NMEDIT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -125,6 +127,7 @@
 PCRE_LIB = @PCRE_LIB@
 PKG_CONFIG = @PKG_CONFIG@
 RANLIB = @RANLIB@
+SED = @SED@
 SENDFILE_LIB = @SENDFILE_LIB@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
@@ -193,7 +196,7 @@
 target_vendor = @target_vendor@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-EXTRA_DIST = cgi.php cgi.pl dummydir index.html index.txt phpinfo.php \
+EXTRA_DIST = cgi.php cgi.pl index.html index.txt phpinfo.php \
 	   redirect.php cgi-pathinfo.pl get-env.php get-server-env.php \
 	   nph-status.pl prefix.fcgi get-header.pl ssi.shtml get-post-len.pl \
 	   exec-date.shtml index.html~ 404.fcgi 404.html 404.pl send404.pl crlfcrash.pl
@@ -313,8 +316,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -339,8 +342,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -350,13 +353,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: lighttpd/trunk/tests/docroot/www/expire/Makefile.in
===================================================================
--- lighttpd/trunk/tests/docroot/www/expire/Makefile.in	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/docroot/www/expire/Makefile.in	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -67,6 +67,7 @@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DL_LIB = @DL_LIB@
+DSYMUTIL = @DSYMUTIL@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -101,6 +102,7 @@
 MYSQL_CONFIG = @MYSQL_CONFIG@
 MYSQL_INCLUDE = @MYSQL_INCLUDE@
 MYSQL_LIBS = @MYSQL_LIBS@
+NMEDIT = @NMEDIT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -113,6 +115,7 @@
 PCRE_LIB = @PCRE_LIB@
 PKG_CONFIG = @PKG_CONFIG@
 RANLIB = @RANLIB@
+SED = @SED@
 SENDFILE_LIB = @SENDFILE_LIB@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@

Modified: lighttpd/trunk/tests/docroot/www/get-env.php
===================================================================
--- lighttpd/trunk/tests/docroot/www/get-env.php	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/docroot/www/get-env.php	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,3 +1,4 @@
 <?php
-	print $_ENV[$_GET["env"]];
+	$env = $_GET["env"];
+	print isset($_ENV[$env]) ? $_ENV[$env] : '';
 ?>

Modified: lighttpd/trunk/tests/docroot/www/go/Makefile.in
===================================================================
--- lighttpd/trunk/tests/docroot/www/go/Makefile.in	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/docroot/www/go/Makefile.in	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -67,6 +67,7 @@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DL_LIB = @DL_LIB@
+DSYMUTIL = @DSYMUTIL@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -101,6 +102,7 @@
 MYSQL_CONFIG = @MYSQL_CONFIG@
 MYSQL_INCLUDE = @MYSQL_INCLUDE@
 MYSQL_LIBS = @MYSQL_LIBS@
+NMEDIT = @NMEDIT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -113,6 +115,7 @@
 PCRE_LIB = @PCRE_LIB@
 PKG_CONFIG = @PKG_CONFIG@
 RANLIB = @RANLIB@
+SED = @SED@
 SENDFILE_LIB = @SENDFILE_LIB@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@

Modified: lighttpd/trunk/tests/docroot/www/indexfile/Makefile.in
===================================================================
--- lighttpd/trunk/tests/docroot/www/indexfile/Makefile.in	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/docroot/www/indexfile/Makefile.in	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -67,6 +67,7 @@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DL_LIB = @DL_LIB@
+DSYMUTIL = @DSYMUTIL@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -101,6 +102,7 @@
 MYSQL_CONFIG = @MYSQL_CONFIG@
 MYSQL_INCLUDE = @MYSQL_INCLUDE@
 MYSQL_LIBS = @MYSQL_LIBS@
+NMEDIT = @NMEDIT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -113,6 +115,7 @@
 PCRE_LIB = @PCRE_LIB@
 PKG_CONFIG = @PKG_CONFIG@
 RANLIB = @RANLIB@
+SED = @SED@
 SENDFILE_LIB = @SENDFILE_LIB@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@

Deleted: lighttpd/trunk/tests/env-variables.conf
===================================================================
--- lighttpd/trunk/tests/env-variables.conf	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/env-variables.conf	2009-03-18 10:20:09 UTC (rev 355)
@@ -1 +0,0 @@
-server.document-root = env.CWD

Deleted: lighttpd/trunk/tests/env-variables.t
===================================================================
--- lighttpd/trunk/tests/env-variables.t	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/env-variables.t	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,21 +0,0 @@
-#!/usr/bin/perl
-BEGIN {
-	# add current source dir to the include-path
-	# we need this for make distcheck
-	(my $srcdir = $0) =~ s,/[^/]+$,/,;
-	unshift @INC, $srcdir;
-}
-
-use strict;
-use IO::Socket;
-use Test::More tests => 2;
-use LightyTest;
-
-my $tf = LightyTest->new();
-$tf->{CONFIGFILE} = 'env-variables.conf';
-
-TODO: {
-    local $TODO = 'we still crash on undefined environment variables';
-    ok($tf->start_proc == 0, "Starting lighttpd");
-    ok($tf->stop_proc  == 0, "Stopping lighttpd");
-};

Modified: lighttpd/trunk/tests/fastcgi-10.conf
===================================================================
--- lighttpd/trunk/tests/fastcgi-10.conf	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/fastcgi-10.conf	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,5 +1,4 @@
 server.document-root         = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
-server.pid-file              = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid"
 
 ## bind to port (default: 80)
 server.port                 = 2048

Modified: lighttpd/trunk/tests/fastcgi-13.conf
===================================================================
--- lighttpd/trunk/tests/fastcgi-13.conf	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/fastcgi-13.conf	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,5 +1,4 @@
 server.document-root         = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
-server.pid-file              = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid"
 
 debug.log-request-header   = "enable"
 debug.log-response-header  = "enable"
@@ -85,7 +84,7 @@
                                   "grisu" => ( 
 				    "host" => "127.0.0.1",
 				    "port" => 1048,
-				    "bin-path" => "/usr/bin/php-cgi",
+				    "bin-path" => env.PHP,
 				    "bin-copy-environment" => ( "PATH", "SHELL", "USER" ),
 				  )
 				)

Modified: lighttpd/trunk/tests/fastcgi-auth.conf
===================================================================
--- lighttpd/trunk/tests/fastcgi-auth.conf	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/fastcgi-auth.conf	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,5 +1,4 @@
 server.document-root         = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
-server.pid-file              = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid"
 
 debug.log-request-header   = "enable"
 debug.log-response-header  = "enable"
@@ -90,6 +89,7 @@
 				    "bin-path" => env.SRCDIR + "/fcgi-auth",
                                     "mode" => "authorizer",
                                     "docroot" => env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/",
+                                    "check-local" => "disable",
 
 				  )
 				)

Modified: lighttpd/trunk/tests/fastcgi-responder.conf
===================================================================
--- lighttpd/trunk/tests/fastcgi-responder.conf	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/fastcgi-responder.conf	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,5 +1,4 @@
 server.document-root         = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
-server.pid-file              = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid"
 
 #debug.log-request-header   = "enable"
 #debug.log-response-header  = "enable"

Modified: lighttpd/trunk/tests/lighttpd.conf
===================================================================
--- lighttpd/trunk/tests/lighttpd.conf	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/lighttpd.conf	2009-03-18 10:20:09 UTC (rev 355)
@@ -3,7 +3,6 @@
 debug.log-response-header = "enable"
 debug.log-condition-handling = "enable"
 server.document-root         = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
-server.pid-file              = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid"
 
 ## 64 Mbyte ... nice limit
 server.max-request-size = 65000
@@ -218,4 +217,5 @@
 
 $HTTP["host"] == "etag.example.org" {
     static-file.etags = "disable"
+    compress.filetype = ()
 }

Modified: lighttpd/trunk/tests/lowercase.conf
===================================================================
--- lighttpd/trunk/tests/lowercase.conf	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/lowercase.conf	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,5 +1,4 @@
 server.document-root         = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
-server.pid-file              = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid"
 
 ## bind to port (default: 80)
 server.port                 = 2048

Copied: lighttpd/trunk/tests/mod-compress.conf (from rev 354, lighttpd/branches/upstream/current/tests/mod-compress.conf)
===================================================================
--- lighttpd/trunk/tests/mod-compress.conf	                        (rev 0)
+++ lighttpd/trunk/tests/mod-compress.conf	2009-03-18 10:20:09 UTC (rev 355)
@@ -0,0 +1,32 @@
+debug.log-request-handling   = "enable"
+debug.log-response-header   = "disable"
+debug.log-request-header   = "disable"
+
+server.document-root         = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
+server.pid-file              = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid"
+
+## bind to port (default: 80)
+server.port                 = 2048
+
+## bind to localhost (default: all interfaces)
+server.bind                = "localhost"
+server.errorlog            = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
+server.name                = "www.example.org"
+
+server.modules = (
+	"mod_compress"
+)
+
+######################## MODULE CONFIG ############################
+
+mimetype.assign = (
+	".html" => "text/html",
+	".txt"  => "text/plain",
+)
+
+$HTTP["host"] == "cache.example.org" {
+	compress.cache-dir = env.SRCDIR + "/tmp/lighttpd/cache/compress/"
+}
+compress.filetype = ("text/plain", "text/html")
+
+compress.allowed-encodings = ( "gzip", "deflate" )

Modified: lighttpd/trunk/tests/mod-compress.t
===================================================================
--- lighttpd/trunk/tests/mod-compress.t	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/mod-compress.t	2009-03-18 10:20:09 UTC (rev 355)
@@ -8,12 +8,14 @@
 
 use strict;
 use IO::Socket;
-use Test::More tests => 10;
+use Test::More tests => 11;
 use LightyTest;
 
 my $tf = LightyTest->new();
 my $t;
 
+$tf->{CONFIGFILE} = 'mod-compress.conf';
+
 ok($tf->start_proc == 0, "Starting lighttpd") or die();
 
 $t->{REQUEST}  = ( <<EOF
@@ -88,5 +90,14 @@
 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Type' => "text/plain" } ];
 ok($tf->handle_http($t) == 0, 'Empty Accept-Encoding');
 
+$t->{REQUEST}  = ( <<EOF
+GET /index.txt HTTP/1.0
+Accept-Encoding: bzip2, gzip, deflate
+Host: cache.example.org
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Encoding' => 'gzip', 'Content-Type' => "text/plain" } ];
+ok($tf->handle_http($t) == 0, 'bzip2 requested but disabled');
 
+
 ok($tf->stop_proc == 0, "Stopping lighttpd");

Modified: lighttpd/trunk/tests/mod-fastcgi.t
===================================================================
--- lighttpd/trunk/tests/mod-fastcgi.t	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/mod-fastcgi.t	2009-03-18 10:20:09 UTC (rev 355)
@@ -7,17 +7,27 @@
 }
 
 use strict;
-use Test::More tests => 47;
+use Test::More tests => 50;
 use LightyTest;
 
 my $tf = LightyTest->new();
 
 my $t;
+my $php_child = -1;
 
+my $phpbin = (defined $ENV{'PHP'} ? $ENV{'PHP'} : '/usr/bin/php-cgi');
+$ENV{'PHP'} = $phpbin;
+
 SKIP: {
+	skip "PHP already running on port 1026", 1 if $tf->listening_on(1026);
+	skip "no php binary found", 1 unless -x $phpbin;
+	ok(-1 != ($php_child = $tf->spawnfcgi($phpbin, 1026)), "Spawning php");
+}
+
+SKIP: {
 	skip "no PHP running on port 1026", 29 unless $tf->listening_on(1026);
 
-	ok($tf->start_proc == 0, "Starting lighttpd") or die();
+	ok($tf->start_proc == 0, "Starting lighttpd") or goto cleanup;
 
 	$t->{REQUEST} = ( <<EOF
 GET /phpinfo.php HTTP/1.0
@@ -65,7 +75,7 @@
 EOF
  );
 	$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/get-server-env.php' } ];
-	ok($tf->handle_http($t) == 0, '$_SERVER["PHP_SELF"]');
+	ok($tf->handle_http($t) == 0, '$_SERVER["SCRIPT_NAME"]');
 
 	$t->{REQUEST}  = ( <<EOF
 GET /get-server-env.php/foo?env=PATH_INFO HTTP/1.0
@@ -161,7 +171,7 @@
 
 
 	$tf->{CONFIGFILE} = 'fastcgi-10.conf';
-	ok($tf->start_proc == 0, "Starting lighttpd with $tf->{CONFIGFILE}") or die();
+	ok($tf->start_proc == 0, "Starting lighttpd with $tf->{CONFIGFILE}") or goto cleanup;
 	$t->{REQUEST}  = ( <<EOF
 GET /get-server-env.php?env=SERVER_NAME HTTP/1.0
 Host: zzz.example.org
@@ -173,7 +183,7 @@
 	ok($tf->stop_proc == 0, "Stopping lighttpd");
 	
 	$tf->{CONFIGFILE} = 'bug-06.conf';
-	ok($tf->start_proc == 0, "Starting lighttpd with $tf->{CONFIGFILE}") or die();
+	ok($tf->start_proc == 0, "Starting lighttpd with $tf->{CONFIGFILE}") or goto cleanup;
 	$t->{REQUEST}  = ( <<EOF
 GET /indexfile/ HTTP/1.0
 Host: www.example.org
@@ -185,7 +195,7 @@
 	ok($tf->stop_proc == 0, "Stopping lighttpd");
 
 	$tf->{CONFIGFILE} = 'bug-12.conf';
-	ok($tf->start_proc == 0, "Starting lighttpd with bug-12.conf") or die();
+	ok($tf->start_proc == 0, "Starting lighttpd with bug-12.conf") or goto cleanup;
 	$t->{REQUEST}  = ( <<EOF
 POST /indexfile/abc HTTP/1.0
 Host: www.example.org
@@ -199,8 +209,14 @@
 }
 
 SKIP: {
-	skip "no fcgi-auth found", 4 unless -x $tf->{BASEDIR}."/tests/fcgi-auth" || -x $tf->{BASEDIR}."/tests/fcgi-auth.exe"; 
+	skip "PHP not started, cannot stop it", 1 unless $php_child != -1;
+	ok(0 == $tf->endspawnfcgi($php_child), "Stopping php");
+	$php_child = -1;
+}
 
+SKIP: {
+	skip "no fcgi-auth found", 5 unless -x $tf->{BASEDIR}."/tests/fcgi-auth" || -x $tf->{BASEDIR}."/tests/fcgi-auth.exe"; 
+
 	$tf->{CONFIGFILE} = 'fastcgi-auth.conf';
 	ok($tf->start_proc == 0, "Starting lighttpd with $tf->{CONFIGFILE}") or die();
 	$t->{REQUEST}  = ( <<EOF
@@ -219,11 +235,19 @@
 	$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ];
 	ok($tf->handle_http($t) == 0, 'FastCGI - Auth');
 
+	$t->{REQUEST}  = ( <<EOF
+GET /expire/access.txt?ok HTTP/1.0
+Host: www.example.org
+EOF
+ );
+	$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
+	ok($tf->handle_http($t) == 0, 'FastCGI - Auth in subdirectory');
+
 	ok($tf->stop_proc == 0, "Stopping lighttpd");
 }
 
 SKIP: {
-	skip "no php found", 5 unless -x "/usr/bin/php-cgi"; 
+	skip "no php found", 5 unless -x $phpbin;
 	$tf->{CONFIGFILE} = 'fastcgi-13.conf';
 	ok($tf->start_proc == 0, "Starting lighttpd with $tf->{CONFIGFILE}") or die();
 	$t->{REQUEST}  = ( <<EOF
@@ -325,3 +349,10 @@
 	ok($tf->stop_proc == 0, "Stopping lighttpd");
 }
 
+exit 0;
+
+cleanup: ;
+
+$tf->endspawnfcgi($php_child) if $php_child != -1;
+
+die();

Modified: lighttpd/trunk/tests/mod-proxy.t
===================================================================
--- lighttpd/trunk/tests/mod-proxy.t	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/mod-proxy.t	2009-03-18 10:20:09 UTC (rev 355)
@@ -8,29 +8,37 @@
 
 use strict;
 use IO::Socket;
-use Test::More tests => 6;
+use Test::More tests => 9;
 use LightyTest;
 
 my $tf_real = LightyTest->new();
 my $tf_proxy = LightyTest->new();
 
 my $t;
+my $php_child = -1;
 
+my $phpbin = (defined $ENV{'PHP'} ? $ENV{'PHP'} : '/usr/bin/php-cgi');
+$ENV{'PHP'} = $phpbin;
+
+SKIP: {
+	skip "PHP already running on port 1026", 1 if $tf_real->listening_on(1026);
+	skip "no php binary found", 1 unless -x $phpbin;
+	ok(-1 != ($php_child = $tf_real->spawnfcgi($phpbin, 1026)), "Spawning php");
+}
+
 ## we need two procs
 ## 1. the real webserver
 ## 2. the proxy server
 
 $tf_real->{PORT} = 2048;
 $tf_real->{CONFIGFILE} = 'lighttpd.conf';
-$tf_real->{LIGHTTPD_PIDFILE} = $tf_real->{TESTDIR}.'/tmp/lighttpd/lighttpd.pid';
 
 $tf_proxy->{PORT} = 2050;
 $tf_proxy->{CONFIGFILE} = 'proxy.conf';
-$tf_proxy->{LIGHTTPD_PIDFILE} = $tf_proxy->{TESTDIR}.'/tmp/lighttpd/lighttpd-proxy.pid';
 
-ok($tf_real->start_proc == 0, "Starting lighttpd") or die();
+ok($tf_real->start_proc == 0, "Starting lighttpd") or goto cleanup;
 
-ok($tf_proxy->start_proc == 0, "Starting lighttpd as proxy") or die();
+ok($tf_proxy->start_proc == 0, "Starting lighttpd as proxy") or goto cleanup;
 
 $t->{REQUEST}  = ( <<EOF
 GET /index.html HTTP/1.0
@@ -48,6 +56,31 @@
 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Server' => 'Apache 1.3.29' } ];
 ok($tf_proxy->handle_http($t) == 0, 'drop Server from real server');
 
+SKIP: {
+	skip "no PHP running on port 1026", 1 unless $tf_real->listening_on(1026);
+	$t->{REQUEST}  = ( <<EOF
+GET /rewrite/all/some+test%3axxx%20with%20space HTTP/1.0
+Host: www.example.org
+EOF
+ );
+	$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/some+test%3axxx%20with%20space' } ];
+	ok($tf_proxy->handle_http($t) == 0, 'rewrited urls work with encoded path');
+}
+
 ok($tf_proxy->stop_proc == 0, "Stopping lighttpd proxy");
 
 ok($tf_real->stop_proc == 0, "Stopping lighttpd");
+
+SKIP: {
+	skip "PHP not started, cannot stop it", 1 unless $php_child != -1;
+	ok(0 == $tf_real->endspawnfcgi($php_child), "Stopping php");
+	$php_child = -1;
+}
+
+exit 0;
+
+cleanup:
+
+$tf_real->endspawnfcgi($php_child) if $php_child != -1;
+
+die();

Modified: lighttpd/trunk/tests/mod-rewrite.t
===================================================================
--- lighttpd/trunk/tests/mod-rewrite.t	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/mod-rewrite.t	2009-03-18 10:20:09 UTC (rev 355)
@@ -8,17 +8,25 @@
 
 use strict;
 use IO::Socket;
-use Test::More tests => 5;
+use Test::More tests => 7;
 use LightyTest;
 
 my $tf = LightyTest->new();
 my $t;
+my $php_child = -1;
 
+my $phpbin = (defined $ENV{'PHP'} ? $ENV{'PHP'} : '/usr/bin/php-cgi');
 
 SKIP: {
+	skip "PHP already running on port 1026", 1 if $tf->listening_on(1026);
+	skip "no php binary found", 1 unless -x $phpbin;
+	ok(-1 != ($php_child = $tf->spawnfcgi($phpbin, 1026)), "Spawning php");
+}
+
+SKIP: {
 	skip "no PHP running on port 1026", 5 unless $tf->listening_on(1026);
 
-	ok($tf->start_proc == 0, "Starting lighttpd") or die();
+	ok($tf->start_proc == 0, "Starting lighttpd") or goto cleanup;
 
 	$t->{REQUEST}  = ( <<EOF
 GET /rewrite/foo HTTP/1.0
@@ -27,7 +35,7 @@
  );
 	$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '' } ];
 	ok($tf->handle_http($t) == 0, 'valid request');
-
+    
 	$t->{REQUEST}  = ( <<EOF
 GET /rewrite/foo?a=b HTTP/1.0
 Host: www.example.org
@@ -46,3 +54,17 @@
 
 	ok($tf->stop_proc == 0, "Stopping lighttpd");
 }
+
+SKIP: {
+	skip "PHP not started, cannot stop it", 1 unless $php_child != -1;
+	ok(0 == $tf->endspawnfcgi($php_child), "Stopping php");
+}
+
+
+exit 0;
+
+cleanup: ;
+
+$tf->endspawnfcgi($php_child) if $php_child != -1;
+
+die();

Modified: lighttpd/trunk/tests/proxy.conf
===================================================================
--- lighttpd/trunk/tests/proxy.conf	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/proxy.conf	2009-03-18 10:20:09 UTC (rev 355)
@@ -1,5 +1,4 @@
 server.document-root         = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
-server.pid-file              = env.SRCDIR + "/tmp/lighttpd/lighttpd-proxy.pid"
 
 ## bind to port (default: 80)
 server.port                 = 2050
@@ -123,7 +122,8 @@
 url.redirect                = ( "^/redirect/$" => "http://localhost:2048/" )
 
 url.rewrite		    = ( "^/rewrite/foo($|\?.+)" => "/indexfile/rewrite.php$1",
-				"^/rewrite/bar(?:$|\?(.+))" => "/indexfile/rewrite.php?bar&$1" )
+				"^/rewrite/bar(?:$|\?(.+))" => "/indexfile/rewrite.php?bar&$1",
+				"^/rewrite/all(/.*)$" => "/indexfile/rewrite.php?$1" )
 
 expire.url                  = ( "/expire/access" => "access 2 hours",
 				"/expire/modification" => "access plus 1 seconds 2 minutes")

Modified: lighttpd/trunk/tests/request.t
===================================================================
--- lighttpd/trunk/tests/request.t	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/request.t	2009-03-18 10:20:09 UTC (rev 355)
@@ -101,7 +101,7 @@
 Expect: 100-continue
 EOF
  );
-$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 417, '-HTTP-Content' => ''} ];
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 417 } ];
 ok($tf->handle_http($t) == 0, 'Continue, Expect');
 
 ## ranges

Modified: lighttpd/trunk/tests/run-tests.pl
===================================================================
--- lighttpd/trunk/tests/run-tests.pl	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/run-tests.pl	2009-03-18 10:20:09 UTC (rev 355)
@@ -3,17 +3,18 @@
 use strict;
 
 use Test::Harness qw(&runtests $verbose);
-$verbose = (defined $ENV{'VERBOSE'} ? $ENV{'VERBOSE'} : 0);;
+$verbose = (defined $ENV{'VERBOSE'} ? $ENV{'VERBOSE'} : 0);
+my $tests = (defined $ENV{'TESTS'} ? $ENV{'TESTS'} : '');
 
 my $srcdir = (defined $ENV{'srcdir'} ? $ENV{'srcdir'} : '.');
 
 opendir DIR, $srcdir;
 my (@fs, $f);
 while ($f = readdir(DIR)) {
-	if ($f =~ /\.t$/) {
+	if ($f =~ /^(.*)\.t$/) {
+		next if ($tests ne '' and $tests !~ /(^|\s+)$1(\s+|$)/);
 		push @fs, $srcdir.'/'.$f;
 	}
 }
 closedir DIR;
 runtests @fs;
-

Modified: lighttpd/trunk/tests/var-include.conf
===================================================================
--- lighttpd/trunk/tests/var-include.conf	2009-03-18 10:18:52 UTC (rev 354)
+++ lighttpd/trunk/tests/var-include.conf	2009-03-18 10:20:09 UTC (rev 355)
@@ -3,7 +3,6 @@
 debug.log-condition-handling = "enable"
 
 server.document-root         = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
-server.pid-file              = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid"
 
 ## bind to port (default: 80)
 server.port                 = 2048




More information about the pkg-lighttpd-maintainers mailing list