[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

'--with-berkeley-db' option [Re: svn commit: r35017 - build/ac-macros]

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Mon, 05 Jan 2009 20:33:16 +0000

> Author: arfrever
> Date: Fri Jan 2 18:53:25 2009
> New Revision: 35017
>
> Log:
> Don't ignore optional argument of the '--with-berkeley-db' option.
>
> * build/ac-macros/berkeley-db.m4
> (SVN_LIB_BERKELEY_DB, SVN_LIB_BERKELEY_DB_TRY): Don't ignore optional
> argument of the '--with-berkeley-db' option.

This change (with r35021, just a tweak to it) breaks detection of BDB on
my system:

[[[
$ configure --prefix=/home/julianfoad/usr/local \
  --enable-maintainer-mode --disable-mod-activation --with-ssl \
  --without-serf --without-javahl --with-sqlite=/home/julianfoad
/home/julianfoad/src/subversion-red/configure: line 21757: -o: command
not found
[...]
You don't seem to have Berkeley DB version 4.0.14 or newer
]]]

It was correctly detecting my BDB 4.3 libraries before this change.

See below...

(Here I am showing the diff of r35017 and r35021 combined together.)

> Index: build/ac-macros/berkeley-db.m4
> ===================================================================
> --- build/ac-macros/berkeley-db.m4 (revision 35016)
> +++ build/ac-macros/berkeley-db.m4 (working copy)
> @@ -42,7 +42,7 @@ AC_DEFUN(SVN_LIB_BERKELEY_DB,
> dnl for headers in HEADER and libraries in LIB.
>
> AC_ARG_WITH(berkeley-db, [AS_HELP_STRING(
> - [--with-berkeley-db=PATH], [
> + [[--with-berkeley-db=[INCLUDES:LIB_SEARCH_DIRS:LIBS]]], [
> The Subversion Berkeley DB based filesystem library
> requires Berkeley DB $db_version or newer. If you
> specify `--without-berkeley-db', that library will
> @@ -64,7 +64,7 @@ AC_DEFUN(SVN_LIB_BERKELEY_DB,
> [
> if test "$withval" = "no"; then
> status=skip
> - else
> + elif test "$withval" = "yes"; then
> apu_db_version="`$apu_config --db-version`"
> if test $? -ne 0; then
> AC_MSG_ERROR([Can't determine whether apr-util is linked against a
> @@ -86,11 +86,27 @@ AC_DEFUN(SVN_LIB_BERKELEY_DB,
> possible to use the specified Berkeley DB: $withval])
> fi
>
> - AC_MSG_WARN([APR-UTIL may or may not be using the specified
> - Berkeley DB at `$withval'. Using the Berkeley DB
> - supplied by APR-UTIL.])
> + status=required
> + fi
> + else
> + if test -n "`echo "$withval" | $GREP -o ":.*:"`"; then

It seems that $GREP is undefined so the command "-o" is attempted.
Changing "$GREP" to "grep" works for me.

Is "grep -o" portable enough? This option causes grep to only output the
matching text, not the whole line. It is only used here (and a few lines
further down - see below) and in the recent KWallet support in
configure.ac, not anywhere else in our build system.

It looks to me like the "-o" is redundant here anyway. The test is just
testing whether "$withval" has two colons in it. I can write that more
simply as:

  if echo "$withval" | grep ":.*:" > /dev/null; then

> + SVN_DB_INCLUDES=""
> + for i in [`echo "$withval" | sed -e "s/\([^:]*\):.*/\1/"`]; do
> + SVN_DB_INCLUDES="$SVN_DB_INCLUDES -I$i"
> + done
> + SVN_DB_INCLUDES="${SVN_DB_INCLUDES## }"
> + for l in [`echo "$withval" | sed -e "s/.*:\([^:]*\):.*/\1/"`]; do
> + LDFLAGS="$LDFLAGS -L$l"
> + done
> + SVN_DB_LIBS=""
> + for l in [`echo "$withval" | sed -e "s/.*:\([^:]*\)/\1/"`]; do
> + SVN_DB_LIBS="$SVN_DB_LIBS -l$l"
> + done
> + SVN_DB_LIBS="${SVN_DB_LIBS## }"
>
> status=required
> + else
> + AC_MSG_ERROR([Invalid syntax of argument of --with-berkeley-db option])
> fi
> fi
> ],
> @@ -125,7 +141,7 @@ AC_DEFUN(SVN_LIB_BERKELEY_DB,
> AC_MSG_RESULT([no])
> svn_lib_berkeley_db=no
> if test "$status" = "required"; then
> - AC_MSG_ERROR([Berkeley DB $db_version wasn't found.])
> + AC_MSG_ERROR([Berkeley DB $db_version or newer wasn't found.])
> fi
> fi
> fi
> @@ -171,10 +187,10 @@ AC_DEFUN(SVN_LIB_BERKELEY_DB_TRY,
> # 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_apu_bdb_lib=["`$apu_config --libs | sed -e 's/.*\(-ldb[^ ]*\).*/\1/'`"]
> + SVN_DB_LIBS=["${SVN_DB_LIBS-`$apu_config --libs | $GREP -o -- '-ldb[^[:space:]]*'`}"]

Is the change from the "sed" command to the "$GREP -o" command
necessary? It looks to me like it is just another way of writing the
same thing. If so, I think we should change it back to the "sed" form.

> - CPPFLAGS="$SVN_APRUTIL_INCLUDES $CPPFLAGS"
> - LIBS="`$apu_config --ldflags` $svn_apu_bdb_lib $LIBS"
> + CPPFLAGS="$SVN_APRUTIL_INCLUDES $SVN_DB_INCLUDES $CPPFLAGS"
> + LIBS="`$apu_config --ldflags` $SVN_DB_LIBS $LIBS"
>
> AC_RUN_IFELSE([AC_LANG_SOURCE([[
> #include <stdlib.h>

Can someone familiar with AutoConf/M4 cast an eye over this and let me
know if it looks reasonable? Thanks.

- Julian

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1005996
Received on 2009-01-05 21:33:51 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.