1AC_PREREQ([2.59])
2
3# Be sure to update ABI version also if anything changes that might require
4# recompiling plugins. Most importantly that means if any structs are changed.
5AC_INIT([Dovecot],[2.3.17],[dovecot@dovecot.org])
6AC_DEFINE_UNQUOTED([DOVECOT_ABI_VERSION], "2.3.ABIv17($PACKAGE_VERSION)", [Dovecot ABI version])
7
8AC_CONFIG_SRCDIR([src])
9AC_CONFIG_MACRO_DIR([m4])
10
11AM_INIT_AUTOMAKE([foreign])
12
13AM_MAINTAINER_MODE
14PKG_PREREQ([0.28])
15PKG_PROG_PKG_CONFIG
16
17ACLOCAL_AMFLAGS='-I $(top_srcdir)/m4'
18AC_SUBST(ACLOCAL_AMFLAGS)
19
20AC_ARG_ENABLE(devel-checks,
21AS_HELP_STRING([--enable-devel-checks], [Enable some extra expensive checks for developers]),
22	if test x$enableval = xyes; then
23		AC_DEFINE(DEBUG,, [Build with extra debugging checks])
24		want_devel_checks=yes
25	fi)
26
27AC_ARG_ENABLE(static-checker,
28AS_HELP_STRING([--enable-static-checker], [Enable code to be used when building with static code analyzer]),
29	if test x$enableval = xyes; then
30		AC_DEFINE(STATIC_CHECKER,, [Building with static code analyzer])
31	fi)
32
33AC_ARG_ENABLE(asserts,
34AS_HELP_STRING([--enable-asserts], [Enable asserts (default)]),
35	if test x$enableval = xno; then
36		AC_DEFINE(DISABLE_ASSERTS,, [Disable asserts])
37	fi)
38
39AC_ARG_WITH(shared-libs,
40AS_HELP_STRING([--with-shared-libs], [Link binaries using shared Dovecot libraries (default)]),
41	want_shared_libs=$withval,
42	want_shared_libs=yes)
43AM_CONDITIONAL(BUILD_SHARED_LIBS, test "$want_shared_libs" = "yes")
44
45AC_ARG_WITH(mem-align,
46AS_HELP_STRING([--with-mem-align=BYTES], [Set the memory alignment (default: 8)]),
47	mem_align=$withval,
48	mem_align=8)
49
50AC_ARG_WITH(ioloop,
51AS_HELP_STRING([--with-ioloop=IOLOOP], [Specify the I/O loop method to use (epoll, kqueue, poll; best for the fastest available; default is best)]),
52	ioloop=$withval,
53	ioloop=best)
54
55AC_ARG_WITH(notify,
56AS_HELP_STRING([--with-notify=NOTIFY], [Specify the file system notification method to use (inotify, kqueue, none; default is detected in the above order)]),
57	notify=$withval,
58	notify=)
59
60AC_ARG_WITH(nss,
61AS_HELP_STRING([--with-nss], [Build with NSS module support (auto)]),
62  TEST_WITH(nss, $withval),
63  want_nss=auto)
64
65AC_ARG_WITH(shadow,
66AS_HELP_STRING([--with-shadow], [Build with shadow password support (auto)]),
67  TEST_WITH(shadow, $withval),
68  want_shadow=auto)
69
70AC_ARG_WITH(pam,
71AS_HELP_STRING([--with-pam], [Build with PAM support (auto)]),
72  TEST_WITH(pam, $withval),
73  want_pam=auto)
74
75AC_ARG_WITH(bsdauth,
76AS_HELP_STRING([--with-bsdauth], [Build with BSD authentication support (auto)]),
77  TEST_WITH(bsdauth, $withval),
78  want_bsdauth=auto)
79
80AC_ARG_WITH(gssapi,
81AS_HELP_STRING([--with-gssapi=yes|plugin Build with GSSAPI authentication support]),
82  TEST_WITH(gssapi, $withval, plugin),
83  want_gssapi=no)
84
85AC_ARG_WITH(ldap,
86AS_HELP_STRING([--with-ldap=yes|plugin], [Build with LDAP support]),
87  TEST_WITH(ldap, $withval, plugin),
88  want_ldap=no)
89
90AC_ARG_WITH(libunwind,
91AS_HELP_STRING([--with-libunwind], [Build with libunwind support (auto)]),
92  TEST_WITH(libunwind, $withval),
93  want_libunwind=auto)
94
95# Berkeley DB support is more or less broken. Disabled for now.
96#AC_ARG_WITH(db,
97#AS_HELP_STRING([--with-db], [Build with Berkeley DB support]),
98#  TEST_WITH(db, $withval),
99#  want_db=no)
100want_db=no
101
102AC_ARG_WITH(cdb,
103AS_HELP_STRING([--with-cdb], [Build with CDB support]),
104  TEST_WITH(cdb, $withval),
105  want_cdb=no)
106
107dnl The --with-sql is useful only if Dovecot is being built with all the SQL
108dnl drivers as modules. If any SQL driver is built-in, this option is ignored.
109AC_ARG_WITH(sql,
110AS_HELP_STRING([--with-sql=yes|plugin], [Build with generic SQL support]),
111  TEST_WITH(sql, $withval, plugin),
112  want_sql=no)
113
114AC_ARG_WITH(pgsql,
115AS_HELP_STRING([--with-pgsql], [Build with PostgreSQL driver support]),
116  TEST_WITH(pgsql, $withval),
117  want_pgsql=no)
118
119AC_ARG_WITH(mysql,
120AS_HELP_STRING([--with-mysql], [Build with MySQL driver support]),
121  TEST_WITH(mysql, $withval),
122  want_mysql=no)
123
124AC_ARG_WITH(sqlite,
125AS_HELP_STRING([--with-sqlite], [Build with SQLite3 driver support]),
126  TEST_WITH(sqlite, $withval),
127  want_sqlite=no)
128
129AC_ARG_WITH(cassandra,
130AS_HELP_STRING([--with-cassandra], [Build with Cassandra driver support]),
131  TEST_WITH(cassandra, $withval),
132  want_cassandra=no)
133
134AC_ARG_WITH(lucene,
135AS_HELP_STRING([--with-lucene], [Build with CLucene full text search support]),
136  TEST_WITH(lucene, $withval),
137  want_lucene=no)
138AM_CONDITIONAL(BUILD_LUCENE, test "$want_lucene" = "yes")
139
140AC_ARG_WITH(stemmer,
141AS_HELP_STRING([--with-stemmer], [Build with libstemmer support (for FTS) (auto)]),
142  TEST_WITH(stemmer, $withval),
143  want_stemmer=auto)
144
145AC_ARG_WITH(textcat,
146AS_HELP_STRING([--with-textcat], [Build with libtextcat support (for FTS) (auto)]),
147  TEST_WITH(textcat, $withval),
148  want_textcat=auto)
149
150AC_ARG_WITH(icu,
151AS_HELP_STRING([--with-icu], [Build with libicu support (for FTS normalization) (auto)]),
152  want_icu=$withval,
153  want_icu=auto)
154
155AC_ARG_WITH(solr,
156AS_HELP_STRING([--with-solr], [Build with Solr full text search support]),
157  TEST_WITH(solr, $withval),
158  want_solr=no)
159
160AC_ARG_WITH(sodium,
161AS_HELP_STRING([--with-sodium], [Build with libsodium support (enables argon2, default: auto)]),
162  TEST_WITH(sodium, $withval),
163  want_sodium=auto)
164
165AC_ARG_WITH(zlib,
166AS_HELP_STRING([--with-zlib], [Build with zlib compression support (auto)]),
167  TEST_WITH(zlib, $withval),
168  want_zlib=auto)
169
170AC_ARG_WITH(bzlib,
171AS_HELP_STRING([--with-bzlib], [Build with bzlib compression support (auto)]),
172  TEST_WITH(bzlib, $withval),
173  want_bzlib=auto)
174
175AC_ARG_WITH(lzma,
176AS_HELP_STRING([--with-lzma], [Build with LZMA decompression support (auto)]),
177  TEST_WITH(lzma, $withval),
178  want_lzma=auto)
179
180AC_ARG_WITH(lz4,
181AS_HELP_STRING([--with-lz4], [Build with LZ4 compression support (auto)]),
182  TEST_WITH(lz4, $withval),
183  want_lz4=auto)
184
185AC_ARG_WITH(zstd,
186AS_HELP_STRING([--with-zstd], [Build with ZSTD compression support (auto)]),
187  TEST_WITH(zstd, $withval),
188  want_zstd=auto)
189
190AC_ARG_WITH(libcap,
191AS_HELP_STRING([--with-libcap], [Build with libcap support (Dropping capabilities) (auto)]),
192  TEST_WITH(libcap, $withval),
193  want_libcap=auto)
194
195AC_ARG_WITH(libwrap,
196AS_HELP_STRING([--with-libwrap], [Build with libwrap, ie. TCP-wrappers]),
197  TEST_WITH(libwrap, $withval),
198  want_libwrap=no)
199
200AC_ARG_WITH(ssl,
201AS_HELP_STRING([--with-ssl=gnutls|openssl], [Build with GNUTLS or OpenSSL (default)]),
202	if test x$withval = xno; then
203		want_gnutls=no
204		want_openssl=no
205	elif test x$withval = xgnutls; then
206		AC_ERROR([GNUTLS support is broken currently])
207		want_gnutls=yes
208		want_openssl=no
209	elif test x$withval = xopenssl; then
210		want_gnutls=no
211		want_openssl=yes
212	elif test x$withval = xyes; then
213		want_gnutls=no
214		want_openssl=yes
215	else
216		AC_ERROR([--with-ssl: Invalid value: $withval])
217	fi, [
218		want_gnutls=no
219		want_openssl=auto
220	])
221
222AC_ARG_WITH(ssldir,
223AS_HELP_STRING([--with-ssldir=DIR], [SSL base directory for certificates (/etc/ssl)]),
224	ssldir="$withval",
225	ssldir=/etc/ssl
226)
227AC_SUBST(ssldir)
228
229AC_ARG_WITH(rundir,
230AS_HELP_STRING([--with-rundir=DIR], [Runtime data directory (LOCALSTATEDIR/run/dovecot)]),
231	rundir="$withval",
232	rundir=$localstatedir/run/$PACKAGE
233)
234AC_SUBST(rundir)
235
236AC_ARG_WITH(statedir,
237AS_HELP_STRING([--with-statedir=DIR], [Permanent data directory (LOCALSTATEDIR/lib/dovecot)]),
238	statedir="$withval",
239	statedir=$localstatedir/lib/$PACKAGE
240)
241AC_SUBST(statedir)
242
243AC_ARG_WITH([systemd],
244   AS_HELP_STRING([--with-systemd], [Build with systemd support (default=auto)]),
245   want_systemd="$withval",
246   want_systemd="auto"
247)
248
249DOVECOT_WANT_SYSTEMD
250
251dovecot_moduledir="$libdir/dovecot"
252DC_DOVECOT_MODULEDIR
253
254AC_ARG_WITH(docs,
255AS_HELP_STRING([--with-docs], [Install documentation (default)]),
256	if test x$withval = xno; then
257		want_docs=no
258	else
259		want_docs=yes
260	fi,
261	want_docs=yes)
262AM_CONDITIONAL(BUILD_DOCS, test "$want_docs" = "yes")
263
264dnl always enable all of the passbs and userdbs that don't require extra libs
265want_passwd=yes
266want_passwd_file=yes
267want_checkpassword=yes
268want_prefetch_userdb=yes
269
270AC_ISC_POSIX
271AC_PROG_CC
272AC_PROG_CPP
273AC_PROG_CXX # lucene plugin needs this
274AC_CHECK_TOOL([FLEX],[flex],[:])
275AC_CHECK_TOOL([BISON],[bison],[:])
276AS_IF([test "$BISON" = ":" && test ! -e src/lib/event-filter-parser.h],
277  AC_MSG_ERROR([Bison is required when building from git])
278])
279AS_IF([test "$FLEX" = ":" && test ! -e src/lib/event-filter-lexer.c],
280  AC_MSG_ERROR([flex is required when building from git])
281])
282AC_HEADER_STDC
283AC_C_INLINE
284AC_PROG_LIBTOOL
285AM_ICONV
286
287# SIZE_MAX is missing without this
288CXXFLAGS="$CXXFLAGS -D__STDC_LIMIT_MACROS"
289
290AC_DEFINE_UNQUOTED(DOVECOT_NAME, "$PACKAGE_NAME", [Dovecot name])
291AC_DEFINE_UNQUOTED(DOVECOT_STRING, "$PACKAGE_STRING", [Dovecot string])
292AC_DEFINE_UNQUOTED(DOVECOT_VERSION, "$PACKAGE_VERSION", [Dovecot version])
293
294AC_DEFINE([DOVECOT_VERSION_MAJOR], regexp(AC_PACKAGE_VERSION, [^\([0-9]+\)\.\([0-9]+\)], [\1]), [Dovecot major version])
295AC_DEFINE([DOVECOT_VERSION_MINOR], regexp(AC_PACKAGE_VERSION, [^\([0-9]+\)\.\([0-9]+\)], [\2]), [Dovecot minor version])
296
297AC_CHECK_HEADERS(strings.h stdint.h unistd.h dirent.h malloc.h \
298  sys/uio.h sys/sysmacros.h sys/resource.h sys/select.h libgen.h \
299  sys/quota.h sys/fs/ufs_quota.h ufs/ufs/quota.h jfs/quota.h \
300  quota.h sys/fs/quota_common.h \
301  mntent.h sys/mnttab.h sys/event.h sys/time.h sys/mkdev.h linux/dqblk_xfs.h \
302  xfs/xqm.h execinfo.h ucontext.h malloc_np.h sys/utsname.h sys/vmount.h \
303  sys/utsname.h glob.h linux/falloc.h ucred.h sys/ucred.h crypt.h)
304
305CC_CLANG
306AC_LD_WHOLE_ARCHIVE
307DC_DOVECOT_HARDENING
308DC_DOVECOT_FUZZER
309DC_DOVECOT_CFLAGS
310
311DOVECOT_NSL
312DOVECOT_FDATASYNC
313DOVECOT_LIBCAP
314DOVECOT_LIBWRAP
315
316DOVECOT_RANDOM
317DOVECOT_ARC4RANDOM
318
319AC_DEFINE(PACKAGE_WEBPAGE, "http://www.dovecot.org/", [Support URL])
320
321dnl * after -lsocket and -lnsl tests, inet_aton() may be in them
322AC_CHECK_FUNCS(fcntl flock lockf inet_aton sigaction getpagesize madvise \
323               strcasecmp stricmp vsyslog writev pread uname \
324	       setrlimit setproctitle seteuid setreuid setegid setresgid \
325	       getmntinfo setpriority quotactl getmntent kqueue kevent \
326	       backtrace_symbols walkcontext dirfd clearenv \
327	       malloc_usable_size glob fallocate posix_fadvise \
328	       getpeereid getpeerucred inotify_init timegm)
329
330DOVECOT_SOCKPEERCRED
331DOVECOT_CLOCK_GETTIME
332
333DOVECOT_TYPEOF
334DOVECOT_IOLOOP
335DOVECOT_NOTIFY
336
337DOVECOT_GLIBC
338
339dnl * OS specific options
340DC_PLUGIN_DEPS
341case "$host_os" in
342	hpux*)
343		CFLAGS="$CFLAGS -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED"
344		# for getting fd_send/fd_recv working:
345		LDFLAGS="$LDFLAGS -Wl,+b,:"
346		LIBS="-lxnet $LIBS"
347		AC_DEFINE(PREAD_BROKEN,, [Define if pread/pwrite implementation is broken])
348		;;
349	linux*|darwin*)
350		AC_DEFINE(PROCTITLE_HACK,, [Define if process title can be changed by modifying argv])
351		;;
352	*)
353		;;
354esac
355
356AC_CHECK_SIZEOF(int)
357AC_CHECK_SIZEOF(long)
358AC_CHECK_SIZEOF(void *)
359AC_CHECK_SIZEOF(long long)
360
361AC_SYS_LARGEFILE
362AC_CHECK_TYPES(_Bool)
363
364AC_CHECK_TYPE(uoff_t, [
365  have_uoff_t=yes
366  AC_DEFINE(HAVE_UOFF_T,, [Define if you have a native uoff_t type])
367], [
368  have_uoff_t=no
369])
370
371AC_TYPEOF(off_t, long int long-long)
372case "$typeof_off_t" in
373  int)
374    offt_max=INT_MAX
375    uofft_max=UINT_MAX
376    uofft_fmt="u"
377    if test "$have_uoff_t" != "yes"; then
378      AC_DEFINE(UOFF_T_INT,, [Define if off_t is int])
379    fi
380    offt_bits=`expr 8 \* $ac_cv_sizeof_int`
381    ;;
382  long)
383    offt_max=LONG_MAX
384    uofft_max=ULONG_MAX
385    uofft_fmt="lu"
386    if test "$have_uoff_t" != "yes"; then
387      AC_DEFINE(UOFF_T_LONG,, [Define if off_t is long])
388    fi
389    offt_bits=`expr 8 \* $ac_cv_sizeof_long`
390    ;;
391  "long long")
392    offt_max=LLONG_MAX
393    uofft_max=ULLONG_MAX
394    uofft_fmt="llu"
395    if test "$have_uoff_t" != "yes"; then
396      AC_DEFINE(UOFF_T_LONG_LONG,, [Define if off_t is long long])
397    fi
398    offt_bits=`expr 8 \* $ac_cv_sizeof_long_long`
399    ;;
400  *)
401    AC_MSG_ERROR([Unsupported off_t type])
402    ;;
403esac
404
405DOVECOT_DIRENT_DTYPE
406DOVECOT_OFF_T_MAX
407DOVECOT_UOFF_T_MAX
408
409AC_DEFINE_UNQUOTED(PRIuUOFF_T, "$uofft_fmt", [printf() format for uoff_t])
410
411DOVECOT_SIZE_T_SIGNED
412
413AC_DEFINE_UNQUOTED(SSIZE_T_MAX, $ssizet_max, [Maximum value of ssize_t])
414
415dnl we require inttypes.h for PRIu{8,16,32,64} macros
416AC_CHECK_HEADER(inttypes.h,,AC_MSG_ERROR([inttypes.h missing but required]))
417
418dnl some systems don't have stdint.h, but still have some of the types
419dnl defined elsewhere
420AC_CHECK_HEADER(stdint.h, [
421  stdint_include="#include <stdint.h>"
422])
423
424AC_CHECKTYPE2(uintmax_t, [$stdint_include])
425if test $i_cv_type_uintmax_t = yes; then
426  AC_DEFINE(HAVE_UINTMAX_T,, [Define if you have uintmax_t (C99 type)])
427fi
428
429dnl use separate check, eg. Solaris 8 has uintmax_t but not uint_fast32_t
430AC_CHECKTYPE2(uint_fast32_t, [$stdint_include])
431if test $i_cv_type_uint_fast32_t = yes; then
432  AC_DEFINE(HAVE_UINT_FAST32_T,, [Define if you have uint_fast32_t (C99 type)])
433fi
434
435AC_CHECKTYPE2(socklen_t, [#include <sys/socket.h>])
436if test $i_cv_type_socklen_t = yes; then
437  AC_DEFINE(HAVE_SOCKLEN_T,, [Define to 'int' if you don't have socklen_t])
438fi
439
440AC_DEFINE_UNQUOTED(MEM_ALIGN_SIZE, $mem_align, [Required memory alignment])
441
442dnl * find random source
443
444AC_ARG_WITH(random-source,
445AS_HELP_STRING([--with-random-source=file], [Device file to use as random source (default=/dev/urandom)]),
446        random_source=$withval,
447        random_source=/dev/urandom)
448
449AC_MSG_CHECKING([for $random_source])
450if test -c $random_source || test -s $random_source; then
451  AC_MSG_RESULT(yes)
452  AC_DEFINE_UNQUOTED(DEV_URANDOM_PATH, ["$random_source"], [Path to random source])
453  have_random_source=yes
454else
455  AC_MSG_ERROR([$random_source not found or is not character device - please provide path for random source device])
456fi
457
458if test "$have_random_source" != "yes"; then
459  AC_CHECK_HEADER(openssl/rand.h, [
460    AC_DEFINE(HAVE_OPENSSL_RAND_H,, [Define if you have openssl/rand.h])
461    LIBS="$LIBS -lcrypto"
462  ])
463fi
464
465DOVECOT_TM_GMTOFF
466DOVECOT_GMTIME_MAX
467DOVECOT_TIME_T
468
469DOVECOT_C_STATIC_ARRAY
470DOVECOT_C_FLEXIBLE_ARRAY_MEMBER
471
472DOVECOT_IOVEC
473
474DOVECOT_TYPEOF_DEV_T
475
476DOVECOT_RLIMIT_AS
477DOVECOT_RLIMIT_NPROC
478DOVECOT_RLIMIT_CORE
479
480DOVECOT_PR_SET_DUMPABLE
481
482DOVECOT_LINUX_MREMAP
483
484DOVECOT_MMAP_WRITE
485
486DOVECOT_FD_PASSING
487
488DOVECOT_SENDFILE
489
490DOVECOT_CRYPT_XPG6
491DOVECOT_CRYPT
492
493DOVECOT_ST_TIM_TIMESPEC
494
495DOVECOT_FILE_BLOCKDEV
496
497DOVECOT_DQBLK_CURBLOCKS
498DOVECOT_DQBLK_CURSPACE
499
500DOVECOT_Q_QUOTACTL
501
502DOVECOT_C99_VSNPRINTF
503
504DOVECOT_VA_COPY
505DOVECOT_VA_COPY_BYVAL
506
507DOVECOT_MODULES
508
509DOVECOT_MNTCTL
510
511DOVECOT_SSL
512
513DOVECOT_WANT_UNWIND
514
515dnl **
516dnl ** userdb and passdb checks
517dnl **
518
519userdb=""
520passdb=""
521not_userdb=""
522not_passdb=""
523
524passdb="$passdb static"
525userdb="$userdb static"
526dict_drivers=""
527
528dnl *** auth/userdb/dict things
529DOVECOT_WANT_LUA
530DOVECOT_WANT_PREFETCH
531DOVECOT_WANT_PASSWD
532DOVECOT_WANT_SHADOW
533DOVECOT_WANT_PAM
534DOVECOT_WANT_CHECKPASSWORD
535DOVECOT_WANT_BSDAUTH
536DOVECOT_WANT_GSSAPI
537DOVECOT_WANT_LDAP
538DOVECOT_WANT_DB
539DOVECOT_WANT_CDB
540DOVECOT_WANT_PGSQL
541DOVECOT_WANT_MYSQL
542DOVECOT_WANT_SODIUM
543DOVECOT_WANT_SQLITE
544DOVECOT_WANT_CASSANDRA
545
546DOVECOT_SQL
547
548AM_CONDITIONAL([AUTH_LUA_PLUGIN], [test "x$with_lua_plugin" = "xyes"])
549AM_CONDITIONAL([HAVE_LUA], [test "x$with_lua" = "xyes"])
550AS_IF([test "x$with_lua" = "xyes"],
551  AS_IF([test "x$with_lua_plugin" = "xyes"],
552      [userdb="$userdb lua (plugin)"; passdb="$passdb lua (plugin)"],
553      [userdb="$userdb lua"; passdb="$passdb lua"],
554  ), [])
555AM_CONDITIONAL([DLUA_WITH_YIELDS], [test "$dlua_with_yields" = "yes"])
556
557if test $have_modules = yes; then
558  AC_DEFINE(HAVE_MODULES,, [Define if you have dynamic module support])
559  AC_SUBST(MODULE_LIBS)
560
561  # shrext_cmds comes from libtool.m4
562  module=yes eval MODULE_SUFFIX=$shrext_cmds
563  if test "$MODULE_SUFFIX" = ""; then
564    # too old libtool?
565    MODULE_SUFFIX=.so
566  fi
567  AC_DEFINE_UNQUOTED(MODULE_SUFFIX,"$MODULE_SUFFIX", [Dynamic module suffix])
568  AC_SUBST(MODULE_SUFFIX)
569fi
570
571AC_SUBST(AUTH_CFLAGS)
572AC_SUBST(AUTH_LIBS)
573AC_SUBST(SQL_CFLAGS)
574AC_SUBST(SQL_LIBS)
575AC_SUBST(MYSQL_CFLAGS)
576AC_SUBST(MYSQL_LIBS)
577AC_SUBST(PGSQL_CFLAGS)
578AC_SUBST(PGSQL_LIBS)
579AC_SUBST(SQLITE_CFLAGS)
580AC_SUBST(SQLITE_LIBS)
581AC_SUBST(CASSANDRA_CFLAGS)
582AC_SUBST(CASSANDRA_LIBS)
583
584AC_SUBST(DICT_LIBS)
585AC_SUBST(CDB_LIBS)
586AC_SUBST(dict_drivers)
587
588AC_C_BIGENDIAN
589
590DOVECOT_IPV6
591
592dnl **
593dnl ** storage classes
594dnl **
595
596CORE_LIBS='$(top_builddir)/src/lib-dovecot/libdovecot.la'
597STORAGE_LIB='$(top_builddir)/src/lib-storage/libdovecot-storage.la'
598
599LINKED_STORAGE_LDADD=
600AC_SUBST(LINKED_STORAGE_LDADD)
601
602dnl **
603dnl ** Shared libraries usage
604dnl **
605
606LIBDOVECOT_LA_LIBS='\
607	$(top_builddir)/src/lib-dict-extra/libdict_extra.la \
608	$(top_builddir)/src/lib-oauth2/liboauth2.la \
609	$(top_builddir)/src/lib-smtp/libsmtp.la \
610	$(top_builddir)/src/lib-program-client/libprogram_client.la \
611	$(top_builddir)/src/lib-master/libmaster.la \
612	$(top_builddir)/src/lib-settings/libsettings.la \
613	$(top_builddir)/src/lib-old-stats/libold_stats.la \
614	$(top_builddir)/src/lib-http/libhttp.la \
615	$(top_builddir)/src/lib-fs/libfs.la \
616	$(top_builddir)/src/lib-dict/libdict.la \
617	$(top_builddir)/src/lib-dns/libdns.la \
618	$(top_builddir)/src/lib-imap/libimap.la \
619	$(top_builddir)/src/lib-mail/libmail.la \
620	$(top_builddir)/src/lib-sasl/libsasl.la \
621	$(top_builddir)/src/lib-auth/libauth.la \
622	$(top_builddir)/src/lib-charset/libcharset.la \
623	$(top_builddir)/src/lib-ssl-iostream/libssl_iostream.la \
624	$(top_builddir)/src/lib-dcrypt/libdcrypt.la \
625	$(top_builddir)/src/lib-test/libtest.la \
626	$(top_builddir)/src/lib/liblib.la'
627# This is used in dovecot-config, which is grepped in dovecot.m4,
628# so it needs to be in a single line.
629LIBDOVECOT_LA_LIBS=`echo "$LIBDOVECOT_LA_LIBS" | tr -d '\t\n\\\\'`
630
631if test "$want_shared_libs" = "yes"; then
632  LIBDOVECOT_DEPS='$(top_builddir)/src/lib-dovecot/libdovecot.la'
633  LIBDOVECOT="$LIBDOVECOT_DEPS \$(MODULE_LIBS)"
634  LIBDOVECOT_STORAGE_DEPS='$(top_builddir)/src/lib-storage/libdovecot-storage.la $(top_builddir)/src/lib-imap-storage/libimap-storage.la'
635  LIBDOVECOT_LOGIN='$(top_builddir)/src/login-common/libdovecot-login.la'
636  LIBDOVECOT_LDA='$(top_builddir)/src/lib-lda/libdovecot-lda.la'
637else
638  LIBDOVECOT_DEPS="$LIBDOVECOT_LA_LIBS"
639  LIBDOVECOT="$LIBDOVECOT_DEPS \$(LIBICONV) \$(MODULE_LIBS)"
640  LIBDOVECOT_STORAGE_DEPS='$(top_builddir)/src/lib-storage/libstorage.la'
641  LIBDOVECOT_LOGIN='$(top_builddir)/src/login-common/liblogin.la'
642  LIBDOVECOT_LDA='$(top_builddir)/src/lib-lda/liblda.la'
643fi
644if test $want_ldap != no; then
645  LIBDOVECOT_LDAP='$(top_builddir)/src/lib-ldap/libdovecot-ldap.la'
646else
647  LIBDOVECOT_LDAP=''
648fi
649LIBDOVECOT_STORAGE="$LIBDOVECOT_STORAGE_DEPS"
650LIBDOVECOT_DSYNC='$(top_builddir)/src/doveadm/dsync/libdovecot-dsync.la'
651LIBDOVECOT_SQL='$(top_builddir)/src/lib-sql/libsql.la'
652LIBDOVECOT_COMPRESS='$(top_builddir)/src/lib-compression/libcompression.la'
653LIBDOVECOT_LIBFTS='$(top_builddir)/src/lib-fts/libfts.la'
654
655if test $with_lua != no; then
656  LIBDOVECOT_LUA='$(top_builddir)/src/lib-lua/libdovecot-lua.la'
657else
658  LIBDOVECOT_LUA=''
659fi
660
661AC_SUBST(LIBDOVECOT)
662AC_SUBST(LIBDOVECOT_LA_LIBS)
663AC_SUBST(LIBDOVECOT_DEPS)
664AC_SUBST(LIBDOVECOT_STORAGE)
665AC_SUBST(LIBDOVECOT_STORAGE_DEPS)
666AC_SUBST(LIBDOVECOT_LOGIN)
667AC_SUBST(LIBDOVECOT_SQL)
668AC_SUBST(LIBDOVECOT_COMPRESS)
669AC_SUBST(LIBDOVECOT_DSYNC)
670AC_SUBST(LIBDOVECOT_LDA)
671AC_SUBST(LIBDOVECOT_LDAP)
672AC_SUBST(LIBDOVECOT_LIBFTS)
673AC_SUBST(LIBDOVECOT_LIBFTS_DEPS)
674AC_SUBST(LIBDOVECOT_LUA)
675AC_SUBST(LIBDOVECOT_LUA_DEPS)
676
677dnl **
678dnl ** SQL drivers
679dnl **
680
681build_pgsql=no
682build_mysql=no
683build_sqlite=no
684build_cassandra=no
685for driver in $sql_drivers; do
686  if test "$driver" = "pgsql"; then
687    AC_DEFINE(BUILD_PGSQL,, [Built-in PostgreSQL support])
688    build_pgsql=yes
689  elif test "$driver" = "mysql"; then
690    AC_DEFINE(BUILD_MYSQL,, [Built-in MySQL support])
691    build_mysql=yes
692  elif test "$driver" = "sqlite"; then
693    AC_DEFINE(BUILD_SQLITE,, [Built-in SQLite support])
694    build_sqlite=yes
695  elif test "$driver" = "cassandra"; then
696    AC_DEFINE(BUILD_CASSANDRA,, [Built-in Cassandra support])
697    build_cassandra=yes
698  fi
699done
700if test $build_pgsql = no; then
701  not_sql_drivers="$not_sql_drivers pgsql"
702fi
703if test $build_mysql = no; then
704  not_sql_drivers="$not_sql_drivers mysql"
705fi
706if test $build_sqlite = no; then
707  not_sql_drivers="$not_sql_drivers sqlite"
708fi
709if test $build_cassandra = no; then
710  not_sql_drivers="$not_sql_drivers cassandra"
711fi
712
713AC_SUBST(sql_drivers)
714AM_CONDITIONAL(BUILD_PGSQL, test "$build_pgsql" = "yes")
715AM_CONDITIONAL(BUILD_MYSQL, test "$build_mysql" = "yes")
716AM_CONDITIONAL(BUILD_SQLITE, test "$build_sqlite" = "yes")
717AM_CONDITIONAL(BUILD_CASSANDRA, test "$build_cassandra" = "yes")
718AM_CONDITIONAL(SQL_PLUGINS, test "$want_sql" = "plugin")
719
720dnl **
721dnl ** Plugins
722dnl **
723
724COMPRESS_LIBS=
725
726DOVECOT_WANT_ZLIB
727DOVECOT_WANT_BZLIB
728DOVECOT_WANT_LZMA
729DOVECOT_WANT_LZ4
730DOVECOT_WANT_ZSTD
731
732AC_SUBST(COMPRESS_LIBS)
733
734AM_CONDITIONAL(BUILD_ZLIB_PLUGIN, test "$have_compress_lib" = "yes")
735
736DOVECOT_RPCGEN
737DOVECOT_QUOTA
738
739dnl
740dnl ** Full text search
741dnl
742
743fts=" squat"
744not_fts=""
745
746DOVECOT_WANT_SOLR
747DOVECOT_WANT_CLUCENE
748DOVECOT_WANT_STEMMER
749DOVECOT_WANT_TEXTCAT
750
751DOVECOT_WANT_ICU
752
753DOVECOT_WANT_APPARMOR
754
755if test $have_lucene = no; then
756  not_fts="$not_fts lucene"
757fi
758if test $have_solr = no; then
759  not_fts="$not_fts solr"
760fi
761
762dnl **
763dnl ** Settings
764dnl **
765
766dnl get a list of setting .[ch] files, but list .h files first
767FILES1=`find $srcdir/src -name '*settings.[[ch]]'|grep "$srcdir/src/lib-" | sed 's/^\(.*\)\(.\)$/\2 \1\2/' | grep -E -v 'lib-(master|smtp|settings).*c$' | sort -r | sed s/^..//`
768FILES2=`find $srcdir/src -name '*settings.[[ch]]'|grep -v "$srcdir/src/lib-" | sed 's/^\(.*\)\(.\)$/\2 \1\2/' | grep -v all-settings | sort -r | sed s/^..//`
769SETTING_FILES=`echo $FILES1 $FILES2 | sed -e s,$srcdir/src,./src,g -e 's,./src,$(top_srcdir)/src,g'`
770AC_SUBST(SETTING_FILES)
771
772dnl **
773dnl ** capabilities
774dnl **
775
776dnl IDLE doesn't really belong to banner. It's there just to make Blackberries
777dnl happy, because otherwise BIS server disables push email.
778capability_banner="IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE"
779capability="$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 SNIPPET=FUZZY PREVIEW=FUZZY PREVIEW STATUS=SIZE SAVEDATE"
780AC_DEFINE_UNQUOTED(CAPABILITY_STRING, "$capability", [IMAP capabilities])
781AC_DEFINE_UNQUOTED(CAPABILITY_BANNER_STRING, "$capability_banner", [IMAP capabilities advertised in banner])
782
783CFLAGS="$CFLAGS $EXTRA_CFLAGS"
784BINARY_LDFLAGS="$PIE_LDFLAGS $RELRO_LDFLAGS"
785BINARY_CFLAGS="$PIE_CFLAGS"
786
787AC_SUBST(BINARY_CFLAGS)
788AC_SUBST(BINARY_LDFLAGS)
789
790NOPLUGIN_LDFLAGS="-no-undefined"
791if test "$with_gnu_ld" = yes; then
792  NOPLUGIN_LDFLAGS="$NOPLUGIN_LDFLAGS -Wl,--as-needed"
793fi
794LDFLAGS="\$(NOPLUGIN_LDFLAGS) $LDFLAGS $EXTRA_LDFLAGS"
795AC_SUBST(NOPLUGIN_LDFLAGS)
796
797DC_CC_WRAPPER
798DC_PANDOC
799
800if test "$docdir" = ""; then
801  dnl docdir supported only by autoconf v2.59c and later
802  docdir='${datadir}/doc/${PACKAGE_TARNAME}'
803fi
804AC_SUBST(docdir)
805
806DC_DOVECOT_TEST_WRAPPER
807AC_SUBST(abs_top_builddir)
808
809AC_CONFIG_HEADERS([config.h])
810AC_CONFIG_FILES([
811Makefile
812doc/Makefile
813doc/man/Makefile
814doc/wiki/Makefile
815doc/example-config/Makefile
816doc/example-config/conf.d/Makefile
817src/Makefile
818src/lib/Makefile
819src/lib-sql/Makefile
820src/lib-auth/Makefile
821src/lib-charset/Makefile
822src/lib-compression/Makefile
823src/lib-dcrypt/Makefile
824src/lib-dict/Makefile
825src/lib-dict-backend/Makefile
826src/lib-dict-extra/Makefile
827src/lib-dns/Makefile
828src/lib-fs/Makefile
829src/lib-fts/Makefile
830src/lib-http/Makefile
831src/lib-oauth2/Makefile
832src/lib-imap/Makefile
833src/lib-imap-storage/Makefile
834src/lib-imap-client/Makefile
835src/lib-imap-urlauth/Makefile
836src/lib-index/Makefile
837src/lib-lda/Makefile
838src/lib-ldap/Makefile
839src/lib-lua/Makefile
840src/lib-mail/Makefile
841src/lib-master/Makefile
842src/lib-program-client/Makefile
843src/lib-otp/Makefile
844src/lib-dovecot/Makefile
845src/lib-sasl/Makefile
846src/lib-settings/Makefile
847src/lib-smtp/Makefile
848src/lib-ssl-iostream/Makefile
849src/lib-old-stats/Makefile
850src/lib-test/Makefile
851src/lib-storage/Makefile
852src/lib-storage/list/Makefile
853src/lib-storage/index/Makefile
854src/lib-storage/index/imapc/Makefile
855src/lib-storage/index/pop3c/Makefile
856src/lib-storage/index/maildir/Makefile
857src/lib-storage/index/mbox/Makefile
858src/lib-storage/index/dbox-common/Makefile
859src/lib-storage/index/dbox-multi/Makefile
860src/lib-storage/index/dbox-single/Makefile
861src/lib-storage/index/raw/Makefile
862src/lib-storage/index/shared/Makefile
863src/anvil/Makefile
864src/auth/Makefile
865src/config/Makefile
866src/doveadm/Makefile
867src/doveadm/dsync/Makefile
868src/lda/Makefile
869src/log/Makefile
870src/lmtp/Makefile
871src/dict/Makefile
872src/director/Makefile
873src/dns/Makefile
874src/indexer/Makefile
875src/ipc/Makefile
876src/imap/Makefile
877src/imap-hibernate/Makefile
878src/imap-login/Makefile
879src/imap-urlauth/Makefile
880src/login-common/Makefile
881src/master/Makefile
882src/pop3/Makefile
883src/pop3-login/Makefile
884src/submission/Makefile
885src/submission-login/Makefile
886src/replication/Makefile
887src/replication/aggregator/Makefile
888src/replication/replicator/Makefile
889src/stats/Makefile
890src/old-stats/Makefile
891src/util/Makefile
892src/plugins/Makefile
893src/plugins/acl/Makefile
894src/plugins/imap-acl/Makefile
895src/plugins/fs-compress/Makefile
896src/plugins/fts/Makefile
897src/plugins/fts-lucene/Makefile
898src/plugins/fts-solr/Makefile
899src/plugins/fts-squat/Makefile
900src/plugins/last-login/Makefile
901src/plugins/lazy-expunge/Makefile
902src/plugins/listescape/Makefile
903src/plugins/mail-log/Makefile
904src/plugins/mail-lua/Makefile
905src/plugins/mailbox-alias/Makefile
906src/plugins/notify/Makefile
907src/plugins/notify-status/Makefile
908src/plugins/push-notification/Makefile
909src/plugins/pop3-migration/Makefile
910src/plugins/quota/Makefile
911src/plugins/quota-clone/Makefile
912src/plugins/imap-quota/Makefile
913src/plugins/replication/Makefile
914src/plugins/old-stats/Makefile
915src/plugins/imap-old-stats/Makefile
916src/plugins/trash/Makefile
917src/plugins/virtual/Makefile
918src/plugins/welcome/Makefile
919src/plugins/zlib/Makefile
920src/plugins/imap-zlib/Makefile
921src/plugins/mail-crypt/Makefile
922src/plugins/var-expand-crypt/Makefile
923src/plugins/apparmor/Makefile
924src/plugins/charset-alias/Makefile
925stamp.h
926dovecot-config.in])
927
928AC_OUTPUT
929
930if test "$want_sql" = "plugin"; then
931  sql_drivers="$sql_drivers (plugins)"
932fi
933
934not_passdb=`echo "$not_passdb"|sed 's/ / -/g'`
935not_userdb=`echo "$not_userdb"|sed 's/ / -/g'`
936not_sql_drivers=`echo "$not_sql_drivers"|sed 's/ / -/g'`
937not_fts=`echo "$not_fts"|sed 's/ / -/g'`
938
939echo
940echo "Install prefix . : $prefix"
941echo "File offsets ... : ${offt_bits}bit"
942echo "I/O polling .... : $ioloop"
943echo "I/O notifys .... : $have_notify"
944echo "SSL ............ : $have_ssl"
945echo "GSSAPI ......... : $have_gssapi"
946echo "passdbs ........ :$passdb"
947if test "$not_passdb" != ""; then
948  echo "                 :$not_passdb"
949fi
950echo "userdbs ........ :$userdb"
951if test "$not_userdb" != ""; then
952  echo "                 :$not_userdb"
953fi
954echo "CFLAGS ......... : $CFLAGS"
955
956if test "$systemdsystemunitdir" != ""; then
957  echo "SYSTEMD ........ : $systemdservicetype - $systemdsystemunitdir/dovecot.service";
958else
959  echo "SYSTEMD ........ : $systemdservicetype - (no unit file)"
960fi
961
962echo "SQL drivers .... :$sql_drivers"
963if test "$not_sql_drivers" != ""; then
964  echo "                 :$not_sql_drivers"
965fi
966echo "Full text search :$fts"
967if test "$not_fts" != ""; then
968  echo "                 :$not_fts"
969fi
970