INN commit: trunk (18 files)

INN Commit rra at isc.org
Fri Dec 27 21:16:10 UTC 2013


    Date: Friday, December 27, 2013 @ 13:16:09
  Author: iulius
Revision: 9593

update m4 files for Berkeley DB and zlib support

bdb.m4 and zlib.m4 are now part of rra-c-util.

The "--with-berkeleydb" configure flag used to add Berkeley DB support
is now "--with-bdb".

When building INN with Berkeley DB or zlib support, no longer add
standard locations to compiler and linker include flags.  Such default
paths are now added only if explicitly given to one or more of the
"--with-bdb", "--with-bdb-include", "--with-bdb-lib", "--with-zlib",
"--with-zlib-include", or "--with-zlib-lib" configure flags.  The flags
ending with "-include" and "-lib" are new.

If the Berkeley DB library is found at configure time, INN will now be
built with support for it unless the B"--without-bdb" flag is explicitly
passed to configure.
Note that it was already the default behaviour for zlib support when
Berkeley DB support was also enabled.

Use BDB_CPPFLAGS, BDB_LDFLAGS and BDB_LIBS instead of DB_CPPFLAGS,
DB_LDFLAGS and DB_LIBS.
Also use HAVE_BDB instead of USE_BERKELEY_DB.

Added:
  trunk/m4/bdb.m4
    (from rev 9577, trunk/m4/berkeleydb.m4)
Modified:
  trunk/MANIFEST
  trunk/Makefile.global.in
  trunk/configure.ac
  trunk/doc/pod/install.pod
  trunk/doc/pod/news.pod
  trunk/doc/pod/ovdb.pod
  trunk/frontends/Makefile
  trunk/frontends/ovdb_init.c
  trunk/frontends/ovdb_monitor.c
  trunk/frontends/ovdb_server.c
  trunk/frontends/ovdb_stat.c
  trunk/m4/zlib.m4
  trunk/storage/Makefile
  trunk/storage/ovdb/ovdb-private.h
  trunk/storage/ovdb/ovdb.c
  trunk/tests/Makefile
Deleted:
  trunk/m4/berkeleydb.m4

-----------------------------+
 MANIFEST                    |    2 
 Makefile.global.in          |   10 +-
 configure.ac                |   34 ++++-----
 doc/pod/install.pod         |   26 ++++---
 doc/pod/news.pod            |   36 ++++++----
 doc/pod/ovdb.pod            |    8 +-
 frontends/Makefile          |    8 +-
 frontends/ovdb_init.c       |    6 -
 frontends/ovdb_monitor.c    |    6 -
 frontends/ovdb_server.c     |    6 -
 frontends/ovdb_stat.c       |    6 -
 m4/bdb.m4                   |  109 +++++++++++++++++++++++++++++++
 m4/berkeleydb.m4            |  145 ------------------------------------------
 m4/zlib.m4                  |  120 +++++++++++++++++++---------------
 storage/Makefile            |    2 
 storage/ovdb/ovdb-private.h |    4 -
 storage/ovdb/ovdb.c         |    6 -
 tests/Makefile              |    4 -
 18 files changed, 268 insertions(+), 270 deletions(-)

Modified: MANIFEST
===================================================================
--- MANIFEST	2013-12-19 17:49:31 UTC (rev 9592)
+++ MANIFEST	2013-12-27 21:16:09 UTC (rev 9593)
@@ -553,7 +553,7 @@
 lib/xwrite.c                          write that handles partial transfers
 m4                                    Autoconf support macros (Directory)
 m4/aux-libs.m4                        Autoconf macro for extra libraries
-m4/berkeleydb.m4                      Autoconf macros for Berkeley DB
+m4/bdb.m4                             Autoconf macros for Berkeley DB
 m4/cc-c-o.m4                          Autoconf macro for -c -o compiler support
 m4/cc-flags.m4                        Autoconf macro for compiler flags
 m4/compress.m4                        Autoconf macro for compress detection

Modified: Makefile.global.in
===================================================================
--- Makefile.global.in	2013-12-19 17:49:31 UTC (rev 9592)
+++ Makefile.global.in	2013-12-27 21:16:09 UTC (rev 9593)
@@ -133,11 +133,11 @@
 LIBLD		= $(LIBTOOLLD) $(CC)
 
 ##  Berkeley DB support.  If this support is configured, anything linking
-##  against libstorage also needs to link against DB_LDFLAGS and DB_LIBS.
+##  against libstorage also needs to link against BDB_LDFLAGS and BDB_LIBS.
 
-DB_CPPFLAGS	= @DB_CPPFLAGS@ @ZLIB_CPPFLAGS@
-DB_LDFLAGS	= @DB_LDFLAGS@ @ZLIB_LDFLAGS@
-DB_LIBS		= @DB_LIBS@ @ZLIB_LIBS@
+BDB_CPPFLAGS	= @BDB_CPPFLAGS@ @ZLIB_CPPFLAGS@
+BDB_LDFLAGS	= @BDB_LDFLAGS@ @ZLIB_LDFLAGS@
+BDB_LIBS	= @BDB_LIBS@ @ZLIB_LIBS@
 
 ##  INN libraries.  Nearly all INN programs are linked with libinn, and any
 ##  INN program that reads from or writes to article storage or overview is
@@ -147,7 +147,7 @@
 LIBINN		= $(abs_builddir)/lib/libinn$(LIBSUFFIX).$(EXTLIB)
 LIBHIST		= $(abs_builddir)/history/libinnhist$(LIBSUFFIX).$(EXTLIB)
 LIBSTORAGE	= $(abs_builddir)/storage/libstorage$(LIBSUFFIX).$(EXTLIB)
-STORAGE_LIBS	= $(DB_LDFLAGS) $(DB_LIBS)
+STORAGE_LIBS	= $(BDB_LDFLAGS) $(BDB_LIBS)
 
 DBM_CPPFLAGS	= @DBM_CPPFLAGS@
 DBM_LIBS	= @DBM_LIBS@

Modified: configure.ac
===================================================================
--- configure.ac	2013-12-19 17:49:31 UTC (rev 9592)
+++ configure.ac	2013-12-27 21:16:09 UTC (rev 9593)
@@ -34,7 +34,7 @@
 
 dnl Lots of our macros are stored in separate files for ease of maintenance.
 m4_include([m4/aux-libs.m4])
-m4_include([m4/berkeleydb.m4])
+m4_include([m4/bdb.m4])
 m4_include([m4/cc-c-o.m4])
 m4_include([m4/cc-flags.m4])
 m4_include([m4/compress.m4])
@@ -332,9 +332,8 @@
 fi
 
 dnl Handle optional libraries and probing for their locations and component
-dnl libraries if needed.
-INN_LIB_BERKELEYDB
-INN_LIB_ZLIB
+dnl libraries if needed.  Support for zlib is handled later.
+INN_LIB_BDB_OPTIONAL
 INN_LIB_KRB5_OPTIONAL
 INN_LIB_OPENSSL_OPTIONAL
 INN_LIB_SASL_OPTIONAL
@@ -354,19 +353,20 @@
 AC_SUBST([KRB5_AUTH])
 
 dnl The dbm libraries are a special case.  If we're building with Berkeley DB,
-dnl just use the ndbm support provided by it.
-if test x"$DB_LIBS" != x ; then
-    INN_LIB_BERKELEYDB_NDBM
-fi
-if test x"$inn_cv_lib_berkeleydb_ndbm_works" != xyes ; then
-    INN_SEARCH_AUX_LIBS([dbm_open], [ndbm dbm gdbm "gdbm_compat -lgdbm"], [DBM_LIBS],
-        [AC_DEFINE([HAVE_DBM], [1], [Define if you have a dbm library.])])
-    DBM_CPPFLAGS=
-else
-    DBM_CPPFLAGS="$DB_CPPFLAGS"
-    DBM_LIBS="$DB_LDFLAGS $DB_LIBS"
-    AC_SUBST([DBM_LIBS])
-fi
+dnl just use the ndbm support provided by it.  Also, do not build with zlib
+dnl support unless Berkeley DB is enabled.
+AS_IF([test x"$inn_use_BDB" = xtrue],
+    [INN_LIB_BDB_NDBM
+     INN_LIB_ZLIB_OPTIONAL])
+AS_IF([test x"$inn_cv_lib_bdb_ndbm" != xyes],
+    [INN_SEARCH_AUX_LIBS([dbm_open], [ndbm dbm gdbm "gdbm_compat -lgdbm"],
+         [DBM_LIBS],
+         [AC_DEFINE([HAVE_DBM], [1],
+              [Define if you have a dbm library.])])
+     DBM_CPPFLAGS=],
+    [DBM_CPPFLAGS="$BDB_CPPFLAGS"
+     DBM_LIBS="$BDB_LDFLAGS $BDB_LIBS"
+     AC_SUBST([DBM_LIBS])])
 AC_SUBST([DBM_CPPFLAGS])
 
 dnl If configuring with large file support, determine the right flags to

Modified: doc/pod/install.pod
===================================================================
--- doc/pod/install.pod	2013-12-19 17:49:31 UTC (rev 9592)
+++ doc/pod/install.pod	2013-12-27 21:16:09 UTC (rev 9593)
@@ -147,7 +147,7 @@
 
     --with-perl         Perl 5.004_03 or higher, 5.8.0+ recommended
     --with-python       Python 1.5.2 or higher, 2.5.0+ recommended
-    --with-berkeleydb   Berkeley DB 4.4 or higher, 4.7+ recommended
+    --with-bdb          Berkeley DB 4.4 or higher, 4.7+ recommended
     --with-zlib         zlib 1.x or higher
     --with-openssl      OpenSSL 0.9.6 or higher
     --with-sasl         SASL 2.x or higher
@@ -391,7 +391,7 @@
 doesn't need to use the local socket (which is what setgid enables it to
 do).  Installing B<inews> setgid was the default prior to S<INN 2.3>.
 
-=item B<--with-berkeleydb>=PATH
+=item B<--with-bdb>=PATH
 
 Enables support for S<Berkeley DB> (4.4 or higher), which means that
 it will then be possible to use the ovdb overview method if you wish.
@@ -404,17 +404,25 @@
 is expected to have subdirectories F<include> and F<lib> (F<lib32>
 and F<lib64> are also checked), containing respectively F<db.h>, and
 the library itself.  In case non-standard paths to the S<Berkeley DB>
-libraries are used, one or both of the options B<--with-berkeleydb-include>
-and B<--with-berkeleydb-lib> can be given to configure with a path.
+libraries are used, one or both of the options B<--with-bdb-include>
+and B<--with-bdb-lib> can be given to configure with a path.
 
+If the S<Berkeley DB> library is found at configure time, INN will be
+built with S<Berkeley DB> support unless the B<--without-bdb> flag is
+explicitly passed to configure.
+
 =item B<--with-zlib>=PATH
 
-The ovdb storage method can optionally use compression.  If B<--with-berkeleydb>
-is set, and configure finds a suitable S<Berkeley DB> version, this option
-defaults to C<yes>, otherwise the default is C<no>.  If you have B<zlib> but it is
-not installed under F</usr> or F</usr/local>, you must specify the directory
-where it is installed.
+The ovdb storage method can optionally use compression.  If B<--with-bdb>
+is set, and configure finds a suitable S<Berkeley DB> version, configure
+will by default also try to find the zlib library.  INN will then be
+built with zlib support unless the B<--without-zlib> flag is explicitly
+passed to configure.
 
+In case non-standard paths to the zlib library are used, one or both
+of the options B<--with-zlib-include> and B<--with-zlib-lib> can be
+given to configure with a path.
+
 =item B<--with-openssl>=PATH
 
 Enables support for TLS/SSL for news reading, which means it will be possible

Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod	2013-12-19 17:49:31 UTC (rev 9592)
+++ doc/pod/news.pod	2013-12-27 21:16:09 UTC (rev 9593)
@@ -23,6 +23,11 @@
 
 =item *
 
+The B<--with-berkeleydb> configure flag used to add S<Berkeley DB>
+support has been renamed to B<--with-bdb>.
+
+=item *
+
 $HOME is no longer exported as an environment variable by B<innshellvars>,
 B<innshellvars.tcl> and the Perl module C<INN::Config>.  It was previously
 overriding the default user home directory with I<pathnews>.  If you use
@@ -127,23 +132,28 @@
 
 =item *
 
-When building INN with S<Berkeley DB>, Cyrus SASL, S<Kerberos v5>, or
-OpenSSL support, no longer add standard locations to compiler and linker
-include flags.  Such default paths are now added only if explicitly given
-to one or more of the B<--with-berkeleydb>, B<--with-berkeleydb-include>,
-B<--with-berkeleydb-lib>, B<--with-sasl>, B<--with-sasl-include>,
-B<--with-sasl-lib>, B<--with-krb5>, B<--with-krb5-include>,
-B<--with-krb5-lib>, B<--with-openssl>, B<--with-openssl-include>, or
-B<--with-openssl-lib> configure flags (the flags ending with C<-include>
-and C<-lib> are new in S<INN 2.6.0>).
+When building INN with S<Berkeley DB>, Cyrus SASL, S<Kerberos
+v5>, OpenSSL, or zlib support, no longer add standard locations to
+compiler and linker include flags.  Such default paths are now added
+only if explicitly given to one or more of the B<--with-bdb>,
+B<--with-bdb-include>, B<--with-bdb-lib>, B<--with-sasl>,
+B<--with-sasl-include>, B<--with-sasl-lib>, B<--with-krb5>,
+B<--with-krb5-include>, B<--with-krb5-lib>, B<--with-openssl>,
+B<--with-openssl-include>, B<--with-openssl-lib>, B<--with-zlib>,
+B<--with-zlib-include>, or B<--with-zlib-lib> configure flags (the
+flags ending with C<-include> and C<-lib> are new in S<INN 2.6.0>).
 
 =item *
 
-If the Cyrus SASL, S<Kerberos v5>, or OpenSSL SSL and crypto libraries
-are found at configure time, INN will now be built with support for
-them unless respectively the B<--without-sasl>, B<--without-krb5>,
-or B<--without-openssl> flags are explicitly passed to configure.
+If the S<Berkeley DB>, Cyrus SASL, S<Kerberos v5>, or OpenSSL SSL
+and crypto libraries are found at configure time, INN will now be
+built with support for them unless respectively the B<--without-bdb>,
+B<--without-sasl>, B<--without-krb5>, or B<--without-openssl> flags
+are explicitly passed to configure.
 
+Note that it was already the default behaviour for zlib support when
+S<Berkeley DB> support was also enabled.
+
 =item *
 
 The configure flag B<--enable-reduced-depends> has been added to request

Modified: doc/pod/ovdb.pod
===================================================================
--- doc/pod/ovdb.pod	2013-12-19 17:49:31 UTC (rev 9592)
+++ doc/pod/ovdb.pod	2013-12-27 21:16:09 UTC (rev 9593)
@@ -23,18 +23,18 @@
 
 =head1 INSTALLATION
 
-To build ovdb support into INN, specify the option B<--with-berkeleydb>
+To build ovdb support into INN, specify the option B<--with-bdb>
 when running the configure script.  By default, configure will search
 for S<Berkeley DB> in default search paths; there will be a message in
 the configure output indicating the pathname that will be used.
 
 You can override this pathname by adding a path to the option, for
-instance B<--with-berkeleydb=/usr/BerkeleyDB.4.4>.  This directory
+instance B<--with-bdb=/usr/BerkeleyDB.4.4>.  This directory
 is expected to have subdirectories F<include> and F<lib> (F<lib32>
 and F<lib64> are also checked), containing respectively F<db.h>, and
 the library itself.  In case non-standard paths to the S<Berkeley DB>
-libraries are used, one or both of the options B<--with-berkeleydb-include>
-and B<--with-berkeleydb-lib> can be given to configure with a path.
+libraries are used, one or both of the options B<--with-bdb-include>
+and B<--with-bdb-lib> can be given to configure with a path.
 
 The ovdb database may take up more disk space for a given spool than the
 other overview methods.  Plan on needing at least S<1.1 KB> for every article

Modified: frontends/Makefile
===================================================================
--- frontends/Makefile	2013-12-19 17:49:31 UTC (rev 9592)
+++ frontends/Makefile	2013-12-27 21:16:09 UTC (rev 9593)
@@ -83,16 +83,16 @@
 sm:		sm.o           $(BOTH)   ; $(LINK) sm.o           $(STORELIBS)
 
 ovdb_init.o: ovdb_init.c
-	$(CC) $(CFLAGS) $(DB_CPPFLAGS) -c $<
+	$(CC) $(CFLAGS) $(BDB_CPPFLAGS) -c $<
 
 ovdb_monitor.o: ovdb_monitor.c
-	$(CC) $(CFLAGS) $(DB_CPPFLAGS) -c $<
+	$(CC) $(CFLAGS) $(BDB_CPPFLAGS) -c $<
 
 ovdb_server.o: ovdb_server.c
-	$(CC) $(CFLAGS) $(DB_CPPFLAGS) -c $<
+	$(CC) $(CFLAGS) $(BDB_CPPFLAGS) -c $<
 
 ovdb_stat.o: ovdb_stat.c
-	$(CC) $(CFLAGS) $(DB_CPPFLAGS) -c $<
+	$(CC) $(CFLAGS) $(BDB_CPPFLAGS) -c $<
 
 cnfsheadconf:	cnfsheadconf.in  $(FIX)	; $(FIX) cnfsheadconf.in
 cnfsstat:	cnfsstat.in      $(FIX)	; $(FIX) cnfsstat.in

Modified: frontends/ovdb_init.c
===================================================================
--- frontends/ovdb_init.c	2013-12-19 17:49:31 UTC (rev 9592)
+++ frontends/ovdb_init.c	2013-12-27 21:16:09 UTC (rev 9593)
@@ -17,14 +17,14 @@
 #include "../storage/ovdb/ovdb.h"
 #include "../storage/ovdb/ovdb-private.h"
 
-#ifndef USE_BERKELEY_DB
+#ifndef HAVE_BDB
 
 int main(int argc UNUSED, char **argv UNUSED)
 {
     die("Berkeley DB support not compiled");
 }
 
-#else /* USE_BERKELEY_DB */
+#else /* HAVE_BDB */
 
 static int open_db(DB **db, const char *name, int type)
 {
@@ -440,5 +440,5 @@
 
     exit(0);
 }
-#endif /* USE_BERKELEY_DB */
+#endif /* HAVE_BDB */
 

Modified: frontends/ovdb_monitor.c
===================================================================
--- frontends/ovdb_monitor.c	2013-12-19 17:49:31 UTC (rev 9592)
+++ frontends/ovdb_monitor.c	2013-12-27 21:16:09 UTC (rev 9593)
@@ -22,14 +22,14 @@
 #include "../storage/ovdb/ovdb.h"
 #include "../storage/ovdb/ovdb-private.h"
 
-#ifndef USE_BERKELEY_DB
+#ifndef HAVE_BDB
 
 int main(int argc UNUSED, char **argv UNUSED)
 {
     exit(0);
 }
 
-#else /* USE_BERKELEY_DB */
+#else /* HAVE_BDB */
 
 static int signalled = 0;
 static void sigfunc(int sig UNUSED)
@@ -275,5 +275,5 @@
     return 1;
 }
 
-#endif /* USE_BERKELEY_DB */
+#endif /* HAVE_BDB */
 

Modified: frontends/ovdb_server.c
===================================================================
--- frontends/ovdb_server.c	2013-12-19 17:49:31 UTC (rev 9592)
+++ frontends/ovdb_server.c	2013-12-27 21:16:09 UTC (rev 9593)
@@ -32,7 +32,7 @@
 #include "../storage/ovdb/ovdb.h"
 #include "../storage/ovdb/ovdb-private.h"
 
-#ifndef USE_BERKELEY_DB
+#ifndef HAVE_BDB
 
 int
 main(int argc UNUSED, char **argv UNUSED)
@@ -40,7 +40,7 @@
     die("Berkeley DB support not compiled");
 }
 
-#else /* USE_BERKELEY_DB */
+#else /* HAVE_BDB */
 
 
 #define SELECT_TIMEOUT 15
@@ -742,4 +742,4 @@
 }
 
 
-#endif /* USE_BERKELEY_DB */
+#endif /* HAVE_BDB */

Modified: frontends/ovdb_stat.c
===================================================================
--- frontends/ovdb_stat.c	2013-12-19 17:49:31 UTC (rev 9592)
+++ frontends/ovdb_stat.c	2013-12-27 21:16:09 UTC (rev 9593)
@@ -21,14 +21,14 @@
 #include "../storage/ovdb/ovdb-private.h"
 
 
-#ifndef USE_BERKELEY_DB
+#ifndef HAVE_BDB
 
 int main(int argc UNUSED, char **argv UNUSED)
 {
     die("Berkeley DB support not compiled");
 }
 
-#else /* USE_BERKELEY_DB */
+#else /* HAVE_BDB */
 
 static int signalled = 0;
 static void sigfunc(int signum UNUSED)
@@ -897,5 +897,5 @@
     return 0;
 }
 
-#endif /* USE_BERKELEY_DB */
+#endif /* HAVE_BDB */
 

Copied: trunk/m4/bdb.m4 (from rev 9577, trunk/m4/berkeleydb.m4)
===================================================================
--- m4/bdb.m4	                        (rev 0)
+++ m4/bdb.m4	2013-12-27 21:16:09 UTC (rev 9593)
@@ -0,0 +1,109 @@
+dnl Find the compiler and linker flags for the Berkeley DB library.
+dnl $Id$
+dnl
+dnl Finds the compiler and linker flags for linking with the Berkeley DB
+dnl library.  Provides the --with-bdb, --with-bdb-lib, and --with-bdb-include
+dnl configure options to specify non-standard paths to the Berkeley DB
+dnl library.
+dnl
+dnl Provides the macro INN_LIB_BDB and sets the substitution variables
+dnl BDB_CPPFLAGS, BDB_LDFLAGS, and BDB_LIBS.  Also provides INN_LIB_BDB_SWITCH
+dnl to set CPPFLAGS, LDFLAGS, and LIBS to include the Berkeley DB library,
+dnl saving the current values first, and INN_LIB_BDB_RESTORE to restore those
+dnl settings to before the last INN_LIB_BDB_SWITCH.  Defines HAVE_BDB and sets
+dnl inn_use_BDB to true if the library is found.
+dnl
+dnl Provides the INN_LIB_BDB_OPTIONAL macro, which should be used if Berkeley
+dnl DB support is optional.  This macro will still always set the substitution
+dnl variables, but they'll be empty unless --with-bdb is given.  Defines
+dnl HAVE_BDB and sets inn_use_BDB to true if the Berkeley DB library is found.
+dnl
+dnl This file also provides INN_LIB_BDB_NDBM, which checks whether the
+dnl Berkeley DB library has ndbm support.  It then defines HAVE_BDB_NDBM and
+dnl sets inn_cv_lib_bdb_ndbm to yes if ndbm compatibility layer for Berkely DB
+dnl is available.  Either INN_LIB_BDB or INN_LIB_BDB_OPTIONAL must be called
+dnl before calling this macro.
+dnl
+dnl Depends on the lib-helper.m4 framework.
+dnl
+dnl The canonical version of this file is maintained in the rra-c-util
+dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+dnl
+dnl Written by Russ Allbery <eagle at eyrie.org>
+dnl Copyright 2013
+dnl     The Board of Trustees of the Leland Stanford Junior University
+dnl
+dnl This file is free software; the authors give unlimited permission to copy
+dnl and/or distribute it, with or without modifications, as long as this
+dnl notice is preserved.
+
+dnl Save the current CPPFLAGS, LDFLAGS, and LIBS settings and switch to
+dnl versions that include the Berkeley DB flags.  Used as a wrapper, with
+dnl INN_LIB_BDB_RESTORE, around tests.
+AC_DEFUN([INN_LIB_BDB_SWITCH], [INN_LIB_HELPER_SWITCH([BDB])])
+
+dnl Restore CPPFLAGS, LDFLAGS, and LIBS to their previous values (before
+dnl INN_LIB_BDB_SWITCH was called).
+AC_DEFUN([INN_LIB_BDB_RESTORE], [INN_LIB_HELPER_RESTORE([BDB])])
+
+dnl Checks if the Berkeley DB library is present.  The single argument,
+dnl if "true", says to fail if the Berkeley DB library could not be found.
+AC_DEFUN([_INN_LIB_BDB_INTERNAL],
+[INN_LIB_HELPER_PATHS([BDB])
+ INN_LIB_BDB_SWITCH
+ AC_CHECK_LIB([db], [db_create],
+    [BDB_LIBS="-ldb"],
+    [AS_IF([test x"$1" = xtrue],
+        [AC_MSG_ERROR([cannot find usable Berkeley DB library])])])
+ INN_LIB_BDB_RESTORE])
+
+dnl The main macro for packages with mandatory Berkeley DB support.
+AC_DEFUN([INN_LIB_BDB],
+[INN_LIB_HELPER_VAR_INIT([BDB])
+ INN_LIB_HELPER_WITH([bdb], [Berkeley DB], [BDB])
+ _INN_LIB_BDB_INTERNAL([true])
+ inn_use_BDB=true
+ AC_DEFINE([HAVE_BDB], 1, [Define if libdb is available.])])
+
+dnl The main macro for packages with optional Berkeley DB support.
+AC_DEFUN([INN_LIB_BDB_OPTIONAL],
+[INN_LIB_HELPER_VAR_INIT([BDB])
+ INN_LIB_HELPER_WITH_OPTIONAL([bdb], [Berkeley DB], [BDB])
+ AS_IF([test x"$inn_use_BDB" != xfalse],
+    [AS_IF([test x"$inn_use_BDB" = xtrue],
+        [_INN_LIB_BDB_INTERNAL([true])],
+        [_INN_LIB_BDB_INTERNAL([false])])])
+ AS_IF([test x"$BDB_LIBS" != x],
+    [inn_use_BDB=true
+     AC_DEFINE([HAVE_BDB], 1, [Define if libdb is available.])])])
+
+dnl Source used by INN_LIB_BDB_NDBM.
+AC_DEFUN([_INN_LIB_BDB_NDBM_SOURCE], [[
+#include <stdio.h>
+#define DB_DBM_HSEARCH 1
+#include <db.h>
+
+int
+main(void)
+{
+    DBM *database;
+    database = dbm_open("test", 0, 0600);
+    dbm_close(database);
+    return 0;
+}
+]])
+
+dnl Check whether Berkeley DB was compiled with ndbm compatibility layer.  If
+dnl so, set HAVE_BDB_NDBM.  Either INN_LIB_BDB or INN_LIB_BDB_OPTIONAL should
+dnl be called before calling this macro.
+AC_DEFUN([INN_LIB_BDB_NDBM],
+[INN_LIB_BDB_SWITCH
+ AC_CACHE_CHECK([for working ndbm compatibility layer with Berkeley DB],
+    [inn_cv_lib_bdb_ndbm],
+    [AC_LINK_IFELSE([AC_LANG_SOURCE([_INN_LIB_BDB_NDBM_SOURCE])],
+        [inn_cv_lib_bdb_ndbm=yes],
+        [inn_cv_lib_bdb_ndbm=no])])
+ AS_IF([test x"$inn_cv_lib_bdb_ndbm" = xyes],
+    [AC_DEFINE([HAVE_BDB_NDBM], 1,
+        [Define if the Berkeley DB ndbm compatibility layer is available.])])
+ INN_LIB_BDB_RESTORE])

Deleted: m4/berkeleydb.m4
===================================================================
--- m4/berkeleydb.m4	2013-12-19 17:49:31 UTC (rev 9592)
+++ m4/berkeleydb.m4	2013-12-27 21:16:09 UTC (rev 9593)
@@ -1,145 +0,0 @@
-dnl berkeleydb.m4 -- Various checks for the Berkeley DB libraries.
-dnl $Id$
-dnl
-dnl Finds the compiler and linker flags for linking with Berkeley DB
-dnl libraries.  Provides the --with-berkeleydb, --with-berkeleydb-lib,
-dnl and --with-berkeleydb-include configure options to specify non-standard
-dnl paths to the Berkeley DB libraries.
-dnl
-dnl Provides the macro INN_LIB_BERKELEYDB and sets the substitution variables
-dnl DB_CPPFLAGS, DB_LDFLAGS, and DB_LIBS.  Also provides
-dnl INN_LIB_BERKELEYDB_SWITCH to set CPPFLAGS, LDFLAGS, and LIBS to include
-dnl the Berkeley DB libraries, saving the current values first, and
-dnl INN_LIB_BERKELEYDB_RESTORE to restore those settings to before the last
-dnl INN_LIB_BERKELEYDB_SWITCH.
-dnl
-dnl If --with-berkeleydb is given, $inn_use_berkeleydb will be set to "true";
-dnl and if Berkeley libraries are properly found, USE_BERKELEY_DB will be
-dnl defined.
-dnl
-dnl Depends on INN_SET_LDFLAGS and INN_ENABLE_REDUCED_DEPENDS.
-dnl
-dnl This file also provides INN_LIB_BERKELEYDB_NDBM, which checks whether
-dnl Berkeley DB has ndbm support.  It then defines HAVE_BDB_NDBM if ndbm
-dnl compatibility layer for Berkely DB is available.
-
-dnl Save the current CPPFLAGS, LDFLAGS, and LIBS settings and switch to
-dnl versions that include the Berkeley DB flags.  Used as a wrapper, with
-dnl INN_LIB_BERKELEYDB_RESTORE, around tests.
-AC_DEFUN([INN_LIB_BERKELEYDB_SWITCH],
-[inn_berkeleydb_save_CPPFLAGS="$CPPFLAGS"
- inn_berkeleydb_save_LDFLAGS="$LDFLAGS"
- inn_berkeleydb_save_LIBS="$LIBS"
- CPPFLAGS="$DB_CPPFLAGS $CPPFLAGS"
- LDFLAGS="$DB_LDFLAGS $LDFLAGS"
- LIBS="$DB_LIBS $LIBS"])
-
-dnl Restore CPPFLAGS, LDFLAGS, and LIBS to their previous values (before
-dnl INN_LIB_BERKELEYDB_SWITCH was called).
-AC_DEFUN([INN_LIB_BERKELEYDB_RESTORE],
-[CPPFLAGS="$inn_berkeleydb_save_CPPFLAGS"
- LDFLAGS="$inn_berkeleydb_save_LDFLAGS"
- LIBS="$inn_berkeleydb_save_LIBS"])
-
-dnl Set DB_CPPFLAGS, and DB_LDFLAGS based on inn_berkeleydb_root,
-dnl inn_berkeleydb_libdir, and inn_berkeleydb_includedir.
-AC_DEFUN([_INN_LIB_BERKELEYDB_PATHS],
-[AS_IF([test x"$inn_berkeleydb_libdir" != x],
-    [DB_LDFLAGS="-L$inn_berkeleydb_libdir"],
-    [AS_IF([test x"$inn_berkeleydb_root" != x],
-        [INN_SET_LDFLAGS([DB_LDFLAGS], [$inn_berkeleydb_root])])])
- AS_IF([test x"$inn_berkeleydb_includedir" != x],
-    [DB_CPPFLAGS="-I$inn_berkeleydb_includedir"
-     inn_berkeleydb_incroot="$inn_berkeleydb_includedir"],
-    [AS_IF([test x"$inn_berkeleydb_root" != x],
-        [AS_IF([test x"$inn_berkeleydb_root" != x/usr],
-            [DB_CPPFLAGS="-I${inn_berkeleydb_root}/include"])
-         inn_berkeleydb_incroot="${inn_berkeleydb_root}/include"])])])
-
-dnl Check for a header using a file existence check rather than using
-dnl AC_CHECK_HEADERS.  This is used if there were arguments to configure
-dnl specifying the Berkeley DB header path, since we may have one header in the
-dnl default include path and another under our explicitly-configured Berkeley DB
-dnl location.
-AC_DEFUN([_INN_LIB_BERKELEYDB_CHECK_HEADER],
-[AC_MSG_CHECKING([for $1])
- AS_IF([test -f "${inn_berkeleydb_incroot}/$1"],
-    [AC_DEFINE([USE_BERKELEY_DB], [1], [Define if Berkeley DB is available.])
-     AC_MSG_RESULT([${inn_berkeleydb_incroot}/$1])],
-    [AC_MSG_ERROR([cannot find Berkeley DB in ${inn_berkeleydb_incroot}])])])
-
-dnl The main macro used to set up paths.
-AC_DEFUN([INN_LIB_BERKELEYDB],
-[AC_REQUIRE([INN_ENABLE_REDUCED_DEPENDS])
- inn_berkeleydb_root=
- inn_berkeleydb_incroot=
- inn_berkeleydb_libdir=
- inn_berkeleydb_includedir=
- inn_use_berkeleydb=
- DB_CPPFLAGS=
- DB_LDFLAGS=
- DB_LIBS=
- AC_SUBST([DB_CPPFLAGS])
- AC_SUBST([DB_LDFLAGS])
- AC_SUBST([DB_LIBS])
-
- AC_ARG_WITH([berkeleydb],
-    [AS_HELP_STRING([--with-berkeleydb@<:@=DIR@:>@],
-        [Location of Berkeley DB headers and libraries (for ovdb overview method)])],
-    [AS_IF([test x"$withval" = xno],
-        [inn_use_berkeleydb=false],
-        [AS_IF([test x"$withval" != xyes], [inn_berkeleydb_root="$withval"])
-         inn_use_berkeleydb=true])],
-    [inn_use_berkeleydb=false])
- AC_ARG_WITH([berkeleydb-include],
-    [AS_HELP_STRING([--with-berkeleydb-include=DIR],
-        [Location of Berkeley DB headers])],
-    [AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
-        [inn_berkeleydb_includedir="$withval"])])
- AC_ARG_WITH([berkeleydb-lib],
-    [AS_HELP_STRING([--with-berkeleydb-lib=DIR],
-        [Location of Berkeley DB libraries])],
-    [AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
-        [inn_berkeleydb_libdir="$withval"])])
-
- AC_MSG_CHECKING([if Berkeley DB is desired])
- AS_IF([test x"$inn_use_berkeleydb" != xfalse],
-    [AC_MSG_RESULT([yes])
-     _INN_LIB_BERKELEYDB_PATHS
-     AS_IF([test x"$inn_berkeleydb_incroot" = x],
-         [AC_CHECK_HEADERS([db.h],
-             [AC_DEFINE([USE_BERKELEY_DB], [1],
-                 [Define if Berkeley DB is available.])],
-             [AC_MSG_ERROR([cannot find Berkeley DB in default path])])],
-         [_INN_LIB_BERKELEYDB_CHECK_HEADER([db.h])])
-     DB_LIBS="-ldb"],
-    [AC_MSG_RESULT([no])])])
-
-dnl Source used by INN_LIB_BERKELEYDB_NDBM.
-AC_DEFUN([_INN_LIB_BERKELEYDB_NDBM_SOURCE], [[
-#include <stdio.h>
-#define DB_DBM_HSEARCH 1
-#include <db.h>
-
-int
-main(void) {
-    DBM *database;
-    database = dbm_open("test", 0, 0600);
-    dbm_close(database);
-    return 0;
-}
-]])
-
-dnl Check whether Berkeley DB was compiled with ndbm compatibily layer.
-dnl If so, set HAVE_BDB_NDBM.
-AC_DEFUN([INN_LIB_BERKELEYDB_NDBM],
-[INN_LIB_BERKELEYDB_SWITCH
-AC_CACHE_CHECK([for working nbdm compatibility layer with Berkeley DB],
-    [inn_cv_lib_berkeleydb_ndbm_works],
-    [AC_LINK_IFELSE([AC_LANG_SOURCE([_INN_LIB_BERKELEYDB_NDBM_SOURCE])],
-        [inn_cv_lib_berkeleydb_ndbm_works=yes],
-        [inn_cv_lib_berkeleydb_ndbm_works=no])])
-AS_IF([test x"$inn_cv_lib_berkeleydb_ndbm_works" = xyes],
-    [AC_DEFINE([HAVE_BDB_NDBM], 1,
-        [Define if the Berkeley DB ndbm compatibility layer is available.])])
-INN_LIB_BERKELEYDB_RESTORE])

Modified: m4/zlib.m4
===================================================================
--- m4/zlib.m4	2013-12-19 17:49:31 UTC (rev 9592)
+++ m4/zlib.m4	2013-12-27 21:16:09 UTC (rev 9593)
@@ -1,56 +1,72 @@
-dnl zlib.m4 -- Find the path to the zlib library.
+dnl Find the compiler and linker flags for the zlib library.
 dnl $Id$
 dnl
-dnl This file provides INN_LIB_ZLIB, which defines the --with-zlib
-dnl command-line option and probes for the location of zlib if that
-dnl option is used without an optional path.  It looks by default in $prefix,
-dnl /usr/local, and /usr.  It exports ZLIB_LDFLAGS, ZLIB_CPPFLAGS, and ZLIB_LIBS.
-dnl The default for --with-zlib is no unless Berkeley DB is enabled, in which
-dnl case the default is yes.
+dnl Finds the compiler and linker flags for linking with the zlib library.
+dnl Provides the --with-zlib, --with-zlib-lib, and --with-zlib-include
+dnl configure options to specify non-standard paths to the zlib library.
+dnl
+dnl Provides the macro INN_LIB_ZLIB and sets the substitution variables
+dnl ZLIB_CPPFLAGS, ZLIB_LDFLAGS, and ZLIB_LIBS.  Also provides
+dnl INN_LIB_ZLIB_SWITCH to set CPPFLAGS, LDFLAGS, and LIBS to include the
+dnl zlib library, saving the current values first, and INN_LIB_ZLIB_RESTORE
+dnl to restore those settings to before the last INN_LIB_ZLIB_SWITCH.
+dnl Defines HAVE_ZLIB and sets inn_use_ZLIB to true if the library is found.
+dnl
+dnl Provides the INN_LIB_ZLIB_OPTIONAL macro, which should be used if zlib
+dnl support is optional.  This macro will still always set the substitution
+dnl variables, but they'll be empty unless --with-zlib is given.
+dnl Defines HAVE_ZLIB and sets inn_use_ZLIB to true if the zlib library
+dnl is found.
+dnl
+dnl Depends on the lib-helper.m4 framework.
+dnl
+dnl The canonical version of this file is maintained in the rra-c-util
+dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+dnl
+dnl Written by Russ Allbery <eagle at eyrie.org>
+dnl Copyright 2013
+dnl     The Board of Trustees of the Leland Stanford Junior University
+dnl
+dnl This file is free software; the authors give unlimited permission to copy
+dnl and/or distribute it, with or without modifications, as long as this
+dnl notice is preserved.
 
+dnl Save the current CPPFLAGS, LDFLAGS, and LIBS settings and switch to
+dnl versions that include the zlib flags.  Used as a wrapper, with
+dnl INN_LIB_ZLIB_RESTORE, around tests.
+AC_DEFUN([INN_LIB_ZLIB_SWITCH], [INN_LIB_HELPER_SWITCH([ZLIB])])
+
+dnl Restore CPPFLAGS, LDFLAGS, and LIBS to their previous values (before
+dnl INN_LIB_ZLIB_SWITCH was called).
+AC_DEFUN([INN_LIB_ZLIB_RESTORE], [INN_LIB_HELPER_RESTORE([ZLIB])])
+
+dnl Checks if the zlib library is present.  The single argument, if "true",
+dnl says to fail if the zlib library could not be found.
+AC_DEFUN([_INN_LIB_ZLIB_INTERNAL],
+[INN_LIB_HELPER_PATHS([ZLIB])
+ INN_LIB_ZLIB_SWITCH
+ AC_CHECK_LIB([z], [compress],
+    [ZLIB_LIBS="-lz"],
+    [AS_IF([test x"$1" = xtrue],
+        [AC_MSG_ERROR([cannot find usable zlib library])])])
+ INN_LIB_ZLIB_RESTORE])
+
+dnl The main macro for packages with mandatory zlib support.
 AC_DEFUN([INN_LIB_ZLIB],
-[ZLIB_CPPFLAGS=
-ZLIB_LDFLAGS=
-ZLIB_LIBS=
-AC_ARG_WITH([zlib],
-    [AS_HELP_STRING([--with-zlib@<:@=PATH@:>@],
-        [Enable zlib (used by ovdb)])],
-    ZLIB_DIR=$with_zlib,
-    [if test x"$DB_LIBS" != x ; then
-	ZLIB_DIR=yes
-     else
-        ZLIB_DIR=no
-     fi])
-AC_MSG_CHECKING([if zlib is desired])
-if test x"$ZLIB_DIR" = xno ; then
-    AC_MSG_RESULT([no])
-else
-    AC_MSG_RESULT([yes])
-    AC_MSG_CHECKING([for zlib location])
-    if test x"$ZLIB_DIR" = xyes ; then
-        for dir in $prefix /usr/local /usr ; do
-            if test -f "$dir/include/zlib.h" ; then
-                ZLIB_DIR=$dir
-                break
-            fi
-        done
-    fi
-    if test x"$ZLIB_DIR" = xyes ; then
-	AC_MSG_RESULT([no])
-    else
-        AC_MSG_RESULT([$ZLIB_DIR])
-        if test x"$ZLIB_DIR" != x/usr ; then
-            ZLIB_CPPFLAGS="-I$ZLIB_DIR/include"
-            ZLIB_LDFLAGS="-L$ZLIB_DIR/lib"
-        fi
-        inn_save_LDFLAGS=$LDFLAGS
-        LDFLAGS="$ZLIB_LDFLAGS $LDFLAGS"
-        AC_CHECK_LIB([z], [compress], [ZLIB_LIBS=-lz],
-            [AC_MSG_ERROR([cannot find libz])])
-        LDFLAGS=$inn_save_LDFLAGS
-        AC_DEFINE([HAVE_ZLIB], 1, [Define if zlib is available.])
-    fi
-fi
-AC_SUBST([ZLIB_CPPFLAGS])
-AC_SUBST([ZLIB_LDFLAGS])
-AC_SUBST([ZLIB_LIBS])])
+[INN_LIB_HELPER_VAR_INIT([ZLIB])
+ INN_LIB_HELPER_WITH([zlib], [zlib], [ZLIB])
+ _INN_LIB_ZLIB_INTERNAL([true])
+ inn_use_ZLIB=true
+ AC_DEFINE([HAVE_ZLIB], 1, [Define if libz is available.])])
+
+dnl The main macro for packages with optional zlib support.
+AC_DEFUN([INN_LIB_ZLIB_OPTIONAL],
+[INN_LIB_HELPER_VAR_INIT([ZLIB])
+ INN_LIB_HELPER_WITH_OPTIONAL([zlib], [zlib], [ZLIB])
+ AS_IF([test x"$inn_use_ZLIB" != xfalse],
+    [AS_IF([test x"$inn_use_ZLIB" = xtrue],
+        [_INN_LIB_ZLIB_INTERNAL([true])],
+        [_INN_LIB_ZLIB_INTERNAL([false])])])
+ AS_IF([test x"$ZLIB_LIBS" != x],
+    [inn_use_ZLIB=true
+     AC_DEFINE([HAVE_ZLIB], 1, [Define if libz is available.])])])

Modified: storage/Makefile
===================================================================
--- storage/Makefile	2013-12-19 17:49:31 UTC (rev 9592)
+++ storage/Makefile	2013-12-27 21:16:09 UTC (rev 9593)
@@ -11,7 +11,7 @@
 LTVERSION     = 3:0:0
 
 top	      = ..
-CFLAGS	      = $(GCFLAGS) -I. $(DB_CPPFLAGS)
+CFLAGS	      = $(GCFLAGS) -I. $(BDB_CPPFLAGS)
 
 SOURCES	      = expire.c interface.c methods.c ov.c overdata.c overview.c \
 		ovmethods.c $(METHOD_SOURCES)

Modified: storage/ovdb/ovdb-private.h
===================================================================
--- storage/ovdb/ovdb-private.h	2013-12-19 17:49:31 UTC (rev 9592)
+++ storage/ovdb/ovdb-private.h	2013-12-27 21:16:09 UTC (rev 9593)
@@ -1,4 +1,4 @@
-#ifdef USE_BERKELEY_DB
+#ifdef HAVE_BDB
 
 #include <db.h>
 
@@ -190,4 +190,4 @@
 
 #define TRYAGAIN DB_LOCK_DEADLOCK
 
-#endif /* USE_BERKELEY_DB */
+#endif /* HAVE_BDB */

Modified: storage/ovdb/ovdb.c
===================================================================
--- storage/ovdb/ovdb.c	2013-12-19 17:49:31 UTC (rev 9592)
+++ storage/ovdb/ovdb.c	2013-12-27 21:16:09 UTC (rev 9593)
@@ -106,7 +106,7 @@
 # include <sys/un.h>
 #endif
 
-#ifndef USE_BERKELEY_DB
+#ifndef HAVE_BDB
 
 /* Provide stub functions if we don't have db */
 
@@ -150,7 +150,7 @@
 
 void ovdb_close(void) { }
 
-#else /* USE_BERKELEY_DB */
+#else /* HAVE_BDB */
 
 #define EXPIREGROUP_TXN_SIZE 100
 #define DELETE_TXN_SIZE 500
@@ -3056,4 +3056,4 @@
     ovdb_releaselock();
 }
 
-#endif /* USE_BERKELEY_DB */
+#endif /* HAVE_BDB */

Modified: tests/Makefile
===================================================================
--- tests/Makefile	2013-12-19 17:49:31 UTC (rev 9592)
+++ tests/Makefile	2013-12-27 21:16:09 UTC (rev 9593)
@@ -4,7 +4,7 @@
 
 top		= ..
 RUNTESTS_CFLAGS	= -DSOURCE='"$(abs_builddir)/tests"' -DBUILD='"$(abs_builddir)/tests"'
-CFLAGS		= $(GCFLAGS) $(DB_CPPFLAGS) $(DBM_CPPFLAGS) $(PERL_CPPFLAGS) $(PYTHON_CPPFLAGS) $(SSL_CPPFLAGS) $(SASL_CPPFLAGS) $(KRB5_CPPFLAGS) $(RUNTESTS_CFLAGS) -I.
+CFLAGS		= $(GCFLAGS) $(BDB_CPPFLAGS) $(DBM_CPPFLAGS) $(PERL_CPPFLAGS) $(PYTHON_CPPFLAGS) $(SSL_CPPFLAGS) $(SASL_CPPFLAGS) $(KRB5_CPPFLAGS) $(RUNTESTS_CFLAGS) -I.
 
 ##  On some platforms, linking with libm is needed as the test suite uses
 ##  math functions (currently only lib/confparse-t.c).
@@ -49,7 +49,7 @@
 .c.o: $*.c
 	$(CC) $(CFLAGS) -c -o $@ $*.c
 
-LINK		= $(LIBTOOLLD) $(CC) $(LDFLAGS) $(LIBM_LDFLAGS) $(DB_LDFLAGS) $(SSL_LDFLAGS) $(SASL_LDFLAGS) $(KRB5_LDFLAGS) -o $@
+LINK		= $(LIBTOOLLD) $(CC) $(LDFLAGS) $(LIBM_LDFLAGS) $(BDB_LDFLAGS) $(SSL_LDFLAGS) $(SASL_LDFLAGS) $(KRB5_LDFLAGS) -o $@
 STORAGEDEPS	= $(LIBSTORAGE) $(LIBHIST) $(LIBINN)
 STORAGELIBS	= $(STORAGEDEPS) $(STORAGE_LIBS)
 



More information about the inn-committers mailing list