Index: buildconf
===================================================================
--- buildconf	(revision 351458)
+++ buildconf	(working copy)
@@ -53,24 +53,32 @@
 #
 
 should_exit=0
-apr_found=0
-apu_found=0
+apr_found="no"
+apu_found="no"
 
 for dir in $apr_src_dir
 do
-    if [ -d "${dir}" -a -f "${dir}/build/apr_common.m4" ]; then
-        echo "found apr source: ${dir}"
-        apr_src_dir=$dir
-        apr_found=1
-        break
+    if [ -d "${dir}" ]; then
+        if [ -f "${dir}/build/apr_common.m4" ]; then
+            echo "found APR source: ${dir}"
+            apr_src_dir=$dir
+            apr_found="source"
+            break
+        fi
+        if [ -f "${dir}/bin/apr-1-config" ]; then
+            echo "found installed APR in: ${dir}"
+            apr_src_dir=$dir
+            apr_found="binary"
+            break
+        fi
     fi
 done
 
-if [ $apr_found -lt 1 ]; then
+if [ x$apr_found = "xno" ]; then
     echo ""
-    echo "You don't have a copy of the apr source in srclib/apr. "
+    echo "You don't have a copy of the Apache Portable Runtime version 1.x. "
     echo "Please get the source using the following instructions," 
-    echo "or specify the location of the source with " 
+    echo "or specify the location of an installed copy with " 
     echo "--with-apr=[path to apr] :"
     echo ""
     echo "   svn co http://svn.apache.org/repos/asf/apr/apr/trunk srclib/apr"
@@ -80,19 +88,27 @@
 
 for dir in $apu_src_dir
 do
-    if [ -d "${dir}" -a -f "${dir}/Makefile.in" ]; then
-        echo "found apr-util source: ${dir}"
-        apu_src_dir=$dir
-        apu_found=1
-        break
+    if [ -d "${dir}" ]; then
+        if [ -f "${dir}/Makefile.in" ]; then
+            echo "found APR-Util source: ${dir}"
+            apu_src_dir=$dir
+            apu_found="source"
+            break
+        fi
+        if [  -f "${dir}/bin/apu-1-config" ]; then
+            echo "found installed APR-Util in: ${dir}"
+            apu_src_dir=$dir
+            apu_found="binary"
+            break
+        fi
     fi
 done
 
-if [ $apu_found -lt 1 ]; then
+if [ x$apu_found = "xno" ]; then
     echo ""
-    echo "You don't have a copy of the apr-util source in srclib/apr-util. "
+    echo "You don't have a copy of the APR Utility Library version 1.x. "
     echo "Please get one the source using the following instructions, "
-    echo "or specify the location of the source with "
+    echo "or specify the location of installed copy with "
     echo "--with-apr-util=[path to apr-util]:"
     echo ""
     echo "   svn co http://svn.apache.org/repos/asf/apr/apr-util/trunk srclib/apr-util"
@@ -128,22 +144,23 @@
 
 cross_compile_warning="warning: AC_TRY_RUN called without default to allow cross compiling"
 
-if [ -d srclib/apr ]; then
+if [ x$apr_found = "xsource" ]; then
     echo rebuilding $apr_configure
-    (cd srclib/apr && ./buildconf) || {
+    (cd ${apr_src_dir} && ./buildconf) || {
         echo "./buildconf failed for apr"
         exit 1
     }
-    rm -f srclib/apr/apr.spec
+    rm -f ${apr_src_dir}/apr.spec
 fi
 
-if [ -d srclib/apr-util ]; then
+if [ x$apu_found = "xsource" ]; then
+    abs_apr_src_dir=$(cd "${apr_src_dir}" && pwd)
     echo rebuilding $aprutil_configure
-    (cd srclib/apr-util && ./buildconf) || {
+    (cd ${apu_src_dir} && ./buildconf --with-apr=${abs_apr_src_dir}) || {
         echo "./buildconf failed for apr-util" 
         exit 1
     }
-    rm -f srclib/apr-util/apr-util.spec
+    rm -f ${apu_src_dir}/apr-util.spec
 fi
 
 echo copying build files
