]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Added dovecot.m4 file that external plugins can use.
authorTimo Sirainen <tss@iki.fi>
Thu, 18 Feb 2010 07:14:43 +0000 (09:14 +0200)
committerTimo Sirainen <tss@iki.fi>
Thu, 18 Feb 2010 07:14:43 +0000 (09:14 +0200)
Based on patch by Dennis Schridde.

--HG--
branch : HEAD

Makefile.am
autogen.sh
configure.in
dovecot.m4 [new file with mode: 0644]
src/plugins/fts-solr/Makefile.am
src/plugins/fts-squat/Makefile.am
src/plugins/imap-acl/Makefile.am
src/plugins/imap-quota/Makefile.am
src/plugins/imap-zlib/Makefile.am
src/plugins/mail-log/Makefile.am
src/plugins/trash/Makefile.am

index 6af6295fbd6c8ad755cce337596b0e84338b764f..b7319f40f8e7d5bd750134c12cc6cd52daa6d8cd 100644 (file)
@@ -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 && \
index 11a635c686876d3f93656fb3985b17f67ffd422b..00445891c2ed2c824a86c44d0d2d6371c16b5119 100755 (executable)
@@ -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
index 170e9e0157ab428a5dc82ed7ef336e82c8c10620..a5968f50f0016767320118c40c2cbefcaa2ff1f7 100644 (file)
@@ -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 (file)
index 0000000..030ade1
--- /dev/null
@@ -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
+])
index 4cc74db481feb60c3f946672798798b666572c9c..53a70a81f256e58b6fd94a12a7b5dec12840ab67 100644 (file)
@@ -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
 
index f1393baefb77ee61907a72343cb21011a7c12767..f07e49edcf1fac7c24c53f0912be1cb109db0846 100644 (file)
@@ -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
index d778c2a5d0169d6237e653b51faa8722b69c0809..f270f898460bb8d2c4d627dd5fe8ff3f7d9b2b8f 100644 (file)
@@ -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
index c459398201c69adc73d9dffeb3daeea6b4e968ac..b53d1f62e4f3336c38a2439d506eb4c97b7301fa 100644 (file)
@@ -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
index d379f8f765495d14643a5959a8c705df3c6ec54b..b3f074121b73aca7dd83eb475b5d6fc874ffd625 100644 (file)
@@ -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
index 59863b5699e4d1a4703e29cc066dc66a6583fce5..4e9d4982356bcb4960315b0ddd0558b42592b36f 100644 (file)
@@ -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
index 710c8a9869fc3b88fb5321b5d66b4fc6145ce26d..49bdc4b7b8d19d0bb87234123281a5c6f376be5c 100644 (file)
@@ -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