OK, I've been poking at the buildconf script a little bit. The following patch:

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

(also attached) gets rid of all the hardcoded references to srclib/apr {,-util}, recognizes an installed copy vs. a source tree and builds configure only in the latter case. However, I keep running into problems:

[EMAIL PROTECTED] trunk $ ./buildconf --with-apr=/Volumes/Files/ asf/apr-1.2.x --with-apr-util=/Volumes/Files/asf/apr-1.2.x
found installed APR in: /Volumes/Files/asf/apr-1.2.x
found installed APR-Util in: /Volumes/Files/asf/apr-1.2.x
copying build files
cp: /Volumes/Files/asf/apr-1.2.x/build/find_apu.m4: No such file or directory cp: /Volumes/Files/asf/apr-1.2.x/build/find_apr.m4: No such file or directory cp: /Volumes/Files/asf/apr-1.2.x/build/apr_common.m4: No such file or directory cp: /Volumes/Files/asf/apr-1.2.x/build/PrintPath: No such file or directory cp: /Volumes/Files/asf/apr-1.2.x/build/config.sub: No such file or directory cp: /Volumes/Files/asf/apr-1.2.x/build/config.guess: No such file or directory
rebuilding srclib/pcre/configure
rebuilding include/ap_config_auto.h.in
rebuilding configure
rebuilding rpm spec file
fixing timestamps for mod_ssl sources

Note the cp turds: those files are not installed along with APR, so buildconf cannot copy them over. How come I or no one else noticed this ever? Probably because these files are not cleaned up by make distclean and ignored by svn, so they stick around and are re-used. To run into this, you need a clean svn checkout, or blow the build directory away and svn up.

I guess this makes it pretty much impossible to build an svn checkout against an installed APR:

[EMAIL PROTECTED] trunk $ ./configure
./configure: line 1502: syntax error near unexpected token `Apache,'
./configure: line 1502: `APR_ENABLE_LAYOUT(Apache, errordir iconsdir htdocsdir cgidir)'

Foom. We're done. Unless we can make APR bring those files along for us in the installation, we have no access to them.

Of course, all of the above are available in the release tarball, since that has buildconf run on it before being rolled.

So, how can we make this useful? I guess we have to figure out why one would want to run buildconf and I'm coming up with the following:

1) Bootstrap an svn checkout against an apr, apu checkout.
   This is what we use it for.
2) Bootstrap an svn checkout against an installed APR. This
   is currently broken as described above.
3) Reconfigure a release drop with autofoo from an installed
   copy of APR if/when building against a newer/older install
4) Reconfigure a release drop to suck in autofoo from a
   module dropped into the tree
5) ... (your use case here)

Thoughts? Ideas? I'd like to hammer out the above list before I do more work on the patch.

S.

--
[EMAIL PROTECTED]              http://www.temme.net/sander/
PGP FP: 51B4 8727 466A 0BC3 69F4  B7B8 B2BE BC40 1529 24AF

Attachment: buildconf.patch
Description: Binary data


Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to