INN commit: trunk (8 files)
INN Commit
rra at isc.org
Fri Sep 20 17:47:03 UTC 2013
Date: Friday, September 20, 2013 @ 10:47:02
Author: iulius
Revision: 9536
improve building with Berkeley DB support
When building INN with Berkeley DB support, no longer add standard
locations to compiler and linker include flags; unconditionally
adding -L/usr/lib (for instance) may break the build, especially when
/usr/lib32 or /usr/lib64 are also defined. Such default paths are now
added only if explicitly given to one or more of the --with-berkeleydb,
--with-berkeleydb-include, or --with-berkeleydb-lib configure flags.
These two last flags are new in INN 2.6.0.
Added:
trunk/m4/lib-depends.m4
trunk/m4/lib-pathname.m4
Modified:
trunk/MANIFEST
trunk/configure.ac
trunk/doc/pod/install.pod
trunk/doc/pod/news.pod
trunk/doc/pod/ovdb.pod
trunk/m4/berkeleydb.m4
---------------------+
MANIFEST | 2
configure.ac | 2
doc/pod/install.pod | 20 +++---
doc/pod/news.pod | 10 +++
doc/pod/ovdb.pod | 19 +++---
m4/berkeleydb.m4 | 153 +++++++++++++++++++++++++++++++++++---------------
m4/lib-depends.m4 | 29 +++++++++
m4/lib-pathname.m4 | 62 ++++++++++++++++++++
8 files changed, 235 insertions(+), 62 deletions(-)
Modified: MANIFEST
===================================================================
--- MANIFEST 2013-09-03 18:23:45 UTC (rev 9535)
+++ MANIFEST 2013-09-20 17:47:02 UTC (rev 9536)
@@ -561,6 +561,8 @@
m4/iov-max.m4 Autoconf macro for IOV_MAX
m4/krb5.m4 Autoconf macro for Kerberos v5
m4/large-fpos.m4 Autoconf macro for large-file fpos_t
+m4/lib-depends.m4 Autoconf macro to change library probes
+m4/lib-pathname.m4 Autoconf macros to find the library path
m4/libtool.m4 Autoconf macros for libtool
m4/ltoptions.m4 Autoconf macros for libtool option handling
m4/ltsugar.m4 Autoconf macros for libtool m4 base layer
Modified: configure.ac
===================================================================
--- configure.ac 2013-09-03 18:23:45 UTC (rev 9535)
+++ configure.ac 2013-09-20 17:47:02 UTC (rev 9536)
@@ -41,6 +41,8 @@
m4_include([m4/iov-max.m4])
m4_include([m4/krb5.m4])
m4_include([m4/large-fpos.m4])
+m4_include([m4/lib-depends.m4])
+m4_include([m4/lib-pathname.m4])
m4_include([m4/libtool.m4])
m4_include([m4/lt~obsolete.m4])
m4_include([m4/ltoptions.m4])
Modified: doc/pod/install.pod
===================================================================
--- doc/pod/install.pod 2013-09-03 18:23:45 UTC (rev 9535)
+++ doc/pod/install.pod 2013-09-20 17:47:02 UTC (rev 9536)
@@ -384,14 +384,18 @@
=item B<--with-berkeleydb>=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. Enabling
-this configure option doesn't mean you'll be required to use ovdb, but it
-does require that S<Berkeley DB> be installed on your system (including the
-header files, not just the runtime libraries). If a path is given, it
-sets the installed directory of S<Berkeley DB> (configure will search for it
-in some standard locations, but if you have it installed elsewhere, you
-may need this option).
+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.
+Enabling this configure option doesn't mean you'll be required to use
+ovdb, but it does require that S<Berkeley DB> be installed on your system
+(including the header files, not just the runtime libraries). If a path
+is given, it sets the installed directory of S<Berkeley DB> (configure
+will search for it in standard locations, but if you have it installed
+elsewhere, you may need this option). This directory is expected to have
+subdirectories F<include> and F<lib>, containing respectively F<db.h>,
+and the library itself. In case non-standard paths to the S<Berkeley
+DB> 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.
=item B<--with-zlib>=PATH
Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod 2013-09-03 18:23:45 UTC (rev 9535)
+++ doc/pod/news.pod 2013-09-20 17:47:02 UTC (rev 9536)
@@ -122,6 +122,16 @@
=item *
+When building INN with S<Berkeley DB> support, no longer add standard
+locations to compiler and linker include flags; unconditionally
+adding F<-L/usr/lib> (for instance) may break the build. Such
+default paths are now added only if explicitly given to one or
+more of the B<--with-berkeleydb>, B<--with-berkeleydb-include>, or
+B<--with-berkeleydb-lib> configure flags (the last two flags are new
+in S<INN 2.6.0>).
+
+=item *
+
For security reasons, use of the flawed SSLv2 protocol is now disabled
for TLS sessions with B<nnrpd>.
Modified: doc/pod/ovdb.pod
===================================================================
--- doc/pod/ovdb.pod 2013-09-03 18:23:45 UTC (rev 9535)
+++ doc/pod/ovdb.pod 2013-09-20 17:47:02 UTC (rev 9536)
@@ -24,16 +24,17 @@
=head1 INSTALLATION
To build ovdb support into INN, specify the option B<--with-berkeleydb>
-when running the configure script. By default, configure will search for
-a S<Berkeley DB> tree in several likely locations, and choose the highest
-version (based on the name of the directory, e.g., F<BerkeleyDB.4.4>) that
-it finds. There will be a message in the configure output indicating the
-chosen pathname.
+when running the configure script. By default, configure will search
+for S<Berkeley DB> in standard 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, e.g.,
-B<--with-berkeleydb=/usr/BerkeleyDB.4.4>. This directory is expected to
-have subdirectories F<include> and F<lib>, containing F<db.h>, and the
-library itself, respectively.
+You can override this pathname by adding a path to the option, for
+instance B<--with-berkeleydb=/usr/BerkeleyDB.4.4>. This directory
+is expected to have subdirectories F<include> and F<lib>, containing
+respectively F<db.h>, and the library itself. In case non-standard
+paths to the S<Berkeley DB> 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.
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: m4/berkeleydb.m4
===================================================================
--- m4/berkeleydb.m4 2013-09-03 18:23:45 UTC (rev 9535)
+++ m4/berkeleydb.m4 2013-09-20 17:47:02 UTC (rev 9536)
@@ -1,53 +1,120 @@
dnl berkeleydb.m4 -- Various checks for the Berkeley DB libraries.
dnl $Id$
dnl
-dnl This file provides INN_LIB_BERKELEYDB, which defines the --with-berkeleydb
-dnl command-line option and probes for the location of Berkeley DB if that
-dnl option is used without an optional path. It looks for Berkeley DB in $prefix,
-dnl /usr/local and /usr. It then exports DB_LDFLAGS, DB_CPPFLAGS, and DB_LIBS.
+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],
-[DB_CPPFLAGS=
-DB_LDFLAGS=
-DB_LIBS=
-AC_ARG_WITH([berkeleydb],
- [AS_HELP_STRING([--with-berkeleydb@<:@=PATH@:>@],
- [Enable Berkeley DB (for ovdb overview method)])],
- DB_DIR=$with_berkeleydb,
- DB_DIR=no)
-AC_MSG_CHECKING([if Berkeley DB is desired])
-if test x"$DB_DIR" = xno ; then
- AC_MSG_RESULT([no])
-else
- AC_MSG_RESULT([yes])
+[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_MSG_CHECKING([for Berkeley DB location])
- if test x"$DB_DIR" = xyes ; then
- for dir in $prefix /usr/local /usr ; do
- if test -f "$dir/include/db.h" ; then
- DB_DIR=$dir
- break
- fi
- done
- fi
- if test x"$DB_DIR" = xyes ; then
- AC_MSG_ERROR([cannot find Berkeley DB])
- else
- DB_CPPFLAGS="-I$DB_DIR/include"
- DB_LDFLAGS="-L$DB_DIR/lib"
- DB_LIBS="-ldb"
- AC_MSG_RESULT([$DB_DIR])
- fi
- AC_DEFINE([USE_BERKELEY_DB], 1, [Define if Berkeley DB is available.])
-fi
-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>
@@ -66,10 +133,7 @@
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_save_LDFLAGS="$LDFLAGS"
-inn_save_CFLAGS="$CFLAGS"
-LDFLAGS="$LDFLAGS $DB_LDFLAGS $DB_LIBS"
-CFLAGS="$CFLAGS $DB_CPPFLAGS"
+[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])],
@@ -78,5 +142,4 @@
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.])])
-LDFLAGS="$inn_save_LDFLAGS"
-CFLAGS="$inn_save_CFLAGS"])
+INN_LIB_BERKELEYDB_RESTORE])
Added: m4/lib-depends.m4
===================================================================
--- m4/lib-depends.m4 (rev 0)
+++ m4/lib-depends.m4 2013-09-20 17:47:02 UTC (rev 9536)
@@ -0,0 +1,29 @@
+dnl Provides option to change library probes.
+dnl $Id$
+dnl
+dnl This file provides INN_ENABLE_REDUCED_DEPENDS, which adds the configure
+dnl option --enable-reduced-depends to request that library probes assume
+dnl shared libraries are in use and dependencies of libraries should not be
+dnl probed. If this option is given, the shell variable inn_reduced_depends
+dnl is set to true; otherwise, it is set to false.
+dnl
+dnl This macro doesn't do much but is defined separately so that other macros
+dnl can require it with AC_REQUIRE.
+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 <rra at stanford.edu>
+dnl Copyright 2005, 2006, 2007
+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.
+
+AC_DEFUN([INN_ENABLE_REDUCED_DEPENDS],
+[inn_reduced_depends=false
+AC_ARG_ENABLE([reduced-depends],
+ [AS_HELP_STRING([--enable-reduced-depends],
+ [Try to minimize shared library dependencies])],
+ [AS_IF([test x"$enableval" = xyes], [inn_reduced_depends=true])])])
Property changes on: trunk/m4/lib-depends.m4
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: m4/lib-pathname.m4
===================================================================
--- m4/lib-pathname.m4 (rev 0)
+++ m4/lib-pathname.m4 2013-09-20 17:47:02 UTC (rev 9536)
@@ -0,0 +1,62 @@
+dnl Determine the library path name.
+dnl $Id$
+dnl
+dnl Red Hat systems and some other Linux systems use lib64 and lib32 rather
+dnl than just lib in some circumstances. This file provides an Autoconf
+dnl macro, INN_SET_LDFLAGS, which given a variable, a prefix, and an optional
+dnl suffix, adds -Lprefix/lib, -Lprefix/lib32, or -Lprefix/lib64 to the
+dnl variable depending on which directories exist and the size of a long in
+dnl the compilation environment. If a suffix is given, a slash and that
+dnl suffix will be appended, to allow for adding a subdirectory of the library
+dnl directory.
+dnl
+dnl This file also provides the Autoconf macro INN_SET_LIBDIR, which sets the
+dnl libdir variable to PREFIX/lib{,32,64} as appropriate.
+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 <rra at stanford.edu>
+dnl Copyright 2008, 2009
+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 Probe for the alternate library name that we should attempt on this
+dnl architecture, given the size of an int, and set inn_lib_arch_name to that
+dnl name. Separated out so that it can be AC_REQUIRE'd and not run multiple
+dnl times.
+dnl
+dnl There is an unfortunate abstraction violation here where we assume we know
+dnl the cache variable name used by Autoconf. Unfortunately, Autoconf doesn't
+dnl provide any other way of getting at that information in shell that I can
+dnl see.
+AC_DEFUN([_INN_LIB_ARCH_NAME],
+[inn_lib_arch_name=lib
+ AC_CHECK_SIZEOF([long])
+ AS_IF([test "$ac_cv_sizeof_long" -eq 4 && test -d /usr/lib32],
+ [inn_lib_arch_name=lib32],
+ [AS_IF([test "$ac_cv_sizeof_long" -eq 8 && test -d /usr/lib64],
+ [inn_lib_arch_name=lib64])])])
+
+dnl Set VARIABLE to -LPREFIX/lib{,32,64} or -LPREFIX/lib{,32,64}/SUFFIX as
+dnl appropriate.
+AC_DEFUN([INN_SET_LDFLAGS],
+[AC_REQUIRE([_INN_LIB_ARCH_NAME])
+ AS_IF([test -d "$2/$inn_lib_arch_name"],
+ [AS_IF([test x"$3" = x],
+ [$1="[$]$1 -L$2/${inn_lib_arch_name}"],
+ [$1="[$]$1 -L$2/${inn_lib_arch_name}/$3"])],
+ [AS_IF([test x"$3" = x],
+ [$1="[$]$1 -L$2/lib"],
+ [$1="[$]$1 -L$2/lib/$3"])])
+ $1=`echo "[$]$1" | sed -e 's/^ *//'`])
+
+dnl Set libdir to PREFIX/lib{,32,64} as appropriate.
+AC_DEFUN([INN_SET_LIBDIR],
+[AC_REQUIRE([_INN_LIB_ARCH_NAME])
+ AS_IF([test -d "$1/$inn_lib_arch_name"],
+ [libdir="$1/${inn_lib_arch_name}"],
+ [libdir="$1/lib"])])
Property changes on: trunk/m4/lib-pathname.m4
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
More information about the inn-committers
mailing list