You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2012/09/26 21:04:37 UTC

svn commit: r1390674 - /subversion/trunk/build/ac-macros/berkeley-db.m4

Author: breser
Date: Wed Sep 26 19:04:36 2012
New Revision: 1390674

URL: http://svn.apache.org/viewvc?rev=1390674&view=rev
Log:
Deal with APR-Util before 1.3.8 which does not have the --dbm-libs on apu-config.

* build/ac-macros/berkeley-db.m4
  (SVN_LIB_BERKELEY_DB_TRY): Fall back to not passing --dbm-libs if apu-config
    returns an error to our attempt to use it.

Modified:
    subversion/trunk/build/ac-macros/berkeley-db.m4

Modified: subversion/trunk/build/ac-macros/berkeley-db.m4
URL: http://svn.apache.org/viewvc/subversion/trunk/build/ac-macros/berkeley-db.m4?rev=1390674&r1=1390673&r2=1390674&view=diff
==============================================================================
--- subversion/trunk/build/ac-macros/berkeley-db.m4 (original)
+++ subversion/trunk/build/ac-macros/berkeley-db.m4 Wed Sep 26 19:04:36 2012
@@ -175,17 +175,23 @@ AC_DEFUN(SVN_LIB_BERKELEY_DB_TRY,
     svn_check_berkeley_db_minor=$2
     svn_check_berkeley_db_patch=$3
 
-    # Extract only the -ldb.* flag from the libs supplied by apu-config
-    # Otherwise we get bit by the fact that expat might not be built yet
-    # Or that it resides in a non-standard location which we would have
-    # to compensate with using something like -R`$apu_config --prefix`/lib.
-    #
-    # We pass --dbm-libs here since Debian has modified apu-config not
-    # to return -ldb unless --dbm-libs is passed.  This may also produce
-    # extra output beyond -ldb but since we're only filtering for -ldb
-    # it won't matter to us.
-    if test -z "$SVN_DB_LIBS"; then
-      SVN_DB_LIBS=["`$apu_config --libs --dbm-libs | $SED -e 's/.*\(-ldb[^[:space:]]*\).*/\1/' | $EGREP -- '-ldb[^[:space:]]*'`"]
+   if test -z "$SVN_DB_LIBS"; then
+      # We pass --dbm-libs here since Debian has modified apu-config not
+      # to return -ldb unless --dbm-libs is passed.  This may also produce
+      # extra output beyond -ldb but since we're only filtering for -ldb
+      # it won't matter to us.  However, --dbm-libs was added to apu-config
+      # in 1.3.8 so it's possible the version we have doesn't support it
+      # so fallback without it if we get an error.
+       svn_db_libs_prefiltered=["`$apu_config --libs --dbm-libs`"]
+      if test $? -ne 0; then
+        svn_db_libs_prefiltered=["`$apu_config --libs`"]
+      fi
+      # Extract only the -ldb.* flag from the libs supplied by apu-config
+      # Otherwise we get bit by the fact that expat might not be built yet
+      # Or that it resides in a non-standard location which we would have
+      # to compensate with using something like -R`$apu_config --prefix`/lib.
+      #
+      SVN_DB_LIBS=["`echo \"$svn_db_libs_prefiltered\" | $SED -e 's/.*\(-ldb[^[:space:]]*\).*/\1/' | $EGREP -- '-ldb[^[:space:]]*'`"]
     fi
 
     CPPFLAGS="$SVN_DB_INCLUDES $SVN_APRUTIL_INCLUDES $CPPFLAGS" 



Re: svn commit: r1390674 - /subversion/trunk/build/ac-macros/berkeley-db.m4

Posted by Greg Stein <gs...@gmail.com>.
On Wed, Sep 26, 2012 at 6:55 PM, Ben Reser <be...@reser.org> wrote:
> On Wed, Sep 26, 2012 at 3:29 PM, Peter Samuelson <pe...@p12n.org> wrote:
>> Interestingly, the case you tried to fix - libraries with
>> Debian-derived packaging - is also a case where it _is_ safe to link to
>> multiple versions of db in the same app.  But you're right, on many
>> other platforms, it is not safe.
>
> Honestly, the whole issue here really is that APR-Util probably
> shouldn't have DB functions in it.

Don't get me started.

</aborted-rant>

Re: svn commit: r1390674 - /subversion/trunk/build/ac-macros/berkeley-db.m4

Posted by Ben Reser <be...@reser.org>.
On Wed, Sep 26, 2012 at 3:29 PM, Peter Samuelson <pe...@p12n.org> wrote:
> Interestingly, the case you tried to fix - libraries with
> Debian-derived packaging - is also a case where it _is_ safe to link to
> multiple versions of db in the same app.  But you're right, on many
> other platforms, it is not safe.

Honestly, the whole issue here really is that APR-Util probably
shouldn't have DB functions in it.  All they are doing is wrapping
another library.  I find doing that to be rather dubious.  I don't
think most of the people using APR-Util are even using the DB related
modules.  However, the fact that it's there and software that's
shipping is linking against it leaves us in this position.

Given that BDB isn't even something we recommend people to be using
anymore, I don't think it's worth all the effort to deal with this
beyond what I've done.  Brane already suggested that we switch APR and
SVN to use pkg-config.  Which is probably something we should
consider.

Re: svn commit: r1390674 - /subversion/trunk/build/ac-macros/berkeley-db.m4

Posted by Peter Samuelson <pe...@p12n.org>.
[Ben Reser]
> Just confirming what brane said above is the reason why I did not try
> to just build detection of BDB into our configure system.  Figuring
> out if it's safe to link to some BDB that we find ourselves is
> actually really hard.  If we could ask APR-Util what version of BDB it
> was built against it might be easier, but there's no way to query
> that, it only says if BDB is available or not.

Interestingly, the case you tried to fix - libraries with
Debian-derived packaging - is also a case where it _is_ safe to link to
multiple versions of db in the same app.  But you're right, on many
other platforms, it is not safe.

Re: svn commit: r1390674 - /subversion/trunk/build/ac-macros/berkeley-db.m4

Posted by Ben Reser <be...@reser.org>.
On Wed, Sep 26, 2012 at 2:41 PM, Branko Čibej <br...@wandisco.com> wrote:
> In fact, there is. If mod_dav_svn is linked with a different version of
> bdb and/or sqlite than the rest of httpd, it will break at best, or
> corrupt your repo in the worst case.

Just confirming what brane said above is the reason why I did not try
to just build detection of BDB into our configure system.  Figuring
out if it's safe to link to some BDB that we find ourselves is
actually really hard.  If we could ask APR-Util what version of BDB it
was built against it might be easier, but there's no way to query
that, it only says if BDB is available or not.

Re: svn commit: r1390674 - /subversion/trunk/build/ac-macros/berkeley-db.m4

Posted by Branko Čibej <br...@wandisco.com>.
On 26.09.2012 23:35, Peter Samuelson wrote:
> [breser@apache.org]
>> +      # We pass --dbm-libs here since Debian has modified apu-config not
>> +      # to return -ldb unless --dbm-libs is passed.
> Better would be not to rely on apr-util to figure out where db is at
> all.  We're not using the apu wrapper for db, after all, we're calling
> the db library directly, so really there's no reason for apr-util to be
> involved at all.

In fact, there is. If mod_dav_svn is linked with a different version of
bdb and/or sqlite than the rest of httpd, it will break at best, or
corrupt your repo in the worst case.

-- Brane


-- 
Certified & Supported Apache Subversion Downloads:
http://www.wandisco.com/subversion/download


Re: svn commit: r1390674 - /subversion/trunk/build/ac-macros/berkeley-db.m4

Posted by Peter Samuelson <pe...@p12n.org>.
[breser@apache.org]
> +      # We pass --dbm-libs here since Debian has modified apu-config not
> +      # to return -ldb unless --dbm-libs is passed.

Better would be not to rely on apr-util to figure out where db is at
all.  We're not using the apu wrapper for db, after all, we're calling
the db library directly, so really there's no reason for apr-util to be
involved at all.

If you're trying to fix detection on Debian specifically, note that it
is really as simple as "--with-berkeley-db=:::db", so that case should
be fairly easy to autodetect.  Easier, I daresay, than figuring out
whether it's safe and reasonable to pass --dbm-libs to apu_config.

Peter