dovecot-2.0: Added dovecot.m4 file that external plugins can use.

dovecot at dovecot.org dovecot at dovecot.org
Thu Feb 18 09:18:01 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/80a11f8650a4
changeset: 10753:80a11f8650a4
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Feb 18 09:14:43 2010 +0200
description:
Added dovecot.m4 file that external plugins can use.
Based on patch by Dennis Schridde.

diffstat:

 Makefile.am                        |   4 +
 autogen.sh                         |   5 +-
 configure.in                       |   7 +--
 dovecot.m4                         |  94 +++++++++++++++++++++++++++++++
 src/plugins/fts-solr/Makefile.am   |   2 +-
 src/plugins/fts-squat/Makefile.am  |   2 +-
 src/plugins/imap-acl/Makefile.am   |   2 +-
 src/plugins/imap-quota/Makefile.am |   2 +-
 src/plugins/imap-zlib/Makefile.am  |   2 +-
 src/plugins/mail-log/Makefile.am   |   2 +-
 src/plugins/trash/Makefile.am      |   2 +-
 11 files changed, 109 insertions(+), 15 deletions(-)

diffs (244 lines):

diff -r 6aa76d89195d -r 80a11f8650a4 Makefile.am
--- a/Makefile.am	Thu Feb 18 08:43:35 2010 +0200
+++ b/Makefile.am	Thu Feb 18 09:14:43 2010 +0200
@@ -1,3 +1,5 @@
+aclocaldir = $(datadir)/aclocal
+
 if BUILD_DOCS
 DOCS = doc
 endif
@@ -27,6 +29,8 @@
 	hg log --style=changelog > ChangeLog
 endif
 
+aclocal_DATA = dovecot.m4
+
 dovecot-config: dovecot-config.in Makefile
 	old=`pwd` && cd $(top_builddir) && abs_builddir=`pwd` && cd $$old && \
 	cd $(top_srcdir) && abs_srcdir=`pwd` && cd $$old && \
diff -r 6aa76d89195d -r 80a11f8650a4 autogen.sh
--- a/autogen.sh	Thu Feb 18 08:43:35 2010 +0200
+++ b/autogen.sh	Thu Feb 18 09:14:43 2010 +0200
@@ -4,10 +4,11 @@
 #ACLOCAL_DIR=
 #GETTEXT_DIR=
 
+ACLOCAL="aclocal -I ."
 if test "$ACLOCAL_DIR" != ""; then
-  ACLOCAL="aclocal -I $ACLOCAL_DIR"
-  export ACLOCAL
+  ACLOCAL="$ACLOCAL -I $ACLOCAL_DIR"
 fi
+export ACLOCAL
 
 for dir in $GETTEXT_DIR /usr/share/gettext /usr/local/share/gettext; do
   if test -f $dir/config.rpath; then
diff -r 6aa76d89195d -r 80a11f8650a4 configure.in
--- a/configure.in	Thu Feb 18 08:43:35 2010 +0200
+++ b/configure.in	Thu Feb 18 09:14:43 2010 +0200
@@ -614,7 +614,7 @@
 fi
 
 dnl * OS specific options
-have_plugin_deps=yes
+DC_PLUGIN_DEPS
 case "$host_os" in
 	hpux*)
 		CFLAGS="$CFLAGS -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED"
@@ -626,14 +626,9 @@
 	linux*)
 		AC_DEFINE(PROCTITLE_HACK,, Define if process title can be changed by modifying argv)
 		;;
-	darwin*)
-		# OSX loads the plugins twice, which breaks stuff
-		have_plugin_deps=no
-		;;
 	*)
 		;;
 esac
-AM_CONDITIONAL(PLUGIN_DEPS, test "$have_plugin_deps" = "yes")
 
 AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(long)
diff -r 6aa76d89195d -r 80a11f8650a4 dovecot.m4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dovecot.m4	Thu Feb 18 09:14:43 2010 +0200
@@ -0,0 +1,94 @@
+# dovecot.m4 - Check presence of dovecot -*-Autoconf-*-
+#
+#   Copyright (C) 2010 Dennis Schridde
+#
+# This file is free software; the authors give
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+AC_DEFUN([DC_PLUGIN_DEPS],[
+	_plugin_deps=yes
+	AC_MSG_CHECKING([whether OS supports plugin dependencies])
+	AS_CASE([$host_os],
+		[darwin*],[
+			# OSX loads the plugins twice, which breaks stuff
+			_plugin_deps=no
+		]
+	)
+	AC_MSG_RESULT([$_plugin_deps])
+	AM_CONDITIONAL([DOVECOT_PLUGIN_DEPS], [test "x$_plugin_deps" = "xyes"])
+	AS_UNSET([_plugin_deps])
+])
+
+# Substitute every var in the given comma seperated list
+AC_DEFUN([AX_SUBST_L],[
+	m4_foreach([__var__], [$@], [AC_SUBST(__var__)])
+])
+
+AC_DEFUN([DC_DOVECOT],[
+	AC_ARG_WITH(dovecot,
+		AS_HELP_STRING([--with-dovecot=DIR],[Dovecot base directory [LIBDIR/dovecot]]),
+			[ dovecotdir="$withval" ], [ dovecotdir="${libdir}"/dovecot ]
+	)
+
+	AC_MSG_CHECKING([for dovecot-config in "$dovecotdir"])
+	AS_IF([test -f "$dovecotdir/dovecot-config"],[
+		AC_MSG_RESULT([$dovecotdir/dovecot-config])
+	],[
+		AC_MSG_RESULT([not found])
+		AC_MSG_NOTICE([])
+		AC_MSG_NOTICE([Use --with-dovecot=DIR to provide the path to the dovecot-config file.])
+		AC_MSG_ERROR([dovecot-config not found])
+	])
+
+	eval `grep \
+		-e ^dovecot_[[a-z]]*= \
+		-e ^LIBDOVECOT[[A-Z_]]*= \
+		"$dovecotdir"/dovecot-config`
+	AX_SUBST_L([dovecot_moduledir], [dovecot_pkgincludedir], [dovecot_pkglibexecdir], [dovecot_pkglibdir], [dovecot_docdir])
+	AX_SUBST_L([LIBDOVECOT], [LIBDOVECOT_LOGIN], [LIBDOVECOT_SQL], [LIBDOVECOT_STORAGE])
+	AX_SUBST_L([LIBDOVECOT_DEPS], [LIBDOVECOT_LOGIN_DEPS], [LIBDOVECOT_SQL_DEPS], [LIBDOVECOT_STORAGE_DEPS])
+	AX_SUBST_L([LIBDOVECOT_INCLUDE], [LIBDOVECOT_LDA_INCLUDE], [LIBDOVECOT_SERVICE_INCLUDE], [LIBDOVECOT_STORAGE_INCLUDE], [LIBDOVECOT_LOGIN_INCLUDE])
+
+	_cppflags=$CPPFLAGS
+	CPPFLAGS=$LIBDOVECOT_INCLUDE
+	AC_MSG_CHECKING([dovecot version])
+	AC_RUN_IFELSE([
+		AC_LANG_PROGRAM([[
+			/* needed for dovecot to include its own config.h ... */
+			#define HAVE_CONFIG_H
+			#include "lib.h"
+			#include <stdlib.h>
+			#include <stdio.h>
+		]],[[
+			printf("%s\n", DOVECOT_VERSION);
+		]])
+	],[
+		DOVECOT_VERSION=`./conftest$EXEEXT`
+	],[
+		AC_MSG_FAILURE([unable to determine dovecot version])
+	])
+	AC_SUBST([DOVECOT_VERSION])
+	CPPFLAGS=$_cppflags
+	AS_UNSET([_cppflags])
+
+	m4_foreach_w([__flag__],[$1],[
+		# Inside m4_foreach __flag__ is a variable!
+		# This expands *entirely* for every flag in the argument list!
+		AS_CASE([__flag__],
+			[
+				# assume an unknown flag is a version number
+				AC_MSG_CHECKING([whether dovecot is newer than __flag__])
+				AS_VERSION_COMPARE([$DOVECOT_VERSION],[__flag__],[
+					AC_MSG_RESULT([no])
+					AC_MSG_ERROR([at least dovecot-flag is required, your version seems older])
+				],[
+					AC_MSG_RESULT([yes])
+				],[
+					AC_MSG_RESULT([yes])
+				])
+		])
+	])
+
+	DC_PLUGIN_DEPS
+])
diff -r 6aa76d89195d -r 80a11f8650a4 src/plugins/fts-solr/Makefile.am
--- a/src/plugins/fts-solr/Makefile.am	Thu Feb 18 08:43:35 2010 +0200
+++ b/src/plugins/fts-solr/Makefile.am	Thu Feb 18 09:14:43 2010 +0200
@@ -11,7 +11,7 @@
 module_LTLIBRARIES = \
 	lib21_fts_solr_plugin.la
 
-if PLUGIN_DEPS
+if DOVECOT_PLUGIN_DEPS
 fts_plugin_dep = ../fts/lib20_fts_plugin.la
 endif
 
diff -r 6aa76d89195d -r 80a11f8650a4 src/plugins/fts-squat/Makefile.am
--- a/src/plugins/fts-squat/Makefile.am	Thu Feb 18 08:43:35 2010 +0200
+++ b/src/plugins/fts-squat/Makefile.am	Thu Feb 18 09:14:43 2010 +0200
@@ -10,7 +10,7 @@
 module_LTLIBRARIES = \
 	lib21_fts_squat_plugin.la
 
-if PLUGIN_DEPS
+if DOVECOT_PLUGIN_DEPS
 lib21_fts_squat_plugin_la_LIBADD = \
 	../fts/lib20_fts_plugin.la
 endif
diff -r 6aa76d89195d -r 80a11f8650a4 src/plugins/imap-acl/Makefile.am
--- a/src/plugins/imap-acl/Makefile.am	Thu Feb 18 08:43:35 2010 +0200
+++ b/src/plugins/imap-acl/Makefile.am	Thu Feb 18 09:14:43 2010 +0200
@@ -14,7 +14,7 @@
 imap_module_LTLIBRARIES = \
 	lib02_imap_acl_plugin.la
 
-if PLUGIN_DEPS
+if DOVECOT_PLUGIN_DEPS
 lib02_imap_acl_plugin_la_LIBADD = \
 	../acl/lib01_acl_plugin.la
 endif
diff -r 6aa76d89195d -r 80a11f8650a4 src/plugins/imap-quota/Makefile.am
--- a/src/plugins/imap-quota/Makefile.am	Thu Feb 18 08:43:35 2010 +0200
+++ b/src/plugins/imap-quota/Makefile.am	Thu Feb 18 09:14:43 2010 +0200
@@ -13,7 +13,7 @@
 imap_module_LTLIBRARIES = \
 	lib11_imap_quota_plugin.la
 
-if PLUGIN_DEPS
+if DOVECOT_PLUGIN_DEPS
 lib11_imap_quota_plugin_la_LIBADD = \
 	../quota/lib10_quota_plugin.la
 endif
diff -r 6aa76d89195d -r 80a11f8650a4 src/plugins/imap-zlib/Makefile.am
--- a/src/plugins/imap-zlib/Makefile.am	Thu Feb 18 08:43:35 2010 +0200
+++ b/src/plugins/imap-zlib/Makefile.am	Thu Feb 18 09:14:43 2010 +0200
@@ -14,7 +14,7 @@
 imap_module_LTLIBRARIES = \
 	lib30_imap_zlib_plugin.la
 
-if PLUGIN_DEPS
+if DOVECOT_PLUGIN_DEPS
 lib30_imap_zlib_plugin_la_LIBADD = \
 	../zlib/lib20_zlib_plugin.la
 endif
diff -r 6aa76d89195d -r 80a11f8650a4 src/plugins/mail-log/Makefile.am
--- a/src/plugins/mail-log/Makefile.am	Thu Feb 18 08:43:35 2010 +0200
+++ b/src/plugins/mail-log/Makefile.am	Thu Feb 18 09:14:43 2010 +0200
@@ -13,7 +13,7 @@
 module_LTLIBRARIES = \
 	lib20_mail_log_plugin.la
 
-if PLUGIN_DEPS
+if DOVECOT_PLUGIN_DEPS
 lib20_mail_log_plugin_la_LIBADD = \
 	../notify/lib15_notify_plugin.la
 endif
diff -r 6aa76d89195d -r 80a11f8650a4 src/plugins/trash/Makefile.am
--- a/src/plugins/trash/Makefile.am	Thu Feb 18 08:43:35 2010 +0200
+++ b/src/plugins/trash/Makefile.am	Thu Feb 18 09:14:43 2010 +0200
@@ -10,7 +10,7 @@
 module_LTLIBRARIES = \
 	lib11_trash_plugin.la
 
-if PLUGIN_DEPS
+if DOVECOT_PLUGIN_DEPS
 lib11_trash_plugin_la_LIBADD = \
 	../quota/lib10_quota_plugin.la
 endif


More information about the dovecot-cvs mailing list