INN commit: trunk (configure.ac doc/pod/news.pod m4/sasl.m4)

INN Commit rra at isc.org
Thu Nov 21 15:32:04 UTC 2013


    Date: Thursday, November 21, 2013 @ 07:32:04
  Author: iulius
Revision: 9571

improve support for Cyrus SASL

* new --with-sasl-include and --with-sasl-lib configure flags to allow
  the use of non-standard paths for the Cyrus SASL library
* if the Cyrus SASL library is found at configure time, INN will now
  be built with support for it unless the --without-sasl flag is
  explicitly passed to configure
* sasl.m4 is now synchronized from upstream rra-c-util

Modified:
  trunk/configure.ac
  trunk/doc/pod/news.pod
  trunk/m4/sasl.m4

------------------+
 configure.ac     |    4 -
 doc/pod/news.pod |   19 ++++----
 m4/sasl.m4       |  117 +++++++++++++++++++++++++++++++----------------------
 3 files changed, 82 insertions(+), 58 deletions(-)

Modified: configure.ac
===================================================================
--- configure.ac	2013-11-21 15:23:24 UTC (rev 9570)
+++ configure.ac	2013-11-21 15:32:04 UTC (rev 9571)
@@ -335,9 +335,9 @@
 dnl libraries if needed.
 INN_LIB_BERKELEYDB
 INN_LIB_ZLIB
+INN_LIB_KRB5_OPTIONAL
 INN_LIB_OPENSSL_OPTIONAL
-INN_LIB_SASL
-INN_LIB_KRB5_OPTIONAL
+INN_LIB_SASL_OPTIONAL
 
 dnl If Kerberos is found, define KRB5_AUTH to auth_krb5 so as to build
 dnl that program.

Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod	2013-11-21 15:23:24 UTC (rev 9570)
+++ doc/pod/news.pod	2013-11-21 15:32:04 UTC (rev 9571)
@@ -127,21 +127,22 @@
 
 =item *
 
-When building INN with S<Berkeley DB>, 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-krb5>, B<--with-krb5-include>,
+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>).
 
 =item *
 
-If the 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-krb5>, or B<--without-openssl> flags are
-explicitly passed to configure.
+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.
 
 =item *
 

Modified: m4/sasl.m4
===================================================================
--- m4/sasl.m4	2013-11-21 15:23:24 UTC (rev 9570)
+++ m4/sasl.m4	2013-11-21 15:32:04 UTC (rev 9571)
@@ -1,51 +1,74 @@
-dnl sasl.m4 -- Find the path to the Cyrus SASL libraries.
+dnl Find the compiler and linker flags for Cyrus SASL.
 dnl $Id$
 dnl
-dnl This file provides INN_LIB_SASL, which defines the --with-sasl
-dnl command-line option and probes for the location of Cyrus SASL v2 if that
-dnl option is used without an optional path.  It looks by default in $prefix,
-dnl /usr/local, and /usr.  It then makes sure that Cyrus SASL is version two
-dnl and will link, and exports SASL_LDFLAGS, SASL_CPPFLAGS, and SASL_LIBS.
+dnl Finds the compiler and linker flags for linking with the Cyrus SASL
+dnl library.  Provides the --with-sasl, --with-sasl-lib, and
+dnl --with-sasl-include configure options to specify non-standard paths to the
+dnl Cyrus SASL library.
+dnl
+dnl Provides the macro INN_LIB_SASL and sets the substitution variables
+dnl SASL_CPPFLAGS, SASL_LDFLAGS, and SASL_LIBS.  Also provides
+dnl INN_LIB_SASL_SWITCH to set CPPFLAGS, LDFLAGS, and LIBS to include the
+dnl Cyrus SASL v2 library, saving the current values first, and
+dnl INN_LIB_SASL_RESTORE to restore those settings to before the last
+dnl INN_LIB_SASL_SWITCH.  Defines HAVE_SASL and sets inn_use_SASL to true if
+dnl the library is found and is version two.
+dnl
+dnl Provides the INN_LIB_SASL_OPTIONAL macro, which should be used if Cyrus
+dnl SASL support is optional.  This macro will still always set the
+dnl substitution variables, but they'll be empty unless --with-sasl is given.
+dnl Defines HAVE_SASL and sets inn_use_SASL to true if the Cyrus SASL library
+dnl is found and is version two.
+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 Cyrus SASL flags.  Used as a wrapper, with
+dnl INN_LIB_SASL_RESTORE, around tests.
+AC_DEFUN([INN_LIB_SASL_SWITCH], [INN_LIB_HELPER_SWITCH([SASL])])
+
+dnl Restore CPPFLAGS, LDFLAGS, and LIBS to their previous values (before
+dnl INN_LIB_SASL_SWITCH was called).
+AC_DEFUN([INN_LIB_SASL_RESTORE], [INN_LIB_HELPER_RESTORE([SASL])])
+
+dnl Checks if the Cyrus SASL library is present.  The single argument, if
+dnl "true", says to fail if the Cyrus SASL library could not be found.
+AC_DEFUN([_INN_LIB_SASL_INTERNAL],
+[INN_LIB_HELPER_PATHS([SASL])
+ INN_LIB_SASL_SWITCH
+ AC_CHECK_LIB([sasl2], [sasl_getprop],
+    [SASL_LIBS="-lsasl2"],
+    [AS_IF([test x"$1" = xtrue],
+        [AC_MSG_ERROR([cannot find usable Cyrus SASL library])])])
+ INN_LIB_SASL_RESTORE])
+
+dnl The main macro for packages with mandatory Cyrus SASL support.
 AC_DEFUN([INN_LIB_SASL],
-[SASL_CPPFLAGS=
-SASL_LDFLAGS=
-SASL_LIBS=
-AC_ARG_WITH([sasl],
-    [AS_HELP_STRING([--with-sasl@<:@=PATH@:>@],
-        [Enable SASL (for imapfeed and nnrpd authentication)])],
-    SASL_DIR=$with_sasl,
-    SASL_DIR=no)
-AC_MSG_CHECKING([if SASL is desired])
-if test x"$SASL_DIR" = xno ; then
-    AC_MSG_RESULT([no])
-else
-    AC_MSG_RESULT([yes])
-    AC_MSG_CHECKING([for SASL location])
-    if test x"$SASL_DIR" = xyes ; then
-        for dir in $prefix /usr/local /usr ; do
-            if test -f "$dir/include/sasl/sasl.h" ; then
-                SASL_DIR=$dir
-                break
-            fi
-        done
-    fi
-    if test x"$SASL_DIR" = xyes ; then
-        AC_MSG_ERROR([cannot find SASL])
-    else
-        AC_MSG_RESULT([$SASL_DIR])
-        if test x"$SASL_DIR" != x/usr ; then
-            SASL_CPPFLAGS="-I$SASL_DIR/include"
-            SASL_LDFLAGS="-L$SASL_DIR/lib"
-        fi
-        inn_save_LDFLAGS=$LDFLAGS
-        LDFLAGS="$SASL_LDFLAGS $LDFLAGS"
-        AC_CHECK_LIB([sasl2], [sasl_getprop], [SASL_LIBS=-lsasl2],
-            [AC_MSG_ERROR([cannot find SASL])])
-        LDFLAGS=$inn_save_LDFLAGS
-        AC_DEFINE([HAVE_SASL], 1, [Define if SASL is available.])
-    fi
-fi
-AC_SUBST([SASL_CPPFLAGS])
-AC_SUBST([SASL_LDFLAGS])
-AC_SUBST([SASL_LIBS])])
+[INN_LIB_HELPER_VAR_INIT([SASL])
+ INN_LIB_HELPER_WITH([sasl], [Cyrus SASL], [SASL])
+ _INN_LIB_SASL_INTERNAL([true])
+ inn_use_SASL=true
+ AC_DEFINE([HAVE_SASL], 1, [Define if libsasl2 is available.])])
+
+dnl The main macro for packages with optional Cyrus SASL support.
+AC_DEFUN([INN_LIB_SASL_OPTIONAL],
+[INN_LIB_HELPER_VAR_INIT([SASL])
+ INN_LIB_HELPER_WITH_OPTIONAL([sasl], [Cyrus SASL], [SASL])
+ AS_IF([test x"$inn_use_SASL" != xfalse],
+    [AS_IF([test x"$inn_use_SASL" = xtrue],
+        [_INN_LIB_SASL_INTERNAL([true])],
+        [_INN_LIB_SASL_INTERNAL([false])])])
+ AS_IF([test x"$SASL_LIBS" != x],
+    [inn_use_SASL=true
+     AC_DEFINE([HAVE_SASL], 1, [Define if libsasl2 is available.])])])



More information about the inn-committers mailing list