286N/A# Be sure to update ABI version also if anything changes that might require
286N/A# recompiling plugins. Most importantly that means if any structs are changed.
286N/AAC_DEFINE_UNQUOTED([DOVECOT_ABI_VERSION], "
2.3.ABIv0($PACKAGE_VERSION)", [Dovecot ABI version])
286N/AAC_CONFIG_MACRO_DIR([m4])
286N/AAM_INIT_AUTOMAKE([foreign])
286N/AACLOCAL_AMFLAGS='-I $(top_srcdir)/m4'
286N/AAC_SUBST(ACLOCAL_AMFLAGS)
286N/AAC_ARG_ENABLE(hardening,
286N/AAS_HELP_STRING([--disable-hardening=no], [Disable various hardenings (default: no)]),
286N/A disable_hardening=$enableval,
286N/AAC_MSG_CHECKING([Whether to disable hardening])
286N/AAC_MSG_RESULT([$disable_hardening])
286N/AAC_ARG_ENABLE(devel-checks,
286N/AAS_HELP_STRING([--enable-devel-checks], [Enable some extra expensive checks for developers]),
286N/A if test x$enableval = xyes; then
286N/A AC_DEFINE(DEBUG,, [Build with extra debugging checks])
286N/AAS_HELP_STRING([--enable-asserts], [Enable asserts (default)]),
286N/A if test x$enableval = xno; then
286N/A AC_DEFINE(DISABLE_ASSERTS,, [Disable asserts])
286N/AAC_ARG_WITH(shared-libs,
286N/AAS_HELP_STRING([--with-shared-libs], [Link binaries using shared Dovecot libraries (default)]),
286N/A want_shared_libs=$withval,
286N/AAM_CONDITIONAL(BUILD_SHARED_LIBS, test "$want_shared_libs" = "yes")
286N/AAS_HELP_STRING([--with-mem-align=BYTES], [Set the memory alignment (default: 8)]),
AS_HELP_STRING([--with-ioloop=IOLOOP], [Specify the I/O loop method to use (epoll, kqueue, poll; best for the fastest available; default is best)]),
AS_HELP_STRING([--with-notify=NOTIFY], [Specify the file system notification method to use (inotify, kqueue, none; default is detected in the above order)]),
AS_HELP_STRING([--with-nss], [Build with NSS module support (auto)]),
TEST_WITH(nss, $withval),
AS_HELP_STRING([--with-shadow], [Build with shadow password support (auto)]),
TEST_WITH(shadow, $withval),
AS_HELP_STRING([--with-pam], [Build with PAM support (auto)]),
TEST_WITH(pam, $withval),
AS_HELP_STRING([--with-bsdauth], [Build with BSD authentication support (auto)]),
TEST_WITH(bsdauth, $withval),
AS_HELP_STRING([--with-gssapi=yes|plugin Build with GSSAPI authentication support]),
TEST_WITH(gssapi, $withval, plugin),
AS_HELP_STRING([--with-sia], [Build with Tru64 SIA support]),
TEST_WITH(sia, $withval),
AS_HELP_STRING([--with-ldap=yes|plugin], [Build with LDAP support]),
TEST_WITH(ldap, $withval, plugin),
AS_HELP_STRING([--with-vpopmail], [Build with vpopmail support (auto)]),
if test x$withval = xno; then
if test x$withval = xyes || test x$withval = xauto; then
vpopmail_home="`echo ~vpopmail`"
# Berkeley DB support is more or less broken. Disabled for now.
#AS_HELP_STRING([--with-db], [Build with Berkeley DB support]),
# TEST_WITH(db, $withval),
AS_HELP_STRING([--with-cdb], [Build with CDB support]),
TEST_WITH(cdb, $withval),
dnl The --with-sql is useful only if Dovecot is being built with all the SQL
dnl drivers as modules. If any SQL driver is built-in, this option is ignored.
AS_HELP_STRING([--with-sql=yes|plugin], [Build with generic SQL support]),
TEST_WITH(sql, $withval, plugin),
AS_HELP_STRING([--with-pgsql], [Build with PostgreSQL driver support]),
TEST_WITH(pgsql, $withval),
AS_HELP_STRING([--with-mysql], [Build with MySQL driver support]),
TEST_WITH(mysql, $withval),
AS_HELP_STRING([--with-sqlite], [Build with SQLite3 driver support]),
TEST_WITH(sqlite, $withval),
AS_HELP_STRING([--with-cassandra], [Build with Cassandra driver support]),
TEST_WITH(cassandra, $withval),
AS_HELP_STRING([--with-lucene], [Build with CLucene full text search support]),
TEST_WITH(lucene, $withval),
AM_CONDITIONAL(BUILD_LUCENE, test "$want_lucene" = "yes")
AS_HELP_STRING([--with-stemmer], [Build with libstemmer support (for FTS) (auto)]),
TEST_WITH(stemmer, $withval),
AS_HELP_STRING([--with-textcat], [Build with libtextcat support (for FTS) (auto)]),
TEST_WITH(textcat, $withval),
AS_HELP_STRING([--with-icu], [Build with libicu support (for FTS normalization) (auto)]),
AS_HELP_STRING([--with-solr], [Build with Solr full text search support]),
TEST_WITH(solr, $withval),
AS_HELP_STRING([--with-zlib], [Build with zlib compression support (auto)]),
TEST_WITH(zlib, $withval),
AS_HELP_STRING([--with-bzlib], [Build with bzlib compression support (auto)]),
TEST_WITH(bzlib, $withval),
AS_HELP_STRING([--with-lzma], [Build with LZMA compression support (auto)]),
TEST_WITH(lzma, $withval),
AS_HELP_STRING([--with-lz4], [Build with LZ4 compression support (auto)]),
TEST_WITH(lz4, $withval),
AS_HELP_STRING([--with-libcap], [Build with libcap support (Dropping capabilities) (auto)]),
TEST_WITH(libcap, $withval),
AS_HELP_STRING([--with-libwrap], [Build with libwrap, ie. TCP-wrappers]),
TEST_WITH(libwrap, $withval),
AS_HELP_STRING([--with-ssl=gnutls|openssl], [Build with GNUTLS or OpenSSL (default)]),
if test x$withval = xno; then
elif test x$withval = xgnutls; then
AC_ERROR([GNUTLS support is broken currently])
elif test x$withval = xopenssl; then
elif test x$withval = xyes; then
AC_ERROR([--with-ssl: Invalid value: $withval])
AS_HELP_STRING([--with-ssldir=DIR], [SSL base directory for certificates (
/etc/ssl)]),
AC_ARG_WITH([systemdsystemunitdir],
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files (auto=detect)]), [
if test "$withval" = "auto"; then
systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
elif test "$withval" != "no"; then
systemdsystemunitdir=$withval
if test "$systemdsystemunitdir" != ""; then
AC_SUBST(systemdsystemunitdir)
AC_DEFINE(HAVE_SYSTEMD,, [Define if you want to use systemd socket activation])
AM_CONDITIONAL(HAVE_SYSTEMD, test "$systemdsystemunitdir" != "")
AS_HELP_STRING([--with-gc], [Use Boehm garbage collector]),
AS_HELP_STRING([--with-storages], [Build with specified mail storage formats (mdbox sdbox maildir mbox cydir imapc pop3c)]), [
if test "$withval" = "yes" || test "$withval" = "no"; then
AC_MSG_ERROR([--with-storages needs storage list as parameter])
mail_storages="shared `echo "$withval"|sed 's/,/ /g'`" ],
mail_storages="shared mdbox sdbox maildir mbox cydir imapc pop3c")
mail_storages="$mail_storages raw fail"
duplicates=`(for i in $mail_storages; do echo $i; done)|sort|uniq -d|xargs echo`
if test "$duplicates" != ""; then
AC_ERROR([Duplicate --with-storages: $duplicates])
AS_HELP_STRING([--with-docs], [Install documentation (default)]),
if test x$withval = xno; then
AM_CONDITIONAL(BUILD_DOCS, test "$want_docs" = "yes")
dnl always enable all of the passbs and userdbs that don't require extra libs
AC_PROG_CXX # lucene plugin needs this
AC_DEFINE_UNQUOTED(DOVECOT_NAME, "$PACKAGE_NAME", [Dovecot name])
AC_DEFINE_UNQUOTED(DOVECOT_STRING, "$PACKAGE_STRING", [Dovecot string])
AC_DEFINE_UNQUOTED(DOVECOT_VERSION, "$PACKAGE_VERSION", [Dovecot version])
AC_DEFINE([DOVECOT_VERSION_MAJOR], regexp(AC_PACKAGE_VERSION, [^\([0-9]+\)\.\([0-9]+\)], [\1]), [Dovecot major version])
AC_DEFINE([DOVECOT_VERSION_MINOR], regexp(AC_PACKAGE_VERSION, [^\([0-9]+\)\.\([0-9]+\)], [\2]), [Dovecot minor version])
dnl * after -lsocket and -lnsl tests, inet_aton() may be in them
AC_CHECK_FUNCS(fcntl flock lockf inet_aton sigaction getpagesize madvise \
strcasecmp stricmp vsyslog writev pread uname unsetenv \
setrlimit setproctitle seteuid setreuid setegid setresgid \
getmntinfo setpriority quotactl getmntent kqueue kevent \
backtrace_symbols walkcontext dirfd clearenv \
malloc_usable_size glob fallocate posix_fadvise \
getpeereid getpeerucred inotify_init timegm)
dnl * OS specific options
CFLAGS="$CFLAGS -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED"
LDFLAGS="$LDFLAGS -Wl,+b,:"
AC_DEFINE(PREAD_BROKEN,, [Define if
pread/pwrite implementation is broken])
AC_DEFINE(PROCTITLE_HACK,, [Define if process title can be changed by modifying argv])
AC_CHECK_SIZEOF(long long)
AC_DEFINE(HAVE_UOFF_T,, [Define if you have a native uoff_t type])
AC_TYPEOF(off_t, long int long-long)
if test "$have_uoff_t" != "yes"; then
AC_DEFINE(UOFF_T_INT,, [Define if off_t is int])
offt_bits=`expr 8 \* $ac_cv_sizeof_int`
if test "$have_uoff_t" != "yes"; then
AC_DEFINE(UOFF_T_LONG,, [Define if off_t is long])
offt_bits=`expr 8 \* $ac_cv_sizeof_long`
if test "$have_uoff_t" != "yes"; then
AC_DEFINE(UOFF_T_LONG_LONG,, [Define if off_t is long long])
offt_bits=`expr 8 \* $ac_cv_sizeof_long_long`
AC_MSG_ERROR([Unsupported off_t type])
AC_DEFINE_UNQUOTED(PRIuUOFF_T, "$uofft_fmt", [printf() format for uoff_t])
AC_DEFINE_UNQUOTED(SSIZE_T_MAX, $ssizet_max, [Maximum value of ssize_t])
AC_DEFINE_UNQUOTED(PRIuSIZE_T, "$sizet_fmt", [printf() format for size_t])
dnl some systems don't have
stdint.h, but still have some of the types
AC_CHECKTYPE2(uintmax_t, [$stdint_include])
if test $i_cv_type_uintmax_t = yes; then
AC_DEFINE(HAVE_UINTMAX_T,, [Define if you have uintmax_t (C99 type)])
dnl use separate check, eg. Solaris 8 has uintmax_t but not uint_fast32_t
AC_CHECKTYPE2(uint_fast32_t, [$stdint_include])
if test $i_cv_type_uint_fast32_t = yes; then
AC_DEFINE(HAVE_UINT_FAST32_T,, [Define if you have uint_fast32_t (C99 type)])
if test $i_cv_type_socklen_t = yes; then
AC_DEFINE(HAVE_SOCKLEN_T,, [Define to 'int' if you don't have socklen_t])
AC_DEFINE_UNQUOTED(MEM_ALIGN_SIZE, $mem_align, [Required memory alignment])
AC_ARG_WITH(random-source,
AS_HELP_STRING([--with-random-source=file], [Device file to use as random source (default=
/dev/urandom)]),
AC_MSG_CHECKING([for $random_source])
if test -c $random_source || test -s $random_source; then
AC_DEFINE_UNQUOTED(DEV_URANDOM_PATH, ["$random_source"], [Path to random source])
AC_MSG_ERROR([$random_source not found or is not character device - please provide path for random source device])
if test "$have_random_source" != "yes"; then
DOVECOT_C_FLEXIBLE_ARRAY_MEMBER
dnl ** userdb and passdb checks
DOVECOT_WANT_CHECKPASSWORD
if test $have_modules = yes; then
AC_DEFINE(HAVE_MODULES,, [Define if you have dynamic module support])
module=yes eval MODULE_SUFFIX=$shrext_cmds
if test "$MODULE_SUFFIX" = ""; then
AC_DEFINE_UNQUOTED(MODULE_SUFFIX,"$MODULE_SUFFIX", [Dynamic module suffix])
AC_SUBST(CASSANDRA_CFLAGS)
mailbox_list_drivers="maildir imapdir fs index none shared"
for storage in $mail_storages; do
LINKED_STORAGE_LIBS="$LINKED_STORAGE_LIBS `eval echo \\$${storage}_libs`"
if test $storage = sdbox; then
if test $storage = mdbox; then
if test $storage = sdbox || test $storage = mdbox; then
LINKED_STORAGE_LIBS="$LINKED_STORAGE_LIBS $dbox_common_libs"
if test $storage = imapc; then
mailbox_list_drivers="$mailbox_list_drivers imapc"
AC_SUBST(LINKED_STORAGE_LIBS)
AC_SUBST(LINKED_STORAGE_LDADD)
AC_SUBST(mailbox_list_drivers)
AC_DEFINE_UNQUOTED(MAIL_STORAGES, "$mail_storages", [List of compiled in mail storages])
if test $have_sdbox = yes; then
mail_storages="$mail_storages dbox"
if test $have_mdbox = yes; then
mail_storages="$mail_storages mdbox_deleted"
dnl ** Shared libraries usage
if test "$want_shared_libs" = "yes"; then
LIBDOVECOT="$LIBDOVECOT_DEPS \$(MODULE_LIBS)"
LIBDOVECOT_DEPS="$LIBDOVECOT_LA_LIBS"
LIBDOVECOT="$LIBDOVECOT_DEPS \$(LIBICONV) \$(MODULE_LIBS)"
if test $want_ldap != no; then
LIBDOVECOT_STORAGE="$LIBDOVECOT_STORAGE_DEPS"
AC_SUBST(LIBDOVECOT_LA_LIBS)
AC_SUBST(LIBDOVECOT_DEPS)
AC_SUBST(LIBDOVECOT_STORAGE)
AC_SUBST(LIBDOVECOT_STORAGE_DEPS)
AC_SUBST(LIBDOVECOT_LOGIN)
AC_SUBST(LIBDOVECOT_COMPRESS)
AC_SUBST(LIBDOVECOT_DSYNC)
AC_SUBST(LIBDOVECOT_LDAP)
AC_SUBST(LIBDOVECOT_LIBFTS)
AC_SUBST(LIBDOVECOT_LIBFTS_DEPS)
for driver in $sql_drivers; do
if test "$driver" = "pgsql"; then
AC_DEFINE(BUILD_PGSQL,, [Built-in PostgreSQL support])
elif test "$driver" = "mysql"; then
AC_DEFINE(BUILD_MYSQL,, [Built-in MySQL support])
elif test "$driver" = "sqlite"; then
AC_DEFINE(BUILD_SQLITE,, [Built-in SQLite support])
elif test "$driver" = "cassandra"; then
AC_DEFINE(BUILD_CASSANDRA,, [Built-in Cassandra support])
if test $build_pgsql = no; then
not_sql_drivers="$not_sql_drivers pgsql"
if test $build_mysql = no; then
not_sql_drivers="$not_sql_drivers mysql"
if test $build_sqlite = no; then
not_sql_drivers="$not_sql_drivers sqlite"
if test $build_cassandra = no; then
not_sql_drivers="$not_sql_drivers cassandra"
AM_CONDITIONAL(BUILD_PGSQL, test "$build_pgsql" = "yes")
AM_CONDITIONAL(BUILD_MYSQL, test "$build_mysql" = "yes")
AM_CONDITIONAL(BUILD_SQLITE, test "$build_sqlite" = "yes")
AM_CONDITIONAL(BUILD_CASSANDRA, test "$build_cassandra" = "yes")
AM_CONDITIONAL(SQL_PLUGINS, test "$want_sql" = "plugin")
AM_CONDITIONAL(BUILD_ZLIB_PLUGIN, test "$have_compress_lib" = "yes")
if test $have_lucene = no; then
not_fts="$not_fts lucene"
if test $have_solr = no; then
dnl get a list of setting .[ch] files, but list .h files first
FILES1=`find $
srcdir/src -name '*settings.[[ch]]'|grep "$
srcdir/src/lib-" | sed 's/^\(.*\)\(.\)$/\2 \1\2/' | grep -v 'lib-master.*c$' | sort -r | sed s/^..//`
FILES2=`find $
srcdir/src -name '*settings.[[ch]]'|grep -v "$
srcdir/src/lib-" | sed 's/^\(.*\)\(.\)$/\2 \1\2/' | grep -v all-settings | sort -r | sed s/^..//`
SETTING_FILES=`echo $FILES1 $FILES2 | sed -e s,$
srcdir/src,./src,g -e 's,./src,$(top_srcdir)/src,g'`
dnl IDLE doesn't really belong to banner. It's there just to make Blackberries
dnl happy, because otherwise BIS server disables push email.
capability_banner="IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE"
capability="$capability_banner SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE"
AC_DEFINE_UNQUOTED(CAPABILITY_STRING, "$capability", [IMAP capabilities])
AC_DEFINE_UNQUOTED(CAPABILITY_BANNER_STRING, "$capability_banner", [IMAP capabilities advertised in banner])
CFLAGS="$CFLAGS $EXTRA_CFLAGS"
BINARY_LDFLAGS="$PIE_LDFLAGS $RELRO_LDFLAGS"
BINARY_CFLAGS="$PIE_CFLAGS"
NOPLUGIN_LDFLAGS="-no-undefined"
if test "$with_gnu_ld" = yes; then
NOPLUGIN_LDFLAGS="$NOPLUGIN_LDFLAGS -Wl,--as-needed"
LDFLAGS="\$(NOPLUGIN_LDFLAGS) $LDFLAGS"
AC_SUBST(NOPLUGIN_LDFLAGS)
if test "$docdir" = ""; then
dnl docdir supported only by autoconf v2.59c and later
docdir='${datadir}/doc/${PACKAGE_TARNAME}'
AC_SUBST(abs_top_builddir)
if test "$want_sql" = "plugin"; then
sql_drivers="$sql_drivers (plugins)"
not_passdb=`echo "$not_passdb"|sed 's/ / -/g'`
not_userdb=`echo "$not_userdb"|sed 's/ / -/g'`
not_sql_drivers=`echo "$not_sql_drivers"|sed 's/ / -/g'`
not_fts=`echo "$not_fts"|sed 's/ / -/g'`
echo "Install prefix . : $prefix"
echo "File offsets ... : ${offt_bits}bit"
echo "I/O polling .... : $ioloop"
echo "I/O notifys .... : $have_notify"
echo "SSL ............ : $have_ssl"
echo "GSSAPI ......... : $have_gssapi"
echo "passdbs ........ :$passdb"
echo "CFLAGS ......... : $CFLAGS"
if test "$not_passdb" != ""; then
echo "userdbs ........ :$userdb"
if test "$not_userdb" != ""; then
echo "SQL drivers .... :$sql_drivers"
if test "$not_sql_drivers" != ""; then
echo " :$not_sql_drivers"
echo "Full text search :$fts"
if test "$not_fts" != ""; then