Index: configure
--- configure.orig	2009-03-06 20:17:06 +0100
+++ configure	2009-08-07 19:29:42 +0200
@@ -19470,11 +19470,11 @@
                 if test ${APR_MAJOR_VERSION:="0"} -eq 0; then
                     apr_config=apr-config
                     apu_config=apu-config
-                    apreq_libs="-lapr -laprutil"
+                    apreq_libs="-laprutil -lapr"
                 else
                     apr_config=apr-$APR_MAJOR_VERSION-config
                     apu_config=apu-$APR_MAJOR_VERSION-config
-                    apreq_libs="-lapr-$APR_MAJOR_VERSION -laprutil-$APR_MAJOR_VERSION"
+                    apreq_libs="-laprutil-$APR_MAJOR_VERSION -lapr-$APR_MAJOR_VERSION"
                 fi
 
                 if test -z "$APR_CONFIG"; then
@@ -19742,10 +19742,10 @@
         APU_LA="`$APU_CONFIG --apu-la-file`"
 
   if test "x$APR_LTFLAGS" = "x"; then
-    echo "  setting APR_LTFLAGS to \""`$APR_CONFIG --link-libtool`"\""
-    APR_LTFLAGS=""`$APR_CONFIG --link-libtool`""
+    echo "  setting APR_LTFLAGS to \""`$APU_CONFIG --link-libtool`"\""
+    APR_LTFLAGS=""`$APU_CONFIG --link-libtool`""
   else
-    apr_addto_bugger=""`$APR_CONFIG --link-libtool`""
+    apr_addto_bugger=""`$APU_CONFIG --link-libtool`""
     for i in $apr_addto_bugger; do
       apr_addto_duplicate="0"
       for j in $APR_LTFLAGS; do
@@ -19761,12 +19761,11 @@
     done
   fi
 
-
   if test "x$APR_LTFLAGS" = "x"; then
-    echo "  setting APR_LTFLAGS to \""`$APU_CONFIG --link-libtool`"\""
-    APR_LTFLAGS=""`$APU_CONFIG --link-libtool`""
+    echo "  setting APR_LTFLAGS to \""`$APR_CONFIG --link-libtool`"\""
+    APR_LTFLAGS=""`$APR_CONFIG --link-libtool`""
   else
-    apr_addto_bugger=""`$APU_CONFIG --link-libtool`""
+    apr_addto_bugger=""`$APR_CONFIG --link-libtool`""
     for i in $apr_addto_bugger; do
       apr_addto_duplicate="0"
       for j in $APR_LTFLAGS; do
@@ -19777,34 +19776,13 @@
       done
       if test $apr_addto_duplicate = "0"; then
         echo "  adding \"$i\" to APR_LTFLAGS"
-        APR_LTFLAGS="$APR_LTFLAGS $i"
+        APR_LTFLAGS="$i $APR_LTFLAGS"
       fi
     done
   fi
 
 
 
-  if test "x$APR_LIBS" = "x"; then
-    echo "  setting APR_LIBS to \""`$APR_CONFIG --libs`"\""
-    APR_LIBS=""`$APR_CONFIG --libs`""
-  else
-    apr_addto_bugger=""`$APR_CONFIG --libs`""
-    for i in $apr_addto_bugger; do
-      apr_addto_duplicate="0"
-      for j in $APR_LIBS; do
-        if test "x$i" = "x$j"; then
-          apr_addto_duplicate="1"
-          break
-        fi
-      done
-      if test $apr_addto_duplicate = "0"; then
-        echo "  adding \"$i\" to APR_LIBS"
-        APR_LIBS="$APR_LIBS $i"
-      fi
-    done
-  fi
-
-
                                                 if test "x$OS" = "xsolaris"; then
             if $APU_CONFIG --avoid-ldap >/dev/null 2>&1; then
                 APU_LIBS=`$APU_CONFIG --avoid-ldap --libs | $PERL -pe 's,-lexpat,,'`
@@ -19880,6 +19858,25 @@
             fi
         fi
 
+  if test "x$APR_LIBS" = "x"; then
+    echo "  setting APR_LIBS to \""`$APR_CONFIG --libs`"\""
+    APR_LIBS=""`$APR_CONFIG --libs`""
+  else
+    apr_addto_bugger=""`$APR_CONFIG --libs`""
+    for i in $apr_addto_bugger; do
+      apr_addto_duplicate="0"
+      for j in $APR_LIBS; do
+        if test "x$i" = "x$j"; then
+          apr_addto_duplicate="1"
+          break
+        fi
+      done
+      if test $apr_addto_duplicate = "0"; then
+        echo "  adding \"$i\" to APR_LIBS"
+        APR_LIBS="$APR_LIBS $i"
+      fi
+    done
+  fi
 
   if test "x$APR_LDFLAGS" = "x"; then
     echo "  setting APR_LDFLAGS to \""`$APU_CONFIG --link-ld --ldflags`"\""
Index: library/Makefile.in
--- library/Makefile.in.orig	2009-03-06 20:17:07 +0100
+++ library/Makefile.in	2009-08-07 19:27:02 +0200
@@ -124,7 +124,7 @@
                        parser_urlencoded.c parser_header.c parser_multipart.c \
 	               module.c module_custom.c module_cgi.c error.c
 
-libapreq2_la_LDFLAGS = -version-info @APREQ_LIBTOOL_VERSION@ @APR_LTFLAGS@ @APR_LIBS@
+libapreq2_la_LDFLAGS = -static -version-info @APREQ_LIBTOOL_VERSION@ @APR_LTFLAGS@ @APR_LIBS@
 
 @ENABLE_PROFILE_TRUE@AM_CFLAGS = -pg -fprofile-arcs -ftest-coverage
 subdir = library
