From: Timo Sirainen Date: Thu, 18 Feb 2010 07:14:43 +0000 (+0200) Subject: Added dovecot.m4 file that external plugins can use. X-Git-Tag: 2.0.beta3~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f8b89b40da847baa15786b63433db5bda2291be;p=thirdparty%2Fdovecot%2Fcore.git Added dovecot.m4 file that external plugins can use. Based on patch by Dennis Schridde. --HG-- branch : HEAD --- diff --git a/Makefile.am b/Makefile.am index 6af6295fbd..b7319f40f8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,5 @@ +aclocaldir = $(datadir)/aclocal + if BUILD_DOCS DOCS = doc endif @@ -27,6 +29,8 @@ ChangeLog: .hg/dirstate 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 --git a/autogen.sh b/autogen.sh index 11a635c686..00445891c2 100755 --- a/autogen.sh +++ b/autogen.sh @@ -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 --git a/configure.in b/configure.in index 170e9e0157..a5968f50f0 100644 --- a/configure.in +++ b/configure.in @@ -614,7 +614,7 @@ if test $i_cv_posix_fallocate_works = yes; then 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 @@ case "$host_os" in 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 --git a/dovecot.m4 b/dovecot.m4 new file mode 100644 index 0000000000..030ade1822 --- /dev/null +++ b/dovecot.m4 @@ -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 + #include + ]],[[ + 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 --git a/src/plugins/fts-solr/Makefile.am b/src/plugins/fts-solr/Makefile.am index 4cc74db481..53a70a81f2 100644 --- a/src/plugins/fts-solr/Makefile.am +++ b/src/plugins/fts-solr/Makefile.am @@ -11,7 +11,7 @@ lib21_fts_solr_plugin_la_LDFLAGS = -module -avoid-version module_LTLIBRARIES = \ lib21_fts_solr_plugin.la -if PLUGIN_DEPS +if DOVECOT_PLUGIN_DEPS fts_plugin_dep = ../fts/lib20_fts_plugin.la endif diff --git a/src/plugins/fts-squat/Makefile.am b/src/plugins/fts-squat/Makefile.am index f1393baefb..f07e49edcf 100644 --- a/src/plugins/fts-squat/Makefile.am +++ b/src/plugins/fts-squat/Makefile.am @@ -10,7 +10,7 @@ lib21_fts_squat_plugin_la_LDFLAGS = -module -avoid-version 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 --git a/src/plugins/imap-acl/Makefile.am b/src/plugins/imap-acl/Makefile.am index d778c2a5d0..f270f89846 100644 --- a/src/plugins/imap-acl/Makefile.am +++ b/src/plugins/imap-acl/Makefile.am @@ -14,7 +14,7 @@ lib02_imap_acl_plugin_la_LDFLAGS = -module -avoid-version 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 --git a/src/plugins/imap-quota/Makefile.am b/src/plugins/imap-quota/Makefile.am index c459398201..b53d1f62e4 100644 --- a/src/plugins/imap-quota/Makefile.am +++ b/src/plugins/imap-quota/Makefile.am @@ -13,7 +13,7 @@ lib11_imap_quota_plugin_la_LDFLAGS = -module -avoid-version 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 --git a/src/plugins/imap-zlib/Makefile.am b/src/plugins/imap-zlib/Makefile.am index d379f8f765..b3f074121b 100644 --- a/src/plugins/imap-zlib/Makefile.am +++ b/src/plugins/imap-zlib/Makefile.am @@ -14,7 +14,7 @@ lib30_imap_zlib_plugin_la_LDFLAGS = -module -avoid-version 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 --git a/src/plugins/mail-log/Makefile.am b/src/plugins/mail-log/Makefile.am index 59863b5699..4e9d498235 100644 --- a/src/plugins/mail-log/Makefile.am +++ b/src/plugins/mail-log/Makefile.am @@ -13,7 +13,7 @@ lib20_mail_log_plugin_la_LDFLAGS = -module -avoid-version 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 --git a/src/plugins/trash/Makefile.am b/src/plugins/trash/Makefile.am index 710c8a9869..49bdc4b7b8 100644 --- a/src/plugins/trash/Makefile.am +++ b/src/plugins/trash/Makefile.am @@ -10,7 +10,7 @@ lib11_trash_plugin_la_LDFLAGS = -module -avoid-version module_LTLIBRARIES = \ lib11_trash_plugin.la -if PLUGIN_DEPS +if DOVECOT_PLUGIN_DEPS lib11_trash_plugin_la_LIBADD = \ ../quota/lib10_quota_plugin.la endif