annotate dovecot.m4 @ 10753:80a11f8650a4 HEAD

Added dovecot.m4 file that external plugins can use. Based on patch by Dennis Schridde.
author Timo Sirainen <tss@iki.fi>
date Thu, 18 Feb 2010 09:14:43 +0200
parents
children 912c132337ed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10753
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
1 # dovecot.m4 - Check presence of dovecot -*-Autoconf-*-
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
2 #
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
3 # Copyright (C) 2010 Dennis Schridde
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
4 #
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
5 # This file is free software; the authors give
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
6 # unlimited permission to copy and/or distribute it, with or without
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
7 # modifications, as long as this notice is preserved.
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
8
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
9 AC_DEFUN([DC_PLUGIN_DEPS],[
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
10 _plugin_deps=yes
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
11 AC_MSG_CHECKING([whether OS supports plugin dependencies])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
12 AS_CASE([$host_os],
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
13 [darwin*],[
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
14 # OSX loads the plugins twice, which breaks stuff
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
15 _plugin_deps=no
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
16 ]
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
17 )
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
18 AC_MSG_RESULT([$_plugin_deps])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
19 AM_CONDITIONAL([DOVECOT_PLUGIN_DEPS], [test "x$_plugin_deps" = "xyes"])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
20 AS_UNSET([_plugin_deps])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
21 ])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
22
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
23 # Substitute every var in the given comma seperated list
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
24 AC_DEFUN([AX_SUBST_L],[
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
25 m4_foreach([__var__], [$@], [AC_SUBST(__var__)])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
26 ])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
27
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
28 AC_DEFUN([DC_DOVECOT],[
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
29 AC_ARG_WITH(dovecot,
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
30 AS_HELP_STRING([--with-dovecot=DIR],[Dovecot base directory [LIBDIR/dovecot]]),
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
31 [ dovecotdir="$withval" ], [ dovecotdir="${libdir}"/dovecot ]
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
32 )
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
33
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
34 AC_MSG_CHECKING([for dovecot-config in "$dovecotdir"])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
35 AS_IF([test -f "$dovecotdir/dovecot-config"],[
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
36 AC_MSG_RESULT([$dovecotdir/dovecot-config])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
37 ],[
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
38 AC_MSG_RESULT([not found])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
39 AC_MSG_NOTICE([])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
40 AC_MSG_NOTICE([Use --with-dovecot=DIR to provide the path to the dovecot-config file.])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
41 AC_MSG_ERROR([dovecot-config not found])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
42 ])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
43
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
44 eval `grep \
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
45 -e ^dovecot_[[a-z]]*= \
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
46 -e ^LIBDOVECOT[[A-Z_]]*= \
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
47 "$dovecotdir"/dovecot-config`
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
48 AX_SUBST_L([dovecot_moduledir], [dovecot_pkgincludedir], [dovecot_pkglibexecdir], [dovecot_pkglibdir], [dovecot_docdir])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
49 AX_SUBST_L([LIBDOVECOT], [LIBDOVECOT_LOGIN], [LIBDOVECOT_SQL], [LIBDOVECOT_STORAGE])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
50 AX_SUBST_L([LIBDOVECOT_DEPS], [LIBDOVECOT_LOGIN_DEPS], [LIBDOVECOT_SQL_DEPS], [LIBDOVECOT_STORAGE_DEPS])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
51 AX_SUBST_L([LIBDOVECOT_INCLUDE], [LIBDOVECOT_LDA_INCLUDE], [LIBDOVECOT_SERVICE_INCLUDE], [LIBDOVECOT_STORAGE_INCLUDE], [LIBDOVECOT_LOGIN_INCLUDE])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
52
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
53 _cppflags=$CPPFLAGS
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
54 CPPFLAGS=$LIBDOVECOT_INCLUDE
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
55 AC_MSG_CHECKING([dovecot version])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
56 AC_RUN_IFELSE([
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
57 AC_LANG_PROGRAM([[
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
58 /* needed for dovecot to include its own config.h ... */
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
59 #define HAVE_CONFIG_H
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
60 #include "lib.h"
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
61 #include <stdlib.h>
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
62 #include <stdio.h>
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
63 ]],[[
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
64 printf("%s\n", DOVECOT_VERSION);
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
65 ]])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
66 ],[
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
67 DOVECOT_VERSION=`./conftest$EXEEXT`
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
68 ],[
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
69 AC_MSG_FAILURE([unable to determine dovecot version])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
70 ])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
71 AC_SUBST([DOVECOT_VERSION])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
72 CPPFLAGS=$_cppflags
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
73 AS_UNSET([_cppflags])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
74
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
75 m4_foreach_w([__flag__],[$1],[
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
76 # Inside m4_foreach __flag__ is a variable!
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
77 # This expands *entirely* for every flag in the argument list!
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
78 AS_CASE([__flag__],
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
79 [
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
80 # assume an unknown flag is a version number
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
81 AC_MSG_CHECKING([whether dovecot is newer than __flag__])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
82 AS_VERSION_COMPARE([$DOVECOT_VERSION],[__flag__],[
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
83 AC_MSG_RESULT([no])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
84 AC_MSG_ERROR([at least dovecot-flag is required, your version seems older])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
85 ],[
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
86 AC_MSG_RESULT([yes])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
87 ],[
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
88 AC_MSG_RESULT([yes])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
89 ])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
90 ])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
91 ])
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
92
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
93 DC_PLUGIN_DEPS
80a11f8650a4 Added dovecot.m4 file that external plugins can use.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
94 ])