[SCM] Debian packaging for apr branch, upstream, updated. a141e0442fe9cc387ac0dd5793f4f37c779b6173

Stefan Fritsch sf at sfritsch.de
Tue Jul 2 19:52:46 UTC 2013


The following commit has been merged in the upstream branch:
commit a141e0442fe9cc387ac0dd5793f4f37c779b6173
Author: Stefan Fritsch <sf at sfritsch.de>
Date:   Tue Jul 2 21:50:40 2013 +0200

    Upstream tarball 1.4.8

diff --git a/CHANGES b/CHANGES
index f3213bf..51d1236 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,11 +1,73 @@
                                                      -*- coding: utf-8 -*-
+Changes for APR 1.4.8
+
+  *) Fix compiltation with FreeBSD on ARM.  [Olli Hauer <ohauer gmx.de>]
+
+  *) Fix 1.4.7 regression in apr_mcast_hops() and apr_mcast_loopback()
+     for AF_INET (IPv4) sockets on most Unix platforms.  [Joe Orton]
+
+  *) Fix the return value of apr_threadattr_detach_get() on some
+     platforms like OS X and Solaris. [Rainer Jung, <dusanv gmail com>]
+
+Changes for APR 1.4.7
+
+  *) Fix apr_sockaddr_info_get() not returning an error in some cases.
+     PR 54779. [Jan Kaluža <jkaluza redhat com>]
+
+  *) Fix amd64 assembler version of apr_atomic_xchgptr(). PR 51851. [Mattias
+     Engdegård <mattiase acm org>]
+
+  *) Fix PPC atomics to work with gcc 4.0. PR 54840. [Mattias Engdegård
+     <mattiase acm org>]
+
+  *) configure: Fix detection of O_NONBLOCK inheritance on busy
+     systems.  [Rainer Jung]
+
+  *) Remove unused code, fix strict C compliance bug in SHA-256
+     implementation.  [Jan Kaluza <jkaluza redhat.com>]
+
+  *) Fix apr_ipsubnet_test() false positives when comparing IPv4
+     subnet representation against an IPv6 address.  PR 54047.  [Joe Orton]
+
+  *) apr_socket_accept_filter: Return success when trying to again set
+     the filter to the same value as before, avoiding an unhelpful
+     APR_EINVAL.  PR 37863.  [Jeff Trawick]
+
+  *) configure: Fix Linux 3.x detection. PR 54001. [Gilles Espinasse
+     <g esp free fr>]
+
+  *) apr_time_exp_*() on Windows: Fix error in the tm_yday field of
+     apr_time_exp_t for times within leap years.  PR 53175.
+     [Jeff Trawick]
+
+  *) Improve platform detection by updating config.guess and config.sub.
+     [Rainer Jung]
+
+  *) Add support for OSX Mountain Lion (10.8) [Jim Jagielski]
+
+  *) Add various gcc function attributes. [Stefan Fritsch]
+
+  *) Fix some problems in apr_sockaddr_info_get() when trying to resolve
+     the loopback addresses of a protocol family that is not otherwise
+     configured on the system. PR 52709. [Nirgal Vourgère
+     <jmv_deb nirgal com>, Stefan Fritsch]
+
+  *) Fix file not being unlocked if truncate call on a file fails.
+     [Mladen Turk]
+
+  *) apr_mcast_hops: Fix EINVAL for IPv6 sockets caused by using byte
+     instead integer for setsockopt. [Mladen Turk]
+
+  *) Windows: Fix compile-time checks for 64-bit builds, resolving a
+     crash in httpd's mod_rewrite.  PR 49155.  [<anindyabaruah gmail.com>]
+
 Changes for APR 1.4.6
 
   *) Flush write buffer before truncate call on a file.
      [Mladen Turk]
 
-  *) Security: oCERT-2011-003
-     Randomise hashes by providing a seed. 
+  *) Randomise hashes by providing a seed. 
+     Assigned CVE-2012-0840, oCERT-2011-003, but not known to be exploitable.
      [Bojan Smojver, Branko Čibej, Ruediger Pluem et al.]
 
   *) apr_random: Prevent segfault if pool used to initialize apr_random is
diff --git a/Makefile.win b/Makefile.win
index d2090f3..5f9c313 100644
--- a/Makefile.win
+++ b/Makefile.win
@@ -25,7 +25,7 @@
 #
 # For example;
 #
-#   nmake -f Makefile.win PREFIX=C:\APR buildall checkall installall clean
+#   nmake -f Makefile.win PREFIX=C:\APR buildall checkall install clean
 #
 
 !IF EXIST("apr.sln") && ([devenv /help > NUL 2>&1] == 0) \
diff --git a/apr.spec b/apr.spec
index abecbdf..40204ff 100644
--- a/apr.spec
+++ b/apr.spec
@@ -3,7 +3,7 @@
 
 Summary: Apache Portable Runtime library
 Name: apr
-Version: 1.4.6
+Version: 1.4.8
 Release: 1
 License: Apache Software License
 Group: System Environment/Libraries
diff --git a/atomic/unix/ia32.c b/atomic/unix/ia32.c
index 3826f92..63f48a7 100644
--- a/atomic/unix/ia32.c
+++ b/atomic/unix/ia32.c
@@ -117,7 +117,7 @@ APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with)
 #elif APR_SIZEOF_VOIDP == 8
     asm volatile ("xchgq %q2, %1"
                   : "=a" (prev), "+m" (*mem)
-                  : "r" ((unsigned long)with));
+                  : "0" (with));
 #else
 #error APR_SIZEOF_VOIDP value not supported
 #endif
diff --git a/atomic/unix/ppc.c b/atomic/unix/ppc.c
index db9fca9..ae8d503 100644
--- a/atomic/unix/ppc.c
+++ b/atomic/unix/ppc.c
@@ -19,7 +19,7 @@
 #ifdef USE_ATOMICS_PPC
 
 #ifdef PPC405_ERRATA
-#   define PPC405_ERR77_SYNC   "	sync\n"
+#   define PPC405_ERR77_SYNC   "    sync\n"
 #else
 #   define PPC405_ERR77_SYNC
 #endif
@@ -43,12 +43,12 @@ APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint3
 {
     apr_uint32_t prev, temp;
 
-    asm volatile ("loop_%=:\n"                  /* lost reservation     */
-                  "	lwarx   %0,0,%3\n"      /* load and reserve     */
-                  "	add     %1,%0,%4\n"     /* add val and prev     */
-                  PPC405_ERR77_SYNC             /* ppc405 Erratum 77    */
-                  "	stwcx.  %1,0,%3\n"      /* store new value      */
-                  "	bne-    loop_%=\n"      /* loop if lost         */
+    asm volatile ("1:\n"                       /* lost reservation     */
+                  "    lwarx   %0,0,%3\n"      /* load and reserve     */
+                  "    add     %1,%0,%4\n"     /* add val and prev     */
+                  PPC405_ERR77_SYNC            /* ppc405 Erratum 77    */
+                  "    stwcx.  %1,0,%3\n"      /* store new value      */
+                  "    bne-    1b\n"           /* loop if lost         */
                   : "=&r" (prev), "=&r" (temp), "=m" (*mem)
                   : "b" (mem), "r" (val)
                   : "cc", "memory");
@@ -60,12 +60,12 @@ APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val)
 {
     apr_uint32_t temp;
 
-    asm volatile ("loop_%=:\n"                  /* lost reservation     */
-                  "	lwarx   %0,0,%2\n"      /* load and reserve     */
-                  "	subf    %0,%3,%0\n"     /* subtract val         */
-                  PPC405_ERR77_SYNC             /* ppc405 Erratum 77    */
-                  "	stwcx.  %0,0,%2\n"      /* store new value      */
-                  "	bne-    loop_%=\n"      /* loop if lost         */
+    asm volatile ("1:\n"                       /* lost reservation     */
+                  "    lwarx   %0,0,%2\n"      /* load and reserve     */
+                  "    subf    %0,%3,%0\n"     /* subtract val         */
+                  PPC405_ERR77_SYNC            /* ppc405 Erratum 77    */
+                  "    stwcx.  %0,0,%2\n"      /* store new value      */
+                  "    bne-    1b\n"           /* loop if lost         */
                   : "=&r" (temp), "=m" (*mem)
                   : "b" (mem), "r" (val)
                   : "cc", "memory");
@@ -75,13 +75,13 @@ APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem)
 {
     apr_uint32_t prev;
 
-    asm volatile ("loop_%=:\n"                  /* lost reservation     */
-                  "	lwarx   %0,0,%2\n"      /* load and reserve     */
-                  "	addi    %0,%0,1\n"      /* add immediate        */
-                  PPC405_ERR77_SYNC             /* ppc405 Erratum 77    */
-                  "	stwcx.  %0,0,%2\n"      /* store new value      */
-                  "	bne-    loop_%=\n"      /* loop if lost         */
-                  "	subi    %0,%0,1\n"      /* return old value     */
+    asm volatile ("1:\n"                       /* lost reservation     */
+                  "    lwarx   %0,0,%2\n"      /* load and reserve     */
+                  "    addi    %0,%0,1\n"      /* add immediate        */
+                  PPC405_ERR77_SYNC            /* ppc405 Erratum 77    */
+                  "    stwcx.  %0,0,%2\n"      /* store new value      */
+                  "    bne-    1b\n"           /* loop if lost         */
+                  "    subi    %0,%0,1\n"      /* return old value     */
                   : "=&b" (prev), "=m" (*mem)
                   : "b" (mem), "m" (*mem)
                   : "cc", "memory");
@@ -93,12 +93,12 @@ APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem)
 {
     apr_uint32_t prev;
 
-    asm volatile ("loop_%=:\n"                  /* lost reservation     */
-                  "	lwarx   %0,0,%2\n"      /* load and reserve     */
-                  "	subi    %0,%0,1\n"      /* subtract immediate   */
-                  PPC405_ERR77_SYNC             /* ppc405 Erratum 77    */
-                  "	stwcx.  %0,0,%2\n"      /* store new value      */
-                  "	bne-    loop_%=\n"      /* loop if lost         */
+    asm volatile ("1:\n"                       /* lost reservation     */
+                  "    lwarx   %0,0,%2\n"      /* load and reserve     */
+                  "    subi    %0,%0,1\n"      /* subtract immediate   */
+                  PPC405_ERR77_SYNC            /* ppc405 Erratum 77    */
+                  "    stwcx.  %0,0,%2\n"      /* store new value      */
+                  "    bne-    1b\n"           /* loop if lost         */
                   : "=&b" (prev), "=m" (*mem)
                   : "b" (mem), "m" (*mem)
                   : "cc", "memory");
@@ -111,14 +111,14 @@ APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint3
 {
     apr_uint32_t prev;
 
-    asm volatile ("loop_%=:\n"                  /* lost reservation     */
-                  "	lwarx   %0,0,%1\n"      /* load and reserve     */
-                  "	cmpw    %0,%3\n"        /* compare operands     */
-                  "	bne-    exit_%=\n"      /* skip if not equal    */
-                  PPC405_ERR77_SYNC             /* ppc405 Erratum 77    */
-                  "	stwcx.  %2,0,%1\n"      /* store new value      */
-                  "	bne-    loop_%=\n"      /* loop if lost         */
-                  "exit_%=:\n"                  /* not equal            */
+    asm volatile ("1:\n"                       /* lost reservation     */
+                  "    lwarx   %0,0,%1\n"      /* load and reserve     */
+                  "    cmpw    %0,%3\n"        /* compare operands     */
+                  "    bne-    exit_%=\n"      /* skip if not equal    */
+                  PPC405_ERR77_SYNC            /* ppc405 Erratum 77    */
+                  "    stwcx.  %2,0,%1\n"      /* store new value      */
+                  "    bne-    1b\n"           /* loop if lost         */
+                  "exit_%=:\n"                 /* not equal            */
                   : "=&r" (prev)
                   : "b" (mem), "r" (with), "r" (cmp)
                   : "cc", "memory");
@@ -130,11 +130,11 @@ APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint
 {
     apr_uint32_t prev;
 
-    asm volatile ("loop_%=:\n"                  /* lost reservation     */
-                  "	lwarx   %0,0,%1\n"      /* load and reserve     */
-                  PPC405_ERR77_SYNC             /* ppc405 Erratum 77    */
-                  "	stwcx.  %2,0,%1\n"      /* store new value      */
-                  "	bne-    loop_%="        /* loop if lost         */
+    asm volatile ("1:\n"                       /* lost reservation     */
+                  "    lwarx   %0,0,%1\n"      /* load and reserve     */
+                  PPC405_ERR77_SYNC            /* ppc405 Erratum 77    */
+                  "    stwcx.  %2,0,%1\n"      /* store new value      */
+                  "    bne-    1b"             /* loop if lost         */
                   : "=&r" (prev)
                   : "b" (mem), "r" (val)
                   : "cc", "memory");
@@ -146,26 +146,26 @@ APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const void
 {
     void *prev;
 #if APR_SIZEOF_VOIDP == 4
-    asm volatile ("loop_%=:\n"                  /* lost reservation     */
-                  "	lwarx   %0,0,%1\n"      /* load and reserve     */
-                  "	cmpw    %0,%3\n"        /* compare operands     */
-                  "	bne-    exit_%=\n"      /* skip if not equal    */
-                  PPC405_ERR77_SYNC             /* ppc405 Erratum 77    */
-                  "	stwcx.  %2,0,%1\n"      /* store new value      */
-                  "	bne-    loop_%=\n"      /* loop if lost         */
-                  "exit_%=:\n"                  /* not equal            */
+    asm volatile ("1:\n"                       /* lost reservation     */
+                  "    lwarx   %0,0,%1\n"      /* load and reserve     */
+                  "    cmpw    %0,%3\n"        /* compare operands     */
+                  "    bne-    2f\n"           /* skip if not equal    */
+                  PPC405_ERR77_SYNC            /* ppc405 Erratum 77    */
+                  "    stwcx.  %2,0,%1\n"      /* store new value      */
+                  "    bne-    1b\n"           /* loop if lost         */
+                  "2:\n"                       /* not equal            */
                   : "=&r" (prev)
                   : "b" (mem), "r" (with), "r" (cmp)
                   : "cc", "memory");
 #elif APR_SIZEOF_VOIDP == 8
-    asm volatile ("loop_%=:\n"                  /* lost reservation     */
-                  "	ldarx   %0,0,%1\n"      /* load and reserve     */
-                  "	cmpd    %0,%3\n"        /* compare operands     */
-                  "	bne-    exit_%=\n"      /* skip if not equal    */
-                  PPC405_ERR77_SYNC             /* ppc405 Erratum 77    */
-                  "	stdcx.  %2,0,%1\n"      /* store new value      */
-                  "	bne-    loop_%=\n"      /* loop if lost         */
-                  "exit_%=:\n"                  /* not equal            */
+    asm volatile ("1:\n"                       /* lost reservation     */
+                  "    ldarx   %0,0,%1\n"      /* load and reserve     */
+                  "    cmpd    %0,%3\n"        /* compare operands     */
+                  "    bne-    2f\n"           /* skip if not equal    */
+                  PPC405_ERR77_SYNC            /* ppc405 Erratum 77    */
+                  "    stdcx.  %2,0,%1\n"      /* store new value      */
+                  "    bne-    1b\n"           /* loop if lost         */
+                  "2:\n"                       /* not equal            */
                   : "=&r" (prev)
                   : "b" (mem), "r" (with), "r" (cmp)
                   : "cc", "memory");
@@ -179,22 +179,22 @@ APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with)
 {
     void *prev;
 #if APR_SIZEOF_VOIDP == 4
-    asm volatile ("loop_%=:\n"                  /* lost reservation     */
-                  "	lwarx   %0,0,%1\n"      /* load and reserve     */
-                  PPC405_ERR77_SYNC             /* ppc405 Erratum 77    */
-                  "	stwcx.  %2,0,%1\n"      /* store new value      */
-                  "	bne-    loop_%=\n"      /* loop if lost         */
-                  "	isync\n"                /* memory barrier       */
+    asm volatile ("1:\n"                       /* lost reservation     */
+                  "    lwarx   %0,0,%1\n"      /* load and reserve     */
+                  PPC405_ERR77_SYNC            /* ppc405 Erratum 77    */
+                  "    stwcx.  %2,0,%1\n"      /* store new value      */
+                  "    bne-    1b\n"           /* loop if lost         */
+                  "    isync\n"                /* memory barrier       */
                   : "=&r" (prev)
                   : "b" (mem), "r" (with)
                   : "cc", "memory");
 #elif APR_SIZEOF_VOIDP == 8
-    asm volatile ("loop_%=:\n"                  /* lost reservation     */
-                  "	ldarx   %0,0,%1\n"      /* load and reserve     */
-                  PPC405_ERR77_SYNC             /* ppc405 Erratum 77    */
-                  "	stdcx.  %2,0,%1\n"      /* store new value      */
-                  "	bne-    loop_%=\n"      /* loop if lost         */
-                  "	isync\n"                /* memory barrier       */
+    asm volatile ("1:\n"                       /* lost reservation     */
+                  "    ldarx   %0,0,%1\n"      /* load and reserve     */
+                  PPC405_ERR77_SYNC            /* ppc405 Erratum 77    */
+                  "    stdcx.  %2,0,%1\n"      /* store new value      */
+                  "    bne-    1b\n"           /* loop if lost         */
+                  "    isync\n"                /* memory barrier       */
                   : "=&r" (prev)
                   : "b" (mem), "r" (with)
                   : "cc", "memory");
diff --git a/atomic/unix/s390.c b/atomic/unix/s390.c
index 3e23320..b6b6f42 100644
--- a/atomic/unix/s390.c
+++ b/atomic/unix/s390.c
@@ -38,10 +38,10 @@ static APR_INLINE apr_uint32_t atomic_add(volatile apr_uint32_t *mem, apr_uint32
     apr_uint32_t prev = *mem, temp;
 
     asm volatile ("loop_%=:\n"
-                  "	lr  %1,%0\n"
-                  "	alr %1,%3\n"
-                  "	cs  %0,%1,%2\n"
-                  "	jl  loop_%=\n"
+                  "    lr  %1,%0\n"
+                  "    alr %1,%3\n"
+                  "    cs  %0,%1,%2\n"
+                  "    jl  loop_%=\n"
                   : "+d" (prev), "+d" (temp), "=Q" (*mem)
                   : "d" (val), "m" (*mem)
                   : "cc", "memory");
@@ -64,10 +64,10 @@ static APR_INLINE apr_uint32_t atomic_sub(volatile apr_uint32_t *mem, apr_uint32
     apr_uint32_t prev = *mem, temp;
 
     asm volatile ("loop_%=:\n"
-                  "	lr  %1,%0\n"
-                  "	slr %1,%3\n"
-                  "	cs  %0,%1,%2\n"
-                  "	jl  loop_%=\n"
+                  "    lr  %1,%0\n"
+                  "    slr %1,%3\n"
+                  "    cs  %0,%1,%2\n"
+                  "    jl  loop_%=\n"
                   : "+d" (prev), "+d" (temp), "=Q" (*mem)
                   : "d" (val), "m" (*mem)
                   : "cc", "memory");
@@ -88,7 +88,7 @@ APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem)
 APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with,
                                            apr_uint32_t cmp)
 {
-    asm volatile ("	cs  %0,%2,%1\n"
+    asm volatile ("    cs  %0,%2,%1\n"
                   : "+d" (cmp), "=Q" (*mem)
                   : "d" (with), "m" (*mem)
                   : "cc", "memory");
@@ -101,8 +101,8 @@ APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint
     apr_uint32_t prev = *mem;
 
     asm volatile ("loop_%=:\n"
-                  "	cs  %0,%2,%1\n"
-                  "	jl  loop_%=\n"
+                  "    cs  %0,%2,%1\n"
+                  "    jl  loop_%=\n"
                   : "+d" (prev), "=Q" (*mem)
                   : "d" (val), "m" (*mem)
                   : "cc", "memory");
@@ -114,12 +114,12 @@ APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const void
 {
     void *prev = (void *) cmp;
 #if APR_SIZEOF_VOIDP == 4
-    asm volatile ("	cs  %0,%2,%1\n"
+    asm volatile ("    cs  %0,%2,%1\n"
                   : "+d" (prev), "=Q" (*mem)
                   : "d" (with), "m" (*mem)
                   : "cc", "memory");
 #elif APR_SIZEOF_VOIDP == 8
-    asm volatile ("	csg %0,%2,%1\n"
+    asm volatile ("    csg %0,%2,%1\n"
                   : "+d" (prev), "=Q" (*mem)
                   : "d" (with), "m" (*mem)
                   : "cc", "memory");
@@ -134,15 +134,15 @@ APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with)
     void *prev = (void *) *mem;
 #if APR_SIZEOF_VOIDP == 4
     asm volatile ("loop_%=:\n"
-                  "	cs  %0,%2,%1\n"
-                  "	jl  loop_%=\n"
+                  "    cs  %0,%2,%1\n"
+                  "    jl  loop_%=\n"
                   : "+d" (prev), "=Q" (*mem)
                   : "d" (with), "m" (*mem)
                   : "cc", "memory");
 #elif APR_SIZEOF_VOIDP == 8
     asm volatile ("loop_%=:\n"
-                  "	csg %0,%2,%1\n"
-                  "	jl  loop_%=\n"
+                  "    csg %0,%2,%1\n"
+                  "    jl  loop_%=\n"
                   : "+d" (prev), "=Q" (*mem)
                   : "d" (with), "m" (*mem)
                   : "cc", "memory");
diff --git a/build/NWGNUenvironment.inc b/build/NWGNUenvironment.inc
index c15e003..bb58a3a 100644
--- a/build/NWGNUenvironment.inc
+++ b/build/NWGNUenvironment.inc
@@ -212,7 +212,7 @@ PLIB3S	= $(METROWERKS)/Novell Support/Metrowerks Support/Libraries/MSL C++/MWCPP
 # The default flags are as follows:
 #
 # -c                    compile only, no link
-# -nosyspath            treat #include <...> like #include "..."
+# -gccinc               search directory of referencing file first for #includes
 # -Cpp_exceptions off   disable C++ exceptions
 # -RTTI off             disable C++ run-time typing information
 # -align 4              align on 4 byte bounderies
@@ -220,7 +220,7 @@ PLIB3S	= $(METROWERKS)/Novell Support/Metrowerks Support/Libraries/MSL C++/MWCPP
 # -proc PII             generate code base on Pentium II instruction set
 # -inst mmx             use MMX extensions (not used)
 
-CFLAGS = -c -nosyspath -Cpp_exceptions off -RTTI off -align 4 -w nocmdline -proc PII
+CFLAGS = -c -w nocmdline -gccinc -Cpp_exceptions off -RTTI off -align 4 -proc PII
 
 ifeq "$(REQUIRE_PROTOTYPES)" "1"
 CFLAGS += -r
diff --git a/build/NWGNUhead.inc b/build/NWGNUhead.inc
index 723137c..fbfc3ec 100644
--- a/build/NWGNUhead.inc
+++ b/build/NWGNUhead.inc
@@ -69,9 +69,11 @@ clobber_install ::
 
 $(SUBDIRS) : FORCE
 ifneq "$(MAKECMDGOALS)" "clean"
+ifneq "$(findstring clobber_,$(MAKECMDGOALS))" "clobber_"
 	@$(ECHONL)
 	@echo Building $(CURDIR)/$@
 endif
+endif
 	$(MAKE) -C $@ $(MAKECMDGOALS) -f NWGNUmakefile RELEASE=$(RELEASE) DEST="$(INSTALL)" LM_LICENSE_FILE="$(LM_LICENSE_FILE)"
 	@$(ECHONL)
 
diff --git a/build/NWGNUtail.inc b/build/NWGNUtail.inc
index ad911c9..4e66c89 100644
--- a/build/NWGNUtail.inc
+++ b/build/NWGNUtail.inc
@@ -102,7 +102,8 @@ endif
 # Generic compiler rules
 #
 
-ifneq ($(MAKECMDGOALS),clean)
+ifneq "$(MAKECMDGOALS)" "clean"
+ifneq "$(findstring clobber_,$(MAKECMDGOALS))" "clobber_"
 $(APRBUILD)/NWGNUversion.inc : $(APRBUILD)/nw_ver.awk $(APR)/include/apr_version.h
 #	@echo Generating $@
 	@echo GEN  $@
@@ -118,6 +119,7 @@ VERSION_STR	= 1.4.0
 VERSION_MAJMIN	= 14
 endif
 endif
+endif
 
 ifeq "$(words $(strip $(TARGET_nlm)))" "1"
 INCLUDE_BLDCMDS	= 1
diff --git a/build/apr_hints.m4 b/build/apr_hints.m4
index 9cde0fe..19fdedf 100644
--- a/build/apr_hints.m4
+++ b/build/apr_hints.m4
@@ -119,18 +119,7 @@ dnl	       # Not a problem in 10.20.  Otherwise, who knows?
 	APR_ADDTO(CPPFLAGS, [-DHPUX -D_REENTRANT])
 	;;
     *-linux*)
-        case `uname -r` in
-	    2.* )  APR_ADDTO(CPPFLAGS, [-DLINUX=2])
-	           ;;
-	    1.* )  APR_ADDTO(CPPFLAGS, [-DLINUX=1])
-	           ;;
-	    * )
-	           ;;
-        esac
-	APR_ADDTO(CPPFLAGS, [-D_REENTRANT -D_GNU_SOURCE])
-	;;
-    *-GNU*)
-	APR_ADDTO(CPPFLAGS, [-DHURD -D_GNU_SOURCE])
+	APR_ADDTO(CPPFLAGS, [-DLINUX -D_REENTRANT -D_GNU_SOURCE])
 	;;
     *-lynx-lynxos)
 	APR_ADDTO(CPPFLAGS, [-D__NO_INCLUDE_WARN__ -DLYNXOS])
@@ -180,6 +169,9 @@ dnl	       # Not a problem in 10.20.  Otherwise, who knows?
     *-k*bsd*-gnu)
         APR_ADDTO(CPPFLAGS, [-D_REENTRANT -D_GNU_SOURCE])
         ;;
+    *-gnu*|*-GNU*)
+        APR_ADDTO(CPPFLAGS, [-D_REENTRANT -D_GNU_SOURCE -DHURD])
+        ;;
     *-next-nextstep*)
 	APR_SETIFNULL(CFLAGS, [-O])
 	APR_ADDTO(CPPFLAGS, [-DNEXT])
@@ -203,7 +195,7 @@ dnl	       # Not a problem in 10.20.  Otherwise, who knows?
                 APR_SETIFNULL(ac_cv_func_kqueue, [no]) 
                 APR_SETIFNULL(ac_cv_func_poll, [no]) # See issue 34332
             ;;
-            *-apple-darwin1[[01]].*)
+            *-apple-darwin1?.*)
                 APR_ADDTO(CPPFLAGS, [-DDARWIN_10])
             ;;
         esac
diff --git a/build/apr_network.m4 b/build/apr_network.m4
index 4d479a4..d70fbd9 100644
--- a/build/apr_network.m4
+++ b/build/apr_network.m4
@@ -555,13 +555,24 @@ dnl
 AC_DEFUN([APR_CHECK_O_NONBLOCK_INHERITED], [
   AC_CACHE_CHECK(if O_NONBLOCK setting is inherited from listening sockets, ac_cv_o_nonblock_inherited,[
   AC_TRY_RUN( [
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_STDIO_H
 #include <stdio.h>
+#endif
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
 #ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
 #endif
@@ -632,6 +643,26 @@ int main(void) {
         exit(1);
     }
     sa_len = sizeof sa;
+    /* 1 second select timeout */
+    tv.tv_sec = 1;
+    tv.tv_usec = 0;
+    /* Set up fd set */
+    FD_ZERO(&fds);
+    FD_SET(listen_s, &fds);
+    /* Wait for socket to become readable */
+    rc = select(listen_s + 1, &fds, NULL, NULL, &tv);
+    if (rc < 0) {
+        perror("select");
+        exit(1);
+    }
+    if (rc == 0) {
+        fprintf(stderr, "Socket failed to become readable (timeout)\n");
+        exit(1);
+    }
+    if (!FD_ISSET(listen_s, &fds)) {
+        fprintf(stderr, "Socket failed to become readable (selected another fd)\n");
+        exit(1);
+    }
     connected_s = accept(listen_s, (struct sockaddr *)&sa, &sa_len);
     if (connected_s < 0) {
         perror("accept");
diff --git a/build/config.guess b/build/config.guess
index 40eaed4..2055429 100755
--- a/build/config.guess
+++ b/build/config.guess
@@ -1,14 +1,12 @@
 #! /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, 2007, 2008, 2009, 2010,
-#   2011 Free Software Foundation, Inc.
+#   Copyright 1992-2013 Free Software Foundation, Inc.
 
-timestamp='2011-05-11'
+timestamp='2013-04-24'
 
 # 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
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful, but
@@ -17,26 +15,22 @@ timestamp='2011-05-11'
 # General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner.  Please send patches (context
-# diff format) to <config-patches at gnu.org> and include a ChangeLog
-# entry.
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
 #
-# This script attempts to guess a canonical system name similar to
-# config.sub.  If it succeeds, it prints the system name on stdout, and
-# exits with 0.  Otherwise, it exits with 1.
+# Originally written by Per Bothner.
 #
 # You can get the latest version of this script from:
 # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+#
+# Please send patches with a ChangeLog entry to config-patches at gnu.org.
+
 
 me=`echo "$0" | sed -e 's,.*/,,'`
 
@@ -56,9 +50,7 @@ version="\
 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, 2006, 2007, 2008, 2009, 2010, 2011 Free
-Software Foundation, Inc.
+Copyright 1992-2013 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."
@@ -145,7 +137,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:NetBSD:*:*)
 	# NetBSD (nbsd) targets should (where applicable) match one or
-	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
 	# switched to ELF, *-*-netbsd* would select the old
 	# object file format.  This provides both forward
@@ -202,6 +194,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
 	echo "${machine}-${os}${release}"
 	exit ;;
+    *:Bitrig:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+	exit ;;
     *:OpenBSD:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
 	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
@@ -304,7 +300,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
 	echo arm-acorn-riscix${UNAME_RELEASE}
 	exit ;;
-    arm:riscos:*:*|arm:RISCOS:*:*)
+    arm*:riscos:*:*|arm*:RISCOS:*:*)
 	echo arm-unknown-riscos
 	exit ;;
     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@@ -792,21 +788,26 @@ EOF
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit ;;
     *:FreeBSD:*:*)
-	case ${UNAME_MACHINE} in
-	    pc98)
-		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	case ${UNAME_PROCESSOR} in
 	    amd64)
 		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	    *)
-		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	esac
 	exit ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
 	exit ;;
+    *:MINGW64*:*)
+	echo ${UNAME_MACHINE}-pc-mingw64
+	exit ;;
     *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
+    i*:MSYS*:*)
+	echo ${UNAME_MACHINE}-pc-msys
+	exit ;;
     i*:windows32*:*)
 	# uname -m includes "-pc" on this system.
 	echo ${UNAME_MACHINE}-mingw32
@@ -861,6 +862,13 @@ EOF
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
+    aarch64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    aarch64_be:Linux:*:*)
+	UNAME_MACHINE=aarch64_be
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
     alpha:Linux:*:*)
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
 	  EV5)   UNAME_MACHINE=alphaev5 ;;
@@ -875,6 +883,9 @@ EOF
 	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
 	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
 	exit ;;
+    arc:Linux:*:* | arceb:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
     arm*:Linux:*:*)
 	eval $set_cc_for_build
 	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
@@ -895,13 +906,16 @@ EOF
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     cris:Linux:*:*)
-	echo cris-axis-linux-gnu
+	echo ${UNAME_MACHINE}-axis-linux-gnu
 	exit ;;
     crisv32:Linux:*:*)
-	echo crisv32-axis-linux-gnu
+	echo ${UNAME_MACHINE}-axis-linux-gnu
 	exit ;;
     frv:Linux:*:*)
-	echo frv-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    hexagon:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     i*86:Linux:*:*)
 	LIBC=gnu
@@ -910,6 +924,11 @@ EOF
 	#ifdef __dietlibc__
 	LIBC=dietlibc
 	#endif
+	#else
+	#include <features.h>
+	#ifdef __UCLIBC__
+	LIBC=uclibc
+	#endif
 EOF
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
 	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
@@ -942,8 +961,11 @@ EOF
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 	;;
+    or1k:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
     or32:Linux:*:*)
-	echo or32-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     padre:Linux:*:*)
 	echo sparc-unknown-linux-gnu
@@ -978,13 +1000,15 @@ EOF
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     tile*:Linux:*:*)
-	echo ${UNAME_MACHINE}-tilera-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     vax:Linux:*:*)
 	echo ${UNAME_MACHINE}-dec-linux-gnu
 	exit ;;
     x86_64:Linux:*:*)
-	echo x86_64-unknown-linux-gnu
+	LIBC=gnu
+	test -r /lib/libc.so && od -An -S13 /lib/libc.so | grep -q __uClibc_main && LIBC=uclibc
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     xtensa*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -1191,6 +1215,9 @@ EOF
     BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
 	echo i586-pc-haiku
 	exit ;;
+    x86_64:Haiku:*:*)
+	echo x86_64-unknown-haiku
+	exit ;;
     SX-4:SUPER-UX:*:*)
 	echo sx4-nec-superux${UNAME_RELEASE}
 	exit ;;
@@ -1246,7 +1273,7 @@ EOF
     NEO-?:NONSTOP_KERNEL:*:*)
 	echo neo-tandem-nsk${UNAME_RELEASE}
 	exit ;;
-    NSE-?:NONSTOP_KERNEL:*:*)
+    NSE-*:NONSTOP_KERNEL:*:*)
 	echo nse-tandem-nsk${UNAME_RELEASE}
 	exit ;;
     NSR-?:NONSTOP_KERNEL:*:*)
@@ -1315,11 +1342,11 @@ EOF
     i*86:AROS:*:*)
 	echo ${UNAME_MACHINE}-pc-aros
 	exit ;;
+    x86_64:VMkernel:*:*)
+	echo ${UNAME_MACHINE}-unknown-esx
+	exit ;;
 esac
 
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
 eval $set_cc_for_build
 cat >$dummy.c <<EOF
 #ifdef _SEQUENT_
diff --git a/build/config.sub b/build/config.sub
index 30fdca8..8b612ab 100755
--- a/build/config.sub
+++ b/build/config.sub
@@ -1,38 +1,31 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-#   2011 Free Software Foundation, Inc.
+#   Copyright 1992-2013 Free Software Foundation, Inc.
 
-timestamp='2011-03-23'
+timestamp='2013-04-24'
 
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine.  It does not imply ALL GNU software can.
-#
-# 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
-# the Free Software Foundation; either version 2 of the License, or
+# 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
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
 
 
-# Please send patches to <config-patches at gnu.org>.  Submit a context
-# diff and a properly formatted GNU ChangeLog entry.
+# Please send patches with a ChangeLog entry to config-patches at gnu.org.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
@@ -75,9 +68,7 @@ Report bugs and patches to <config-patches at gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
-Software Foundation, Inc.
+Copyright 1992-2013 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."
@@ -125,13 +116,17 @@ esac
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
-  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+  linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
   knetbsd*-gnu* | netbsd*-gnu* | \
   kopensolaris*-gnu* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
+  android-linux)
+    os=-linux-android
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+    ;;
   *)
     basic_machine=`echo $1 | sed 's/-[^-]*$//'`
     if [ $basic_machine != $1 ]
@@ -154,7 +149,7 @@ case $os in
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis | -knuth | -cray | -microblaze)
+	-apple | -axis | -knuth | -cray | -microblaze*)
 		os=
 		basic_machine=$1
 		;;
@@ -223,6 +218,12 @@ case $os in
 	-isc*)
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
+	-lynx*178)
+		os=-lynxos178
+		;;
+	-lynx*5)
+		os=-lynxos5
+		;;
 	-lynx*)
 		os=-lynxos
 		;;
@@ -247,20 +248,27 @@ case $basic_machine in
 	# Some are omitted here because they have special meanings below.
 	1750a | 580 \
 	| a29k \
+	| aarch64 | aarch64_be \
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
-	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+	| arc | arceb \
+	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
+	| avr | avr32 \
+	| be32 | be64 \
 	| bfin \
 	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
+	| epiphany \
 	| fido | fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| hexagon \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
+	| le32 | le64 \
 	| lm32 \
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
-	| maxq | mb | microblaze | mcore | mep | metag \
+	| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
@@ -278,20 +286,21 @@ case $basic_machine in
 	| mipsisa64r2 | mipsisa64r2el \
 	| mipsisa64sb1 | mipsisa64sb1el \
 	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipsr5900 | mipsr5900el \
 	| mipstx39 | mipstx39el \
 	| mn10200 | mn10300 \
 	| moxie \
 	| mt \
 	| msp430 \
 	| nds32 | nds32le | nds32be \
-	| nios | nios2 \
+	| nios | nios2 | nios2eb | nios2el \
 	| ns16k | ns32k \
 	| open8 \
-	| or32 \
+	| or1k | or32 \
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle \
 	| pyramid \
-	| rx \
+	| rl78 | rx \
 	| score \
 	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
@@ -300,7 +309,7 @@ case $basic_machine in
 	| spu \
 	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
 	| ubicom32 \
-	| v850 | v850e \
+	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
 	| we32k \
 	| x86 | xc16x | xstormy16 | xtensa \
 	| z8k | z80)
@@ -315,8 +324,7 @@ case $basic_machine in
 	c6x)
 		basic_machine=tic6x-unknown
 		;;
-	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
-		# Motorola 68HC11/12.
+	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
 		basic_machine=$basic_machine-unknown
 		os=-none
 		;;
@@ -329,7 +337,10 @@ case $basic_machine in
 	strongarm | thumb | xscale)
 		basic_machine=arm-unknown
 		;;
-
+	xgate)
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
 	xscaleeb)
 		basic_machine=armeb-unknown
 		;;
@@ -352,11 +363,13 @@ case $basic_machine in
 	# Recognize the basic CPU types with company name.
 	580-* \
 	| a29k-* \
+	| aarch64-* | aarch64_be-* \
 	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
 	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
-	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* | avr32-* \
+	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* \
 	| clipper-* | craynv-* | cydra-* \
@@ -365,12 +378,15 @@ case $basic_machine in
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| hexagon-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
+	| le32-* | le64-* \
 	| lm32-* \
 	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+	| microblaze-* | microblazeel-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
 	| mips16-* \
 	| mips64-* | mips64el-* \
@@ -388,19 +404,20 @@ case $basic_machine in
 	| mipsisa64r2-* | mipsisa64r2el-* \
 	| mipsisa64sb1-* | mipsisa64sb1el-* \
 	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipsr5900-* | mipsr5900el-* \
 	| mipstx39-* | mipstx39el-* \
 	| mmix-* \
 	| mt-* \
 	| msp430-* \
 	| nds32-* | nds32le-* | nds32be-* \
-	| nios-* | nios2-* \
+	| nios-* | nios2-* | nios2eb-* | nios2el-* \
 	| none-* | np1-* | ns16k-* | ns32k-* \
 	| open8-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
 	| pyramid-* \
-	| romp-* | rs6000-* | rx-* \
+	| rl78-* | romp-* | rs6000-* | rx-* \
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
@@ -408,10 +425,11 @@ case $basic_machine in
 	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
 	| tahoe-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
-	| tile-* | tilegx-* \
+	| tile*-* \
 	| tron-* \
 	| ubicom32-* \
-	| v850-* | v850e-* | vax-* \
+	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+	| vax-* \
 	| we32k-* \
 	| x86-* | x86_64-* | xc16x-* | xps100-* \
 	| xstormy16-* | xtensa*-* \
@@ -711,7 +729,6 @@ case $basic_machine in
 	i370-ibm* | ibm*)
 		basic_machine=i370-ibm
 		;;
-# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
 	i*86v32)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv32
@@ -769,9 +786,13 @@ case $basic_machine in
 		basic_machine=ns32k-utek
 		os=-sysv
 		;;
-	microblaze)
+	microblaze*)
 		basic_machine=microblaze-xilinx
 		;;
+	mingw64)
+		basic_machine=x86_64-pc
+		os=-mingw64
+		;;
 	mingw32)
 		basic_machine=i386-pc
 		os=-mingw32
@@ -808,10 +829,18 @@ case $basic_machine in
 	ms1-*)
 		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
 		;;
+	msys)
+		basic_machine=i386-pc
+		os=-msys
+		;;
 	mvs)
 		basic_machine=i370-ibm
 		os=-mvs
 		;;
+	nacl)
+		basic_machine=le32-unknown
+		os=-nacl
+		;;
 	ncr3000)
 		basic_machine=i486-ncr
 		os=-sysv4
@@ -992,7 +1021,11 @@ case $basic_machine in
 		basic_machine=i586-unknown
 		os=-pw32
 		;;
-	rdos)
+	rdos | rdos64)
+		basic_machine=x86_64-pc
+		os=-rdos
+		;;
+	rdos32)
 		basic_machine=i386-pc
 		os=-rdos
 		;;
@@ -1120,13 +1153,8 @@ case $basic_machine in
 		basic_machine=t90-cray
 		os=-unicos
 		;;
-	# This must be matched before tile*.
-	tilegx*)
-		basic_machine=tilegx-unknown
-		os=-linux-gnu
-		;;
 	tile*)
-		basic_machine=tile-unknown
+		basic_machine=$basic_machine-unknown
 		os=-linux-gnu
 		;;
 	tx39)
@@ -1324,21 +1352,21 @@ case $os in
 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
 	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
-	      | -sym* | -kopensolaris* \
+	      | -sym* | -kopensolaris* | -plan9* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
 	      | -aos* | -aros* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-	      | -openbsd* | -solidbsd* \
+	      | -bitrig* | -openbsd* | -solidbsd* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* | -cegcc* \
-	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -linux-android* \
-	      | -linux-newlib* | -linux-uclibc* \
+	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@@ -1470,9 +1498,6 @@ case $os in
 	-aros*)
 		os=-aros
 		;;
-	-kaos*)
-		os=-kaos
-		;;
 	-zvmoe)
 		os=-zvmoe
 		;;
@@ -1521,6 +1546,9 @@ case $basic_machine in
 	c4x-* | tic4x-*)
 		os=-coff
 		;;
+	hexagon-*)
+		os=-elf
+		;;
 	tic54x-*)
 		os=-coff
 		;;
@@ -1548,9 +1576,6 @@ case $basic_machine in
 		;;
 	m68000-sun)
 		os=-sunos3
-		# This also exists in the configure program, but was not the
-		# default.
-		# os=-sunos4
 		;;
 	m68*-cisco)
 		os=-aout
@@ -1564,6 +1589,9 @@ case $basic_machine in
 	mips*-*)
 		os=-elf
 		;;
+	or1k-*)
+		os=-elf
+		;;
 	or32-*)
 		os=-coff
 		;;
diff --git a/build/mkdir.sh b/build/mkdir.sh
index b947c92..c59f03e 100755
--- a/build/mkdir.sh
+++ b/build/mkdir.sh
@@ -28,7 +28,13 @@ for file in ${1+"$@"} ; do
         esac
         if test ! -d "$pathcomp"; then
             echo "mkdir $pathcomp" 1>&2
-            mkdir "$pathcomp" || errstatus=$?
+            thiserrstatus=0
+            mkdir "$pathcomp" || thiserrstatus=$?
+            # ignore errors due to races if a parallel mkdir.sh already
+            # created the dir
+            if test $thiserrstatus != 0 && test ! -d "$pathcomp" ; then
+                errstatus=$thiserrstatus
+            fi
         fi
         pathcomp="$pathcomp/"
     done
diff --git a/configure b/configure
index cee0f0e..00122df 100755
--- a/configure
+++ b/configure
@@ -1,11 +1,9 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68.
+# Generated by GNU Autoconf 2.69.
 #
 #
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
@@ -134,6 +132,31 @@ export LANGUAGE
 # CDPATH.
 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
+# Use a proper internal environment variable to ensure we don't fall
+  # into an infinite loop, continuously re-executing ourselves.
+  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+    _as_can_reexec=no; export _as_can_reexec;
+    # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+  fi
+  # We don't want this to propagate to other subprocesses.
+          { _as_can_reexec=; unset _as_can_reexec;}
 if test "x$CONFIG_SHELL" = x; then
   as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
@@ -167,7 +190,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
 else
   exitcode=1; echo positional parameters were not saved.
 fi
-test x\$exitcode = x0 || exit 1"
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
   as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
   as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
@@ -220,21 +244,25 @@ IFS=$as_save_IFS
 
 
       if test "x$CONFIG_SHELL" != x; then :
-  # We cannot yet assume a decent shell, so we have to provide a
-	# neutralization value for shells without unset; and this also
-	# works around shells that cannot unset nonexistent variables.
-	# Preserve -v and -x to the replacement shell.
-	BASH_ENV=/dev/null
-	ENV=/dev/null
-	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-	export CONFIG_SHELL
-	case $- in # ((((
-	  *v*x* | *x*v* ) as_opts=-vx ;;
-	  *v* ) as_opts=-v ;;
-	  *x* ) as_opts=-x ;;
-	  * ) as_opts= ;;
-	esac
-	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+  export CONFIG_SHELL
+             # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
 fi
 
     if test x$as_have_required = xno; then :
@@ -336,6 +364,14 @@ $as_echo X"$as_dir" |
 
 
 } # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
 # as_fn_append VAR VALUE
 # ----------------------
 # Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -457,6 +493,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
   chmod +x "$as_me.lineno" ||
     { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
 
+  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+  # already done that, so ensure we don't try to do so again and fall
+  # in an infinite loop.  This has already happened in practice.
+  _as_can_reexec=no; export _as_can_reexec
   # Don't try to exec as it changes $[0], causing all sort of problems
   # (the dirname of $[0] is not the place where we might find the
   # original and so on.  Autoconf is especially sensitive to this).
@@ -491,16 +531,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -512,28 +552,8 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in #(
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -1371,8 +1391,6 @@ target=$target_alias
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
-    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
-    If a cross compiler is detected then cross compile mode will be used" >&2
   elif test "x$build_alias" != "x$host_alias"; then
     cross_compiling=yes
   fi
@@ -1642,9 +1660,9 @@ test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
 configure
-generated by GNU Autoconf 2.68
+generated by GNU Autoconf 2.69
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -1917,7 +1935,7 @@ $as_echo "$ac_try_echo"; } >&5
 	 test ! -s conftest.err
        } && test -s conftest$ac_exeext && {
 	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
+	 test -x conftest$ac_exeext
        }; then :
   ac_retval=0
 else
@@ -2074,7 +2092,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) >= 0)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2090,7 +2109,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2116,7 +2136,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) < 0)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2132,7 +2153,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) >= $ac_mid)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2166,7 +2188,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2342,7 +2365,7 @@ This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by $as_me, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
 
@@ -3192,14 +3215,6 @@ ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 # _LT_LANG
 
 
-
-############################################################
-# NOTE: This macro has been submitted for inclusion into   #
-#  GNU Autoconf as AC_PROG_GO.  When it is available in    #
-#  a released version of Autoconf we should remove this    #
-#  macro and use it instead.                               #
-############################################################
-#m4_defun
 #m4_ifndef
 
 
@@ -5069,7 +5084,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5109,7 +5124,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5162,7 +5177,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}cc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5203,7 +5218,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
@@ -5261,7 +5276,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5305,7 +5320,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5751,8 +5766,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
 struct buf { int x; };
 FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -5860,7 +5874,7 @@ do
     for ac_prog in sed gsed; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+      as_fn_executable_p "$ac_path_SED" || continue
 # Check for GNU ac_path_SED and select it if it is found.
   # Check for GNU $ac_path_SED
 case `"$ac_path_SED" --version 2>&1` in
@@ -6444,83 +6458,12 @@ if test "x$apr_preload_done" != "xyes" ; then
 
 	;;
     *-linux*)
-        case `uname -r` in
-	    2.* )
-  if test "x$CPPFLAGS" = "x"; then
-    test "x$silent" != "xyes" && echo "  setting CPPFLAGS to \"-DLINUX=2\""
-    CPPFLAGS="-DLINUX=2"
-  else
-    apr_addto_bugger="-DLINUX=2"
-    for i in $apr_addto_bugger; do
-      apr_addto_duplicate="0"
-      for j in $CPPFLAGS; do
-        if test "x$i" = "x$j"; then
-          apr_addto_duplicate="1"
-          break
-        fi
-      done
-      if test $apr_addto_duplicate = "0"; then
-        test "x$silent" != "xyes" && echo "  adding \"$i\" to CPPFLAGS"
-        CPPFLAGS="$CPPFLAGS $i"
-      fi
-    done
-  fi
-
-	           ;;
-	    1.* )
-  if test "x$CPPFLAGS" = "x"; then
-    test "x$silent" != "xyes" && echo "  setting CPPFLAGS to \"-DLINUX=1\""
-    CPPFLAGS="-DLINUX=1"
-  else
-    apr_addto_bugger="-DLINUX=1"
-    for i in $apr_addto_bugger; do
-      apr_addto_duplicate="0"
-      for j in $CPPFLAGS; do
-        if test "x$i" = "x$j"; then
-          apr_addto_duplicate="1"
-          break
-        fi
-      done
-      if test $apr_addto_duplicate = "0"; then
-        test "x$silent" != "xyes" && echo "  adding \"$i\" to CPPFLAGS"
-        CPPFLAGS="$CPPFLAGS $i"
-      fi
-    done
-  fi
-
-	           ;;
-	    * )
-	           ;;
-        esac
 
   if test "x$CPPFLAGS" = "x"; then
-    test "x$silent" != "xyes" && echo "  setting CPPFLAGS to \"-D_REENTRANT -D_GNU_SOURCE\""
-    CPPFLAGS="-D_REENTRANT -D_GNU_SOURCE"
+    test "x$silent" != "xyes" && echo "  setting CPPFLAGS to \"-DLINUX -D_REENTRANT -D_GNU_SOURCE\""
+    CPPFLAGS="-DLINUX -D_REENTRANT -D_GNU_SOURCE"
   else
-    apr_addto_bugger="-D_REENTRANT -D_GNU_SOURCE"
-    for i in $apr_addto_bugger; do
-      apr_addto_duplicate="0"
-      for j in $CPPFLAGS; do
-        if test "x$i" = "x$j"; then
-          apr_addto_duplicate="1"
-          break
-        fi
-      done
-      if test $apr_addto_duplicate = "0"; then
-        test "x$silent" != "xyes" && echo "  adding \"$i\" to CPPFLAGS"
-        CPPFLAGS="$CPPFLAGS $i"
-      fi
-    done
-  fi
-
-	;;
-    *-GNU*)
-
-  if test "x$CPPFLAGS" = "x"; then
-    test "x$silent" != "xyes" && echo "  setting CPPFLAGS to \"-DHURD -D_GNU_SOURCE\""
-    CPPFLAGS="-DHURD -D_GNU_SOURCE"
-  else
-    apr_addto_bugger="-DHURD -D_GNU_SOURCE"
+    apr_addto_bugger="-DLINUX -D_REENTRANT -D_GNU_SOURCE"
     for i in $apr_addto_bugger; do
       apr_addto_duplicate="0"
       for j in $CPPFLAGS; do
@@ -6770,6 +6713,29 @@ if test "x$apr_preload_done" != "xyes" ; then
   fi
 
         ;;
+    *-gnu*|*-GNU*)
+
+  if test "x$CPPFLAGS" = "x"; then
+    test "x$silent" != "xyes" && echo "  setting CPPFLAGS to \"-D_REENTRANT -D_GNU_SOURCE -DHURD\""
+    CPPFLAGS="-D_REENTRANT -D_GNU_SOURCE -DHURD"
+  else
+    apr_addto_bugger="-D_REENTRANT -D_GNU_SOURCE -DHURD"
+    for i in $apr_addto_bugger; do
+      apr_addto_duplicate="0"
+      for j in $CPPFLAGS; do
+        if test "x$i" = "x$j"; then
+          apr_addto_duplicate="1"
+          break
+        fi
+      done
+      if test $apr_addto_duplicate = "0"; then
+        test "x$silent" != "xyes" && echo "  adding \"$i\" to CPPFLAGS"
+        CPPFLAGS="$CPPFLAGS $i"
+      fi
+    done
+  fi
+
+        ;;
     *-next-nextstep*)
 
   if test -z "$CFLAGS"; then
@@ -6898,7 +6864,7 @@ if test "x$apr_preload_done" != "xyes" ; then
   fi
  # See issue 34332
             ;;
-            *-apple-darwin1[01].*)
+            *-apple-darwin1?.*)
 
   if test "x$CPPFLAGS" = "x"; then
     test "x$silent" != "xyes" && echo "  setting CPPFLAGS to \"-DDARWIN_10\""
@@ -9512,7 +9478,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_AWK="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9564,7 +9530,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9604,7 +9570,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_RANLIB="ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9676,7 +9642,7 @@ case $as_dir/ in #((
     # by default.
     for ac_prog in ginstall scoinst install; do
       for ac_exec_ext in '' $ac_executable_extensions; do
-	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
 	  if test $ac_prog = install &&
 	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
 	    # AIX install.  It has an incompatible calling convention.
@@ -9748,7 +9714,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_RM="rm"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9785,7 +9751,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_AS="as"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9822,7 +9788,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ASCPP="cpp"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9860,7 +9826,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_AR="${ac_tool_prefix}ar"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9900,7 +9866,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_AR="ar"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9955,7 +9921,7 @@ do
     for ac_prog in grep ggrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+      as_fn_executable_p "$ac_path_GREP" || continue
 # Check for GNU ac_path_GREP and select it if it is found.
   # Check for GNU $ac_path_GREP
 case `"$ac_path_GREP" --version 2>&1` in
@@ -10021,7 +9987,7 @@ do
     for ac_prog in egrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+      as_fn_executable_p "$ac_path_EGREP" || continue
 # Check for GNU ac_path_EGREP and select it if it is found.
   # Check for GNU $ac_path_EGREP
 case `"$ac_path_EGREP" --version 2>&1` in
@@ -10228,8 +10194,8 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#	  define __EXTENSIONS__ 1
-	  $ac_includes_default
+#         define __EXTENSIONS__ 1
+          $ac_includes_default
 int
 main ()
 {
@@ -10421,7 +10387,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_AS="${ac_tool_prefix}as"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -10461,7 +10427,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_AS="as"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -10513,7 +10479,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -10553,7 +10519,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DLLTOOL="dlltool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -10605,7 +10571,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -10645,7 +10611,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OBJDUMP="objdump"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -10819,7 +10785,7 @@ do
     for ac_prog in sed gsed; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+      as_fn_executable_p "$ac_path_SED" || continue
 # Check for GNU ac_path_SED and select it if it is found.
   # Check for GNU $ac_path_SED
 case `"$ac_path_SED" --version 2>&1` in
@@ -10898,7 +10864,7 @@ do
     for ac_prog in fgrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+      as_fn_executable_p "$ac_path_FGREP" || continue
 # Check for GNU ac_path_FGREP and select it if it is found.
   # Check for GNU $ac_path_FGREP
 case `"$ac_path_FGREP" --version 2>&1` in
@@ -11154,7 +11120,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -11198,7 +11164,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -11611,7 +11577,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -11651,7 +11617,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OBJDUMP="objdump"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -11954,7 +11920,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -11994,7 +11960,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DLLTOOL="dlltool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -12094,7 +12060,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -12138,7 +12104,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_AR="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -12263,7 +12229,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_STRIP="${ac_tool_prefix}strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -12303,7 +12269,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_STRIP="strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -12362,7 +12328,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -12402,7 +12368,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_RANLIB="ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -13051,7 +13017,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -13091,7 +13057,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -13171,7 +13137,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -13211,7 +13177,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -13263,7 +13229,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -13303,7 +13269,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_NMEDIT="nmedit"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -13355,7 +13321,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -13395,7 +13361,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_LIPO="lipo"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -13447,7 +13413,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -13487,7 +13453,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OTOOL="otool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -13539,7 +13505,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -13579,7 +13545,7 @@ 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
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OTOOL64="otool64"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -21805,23 +21771,20 @@ else
 /* end confdefs.h.  */
 $ac_includes_default
 int
-find_stack_direction ()
+find_stack_direction (int *addr, int depth)
 {
-  static char *addr = 0;
-  auto char dummy;
-  if (addr == 0)
-    {
-      addr = &dummy;
-      return find_stack_direction ();
-    }
-  else
-    return (&dummy > addr) ? 1 : -1;
+  int dir, dummy = 0;
+  if (! addr)
+    addr = &dummy;
+  *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
+  dir = depth ? find_stack_direction (addr, depth - 1) : 0;
+  return dir + dummy;
 }
 
 int
-main ()
+main (int argc, char **argv)
 {
-  return find_stack_direction () < 0;
+  return find_stack_direction (0, argc + !argv + 20) < 0;
 }
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
@@ -22960,11 +22923,11 @@ else
 int
 main ()
 {
-/* FIXME: Include the comments suggested by Paul. */
+
 #ifndef __cplusplus
-  /* Ultrix mips cc rejects this.  */
+  /* Ultrix mips cc rejects this sort of thing.  */
   typedef int charset[2];
-  const charset cs;
+  const charset cs = { 0, 0 };
   /* SunOS 4.1.1 cc rejects this.  */
   char const *const *pcpcc;
   char **ppc;
@@ -22981,8 +22944,9 @@ main ()
   ++pcpcc;
   ppc = (char**) pcpcc;
   pcpcc = (char const *const *) ppc;
-  { /* SCO 3.2v4 cc rejects this.  */
-    char *t;
+  { /* SCO 3.2v4 cc rejects this sort of thing.  */
+    char tx;
+    char *t = &tx;
     char const *s = 0 ? (char *) 0 : (char const *) 0;
 
     *t++ = 0;
@@ -22998,10 +22962,10 @@ main ()
     iptr p = 0;
     ++p;
   }
-  { /* AIX XL C 1.02.0.0 rejects this saying
+  { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
        "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-    struct s { int j; const int *ap[3]; };
-    struct s *b; b->j = 5;
+    struct s { int j; const int *ap[3]; } bx;
+    struct s *b = &bx; b->j = 5;
   }
   { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
     const int foo = 10;
@@ -27149,13 +27113,24 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_STDIO_H
 #include <stdio.h>
+#endif
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
 #ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
 #endif
@@ -27226,6 +27201,26 @@ int main(void) {
         exit(1);
     }
     sa_len = sizeof sa;
+    /* 1 second select timeout */
+    tv.tv_sec = 1;
+    tv.tv_usec = 0;
+    /* Set up fd set */
+    FD_ZERO(&fds);
+    FD_SET(listen_s, &fds);
+    /* Wait for socket to become readable */
+    rc = select(listen_s + 1, &fds, NULL, NULL, &tv);
+    if (rc < 0) {
+        perror("select");
+        exit(1);
+    }
+    if (rc == 0) {
+        fprintf(stderr, "Socket failed to become readable (timeout)\n");
+        exit(1);
+    }
+    if (!FD_ISSET(listen_s, &fds)) {
+        fprintf(stderr, "Socket failed to become readable (selected another fd)\n");
+        exit(1);
+    }
     connected_s = accept(listen_s, (struct sockaddr *)&sa, &sa_len);
     if (connected_s < 0) {
         perror("accept");
@@ -28875,16 +28870,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -28944,28 +28939,16 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in #(
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -28987,7 +28970,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # values after options handling.
 ac_log="
 This file was extended by $as_me, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -29053,10 +29036,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 config.status
-configured by $0, generated by GNU Autoconf 2.68,
+configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -29146,7 +29129,7 @@ fi
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 if \$ac_cs_recheck; then
-  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
   shift
   \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
   CONFIG_SHELL='$SHELL'
diff --git a/docs/pool-design.html b/docs/pool-design.html
index f039d46..90d8452 100644
--- a/docs/pool-design.html
+++ b/docs/pool-design.html
@@ -4,7 +4,7 @@
   </head>
   <body>
     <div align="right">
-      Last modified at [$Date: 2004-11-25 09:51:51 +1100 (Thu, 25 Nov 2004) $]
+      Last modified at [$Date: 2004-11-24 17:51:51 -0500 (Wed, 24 Nov 2004) $]
     </div>
 
     <h1>Using APR Pools</h1>
diff --git a/file_io/unix/seek.c b/file_io/unix/seek.c
index e70805d..3f5aa00 100644
--- a/file_io/unix/seek.c
+++ b/file_io/unix/seek.c
@@ -117,10 +117,10 @@ apr_status_t apr_file_trunc(apr_file_t *fp, apr_off_t offset)
             /* Reset buffer positions for write mode */
             fp->bufpos = fp->direction = fp->dataRead = 0;
         }
+        file_unlock(fp);
         if (rc) {
             return rc;
         }
-        file_unlock(fp);
     }
     if (ftruncate(fp->filedes, offset) == -1) {
         return errno;
diff --git a/include/apr.hw b/include/apr.hw
index 0aaa62c..a75bc60 100644
--- a/include/apr.hw
+++ b/include/apr.hw
@@ -36,6 +36,12 @@
  * for Win32 or Netware by those build environments, respectively.
  */
 
+/* Make sure we have our platform identifier macro defined we ask for later.
+ */
+#if defined(_WIN32) && !defined(WIN32)
+#define WIN32 1
+#endif
+
 #if defined(WIN32) || defined(DOXYGEN)
 
 /* Ignore most warnings (back down to /W3) for poorly constructed headers
@@ -377,7 +383,7 @@ typedef  int         apr_off_t;
 typedef  int         apr_socklen_t;
 typedef  apr_uint64_t      apr_ino_t;
 
-#ifdef WIN64
+#ifdef _WIN64
 #define APR_SIZEOF_VOIDP   8
 #else
 #define APR_SIZEOF_VOIDP   4
@@ -552,7 +558,7 @@ typedef  apr_uint32_t            apr_uintptr_t;
 #define APR_DECLARE_DATA             __declspec(dllimport)
 #endif
 
-#ifdef WIN64
+#ifdef _WIN64
 #define APR_SSIZE_T_FMT          "I64d"
 #define APR_SIZE_T_FMT           "I64u"
 #else
diff --git a/include/apr_allocator.h b/include/apr_allocator.h
index 5aaeb1b..5d66776 100644
--- a/include/apr_allocator.h
+++ b/include/apr_allocator.h
@@ -71,7 +71,8 @@ struct apr_memnode_t {
  * @param allocator The allocator we have just created.
  *
  */
-APR_DECLARE(apr_status_t) apr_allocator_create(apr_allocator_t **allocator);
+APR_DECLARE(apr_status_t) apr_allocator_create(apr_allocator_t **allocator)
+                          __attribute__((nonnull(1)));
 
 /**
  * Destroy an allocator
@@ -79,7 +80,8 @@ APR_DECLARE(apr_status_t) apr_allocator_create(apr_allocator_t **allocator);
  * @remark Any memnodes not given back to the allocator prior to destroying
  *         will _not_ be free()d.
  */
-APR_DECLARE(void) apr_allocator_destroy(apr_allocator_t *allocator);
+APR_DECLARE(void) apr_allocator_destroy(apr_allocator_t *allocator)
+                  __attribute__((nonnull(1)));
 
 /**
  * Allocate a block of mem from the allocator
@@ -88,7 +90,8 @@ APR_DECLARE(void) apr_allocator_destroy(apr_allocator_t *allocator);
  *        memnode structure)
  */
 APR_DECLARE(apr_memnode_t *) apr_allocator_alloc(apr_allocator_t *allocator,
-                                                 apr_size_t size);
+                                                 apr_size_t size)
+                             __attribute__((nonnull(1)));
 
 /**
  * Free a list of blocks of mem, giving them back to the allocator.
@@ -98,7 +101,8 @@ APR_DECLARE(apr_memnode_t *) apr_allocator_alloc(apr_allocator_t *allocator,
  * @param memnode The memory node to return
  */
 APR_DECLARE(void) apr_allocator_free(apr_allocator_t *allocator,
-                                     apr_memnode_t *memnode);
+                                     apr_memnode_t *memnode)
+                  __attribute__((nonnull(1,2)));
 
 #include "apr_pools.h"
 
@@ -114,13 +118,15 @@ APR_DECLARE(void) apr_allocator_free(apr_allocator_t *allocator,
  * the allocator will never be destroyed.
  */
 APR_DECLARE(void) apr_allocator_owner_set(apr_allocator_t *allocator,
-                                          apr_pool_t *pool);
+                                          apr_pool_t *pool)
+                  __attribute__((nonnull(1)));
 
 /**
  * Get the current owner of the allocator
  * @param allocator The allocator to get the owner from
  */
-APR_DECLARE(apr_pool_t *) apr_allocator_owner_get(apr_allocator_t *allocator);
+APR_DECLARE(apr_pool_t *) apr_allocator_owner_get(apr_allocator_t *allocator)
+                          __attribute__((nonnull(1)));
 
 /**
  * Set the current threshold at which the allocator should start
@@ -129,7 +135,8 @@ APR_DECLARE(apr_pool_t *) apr_allocator_owner_get(apr_allocator_t *allocator);
  * @param size The threshold.  0 == unlimited.
  */
 APR_DECLARE(void) apr_allocator_max_free_set(apr_allocator_t *allocator,
-                                             apr_size_t size);
+                                             apr_size_t size)
+                  __attribute__((nonnull(1)));
 
 #include "apr_thread_mutex.h"
 
@@ -140,14 +147,16 @@ APR_DECLARE(void) apr_allocator_max_free_set(apr_allocator_t *allocator,
  * @param mutex The mutex
  */
 APR_DECLARE(void) apr_allocator_mutex_set(apr_allocator_t *allocator,
-                                          apr_thread_mutex_t *mutex);
+                                          apr_thread_mutex_t *mutex)
+                  __attribute__((nonnull(1)));
 
 /**
  * Get the mutex currently set for the allocator
  * @param allocator The allocator
  */
 APR_DECLARE(apr_thread_mutex_t *) apr_allocator_mutex_get(
-                                      apr_allocator_t *allocator);
+                                          apr_allocator_t *allocator)
+                                  __attribute__((nonnull(1)));
 
 #endif /* APR_HAS_THREADS */
 
diff --git a/include/apr_general.h b/include/apr_general.h
index 1ead8b6..c7389ec 100644
--- a/include/apr_general.h
+++ b/include/apr_general.h
@@ -76,7 +76,7 @@ typedef int               apr_signum_t;
  * @return offset
  */
 
-#if defined(CRAY) || (defined(__arm) && !defined(LINUX))
+#if defined(CRAY) || (defined(__arm) && !(defined(LINUX) || defined(__FreeBSD__)))
 #ifdef __STDC__
 #define APR_OFFSET(p_type,field) _Offsetof(p_type,field)
 #else
diff --git a/include/apr_network_io.h b/include/apr_network_io.h
index 0335da9..8b9209e 100644
--- a/include/apr_network_io.h
+++ b/include/apr_network_io.h
@@ -756,6 +756,8 @@ APR_DECLARE(int) apr_ipsubnet_test(apr_ipsubnet_t *ipsub, apr_sockaddr_t *sa);
  * @param name The accept filter
  * @param args Any extra args to the accept filter.  Passing NULL here removes
  *             the accept filter. 
+ * @bug name and args should have been declared as const char *, as they are in
+ * APR 2.0
  */
 apr_status_t apr_socket_accept_filter(apr_socket_t *sock, char *name,
                                       char *args);
diff --git a/include/apr_pools.h b/include/apr_pools.h
index 7ae1ed6..0f0b95e 100644
--- a/include/apr_pools.h
+++ b/include/apr_pools.h
@@ -196,7 +196,8 @@ APR_DECLARE(void) apr_pool_terminate(void);
 APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool,
                                              apr_pool_t *parent,
                                              apr_abortfunc_t abort_fn,
-                                             apr_allocator_t *allocator);
+                                             apr_allocator_t *allocator)
+                          __attribute__((nonnull(1)));
 
 /**
  * Create a new pool.
@@ -220,7 +221,8 @@ APR_DECLARE(apr_status_t) apr_pool_create_core_ex(apr_pool_t **newpool,
  */
 APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex(apr_pool_t **newpool,
                                                    apr_abortfunc_t abort_fn,
-                                                   apr_allocator_t *allocator);
+                                                   apr_allocator_t *allocator)
+                          __attribute__((nonnull(1)));
 
 /**
  * Debug version of apr_pool_create_ex.
@@ -242,7 +244,8 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool,
                                                    apr_pool_t *parent,
                                                    apr_abortfunc_t abort_fn,
                                                    apr_allocator_t *allocator,
-                                                   const char *file_line);
+                                                   const char *file_line)
+                          __attribute__((nonnull(1)));
 
 #if APR_POOL_DEBUG
 #define apr_pool_create_ex(newpool, parent, abort_fn, allocator)  \
@@ -277,7 +280,8 @@ APR_DECLARE(apr_status_t) apr_pool_create_core_ex_debug(apr_pool_t **newpool,
 APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex_debug(apr_pool_t **newpool,
                                                    apr_abortfunc_t abort_fn,
                                                    apr_allocator_t *allocator,
-                                                   const char *file_line);
+                                                   const char *file_line)
+                          __attribute__((nonnull(1)));
 
 #if APR_POOL_DEBUG
 #define apr_pool_create_core_ex(newpool, abort_fn, allocator)  \
@@ -343,7 +347,8 @@ APR_DECLARE(apr_status_t) apr_pool_create_unmanaged(apr_pool_t **newpool);
  * Find the pool's allocator
  * @param pool The pool to get the allocator from.
  */
-APR_DECLARE(apr_allocator_t *) apr_pool_allocator_get(apr_pool_t *pool);
+APR_DECLARE(apr_allocator_t *) apr_pool_allocator_get(apr_pool_t *pool)
+                               __attribute__((nonnull(1)));
 
 /**
  * Clear all memory in the pool and run all the cleanups. This also destroys all
@@ -353,7 +358,7 @@ APR_DECLARE(apr_allocator_t *) apr_pool_allocator_get(apr_pool_t *pool);
  *         to re-use this memory for the next allocation.
  * @see apr_pool_destroy()
  */
-APR_DECLARE(void) apr_pool_clear(apr_pool_t *p);
+APR_DECLARE(void) apr_pool_clear(apr_pool_t *p) __attribute__((nonnull(1)));
 
 /**
  * Debug version of apr_pool_clear.
@@ -369,7 +374,8 @@ APR_DECLARE(void) apr_pool_clear(apr_pool_t *p);
  *         and don't call apr_pool_destroy_clear directly.
  */
 APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *p,
-                                       const char *file_line);
+                                       const char *file_line)
+                  __attribute__((nonnull(1)));
 
 #if APR_POOL_DEBUG
 #define apr_pool_clear(p) \
@@ -382,7 +388,7 @@ APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *p,
  * @param p The pool to destroy
  * @remark This will actually free the memory
  */
-APR_DECLARE(void) apr_pool_destroy(apr_pool_t *p);
+APR_DECLARE(void) apr_pool_destroy(apr_pool_t *p) __attribute__((nonnull(1)));
 
 /**
  * Debug version of apr_pool_destroy.
@@ -398,7 +404,8 @@ APR_DECLARE(void) apr_pool_destroy(apr_pool_t *p);
  *         and don't call apr_pool_destroy_debug directly.
  */
 APR_DECLARE(void) apr_pool_destroy_debug(apr_pool_t *p,
-                                         const char *file_line);
+                                         const char *file_line)
+                  __attribute__((nonnull(1)));
 
 #if APR_POOL_DEBUG
 #define apr_pool_destroy(p) \
@@ -416,7 +423,11 @@ APR_DECLARE(void) apr_pool_destroy_debug(apr_pool_t *p,
  * @param size The amount of memory to allocate
  * @return The allocated memory
  */
-APR_DECLARE(void *) apr_palloc(apr_pool_t *p, apr_size_t size);
+APR_DECLARE(void *) apr_palloc(apr_pool_t *p, apr_size_t size)
+#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+                    __attribute__((alloc_size(2)))
+#endif
+                    __attribute__((nonnull(1)));
 
 /**
  * Debug version of apr_palloc
@@ -427,7 +438,11 @@ APR_DECLARE(void *) apr_palloc(apr_pool_t *p, apr_size_t size);
  * @return See: apr_palloc
  */
 APR_DECLARE(void *) apr_palloc_debug(apr_pool_t *p, apr_size_t size,
-                                     const char *file_line);
+                                     const char *file_line)
+#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+                    __attribute__((alloc_size(2)))
+#endif
+                    __attribute__((nonnull(1)));
 
 #if APR_POOL_DEBUG
 #define apr_palloc(p, size) \
@@ -455,7 +470,8 @@ APR_DECLARE(void *) apr_pcalloc(apr_pool_t *p, apr_size_t size);
  * @return See: apr_pcalloc
  */
 APR_DECLARE(void *) apr_pcalloc_debug(apr_pool_t *p, apr_size_t size,
-                                      const char *file_line);
+                                      const char *file_line)
+                    __attribute__((nonnull(1)));
 
 #if APR_POOL_DEBUG
 #define apr_pcalloc(p, size) \
@@ -476,21 +492,24 @@ APR_DECLARE(void *) apr_pcalloc_debug(apr_pool_t *p, apr_size_t size,
  *      deal with the error accordingly.
  */
 APR_DECLARE(void) apr_pool_abort_set(apr_abortfunc_t abortfunc,
-                                     apr_pool_t *pool);
+                                     apr_pool_t *pool)
+                  __attribute__((nonnull(2)));
 
 /**
  * Get the abort function associated with the specified pool.
  * @param pool The pool for retrieving the abort function.
  * @return The abort function for the given pool.
  */
-APR_DECLARE(apr_abortfunc_t) apr_pool_abort_get(apr_pool_t *pool);
+APR_DECLARE(apr_abortfunc_t) apr_pool_abort_get(apr_pool_t *pool)
+                             __attribute__((nonnull(1)));
 
 /**
  * Get the parent pool of the specified pool.
  * @param pool The pool for retrieving the parent pool.
  * @return The parent of the given pool.
  */
-APR_DECLARE(apr_pool_t *) apr_pool_parent_get(apr_pool_t *pool);
+APR_DECLARE(apr_pool_t *) apr_pool_parent_get(apr_pool_t *pool)
+                          __attribute__((nonnull(1)));
 
 /**
  * Determine if pool a is an ancestor of pool b.
@@ -510,7 +529,8 @@ APR_DECLARE(int) apr_pool_is_ancestor(apr_pool_t *a, apr_pool_t *b);
  * @param pool The pool to tag
  * @param tag  The tag
  */
-APR_DECLARE(void) apr_pool_tag(apr_pool_t *pool, const char *tag);
+APR_DECLARE(void) apr_pool_tag(apr_pool_t *pool, const char *tag)
+                  __attribute__((nonnull(1)));
 
 
 /*
@@ -536,11 +556,11 @@ APR_DECLARE(void) apr_pool_tag(apr_pool_t *pool, const char *tag);
  *      key names is a typical way to help ensure this uniqueness.
  *
  */
-APR_DECLARE(apr_status_t) apr_pool_userdata_set(
-    const void *data,
-    const char *key,
-    apr_status_t (*cleanup)(void *),
-    apr_pool_t *pool);
+APR_DECLARE(apr_status_t) apr_pool_userdata_set(const void *data,
+                                                const char *key,
+                                                apr_status_t (*cleanup)(void *),
+                                                apr_pool_t *pool)
+                          __attribute__((nonnull(2,4)));
 
 /**
  * Set the data associated with the current pool
@@ -562,10 +582,10 @@ APR_DECLARE(apr_status_t) apr_pool_userdata_set(
  *
  */
 APR_DECLARE(apr_status_t) apr_pool_userdata_setn(
-    const void *data,
-    const char *key,
-    apr_status_t (*cleanup)(void *),
-    apr_pool_t *pool);
+                                const void *data, const char *key,
+                                apr_status_t (*cleanup)(void *),
+                                apr_pool_t *pool)
+                          __attribute__((nonnull(2,4)));
 
 /**
  * Return the data associated with the current pool.
@@ -574,7 +594,8 @@ APR_DECLARE(apr_status_t) apr_pool_userdata_setn(
  * @param pool The current pool.
  */
 APR_DECLARE(apr_status_t) apr_pool_userdata_get(void **data, const char *key,
-                                                apr_pool_t *pool);
+                                                apr_pool_t *pool)
+                          __attribute__((nonnull(1,2,3)));
 
 
 /**
@@ -601,10 +622,10 @@ APR_DECLARE(apr_status_t) apr_pool_userdata_get(void **data, const char *key,
  *                      to exec - this function is called in the child, obviously!
  */
 APR_DECLARE(void) apr_pool_cleanup_register(
-    apr_pool_t *p,
-    const void *data,
-    apr_status_t (*plain_cleanup)(void *),
-    apr_status_t (*child_cleanup)(void *));
+                            apr_pool_t *p, const void *data,
+                            apr_status_t (*plain_cleanup)(void *),
+                            apr_status_t (*child_cleanup)(void *))
+                  __attribute__((nonnull(3,4)));
 
 /**
  * Register a function to be called when a pool is cleared or destroyed.
@@ -619,9 +640,9 @@ APR_DECLARE(void) apr_pool_cleanup_register(
  *                      or destroyed
  */
 APR_DECLARE(void) apr_pool_pre_cleanup_register(
-    apr_pool_t *p,
-    const void *data,
-    apr_status_t (*plain_cleanup)(void *));
+                            apr_pool_t *p, const void *data,
+                            apr_status_t (*plain_cleanup)(void *))
+                  __attribute__((nonnull(3)));
 
 /**
  * Remove a previously registered cleanup function.
@@ -636,7 +657,8 @@ APR_DECLARE(void) apr_pool_pre_cleanup_register(
  *          function
  */
 APR_DECLARE(void) apr_pool_cleanup_kill(apr_pool_t *p, const void *data,
-                                        apr_status_t (*cleanup)(void *));
+                                        apr_status_t (*cleanup)(void *))
+                  __attribute__((nonnull(3)));
 
 /**
  * Replace the child cleanup function of a previously registered cleanup.
@@ -651,10 +673,10 @@ APR_DECLARE(void) apr_pool_cleanup_kill(apr_pool_t *p, const void *data,
  * @param child_cleanup The function to register as the child cleanup
  */
 APR_DECLARE(void) apr_pool_child_cleanup_set(
-    apr_pool_t *p,
-    const void *data,
-    apr_status_t (*plain_cleanup)(void *),
-    apr_status_t (*child_cleanup)(void *));
+                        apr_pool_t *p, const void *data,
+                        apr_status_t (*plain_cleanup)(void *),
+                        apr_status_t (*child_cleanup)(void *))
+                  __attribute__((nonnull(3,4)));
 
 /**
  * Run the specified cleanup function immediately and unregister it.
@@ -667,10 +689,9 @@ APR_DECLARE(void) apr_pool_child_cleanup_set(
  * @param data The data to remove from cleanup
  * @param cleanup The function to remove from cleanup
  */
-APR_DECLARE(apr_status_t) apr_pool_cleanup_run(
-    apr_pool_t *p,
-    void *data,
-    apr_status_t (*cleanup)(void *));
+APR_DECLARE(apr_status_t) apr_pool_cleanup_run(apr_pool_t *p, void *data,
+                                               apr_status_t (*cleanup)(void *))
+                          __attribute__((nonnull(3)));
 
 /**
  * An empty cleanup function.
@@ -739,7 +760,8 @@ APR_DECLARE(void) apr_pool_cleanup_for_exec(void);
  * @param p The parent pool
  * @param sub The subpool
  */
-APR_DECLARE(void) apr_pool_join(apr_pool_t *p, apr_pool_t *sub);
+APR_DECLARE(void) apr_pool_join(apr_pool_t *p, apr_pool_t *sub)
+                  __attribute__((nonnull(2)));
 
 /**
  * Find a pool from something allocated in it.
@@ -754,7 +776,8 @@ APR_DECLARE(apr_pool_t *) apr_pool_find(const void *mem);
  * @param recurse Recurse/include the subpools' sizes
  * @return The number of bytes
  */
-APR_DECLARE(apr_size_t) apr_pool_num_bytes(apr_pool_t *p, int recurse);
+APR_DECLARE(apr_size_t) apr_pool_num_bytes(apr_pool_t *p, int recurse)
+                        __attribute__((nonnull(1)));
 
 /**
  * Lock a pool
diff --git a/include/apr_strings.h b/include/apr_strings.h
index 6b71ff1..4572173 100644
--- a/include/apr_strings.h
+++ b/include/apr_strings.h
@@ -106,7 +106,11 @@ APR_DECLARE(char *) apr_pstrdup(apr_pool_t *p, const char *s);
  *         has 'n' or more characters.  If the string might contain
  *         fewer characters, use apr_pstrndup.
  */
-APR_DECLARE(char *) apr_pstrmemdup(apr_pool_t *p, const char *s, apr_size_t n);
+APR_DECLARE(char *) apr_pstrmemdup(apr_pool_t *p, const char *s, apr_size_t n)
+#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+    __attribute__((alloc_size(3)))
+#endif
+    ;
 
 /**
  * Duplicate at most n characters of a string into memory allocated 
@@ -128,7 +132,11 @@ APR_DECLARE(char *) apr_pstrndup(apr_pool_t *p, const char *s, apr_size_t n);
  * @param n The number of bytes to duplicate
  * @return The new block of memory
  */
-APR_DECLARE(void *) apr_pmemdup(apr_pool_t *p, const void *m, apr_size_t n);
+APR_DECLARE(void *) apr_pmemdup(apr_pool_t *p, const void *m, apr_size_t n)
+#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+    __attribute__((alloc_size(3)))
+#endif
+    ;
 
 /**
  * Concatenate multiple strings, allocating memory out a pool
diff --git a/include/apr_thread_proc.h b/include/apr_thread_proc.h
index 7df84ef..0a97c95 100644
--- a/include/apr_thread_proc.h
+++ b/include/apr_thread_proc.h
@@ -315,7 +315,7 @@ APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control,
 APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd);
 
 /**
- * Return the pool associated with the current thread.
+ * Return user data associated with the current thread.
  * @param data The user data associated with the thread.
  * @param key The key to associate with the data
  * @param thread The currently open thread.
@@ -324,7 +324,7 @@ APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key,
                                              apr_thread_t *thread);
 
 /**
- * Return the pool associated with the current thread.
+ * Set user data associated with the current thread.
  * @param data The user data to associate with the thread.
  * @param key The key to use for associating the data with the thread
  * @param cleanup The cleanup routine to use when the thread is destroyed.
diff --git a/include/apr_version.h b/include/apr_version.h
index 8122320..4b06508 100644
--- a/include/apr_version.h
+++ b/include/apr_version.h
@@ -38,6 +38,9 @@
  */
 
 
+#define APR_COPYRIGHT "Copyright (c) 2013 The Apache Software " \
+                      "Foundation or its licensors, as applicable."
+
 /* The numeric compile-time version constants. These constants are the
  * authoritative version numbers for APR. 
  */
@@ -59,7 +62,7 @@
  * The Patch Level never includes API changes, simply bug fixes.
  * Reset to 0 when upgrading APR_MINOR_VERSION
  */
-#define APR_PATCH_VERSION       6
+#define APR_PATCH_VERSION       8
 
 /** 
  * The symbol APR_IS_DEV_VERSION is only defined for internal,
@@ -87,7 +90,9 @@
 
 #if defined(APR_IS_DEV_VERSION) || defined(DOXYGEN)
 /** Internal: string form of the "is dev" flag */
+#ifndef APR_IS_DEV_STRING
 #define APR_IS_DEV_STRING "-dev"
+#endif
 #else
 #define APR_IS_DEV_STRING ""
 #endif
diff --git a/libapr.rc b/libapr.rc
index 098b5f1..604fc7c 100644
--- a/libapr.rc
+++ b/libapr.rc
@@ -1,8 +1,5 @@
 #include "apr_version.h"
 
-#define APR_COPYRIGHT "Copyright (c) 2011 The Apache Software " \
-                      "Foundation or its licensors, as applicable."
-
 #define APR_LICENSE \
   "Licensed to the Apache Software Foundation (ASF) under one or more " \
   "contributor license agreements.  See the NOTICE file distributed with " \
diff --git a/network_io/unix/multicast.c b/network_io/unix/multicast.c
index 67ab245..3767bfd 100644
--- a/network_io/unix/multicast.c
+++ b/network_io/unix/multicast.c
@@ -193,36 +193,39 @@ static apr_status_t do_mcast(int type, apr_socket_t *sock,
     return rv;
 }
 
+/* Set the IP_MULTICAST_TTL or IP_MULTICAST_LOOP option, or IPv6
+ * equivalents, for the socket, to the given value.  Note that this
+ * function *only works* for those particular option types. */
 static apr_status_t do_mcast_opt(int type, apr_socket_t *sock,
                                  apr_byte_t value)
 {
     apr_status_t rv = APR_SUCCESS;
 
     if (sock_is_ipv4(sock)) {
+        /* For the IP_MULTICAST_* options, this must be a (char *)
+         * pointer. */
         if (setsockopt(sock->socketdes, IPPROTO_IP, type,
                        (const void *) &value, sizeof(value)) == -1) {
             rv = errno;
         }
     }
 #if APR_HAVE_IPV6
-    else if (sock_is_ipv6(sock) && type == IP_MULTICAST_LOOP) {
-        unsigned int loopopt = value;
-        type = IPV6_MULTICAST_LOOP;
-        if (setsockopt(sock->socketdes, IPPROTO_IPV6, type,
-                       (const void *) &loopopt, sizeof(loopopt)) == -1) {
-            rv = errno;
-        }
-    }
     else if (sock_is_ipv6(sock)) {
+        /* For the IPV6_* options, an (int *) pointer must be used. */
+        int ivalue = value;
+
         if (type == IP_MULTICAST_TTL) {
             type = IPV6_MULTICAST_HOPS;
         }
+        else if (type == IP_MULTICAST_LOOP) {
+            type = IPV6_MULTICAST_LOOP;
+        }
         else {
             return APR_ENOTIMPL;
         }
 
         if (setsockopt(sock->socketdes, IPPROTO_IPV6, type,
-                       &value, sizeof(value)) == -1) {
+                       (const void *) &ivalue, sizeof(ivalue)) == -1) {
             rv = errno;
         }
     }
diff --git a/network_io/unix/sendrecv.c b/network_io/unix/sendrecv.c
index c133a26..6b14643 100644
--- a/network_io/unix/sendrecv.c
+++ b/network_io/unix/sendrecv.c
@@ -174,7 +174,14 @@ apr_status_t apr_socket_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock,
         return errno;
     }
 
-    apr_sockaddr_vars_set(from, from->sa.sin.sin_family, ntohs(from->sa.sin.sin_port));
+    /*
+     * Check if we have a valid address. recvfrom() with MSG_PEEK may return
+     * success without filling in the address.
+     */
+    if (from->salen > APR_OFFSETOF(struct sockaddr_in, sin_port)) {
+        apr_sockaddr_vars_set(from, from->sa.sin.sin_family,
+                              ntohs(from->sa.sin.sin_port));
+    }
 
     (*len) = rv;
     if (rv == 0 && sock->type == SOCK_STREAM) {
@@ -245,7 +252,7 @@ do_select:
 /* Define a structure to pass in when we have a NULL header value */
 static apr_hdtr_t no_hdtr;
 
-#if defined(__linux__) && defined(HAVE_WRITEV)
+#if (defined(__linux__) || defined(__GNU__)) && defined(HAVE_WRITEV)
 
 apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file,
                                  apr_hdtr_t *hdtr, apr_off_t *offset,
@@ -285,9 +292,6 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file,
         hdtr = &no_hdtr;
     }
 
-    /* Ignore flags for now. */
-    flags = 0;
-
     if (hdtr->numheaders > 0) {
         apr_size_t hdrbytes;
 
diff --git a/network_io/unix/sockaddr.c b/network_io/unix/sockaddr.c
index ed4c474..9253a27 100644
--- a/network_io/unix/sockaddr.c
+++ b/network_io/unix/sockaddr.c
@@ -356,9 +356,27 @@ static apr_status_t call_resolver(apr_sockaddr_t **sa,
     }
     error = getaddrinfo(hostname, servname, &hints, &ai_list);
 #ifdef HAVE_GAI_ADDRCONFIG
-    if (error == EAI_BADFLAGS && family == APR_UNSPEC) {
-        /* Retry with no flags if AI_ADDRCONFIG was rejected. */
-        hints.ai_flags = 0;
+    /*
+     * Using AI_ADDRCONFIG involves some unfortunate guesswork because it
+     * does not consider loopback addresses when trying to determine if
+     * IPv4 or IPv6 is configured on a system (see RFC 3493).
+     * This is a problem if one actually wants to listen on or connect to
+     * the loopback address of a protocol family that is not otherwise
+     * configured on the system. See PR 52709.
+     * To work around some of the problems, retry without AI_ADDRCONFIG
+     * in case of EAI_ADDRFAMILY.
+     * XXX: apr_sockaddr_info_get() should really accept a flag to determine
+     * XXX: if AI_ADDRCONFIG's guesswork is wanted and if the address is
+     * XXX: to be used for listen() or connect().
+     *
+     * In case of EAI_BADFLAGS, AI_ADDRCONFIG is not supported.
+     */
+    if ((family == APR_UNSPEC) && (error == EAI_BADFLAGS
+#ifdef EAI_ADDRFAMILY
+                                   || error == EAI_ADDRFAMILY
+#endif
+                                                             )) {
+        hints.ai_flags &= ~AI_ADDRCONFIG;
         error = getaddrinfo(hostname, servname, &hints, &ai_list);
     }
 #endif
@@ -367,7 +385,7 @@ static apr_status_t call_resolver(apr_sockaddr_t **sa,
         return apr_get_netos_error();
 #else
         if (error == EAI_SYSTEM) {
-            return errno;
+            return errno ? errno : APR_EGENERAL;
         }
         else 
         {
@@ -422,6 +440,15 @@ static apr_status_t call_resolver(apr_sockaddr_t **sa,
         ai = ai->ai_next;
     }
     freeaddrinfo(ai_list);
+
+    if (prev_sa == NULL) {
+        /*
+         * getaddrinfo returned only useless entries and *sa is still empty.
+         * This should be treated as an error.
+         */
+        return APR_EGENERAL;
+    }
+
     return APR_SUCCESS;
 }
 
@@ -555,6 +582,11 @@ static apr_status_t find_addresses(apr_sockaddr_t **sa,
         ++curaddr;
     }
 
+    if (prev_sa == NULL) {
+        /* this should not happen but no result should be treated as error */
+        return APR_EGENERAL;
+    }
+
     return APR_SUCCESS;
 }
 
@@ -1010,7 +1042,7 @@ APR_DECLARE(int) apr_ipsubnet_test(apr_ipsubnet_t *ipsub, apr_sockaddr_t *sa)
     /* XXX This line will segv on Win32 build with APR_HAVE_IPV6,
      * but without the IPV6 drivers installed.
      */
-    if (sa->sa.sin.sin_family == AF_INET) {
+    if (sa->family == AF_INET) {
         if (ipsub->family == AF_INET &&
             ((sa->sa.sin.sin_addr.s_addr & ipsub->mask[0]) == ipsub->sub[0])) {
             return 1;
@@ -1022,7 +1054,7 @@ APR_DECLARE(int) apr_ipsubnet_test(apr_ipsubnet_t *ipsub, apr_sockaddr_t *sa)
             return 1;
         }
     }
-    else {
+    else if (sa->family == AF_INET6 && ipsub->family == AF_INET6) {
         apr_uint32_t *addr = (apr_uint32_t *)sa->ipaddr_ptr;
 
         if ((addr[0] & ipsub->mask[0]) == ipsub->sub[0] &&
diff --git a/network_io/unix/sockopt.c b/network_io/unix/sockopt.c
index 3fc932f..7b67c2e 100644
--- a/network_io/unix/sockopt.c
+++ b/network_io/unix/sockopt.c
@@ -381,12 +381,33 @@ apr_status_t apr_gethostname(char *buf, apr_int32_t len, apr_pool_t *cont)
 }
 
 #if APR_HAS_SO_ACCEPTFILTER
-apr_status_t apr_socket_accept_filter(apr_socket_t *sock, char *name, 
-                                      char *args)
+apr_status_t apr_socket_accept_filter(apr_socket_t *sock, char *nonconst_name, 
+                                      char *nonconst_args)
 {
+    /* these should have been const; act like they are */
+    const char *name = nonconst_name;
+    const char *args = nonconst_args;
+
     struct accept_filter_arg af;
-    strncpy(af.af_name, name, 16);
-    strncpy(af.af_arg, args, 256 - 16);
+    socklen_t optlen = sizeof(af);
+
+    /* FreeBSD returns an error if the filter is already set; ignore
+     * this call if we previously set it to the same value.
+     */
+    if ((getsockopt(sock->socketdes, SOL_SOCKET, SO_ACCEPTFILTER,
+                    &af, &optlen)) == 0) {
+        if (!strcmp(name, af.af_name) && !strcmp(args, af.af_arg)) {
+            return APR_SUCCESS;
+        }
+    }
+
+    /* Uhh, at least in FreeBSD 9 the fields are declared as arrays of
+     * these lengths; did sizeof not work in some ancient release?
+     *
+     * FreeBSD kernel sets the last byte to a '\0'.
+     */
+    apr_cpystrn(af.af_name, name, 16);
+    apr_cpystrn(af.af_arg, args, 256 - 16);
 
     if ((setsockopt(sock->socketdes, SOL_SOCKET, SO_ACCEPTFILTER,
           &af, sizeof(af))) < 0) {
diff --git a/random/unix/sha2.c b/random/unix/sha2.c
index 212c1b7..12c257d 100644
--- a/random/unix/sha2.c
+++ b/random/unix/sha2.c
@@ -52,8 +52,6 @@ typedef apr_uint64_t sha2_word64;       /* Exactly 8 bytes */
 /*** SHA-256/384/512 Various Length Definitions ***********************/
 /* NOTE: Most of these are in sha2.h */
 #define SHA256_SHORT_BLOCK_LENGTH       (SHA256_BLOCK_LENGTH - 8)
-#define SHA384_SHORT_BLOCK_LENGTH       (SHA384_BLOCK_LENGTH - 16)
-#define SHA512_SHORT_BLOCK_LENGTH       (SHA512_BLOCK_LENGTH - 16)
 
 
 /*** ENDIAN REVERSAL MACROS *******************************************/
@@ -150,9 +148,7 @@ typedef apr_uint64_t sha2_word64;       /* Exactly 8 bytes */
  * library -- they are intended for private internal visibility/use
  * only.
  */
-void apr__SHA512_Last(SHA512_CTX*);
 void apr__SHA256_Transform(SHA256_CTX*, const sha2_word32*);
-void apr__SHA512_Transform(SHA512_CTX*, const sha2_word64*);
 
 
 /*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS ************************/
@@ -188,74 +184,6 @@ static const sha2_word32 sha256_initial_hash_value[8] = {
         0x5be0cd19UL
 };
 
-/* Hash constant words K for SHA-384 and SHA-512: */
-static const sha2_word64 K512[80] = {
-    APR_UINT64_C(0x428a2f98d728ae22), APR_UINT64_C(0x7137449123ef65cd),
-    APR_UINT64_C(0xb5c0fbcfec4d3b2f), APR_UINT64_C(0xe9b5dba58189dbbc),
-    APR_UINT64_C(0x3956c25bf348b538), APR_UINT64_C(0x59f111f1b605d019),
-    APR_UINT64_C(0x923f82a4af194f9b), APR_UINT64_C(0xab1c5ed5da6d8118),
-    APR_UINT64_C(0xd807aa98a3030242), APR_UINT64_C(0x12835b0145706fbe),
-    APR_UINT64_C(0x243185be4ee4b28c), APR_UINT64_C(0x550c7dc3d5ffb4e2),
-    APR_UINT64_C(0x72be5d74f27b896f), APR_UINT64_C(0x80deb1fe3b1696b1),
-    APR_UINT64_C(0x9bdc06a725c71235), APR_UINT64_C(0xc19bf174cf692694),
-    APR_UINT64_C(0xe49b69c19ef14ad2), APR_UINT64_C(0xefbe4786384f25e3),
-    APR_UINT64_C(0x0fc19dc68b8cd5b5), APR_UINT64_C(0x240ca1cc77ac9c65),
-    APR_UINT64_C(0x2de92c6f592b0275), APR_UINT64_C(0x4a7484aa6ea6e483),
-    APR_UINT64_C(0x5cb0a9dcbd41fbd4), APR_UINT64_C(0x76f988da831153b5),
-    APR_UINT64_C(0x983e5152ee66dfab), APR_UINT64_C(0xa831c66d2db43210),
-    APR_UINT64_C(0xb00327c898fb213f), APR_UINT64_C(0xbf597fc7beef0ee4),
-    APR_UINT64_C(0xc6e00bf33da88fc2), APR_UINT64_C(0xd5a79147930aa725),
-    APR_UINT64_C(0x06ca6351e003826f), APR_UINT64_C(0x142929670a0e6e70),
-    APR_UINT64_C(0x27b70a8546d22ffc), APR_UINT64_C(0x2e1b21385c26c926),
-    APR_UINT64_C(0x4d2c6dfc5ac42aed), APR_UINT64_C(0x53380d139d95b3df),
-    APR_UINT64_C(0x650a73548baf63de), APR_UINT64_C(0x766a0abb3c77b2a8),
-    APR_UINT64_C(0x81c2c92e47edaee6), APR_UINT64_C(0x92722c851482353b),
-    APR_UINT64_C(0xa2bfe8a14cf10364), APR_UINT64_C(0xa81a664bbc423001),
-    APR_UINT64_C(0xc24b8b70d0f89791), APR_UINT64_C(0xc76c51a30654be30),
-    APR_UINT64_C(0xd192e819d6ef5218), APR_UINT64_C(0xd69906245565a910),
-    APR_UINT64_C(0xf40e35855771202a), APR_UINT64_C(0x106aa07032bbd1b8),
-    APR_UINT64_C(0x19a4c116b8d2d0c8), APR_UINT64_C(0x1e376c085141ab53),
-    APR_UINT64_C(0x2748774cdf8eeb99), APR_UINT64_C(0x34b0bcb5e19b48a8),
-    APR_UINT64_C(0x391c0cb3c5c95a63), APR_UINT64_C(0x4ed8aa4ae3418acb),
-    APR_UINT64_C(0x5b9cca4f7763e373), APR_UINT64_C(0x682e6ff3d6b2b8a3),
-    APR_UINT64_C(0x748f82ee5defb2fc), APR_UINT64_C(0x78a5636f43172f60),
-    APR_UINT64_C(0x84c87814a1f0ab72), APR_UINT64_C(0x8cc702081a6439ec),
-    APR_UINT64_C(0x90befffa23631e28), APR_UINT64_C(0xa4506cebde82bde9),
-    APR_UINT64_C(0xbef9a3f7b2c67915), APR_UINT64_C(0xc67178f2e372532b),
-    APR_UINT64_C(0xca273eceea26619c), APR_UINT64_C(0xd186b8c721c0c207),
-    APR_UINT64_C(0xeada7dd6cde0eb1e), APR_UINT64_C(0xf57d4f7fee6ed178),
-    APR_UINT64_C(0x06f067aa72176fba), APR_UINT64_C(0x0a637dc5a2c898a6),
-    APR_UINT64_C(0x113f9804bef90dae), APR_UINT64_C(0x1b710b35131c471b),
-    APR_UINT64_C(0x28db77f523047d84), APR_UINT64_C(0x32caab7b40c72493),
-    APR_UINT64_C(0x3c9ebe0a15c9bebc), APR_UINT64_C(0x431d67c49c100d4c),
-    APR_UINT64_C(0x4cc5d4becb3e42b6), APR_UINT64_C(0x597f299cfc657e2a),
-    APR_UINT64_C(0x5fcb6fab3ad6faec), APR_UINT64_C(0x6c44198c4a475817)
-};
-
-/* Initial hash value H for SHA-384 */
-static const sha2_word64 sha384_initial_hash_value[8] = {
-    APR_UINT64_C(0xcbbb9d5dc1059ed8),
-    APR_UINT64_C(0x629a292a367cd507),
-    APR_UINT64_C(0x9159015a3070dd17),
-    APR_UINT64_C(0x152fecd8f70e5939),
-    APR_UINT64_C(0x67332667ffc00b31),
-    APR_UINT64_C(0x8eb44a8768581511),
-    APR_UINT64_C(0xdb0c2e0d64f98fa7),
-    APR_UINT64_C(0x47b5481dbefa4fa4)
-};
-
-/* Initial hash value H for SHA-512 */
-static const sha2_word64 sha512_initial_hash_value[8] = {
-    APR_UINT64_C(0x6a09e667f3bcc908),
-    APR_UINT64_C(0xbb67ae8584caa73b),
-    APR_UINT64_C(0x3c6ef372fe94f82b),
-    APR_UINT64_C(0xa54ff53a5f1d36f1),
-    APR_UINT64_C(0x510e527fade682d1),
-    APR_UINT64_C(0x9b05688c2b3e6c1f),
-    APR_UINT64_C(0x1f83d9abfb41bd6b),
-    APR_UINT64_C(0x5be0cd19137e2179)
-};
-
 /*
  * Constant used by SHA256/384/512_End() functions for converting the
  * digest to a readable hexadecimal character string:
@@ -537,7 +465,14 @@ void apr__SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
                         *context->buffer = 0x80;
                 }
                 /* Set the bit count: */
-                *(sha2_word64*)&context->buffer[SHA256_SHORT_BLOCK_LENGTH] = context->bitcount;
+                {
+                        union dummy {
+                                apr_uint64_t bitcount;
+                                apr_byte_t bytes[8];
+                        } bitcount;
+                        bitcount.bitcount = context->bitcount;
+                        MEMCPY_BCOPY(&context->buffer[SHA256_SHORT_BLOCK_LENGTH], bitcount.bytes, 8);
+                }
 
                 /* Final transform: */
                 apr__SHA256_Transform(context, (sha2_word32*)context->buffer);
@@ -591,410 +526,3 @@ char* apr__SHA256_Data(const sha2_byte* data, size_t len, char digest[SHA256_DIG
         apr__SHA256_Update(&context, data, len);
         return apr__SHA256_End(&context, digest);
 }
-
-
-/*** SHA-512: *********************************************************/
-void apr__SHA512_Init(SHA512_CTX* context) {
-        if (context == (SHA512_CTX*)0) {
-                return;
-        }
-        MEMCPY_BCOPY(context->state, sha512_initial_hash_value, SHA512_DIGEST_LENGTH);
-        MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH);
-        context->bitcount[0] = context->bitcount[1] =  0;
-}
-
-#ifdef SHA2_UNROLL_TRANSFORM
-
-/* Unrolled SHA-512 round macros: */
-#if !APR_IS_BIGENDIAN
-
-#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h)       \
-        REVERSE64(*data++, W512[j]); \
-        T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \
-             K512[j] + W512[j]; \
-        (d) += T1, \
-        (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)), \
-        j++
-
-
-#else /* APR_IS_BIGENDIAN */
-
-#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h)       \
-        T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \
-             K512[j] + (W512[j] = *data++); \
-        (d) += T1; \
-        (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \
-        j++
-
-#endif /* APR_IS_BIGENDIAN */
-
-#define ROUND512(a,b,c,d,e,f,g,h)       \
-        s0 = W512[(j+1)&0x0f]; \
-        s0 = sigma0_512(s0); \
-        s1 = W512[(j+14)&0x0f]; \
-        s1 = sigma1_512(s1); \
-        T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + K512[j] + \
-             (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); \
-        (d) += T1; \
-        (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \
-        j++
-
-void apr__SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) {
-        sha2_word64     a, b, c, d, e, f, g, h, s0, s1;
-        sha2_word64     T1, *W512 = (sha2_word64*)context->buffer;
-        int             j;
-
-        /* Initialize registers with the prev. intermediate value */
-        a = context->state[0];
-        b = context->state[1];
-        c = context->state[2];
-        d = context->state[3];
-        e = context->state[4];
-        f = context->state[5];
-        g = context->state[6];
-        h = context->state[7];
-
-        j = 0;
-        do {
-                ROUND512_0_TO_15(a,b,c,d,e,f,g,h);
-                ROUND512_0_TO_15(h,a,b,c,d,e,f,g);
-                ROUND512_0_TO_15(g,h,a,b,c,d,e,f);
-                ROUND512_0_TO_15(f,g,h,a,b,c,d,e);
-                ROUND512_0_TO_15(e,f,g,h,a,b,c,d);
-                ROUND512_0_TO_15(d,e,f,g,h,a,b,c);
-                ROUND512_0_TO_15(c,d,e,f,g,h,a,b);
-                ROUND512_0_TO_15(b,c,d,e,f,g,h,a);
-        } while (j < 16);
-
-        /* Now for the remaining rounds up to 79: */
-        do {
-                ROUND512(a,b,c,d,e,f,g,h);
-                ROUND512(h,a,b,c,d,e,f,g);
-                ROUND512(g,h,a,b,c,d,e,f);
-                ROUND512(f,g,h,a,b,c,d,e);
-                ROUND512(e,f,g,h,a,b,c,d);
-                ROUND512(d,e,f,g,h,a,b,c);
-                ROUND512(c,d,e,f,g,h,a,b);
-                ROUND512(b,c,d,e,f,g,h,a);
-        } while (j < 80);
-
-        /* Compute the current intermediate hash value */
-        context->state[0] += a;
-        context->state[1] += b;
-        context->state[2] += c;
-        context->state[3] += d;
-        context->state[4] += e;
-        context->state[5] += f;
-        context->state[6] += g;
-        context->state[7] += h;
-
-        /* Clean up */
-        a = b = c = d = e = f = g = h = T1 = 0;
-}
-
-#else /* SHA2_UNROLL_TRANSFORM */
-
-void apr__SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) {
-        sha2_word64     a, b, c, d, e, f, g, h, s0, s1;
-        sha2_word64     T1, T2, *W512 = (sha2_word64*)context->buffer;
-        int             j;
-
-        /* Initialize registers with the prev. intermediate value */
-        a = context->state[0];
-        b = context->state[1];
-        c = context->state[2];
-        d = context->state[3];
-        e = context->state[4];
-        f = context->state[5];
-        g = context->state[6];
-        h = context->state[7];
-
-        j = 0;
-        do {
-#if !APR_IS_BIGENDIAN
-                /* Convert TO host byte order */
-                REVERSE64(*data++, W512[j]);
-                /* Apply the SHA-512 compression function to update a..h */
-                T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + W512[j];
-#else /* APR_IS_BIGENDIAN */
-                /* Apply the SHA-512 compression function to update a..h with copy */
-                T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + (W512[j] = *data++);
-#endif /* APR_IS_BIGENDIAN */
-                T2 = Sigma0_512(a) + Maj(a, b, c);
-                h = g;
-                g = f;
-                f = e;
-                e = d + T1;
-                d = c;
-                c = b;
-                b = a;
-                a = T1 + T2;
-
-                j++;
-        } while (j < 16);
-
-        do {
-                /* Part of the message block expansion: */
-                s0 = W512[(j+1)&0x0f];
-                s0 = sigma0_512(s0);
-                s1 = W512[(j+14)&0x0f];
-                s1 =  sigma1_512(s1);
-
-                /* Apply the SHA-512 compression function to update a..h */
-                T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] +
-                     (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0);
-                T2 = Sigma0_512(a) + Maj(a, b, c);
-                h = g;
-                g = f;
-                f = e;
-                e = d + T1;
-                d = c;
-                c = b;
-                b = a;
-                a = T1 + T2;
-
-                j++;
-        } while (j < 80);
-
-        /* Compute the current intermediate hash value */
-        context->state[0] += a;
-        context->state[1] += b;
-        context->state[2] += c;
-        context->state[3] += d;
-        context->state[4] += e;
-        context->state[5] += f;
-        context->state[6] += g;
-        context->state[7] += h;
-
-        /* Clean up */
-        a = b = c = d = e = f = g = h = T1 = T2 = 0;
-}
-
-#endif /* SHA2_UNROLL_TRANSFORM */
-
-void apr__SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) {
-        unsigned int    freespace, usedspace;
-
-        if (len == 0) {
-                /* Calling with no data is valid - we do nothing */
-                return;
-        }
-
-        /* Sanity check: */
-        assert(context != (SHA512_CTX*)0 && data != (sha2_byte*)0);
-
-        usedspace = (unsigned int)((context->bitcount[0] >> 3) 
-                                 % SHA512_BLOCK_LENGTH);
-        if (usedspace > 0) {
-                /* Calculate how much free space is available in the buffer */
-                freespace = SHA512_BLOCK_LENGTH - usedspace;
-
-                if (len >= freespace) {
-                        /* Fill the buffer completely and process it */
-                        MEMCPY_BCOPY(&context->buffer[usedspace], data, freespace);
-                        ADDINC128(context->bitcount, freespace << 3);
-                        len -= freespace;
-                        data += freespace;
-                        apr__SHA512_Transform(context, (sha2_word64*)context->buffer);
-                } else {
-                        /* The buffer is not yet full */
-                        MEMCPY_BCOPY(&context->buffer[usedspace], data, len);
-                        ADDINC128(context->bitcount, len << 3);
-                        /* Clean up: */
-                        usedspace = freespace = 0;
-                        return;
-                }
-        }
-        while (len >= SHA512_BLOCK_LENGTH) {
-                /* Process as many complete blocks as we can */
-                apr__SHA512_Transform(context, (sha2_word64*)data);
-                ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3);
-                len -= SHA512_BLOCK_LENGTH;
-                data += SHA512_BLOCK_LENGTH;
-        }
-        if (len > 0) {
-                /* There's left-overs, so save 'em */
-                MEMCPY_BCOPY(context->buffer, data, len);
-                ADDINC128(context->bitcount, len << 3);
-        }
-        /* Clean up: */
-        usedspace = freespace = 0;
-}
-
-void apr__SHA512_Last(SHA512_CTX* context) {
-        unsigned int    usedspace;
-
-        usedspace = (unsigned int)((context->bitcount[0] >> 3) 
-                                 % SHA512_BLOCK_LENGTH);
-#if !APR_IS_BIGENDIAN
-        /* Convert FROM host byte order */
-        REVERSE64(context->bitcount[0],context->bitcount[0]);
-        REVERSE64(context->bitcount[1],context->bitcount[1]);
-#endif
-        if (usedspace > 0) {
-                /* Begin padding with a 1 bit: */
-                context->buffer[usedspace++] = 0x80;
-
-                if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) {
-                        /* Set-up for the last transform: */
-                        MEMSET_BZERO(&context->buffer[usedspace], SHA512_SHORT_BLOCK_LENGTH - usedspace);
-                } else {
-                        if (usedspace < SHA512_BLOCK_LENGTH) {
-                                MEMSET_BZERO(&context->buffer[usedspace], SHA512_BLOCK_LENGTH - usedspace);
-                        }
-                        /* Do second-to-last transform: */
-                        apr__SHA512_Transform(context, (sha2_word64*)context->buffer);
-
-                        /* And set-up for the last transform: */
-                        MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH - 2);
-                }
-        } else {
-                /* Prepare for final transform: */
-                MEMSET_BZERO(context->buffer, SHA512_SHORT_BLOCK_LENGTH);
-
-                /* Begin padding with a 1 bit: */
-                *context->buffer = 0x80;
-        }
-        /* Store the length of input data (in bits): */
-        *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1];
-        *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0];
-
-        /* Final transform: */
-        apr__SHA512_Transform(context, (sha2_word64*)context->buffer);
-}
-
-void apr__SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
-        sha2_word64     *d = (sha2_word64*)digest;
-
-        /* Sanity check: */
-        assert(context != (SHA512_CTX*)0);
-
-        /* If no digest buffer is passed, we don't bother doing this: */
-        if (digest != (sha2_byte*)0) {
-                apr__SHA512_Last(context);
-
-                /* Save the hash data for output: */
-#if !APR_IS_BIGENDIAN
-                {
-                        /* Convert TO host byte order */
-                        int     j;
-                        for (j = 0; j < 8; j++) {
-                                REVERSE64(context->state[j],context->state[j]);
-                                *d++ = context->state[j];
-                        }
-                }
-#else /* APR_IS_BIGENDIAN */
-                MEMCPY_BCOPY(d, context->state, SHA512_DIGEST_LENGTH);
-#endif /* APR_IS_BIGENDIAN */
-        }
-
-        /* Zero out state data */
-        MEMSET_BZERO(context, sizeof(*context));
-}
-
-char *apr__SHA512_End(SHA512_CTX* context, char buffer[]) {
-        sha2_byte       digest[SHA512_DIGEST_LENGTH], *d = digest;
-        int             i;
-
-        /* Sanity check: */
-        assert(context != (SHA512_CTX*)0);
-
-        if (buffer != (char*)0) {
-                apr__SHA512_Final(digest, context);
-
-                for (i = 0; i < SHA512_DIGEST_LENGTH; i++) {
-                        *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
-                        *buffer++ = sha2_hex_digits[*d & 0x0f];
-                        d++;
-                }
-                *buffer = (char)0;
-        } else {
-                MEMSET_BZERO(context, sizeof(*context));
-        }
-        MEMSET_BZERO(digest, SHA512_DIGEST_LENGTH);
-        return buffer;
-}
-
-char* apr__SHA512_Data(const sha2_byte* data, size_t len, char digest[SHA512_DIGEST_STRING_LENGTH]) {
-        SHA512_CTX      context;
-
-        apr__SHA512_Init(&context);
-        apr__SHA512_Update(&context, data, len);
-        return apr__SHA512_End(&context, digest);
-}
-
-
-/*** SHA-384: *********************************************************/
-void apr__SHA384_Init(SHA384_CTX* context) {
-        if (context == (SHA384_CTX*)0) {
-                return;
-        }
-        MEMCPY_BCOPY(context->state, sha384_initial_hash_value, SHA512_DIGEST_LENGTH);
-        MEMSET_BZERO(context->buffer, SHA384_BLOCK_LENGTH);
-        context->bitcount[0] = context->bitcount[1] = 0;
-}
-
-void apr__SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) {
-        apr__SHA512_Update((SHA512_CTX*)context, data, len);
-}
-
-void apr__SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
-        sha2_word64     *d = (sha2_word64*)digest;
-
-        /* Sanity check: */
-        assert(context != (SHA384_CTX*)0);
-
-        /* If no digest buffer is passed, we don't bother doing this: */
-        if (digest != (sha2_byte*)0) {
-                apr__SHA512_Last((SHA512_CTX*)context);
-
-                /* Save the hash data for output: */
-#if !APR_IS_BIGENDIAN
-                {
-                        /* Convert TO host byte order */
-                        int     j;
-                        for (j = 0; j < 6; j++) {
-                                REVERSE64(context->state[j],context->state[j]);
-                                *d++ = context->state[j];
-                        }
-                }
-#else /* APR_IS_BIGENDIAN */
-                MEMCPY_BCOPY(d, context->state, SHA384_DIGEST_LENGTH);
-#endif /* APR_IS_BIGENDIAN */
-        }
-
-        /* Zero out state data */
-        MEMSET_BZERO(context, sizeof(*context));
-}
-
-char *apr__SHA384_End(SHA384_CTX* context, char buffer[]) {
-        sha2_byte       digest[SHA384_DIGEST_LENGTH], *d = digest;
-        int             i;
-
-        /* Sanity check: */
-        assert(context != (SHA384_CTX*)0);
-
-        if (buffer != (char*)0) {
-                apr__SHA384_Final(digest, context);
-
-                for (i = 0; i < SHA384_DIGEST_LENGTH; i++) {
-                        *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
-                        *buffer++ = sha2_hex_digits[*d & 0x0f];
-                        d++;
-                }
-                *buffer = (char)0;
-        } else {
-                MEMSET_BZERO(context, sizeof(*context));
-        }
-        MEMSET_BZERO(digest, SHA384_DIGEST_LENGTH);
-        return buffer;
-}
-
-char* apr__SHA384_Data(const sha2_byte* data, size_t len, char digest[SHA384_DIGEST_STRING_LENGTH]) {
-        SHA384_CTX      context;
-
-        apr__SHA384_Init(&context);
-        apr__SHA384_Update(&context, data, len);
-        return apr__SHA384_End(&context, digest);
-}
-
diff --git a/random/unix/sha2.h b/random/unix/sha2.h
index 9f0d93e..0a030d7 100644
--- a/random/unix/sha2.h
+++ b/random/unix/sha2.h
@@ -29,16 +29,10 @@ extern "C" {
 
 #include "apr.h"
 
-/*** SHA-256/384/512 Various Length Definitions ***********************/
+/*** SHA-256 Various Length Definitions ***********************/
 #define SHA256_BLOCK_LENGTH             64
 #define SHA256_DIGEST_LENGTH            32
 #define SHA256_DIGEST_STRING_LENGTH     (SHA256_DIGEST_LENGTH * 2 + 1)
-#define SHA384_BLOCK_LENGTH             128
-#define SHA384_DIGEST_LENGTH            48
-#define SHA384_DIGEST_STRING_LENGTH     (SHA384_DIGEST_LENGTH * 2 + 1)
-#define SHA512_BLOCK_LENGTH             128
-#define SHA512_DIGEST_LENGTH            64
-#define SHA512_DIGEST_STRING_LENGTH     (SHA512_DIGEST_LENGTH * 2 + 1)
 
 
 /*** SHA-256/384/512 Context Structures *******************************/
@@ -47,13 +41,6 @@ typedef struct _SHA256_CTX {
         apr_uint64_t    bitcount;
         apr_byte_t      buffer[SHA256_BLOCK_LENGTH];
 } SHA256_CTX;
-typedef struct _SHA512_CTX {
-        apr_uint64_t    state[8];
-        apr_uint64_t    bitcount[2];
-        apr_byte_t      buffer[SHA512_BLOCK_LENGTH];
-} SHA512_CTX;
-
-typedef SHA512_CTX SHA384_CTX;
 
 
 /*** SHA-256/384/512 Function Prototypes ******************************/
@@ -63,21 +50,7 @@ void apr__SHA256_Final(apr_byte_t [SHA256_DIGEST_LENGTH], SHA256_CTX *);
 char* apr__SHA256_End(SHA256_CTX *, char [SHA256_DIGEST_STRING_LENGTH]);
 char* apr__SHA256_Data(const apr_byte_t *, size_t,
                   char [SHA256_DIGEST_STRING_LENGTH]);
-
-void apr__SHA384_Init(SHA384_CTX *);
-void apr__SHA384_Update(SHA384_CTX *, const apr_byte_t *, size_t);
-void apr__SHA384_Final(apr_byte_t [SHA384_DIGEST_LENGTH], SHA384_CTX *);
-char* apr__SHA384_End(SHA384_CTX *, char [SHA384_DIGEST_STRING_LENGTH]);
-char* apr__SHA384_Data(const apr_byte_t *, size_t,
-                  char [SHA384_DIGEST_STRING_LENGTH]);
-
-void apr__SHA512_Init(SHA512_CTX *);
-void apr__SHA512_Update(SHA512_CTX *, const apr_byte_t *, size_t);
-void apr__SHA512_Final(apr_byte_t [SHA512_DIGEST_LENGTH], SHA512_CTX *);
-char* apr__SHA512_End(SHA512_CTX *, char [SHA512_DIGEST_STRING_LENGTH]);
-char* apr__SHA512_Data(const apr_byte_t *, size_t,
-                  char [SHA512_DIGEST_STRING_LENGTH]);
-
+                  
 #ifdef  __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/random/unix/sha2_glue.c b/random/unix/sha2_glue.c
index 4909a8f..cb6e897 100644
--- a/random/unix/sha2_glue.c
+++ b/random/unix/sha2_glue.c
@@ -1,26 +1,42 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 #include <apr.h>
 #include <apr_random.h>
 #include <apr_pools.h>
 #include "sha2.h"
 
 static void sha256_init(apr_crypto_hash_t *h)
-    {
+{
     apr__SHA256_Init(h->data);
-    }
+}
 
 static void sha256_add(apr_crypto_hash_t *h,const void *data,
-			  apr_size_t bytes)
-    {
+                       apr_size_t bytes)
+{
     apr__SHA256_Update(h->data,data,bytes);
-    }
+}
 
 static void sha256_finish(apr_crypto_hash_t *h,unsigned char *result)
-    {
+{
     apr__SHA256_Final(result,h->data);
-    }
+}
 
 APR_DECLARE(apr_crypto_hash_t *) apr_crypto_sha256_new(apr_pool_t *p)
-    {
+{
     apr_crypto_hash_t *h=apr_palloc(p,sizeof *h);
 
     h->data=apr_palloc(p,sizeof(SHA256_CTX));
@@ -30,4 +46,4 @@ APR_DECLARE(apr_crypto_hash_t *) apr_crypto_sha256_new(apr_pool_t *p)
     h->size=256/8;
 
     return h;
-    }
+}
diff --git a/shmem/win32/shm.c b/shmem/win32/shm.c
index da736aa..85926ab 100644
--- a/shmem/win32/shm.c
+++ b/shmem/win32/shm.c
@@ -82,7 +82,7 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m,
     /* Compute the granualar multiple of the pagesize */
     size = memblock * (1 + (reqsize - 1) / memblock);
     sizelo = (DWORD)size;
-#ifdef WIN64
+#ifdef _WIN64
     sizehi = (DWORD)(size >> 32);
 #else
     sizehi = 0;
diff --git a/tables/apr_tables.c b/tables/apr_tables.c
index 51b2340..7479ef4 100644
--- a/tables/apr_tables.c
+++ b/tables/apr_tables.c
@@ -734,11 +734,14 @@ APR_DECLARE(void) apr_table_mergen(apr_table_t *t, const char *key,
 
 #if APR_POOL_DEBUG
     {
-	if (!apr_pool_is_ancestor(apr_pool_find(key), t->a.pool)) {
+	apr_pool_t *pool;
+	pool = apr_pool_find(key);
+	if ((pool != key) && (!apr_pool_is_ancestor(pool, t->a.pool))) {
 	    fprintf(stderr, "apr_table_mergen: key not in ancestor pool of t\n");
 	    abort();
 	}
-	if (!apr_pool_is_ancestor(apr_pool_find(val), t->a.pool)) {
+	pool = apr_pool_find(val);
+	if ((pool != val) && (!apr_pool_is_ancestor(pool, t->a.pool))) {
 	    fprintf(stderr, "apr_table_mergen: val not in ancestor pool of t\n");
 	    abort();
 	}
diff --git a/test/NWGNUmakefile b/test/NWGNUmakefile
index b9ebfaf..a1085d7 100644
--- a/test/NWGNUmakefile
+++ b/test/NWGNUmakefile
@@ -45,6 +45,7 @@ nlms :: libs $(TARGET_nlm)
 #
 install :: nlms FORCE
 	$(call COPY,$(OBJDIR)/*.nlm,$(INSTALLBASE))
+	$(call COPYR,data,$(INSTALLBASE)/data/)
 
 #
 # Any specialized rules here
diff --git a/test/echod.c b/test/echod.c
index c78e90f..87f386a 100644
--- a/test/echod.c
+++ b/test/echod.c
@@ -113,7 +113,6 @@ static apr_status_t glassToWall(apr_int16_t port, apr_pool_t *parent)
 int main(int argc, char **argv)
 {
     apr_pool_t *pool;
-    apr_status_t rv;
     apr_int16_t theport = 4747;
 
     printf("APR Test Application: echod\n");
@@ -129,7 +128,7 @@ int main(int argc, char **argv)
     }
 
     fprintf(stdout, "Starting to listen on port %d\n", theport);
-    rv = glassToWall(theport, pool);
+    glassToWall(theport, pool);
 
     return 0;
 }
diff --git a/test/sockperf.c b/test/sockperf.c
index bc3d1e2..a18d8ba 100644
--- a/test/sockperf.c
+++ b/test/sockperf.c
@@ -96,8 +96,10 @@ static apr_status_t sendRecvBuffer(apr_time_t *t, const char *buf,
 
         rv = apr_socket_create(&sock, APR_INET, SOCK_STREAM, APR_PROTO_TCP,
                            pool);
-        if (rv != APR_SUCCESS)
+        if (rv != APR_SUCCESS) {
+            reportError("Unable to create IPv4 stream socket", rv, pool);
             return rv;
+        }
 
         rv = apr_socket_connect(sock, sockAddr);
         if (rv != APR_SUCCESS) {
@@ -110,16 +112,21 @@ static apr_status_t sendRecvBuffer(apr_time_t *t, const char *buf,
     }
 
     recvBuf = apr_palloc(pool, size);
-    if (! recvBuf)
+    if (! recvBuf) {
+        reportError("Unable to allocate buffer", ENOMEM, pool);
         return ENOMEM;
+    }
+
     *t = 0;
 
     /* START! */
     testStart = apr_time_now();
     rv = apr_socket_create(&sock, APR_INET, SOCK_STREAM, APR_PROTO_TCP,
                            pool);
-    if (rv != APR_SUCCESS)
+    if (rv != APR_SUCCESS) {
+        reportError("Unable to create IPv4 stream socket", rv, pool);
         return rv;
+    }
 
     rv = apr_socket_connect(sock, sockAddr);
     if (rv != APR_SUCCESS) {
@@ -146,8 +153,10 @@ static apr_status_t sendRecvBuffer(apr_time_t *t, const char *buf,
         do {
             len = thistime;
             rv = apr_socket_recv(sock, &recvBuf[size - thistime], &len);
-            if (rv != APR_SUCCESS)
+            if (rv != APR_SUCCESS) {
+                reportError("Error receiving from socket", rv, pool);
                 break;
+            }
             thistime -= len;
         } while (thistime);
     }
@@ -218,14 +227,18 @@ int main(int argc, char **argv)
     results = (struct testResult *)apr_pcalloc(pool, 
                                         sizeof(*results) * nTests);
 
-    for(i = 0; i < nTests; i++) {
+    for (i = 0; i < nTests; i++) {
         printf("Test -> %c\n", testRuns[i].c);
         results[i].size = testRuns[i].size * (apr_size_t)TEST_SIZE;
         rv = runTest(&testRuns[i], &results[i], pool);
+        if (rv != APR_SUCCESS) {
+            /* error already reported */
+            exit(1);
+        }
     }
 
     printf("Tests Complete!\n");
-    for(i = 0; i < nTests; i++) {
+    for (i = 0; i < nTests; i++) {
         int j;
         apr_time_t totTime = 0;
         printf("%10d byte block:\n", results[i].size);
diff --git a/test/testatomic.c b/test/testatomic.c
index cfea2a6..8e00fb1 100644
--- a/test/testatomic.c
+++ b/test/testatomic.c
@@ -84,11 +84,12 @@ static void test_xchg32(abts_case *tc, void *data)
 static void test_xchgptr(abts_case *tc, void *data)
 {
     int a;
-    volatile void *target_ptr = NULL;
+    void *ref = "little piggy";
+    volatile void *target_ptr = ref;
     void *old_ptr;
 
     old_ptr = apr_atomic_xchgptr(&target_ptr, &a);
-    ABTS_PTR_EQUAL(tc, NULL, old_ptr);
+    ABTS_PTR_EQUAL(tc, ref, old_ptr);
     ABTS_PTR_EQUAL(tc, &a, (void *) target_ptr);
 }
 
diff --git a/test/testfile.c b/test/testfile.c
index 2b46586..7b58006 100644
--- a/test/testfile.c
+++ b/test/testfile.c
@@ -749,6 +749,7 @@ static void test_writev_buffered_seek(abts_case *tc, void *data)
                                      APR_OS_DEFAULT, p));
 
     rv = apr_file_read(f, str, &nbytes);
+    ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
     ABTS_STR_EQUAL(tc, TESTSTR, str);
     APR_ASSERT_SUCCESS(tc, "buffered seek", apr_file_seek(f, APR_SET, &off));
 
@@ -950,6 +951,7 @@ static void test_xthread(abts_case *tc, void *data)
         apr_off_t offset = 0;
 
         rv = apr_file_seek(f, APR_END, &offset);
+        ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
     }
 
     APR_ASSERT_SUCCESS(tc, "more writes should succeed",
@@ -960,6 +962,7 @@ static void test_xthread(abts_case *tc, void *data)
         apr_off_t offset = 0;
         
         rv = apr_file_seek(f, APR_SET, &offset);
+        ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
     }
     
     apr_file_read_full(f, buf, sizeof(buf), NULL);
diff --git a/test/testipsub.c b/test/testipsub.c
index 8fd3672..804bb3d 100644
--- a/test/testipsub.c
+++ b/test/testipsub.c
@@ -119,6 +119,7 @@ static void test_interesting_subnets(abts_case *tc, void *data)
         ,{"127",              NULL,            APR_INET,  "127.0.0.1",           "10.1.2.3"}
         ,{"127.0.0.1",        "8",             APR_INET,  "127.0.0.1",           "10.1.2.3"}
 #if APR_HAVE_IPV6
+        ,{"38.0.0.0",         "8",             APR_INET6, "::ffff:38.1.1.1",     "2600::1"} /* PR 54047 */
         ,{"fe80::",           "8",             APR_INET6, "fe80::1",             "ff01::1"}
         ,{"ff01::",           "8",             APR_INET6, "ff01::1",             "fe80::1"}
         ,{"3FFE:8160::",      "28",            APR_INET6, "3ffE:816e:abcd:1234::1", "3ffe:8170::1"}
diff --git a/test/testlockperf.c b/test/testlockperf.c
index f673e5f..84c0ba9 100644
--- a/test/testlockperf.c
+++ b/test/testlockperf.c
@@ -226,7 +226,6 @@ int main(int argc, const char * const *argv)
 {
     apr_status_t rv;
     char errmsg[200];
-    const char *lockname = "multi.lock";
     apr_getopt_t *opt;
     char optchar;
     const char *optarg;
@@ -245,13 +244,10 @@ int main(int argc, const char * const *argv)
         exit(-1);
     }
         
-    while ((rv = apr_getopt(opt, "vf:", &optchar, &optarg)) == APR_SUCCESS) {
+    while ((rv = apr_getopt(opt, "v", &optchar, &optarg)) == APR_SUCCESS) {
         if (optchar == 'v') {
             verbose = 1;
         }
-        if (optchar == 'f') {
-            lockname = optarg;
-        }
     }
 
     if (rv != APR_SUCCESS && rv != APR_EOF) {
diff --git a/test/testmmap.c b/test/testmmap.c
index 4063ba6..74c0c9f 100644
--- a/test/testmmap.c
+++ b/test/testmmap.c
@@ -125,6 +125,7 @@ static void test_mmap_offset(abts_case *tc, void *data)
     ABTS_PTR_NOTNULL(tc, themmap);
     rv = apr_mmap_offset(&addr, themmap, 5);
 
+    ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
     /* Must use nEquals since the string is not guaranteed to be NULL terminated */
     ABTS_STR_NEQUAL(tc, addr, TEST_STRING + 5, thisfsize-5);
 }
diff --git a/test/testnames.c b/test/testnames.c
index 7a310fa..5afba0c 100644
--- a/test/testnames.c
+++ b/test/testnames.c
@@ -269,7 +269,9 @@ static void root_from_cwd_and_back(abts_case *tc, void *data)
     const char *path = "//";
     char *origpath;
     char *testpath;
+#if defined(WIN32) || defined(OS2) || defined(NETWARE)
     int hadfailed;
+#endif
 
     ABTS_INT_EQUAL(tc, APR_SUCCESS, apr_filepath_get(&origpath, 0, p));
     path = origpath;
@@ -308,7 +310,9 @@ static void root_from_cwd_and_back(abts_case *tc, void *data)
                           | APR_FILEPATH_NOTABOVEROOT
                           | APR_FILEPATH_NOTRELATIVE, p);
     ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
+#if defined(WIN32) || defined(OS2) || defined(NETWARE)
     hadfailed = tc->failed;
+#endif
     /* The API doesn't promise equality!!! 
      * apr_filepath_get never promised a canonical filepath.
      * We'll emit noise under verbose so the user is aware,
diff --git a/test/testsockets.c b/test/testsockets.c
index 2c0bb57..2a7499a 100644
--- a/test/testsockets.c
+++ b/test/testsockets.c
@@ -131,6 +131,10 @@ static void sendto_receivefrom_helper(abts_case *tc, const char *addr,
     APR_ASSERT_SUCCESS(tc, "Could not bind socket", rv);
     if (rv != APR_SUCCESS)
         return;
+    rv = apr_mcast_hops(sock, 10);
+    APR_ASSERT_SUCCESS(tc, "Could not set multicast hops", rv);
+    if (rv != APR_SUCCESS)
+        return;
 
     rv = apr_socket_bind(sock2, from);
     APR_ASSERT_SUCCESS(tc, "Could not bind second socket", rv);
diff --git a/test/testtime.c b/test/testtime.c
index 84b4772..fadef97 100644
--- a/test/testtime.c
+++ b/test/testtime.c
@@ -27,17 +27,19 @@
 /* The time value is used throughout the tests, so just make this a global.
  * Also, we need a single value that we can test for the positive tests, so
  * I chose the number below, it corresponds to:
- *           2002-08-14 12:05:36.186711 -25200 [257 Sat].
+ *           2002-09-14 12:05:36.186711 -25200 [257 Sat].
  * Which happens to be when I wrote the new tests.
  */
 static apr_time_t now = APR_INT64_C(1032030336186711);
+/* 2012-08-11 16:00:55.151600 -14400 [224 Sat] DST */
+static apr_time_t leap_year_now = APR_INT64_C(1344715255151600);
 
 static char* print_time (apr_pool_t *pool, const apr_time_exp_t *xt)
 {
     return apr_psprintf (pool,
                          "%04d-%02d-%02d %02d:%02d:%02d.%06d %+05d [%d %s]%s",
                          xt->tm_year + 1900,
-                         xt->tm_mon,
+                         xt->tm_mon + 1,
                          xt->tm_mday,
                          xt->tm_hour,
                          xt->tm_min,
@@ -59,12 +61,12 @@ static void test_now(abts_case *tc, void *data)
     current = apr_time_now();
     time(&os_now);
 
-    timediff = os_now - (current / APR_USEC_PER_SEC); 
+    timediff = os_now - (current / APR_USEC_PER_SEC);
     /* Even though these are called so close together, there is the chance
      * that the time will be slightly off, so accept anything between -1 and
      * 1 second.
      */
-    ABTS_ASSERT(tc, "apr_time and OS time do not agree", 
+    ABTS_ASSERT(tc, "apr_time and OS time do not agree",
              (timediff > -2) && (timediff < 2));
 }
 
@@ -78,36 +80,44 @@ static void test_gmtstr(abts_case *tc, void *data)
         ABTS_NOT_IMPL(tc, "apr_time_exp_gmt");
     }
     ABTS_TRUE(tc, rv == APR_SUCCESS);
-    ABTS_STR_EQUAL(tc, "2002-08-14 19:05:36.186711 +0000 [257 Sat]", 
+    ABTS_STR_EQUAL(tc, "2002-09-14 19:05:36.186711 +0000 [257 Sat]",
                       print_time(p, &xt));
 }
 
 static void test_exp_lt(abts_case *tc, void *data)
 {
-    apr_status_t rv;
-    apr_time_exp_t xt;
-    time_t posix_secs = (time_t)apr_time_sec(now);
-    struct tm *posix_exp = localtime(&posix_secs);
+    apr_time_t test_times[] = {0, 0, 0};
+    int i;
 
-    rv = apr_time_exp_lt(&xt, now);
-    if (rv == APR_ENOTIMPL) {
-        ABTS_NOT_IMPL(tc, "apr_time_exp_lt");
-    }
-    ABTS_TRUE(tc, rv == APR_SUCCESS);
+    test_times[0] = now;
+    test_times[1] = leap_year_now;
+
+    for (i = 0; test_times[i] != 0; i++) {
+        apr_status_t rv;
+        apr_time_exp_t xt;
+        time_t posix_secs = (time_t)apr_time_sec(test_times[i]);
+        struct tm *posix_exp = localtime(&posix_secs);
+
+        rv = apr_time_exp_lt(&xt, test_times[i]);
+        if (rv == APR_ENOTIMPL) {
+            ABTS_NOT_IMPL(tc, "apr_time_exp_lt");
+        }
+        ABTS_TRUE(tc, rv == APR_SUCCESS);
 
 #define CHK_FIELD(f) \
-    ABTS_ASSERT(tc, "Mismatch in " #f, posix_exp->f == xt.f)
-
-    CHK_FIELD(tm_sec);
-    CHK_FIELD(tm_min);
-    CHK_FIELD(tm_hour);
-    CHK_FIELD(tm_mday);
-    CHK_FIELD(tm_mon);
-    CHK_FIELD(tm_year);
-    CHK_FIELD(tm_wday);
-    CHK_FIELD(tm_yday);
-    CHK_FIELD(tm_isdst);
+        ABTS_ASSERT(tc, "Mismatch in " #f, posix_exp->f == xt.f)
+
+        CHK_FIELD(tm_sec);
+        CHK_FIELD(tm_min);
+        CHK_FIELD(tm_hour);
+        CHK_FIELD(tm_mday);
+        CHK_FIELD(tm_mon);
+        CHK_FIELD(tm_year);
+        CHK_FIELD(tm_wday);
+        CHK_FIELD(tm_yday);
+        CHK_FIELD(tm_isdst);
 #undef CHK_FIELD
+    }
 }
 
 static void test_exp_get_gmt(abts_case *tc, void *data)
@@ -238,9 +248,9 @@ static void test_exp_tz(abts_case *tc, void *data)
         ABTS_NOT_IMPL(tc, "apr_time_exp_tz");
     }
     ABTS_TRUE(tc, rv == APR_SUCCESS);
-    ABTS_TRUE(tc, (xt.tm_usec == 186711) && 
+    ABTS_TRUE(tc, (xt.tm_usec == 186711) &&
                      (xt.tm_sec == 36) &&
-                     (xt.tm_min == 5) && 
+                     (xt.tm_min == 5) &&
                      (xt.tm_hour == 14) &&
                      (xt.tm_mday == 14) &&
                      (xt.tm_mon == 8) &&
@@ -278,7 +288,7 @@ static void test_2038(abts_case *tc, void *data)
     xt.tm_hour = 3;
     xt.tm_min = 14;
     xt.tm_sec = 7;
-    
+
     APR_ASSERT_SUCCESS(tc, "explode January 19th, 2038",
                        apr_time_exp_get(&t, &xt));
 }
diff --git a/threadproc/unix/thread.c b/threadproc/unix/thread.c
index 5639ac7..6d060be 100644
--- a/threadproc/unix/thread.c
+++ b/threadproc/unix/thread.c
@@ -96,7 +96,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr)
 #else
     pthread_attr_getdetachstate(&attr->attr, &state);
 #endif
-    if (state == 1)
+    if (state == DETACH_ARG(1))
         return APR_DETACH;
     return APR_NOTDETACH;
 }
diff --git a/time/win32/time.c b/time/win32/time.c
index ecf0228..2349799 100644
--- a/time/win32/time.c
+++ b/time/win32/time.c
@@ -32,7 +32,7 @@
 /* Leap year is any year divisible by four, but not by 100 unless also
  * divisible by 400
  */
-#define IsLeapYear(y) ((!(y % 4)) ? (((!(y % 400)) && (y % 100)) ? 1 : 0) : 0)
+#define IsLeapYear(y) ((!(y % 4)) ? (((y % 400) && !(y % 100)) ? 0 : 1) : 0)
 
 static DWORD get_local_timezone(TIME_ZONE_INFORMATION **tzresult)
 {

-- 
Debian packaging for apr



More information about the Pkg-apache-commits mailing list