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.
5
AC_INIT([Dovecot],[2.2.5],[dovecot@dovecot.org])
6
AC_DEFINE_UNQUOTED([DOVECOT_ABI_VERSION], "2.2.ABIv5($PACKAGE_VERSION)", [Dovecot ABI version])
8
AC_CONFIG_SRCDIR([src])
10
AM_INIT_AUTOMAKE([foreign])
15
ACLOCAL_AMFLAGS='-I $(top_srcdir)'
16
AC_SUBST(ACLOCAL_AMFLAGS)
18
dnl TEST_WITH(name, value, [plugin])
19
AC_DEFUN([TEST_WITH], [
20
want=want_`echo $1|sed s/-/_/g`
21
if test $2 = yes || test $2 = no || test $2 = auto; then
23
elif test $2 = plugin; then
24
if test "$3" = plugin; then
27
AC_ERROR([--with-$1=plugin not supported])
29
elif `echo $2|grep '^/' >/dev/null`; then
30
AC_ERROR([--with-$1=path not supported. You may want to use instead:
31
CPPFLAGS=-I$2/include LDFLAGS=-L$2/lib ./configure --with-$1])
33
AC_ERROR([--with-$1: Unknown value: $2])
37
AC_ARG_ENABLE(devel-checks,
38
AS_HELP_STRING([--enable-devel-checks], [Enable some extra expensive checks for developers]),
39
if test x$enableval = xyes; then
40
AC_DEFINE(DEBUG,, Build with extra debugging checks)
44
AC_ARG_ENABLE(asserts,
45
AS_HELP_STRING([--enable-asserts], [Enable asserts (default)]),
46
if test x$enableval = xno; then
47
AC_DEFINE(DISABLE_ASSERTS,, Disable asserts)
50
AC_ARG_WITH(shared-libs,
51
AS_HELP_STRING([--with-shared-libs], [Link binaries using shared Dovecot libraries (default)]),
52
want_shared_libs=$withval,
54
AM_CONDITIONAL(BUILD_SHARED_LIBS, test "$want_shared_libs" = "yes")
56
AC_ARG_WITH(mem-align,
57
AS_HELP_STRING([--with-mem-align=BYTES], [Set the memory alignment (default: 8)]),
62
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)]),
67
AS_HELP_STRING([--with-notify=NOTIFY], [Specify the file system notification method to use (inotify, kqueue, dnotify, none; default is detected in the above order)]),
72
AS_HELP_STRING([--with-nss], [Build with NSS module support (auto)]),
73
TEST_WITH(nss, $withval),
77
AS_HELP_STRING([--with-shadow], [Build with shadow password support (auto)]),
78
TEST_WITH(shadow, $withval),
82
AS_HELP_STRING([--with-pam], [Build with PAM support (auto)]),
83
TEST_WITH(pam, $withval),
87
AS_HELP_STRING([--with-bsdauth], [Build with BSD authentication support (auto)]),
88
TEST_WITH(bsdauth, $withval),
92
AS_HELP_STRING([--with-gssapi=yes|plugin Build with GSSAPI authentication support]),
93
TEST_WITH(gssapi, $withval, plugin),
97
AS_HELP_STRING([--with-sia], [Build with Tru64 SIA support]),
98
TEST_WITH(sia, $withval),
102
AS_HELP_STRING([--with-ldap=yes|plugin], [Build with LDAP support]),
103
TEST_WITH(ldap, $withval, plugin),
106
AC_ARG_WITH(vpopmail,
107
AS_HELP_STRING([--with-vpopmail], [Build with vpopmail support (auto)]),
108
if test x$withval = xno; then
111
if test x$withval = xyes || test x$withval = xauto; then
112
vpopmail_home="`echo ~vpopmail`"
113
want_vpopmail=$withval
115
vpopmail_home="$withval"
122
# Berkeley DB support is more or less broken. Disabled for now.
124
#AS_HELP_STRING([--with-db], [Build with Berkeley DB support]),
125
# TEST_WITH(db, $withval),
130
AS_HELP_STRING([--with-cdb], [Build with CDB support]),
131
TEST_WITH(cdb, $withval),
134
dnl The --with-sql is useful only if Dovecot is being built with all the SQL
135
dnl drivers as modules. If any SQL driver is built-in, this option is ignored.
137
AS_HELP_STRING([--with-sql=yes|plugin], [Build with generic SQL support]),
138
TEST_WITH(sql, $withval, plugin),
142
AS_HELP_STRING([--with-pgsql], [Build with PostgreSQL driver support]),
143
TEST_WITH(pgsql, $withval),
147
AS_HELP_STRING([--with-mysql], [Build with MySQL driver support]),
148
TEST_WITH(mysql, $withval),
152
AS_HELP_STRING([--with-sqlite], [Build with SQLite3 driver support]),
153
TEST_WITH(sqlite, $withval),
157
AS_HELP_STRING([--with-lucene], [Build with CLucene full text search support]),
158
TEST_WITH(lucene, $withval),
160
AM_CONDITIONAL(BUILD_LUCENE, test "$want_lucene" = "yes")
163
AS_HELP_STRING([--with-stemmer], [Build with libstemmer support (for CLucene)]),
164
TEST_WITH(stemmer, $withval),
168
AS_HELP_STRING([--with-solr], [Build with Solr full text search support]),
169
TEST_WITH(solr, $withval),
173
AS_HELP_STRING([--with-zlib], [Build with zlib compression support]),
174
TEST_WITH(zlib, $withval),
178
AS_HELP_STRING([--with-bzlib], [Build with bzlib compression support]),
179
TEST_WITH(bzlib, $withval),
183
AS_HELP_STRING([--with-libcap], [Build with libcap support (Dropping capabilities).]),
184
TEST_WITH(libcap, $withval),
188
AS_HELP_STRING([--with-libwrap], [Build with libwrap, ie. TCP-wrappers]),
189
TEST_WITH(libwrap, $withval),
193
AS_HELP_STRING([--with-ssl=gnutls|openssl], [Build with GNUTLS or OpenSSL (default)]),
194
if test x$withval = xno; then
197
elif test x$withval = xgnutls; then
198
AC_ERROR([GNUTLS support is broken currently])
201
elif test x$withval = xopenssl; then
204
elif test x$withval = xyes; then
208
AC_ERROR([--with-ssl: Invalid value: $withval])
215
AS_HELP_STRING([--with-ssldir=DIR], [SSL base directory for certificates (/etc/ssl)]),
222
AS_HELP_STRING([--with-rundir=DIR], [Runtime data directory (LOCALSTATEDIR/run/dovecot)]),
224
rundir=$localstatedir/run/$PACKAGE
228
AC_ARG_WITH(statedir,
229
AS_HELP_STRING([--with-statedir=DIR], [Permanent data directory (LOCALSTATEDIR/lib/dovecot)]),
231
statedir=$localstatedir/lib/$PACKAGE
235
AC_ARG_WITH([systemdsystemunitdir],
236
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files (auto=detect)]), [
237
if test "$withval" = "auto"; then
238
systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
239
elif test "$withval" != "no"; then
240
systemdsystemunitdir=$withval
243
if test "$systemdsystemunitdir" != ""; then
244
AC_SUBST(systemdsystemunitdir)
245
AC_DEFINE(HAVE_SYSTEMD,, Define if you want to use systemd socket activation)
247
AM_CONDITIONAL(HAVE_SYSTEMD, test "$systemdsystemunitdir" != "")
250
AS_HELP_STRING([--with-gc], [Use Boehm garbage collector]),
251
TEST_WITH(gc, $withval),
254
AC_ARG_WITH(storages,
255
AS_HELP_STRING([--with-storages], [Build with specified mail storage formats (mdbox sdbox maildir mbox cydir imapc pop3c)]), [
256
if test "$withval" = "yes" || test "$withval" = "no"; then
257
AC_MSG_ERROR([--with-storages needs storage list as parameter])
259
mail_storages="shared `echo "$withval"|sed 's/,/ /g'`" ],
260
mail_storages="shared mdbox sdbox maildir mbox cydir imapc pop3c")
261
AC_SUBST(mail_storages)
262
mail_storages="$mail_storages raw fail"
264
duplicates=`(for i in $mail_storages; do echo $i; done)|sort|uniq -d|xargs echo`
265
if test "$duplicates" != ""; then
266
AC_ERROR([Duplicate --with-storages: $duplicates])
272
AS_HELP_STRING([--with-docs], [Install documentation (default)]),
273
if test x$withval = xno; then
279
AM_CONDITIONAL(BUILD_DOCS, test "$want_docs" = "yes")
281
dnl always enable all of the passbs and userdbs that don't require extra libs
284
want_checkpassword=yes
285
want_prefetch_userdb=yes
290
AC_PROG_CXX # lucene plugin needs this
296
AC_DEFINE_UNQUOTED(DOVECOT_NAME, "$PACKAGE_NAME", Dovecot name)
297
AC_DEFINE_UNQUOTED(DOVECOT_STRING, "$PACKAGE_STRING", Dovecot string)
298
AC_DEFINE_UNQUOTED(DOVECOT_VERSION, "$PACKAGE_VERSION", Dovecot version)
300
AC_DEFINE([DOVECOT_VERSION_MAJOR], regexp(AC_PACKAGE_VERSION, [^\([0-9]+\)\.\([0-9]+\)], [\1]), [Dovecot major version])
301
AC_DEFINE([DOVECOT_VERSION_MINOR], regexp(AC_PACKAGE_VERSION, [^\([0-9]+\)\.\([0-9]+\)], [\2]), [Dovecot minor version])
303
AC_CHECK_HEADERS(strings.h stdint.h unistd.h dirent.h malloc.h inttypes.h \
304
sys/uio.h sys/sysmacros.h sys/resource.h sys/select.h libgen.h \
305
sys/quota.h sys/fs/ufs_quota.h ufs/ufs/quota.h jfs/quota.h \
306
quota.h sys/fs/quota_common.h \
307
mntent.h sys/mnttab.h sys/event.h sys/time.h sys/mkdev.h linux/dqblk_xfs.h \
308
xfs/xqm.h execinfo.h ucontext.h malloc_np.h sys/utsname.h sys/vmount.h \
309
sys/utsname.h glob.h linux/falloc.h ucred.h sys/ucred.h)
313
if $CC -dM -E -x c /dev/null | grep __clang__ > /dev/null 2>&1; then
317
dnl * gcc specific options
318
if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
319
# -Wcast-qual -Wcast-align -Wconversion -Wunreachable-code # too many warnings
320
# -Wstrict-prototypes -Wredundant-decls # may give warnings in some systems
321
# -Wmissing-format-attribute -Wmissing-noreturn -Wwrite-strings # a couple of warnings
322
CFLAGS="$CFLAGS -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast"
324
if test "$have_clang" = "yes"; then
326
#if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 3)
330
# clang 3.3+ unfortunately this gives warnings with hash.h
331
CFLAGS="$CFLAGS -Wno-duplicate-decl-specifier"
334
# This is simply to avoid warning when building strftime() wrappers..
335
CFLAGS="$CFLAGS -fno-builtin-strftime"
344
CFLAGS="$CFLAGS -Wstrict-aliasing=2"
347
# Use std=gnu99 if we have new enough gcc
352
CFLAGS="$CFLAGS $old_cflags"
357
if test "$have_clang" = "yes"; then
358
# clang specific options
359
if test "$want_devel_checks" = "yes"; then
360
# FIXME: enable once md[45], sha[12] can be compiled without
361
#CFLAGS="$CFLAGS -fsanitize=integer,undefined -ftrapv"
367
dnl ** just some generic stuff...
370
AC_SEARCH_LIBS(socket, socket)
371
AC_SEARCH_LIBS(inet_addr, nsl)
372
AC_SEARCH_LIBS(fdatasync, rt, [
373
AC_DEFINE(HAVE_FDATASYNC,, Define if you have fdatasync())
376
if test $want_libcap != no; then
377
AC_CHECK_LIB(cap, cap_init, [
378
AC_DEFINE(HAVE_LIBCAP,, libcap is installed for cap_init())
382
if test "$want_libcap" = "yes"; then
383
AC_ERROR([Can't build with libcap support: libcap not found])
389
if test $want_libwrap != no; then
390
AC_CHECK_HEADER(tcpd.h, [
393
AC_CACHE_CHECK([whether we have libwrap],i_cv_have_libwrap,[
396
int allow_severity = 0;
397
int deny_severity = 0;
399
request_init((void *)0);
401
i_cv_have_libwrap=yes
406
if test $i_cv_have_libwrap = yes; then
407
AC_DEFINE(HAVE_LIBWRAP,, Define if you have libwrap)
409
AC_SUBST(LIBWRAP_LIBS)
412
if test "$want_libwrap" = "yes"; then
413
AC_ERROR([Can't build with libwrap support: libwrap not found])
418
if test "$want_libwrap" = "yes"; then
419
AC_ERROR([Can't build with libwrap support: tcpd.h not found])
423
AM_CONDITIONAL(TCPWRAPPERS, test "$have_libwrap" = "yes")
425
AC_DEFINE(PACKAGE_WEBPAGE, "http://www.dovecot.org/", Support URL)
427
dnl * after -lsocket and -lnsl tests, inet_aton() may be in them
428
AC_CHECK_FUNCS(fcntl flock lockf inet_aton sigaction getpagesize madvise \
429
strcasecmp stricmp vsyslog writev pread uname unsetenv \
430
setrlimit setproctitle seteuid setreuid setegid setresgid \
431
strtoull strtoll strtouq strtoq getmntinfo \
432
setpriority quotactl getmntent kqueue kevent backtrace_symbols \
433
walkcontext dirfd clearenv malloc_usable_size glob fallocate \
434
posix_fadvise getpeereid getpeerucred)
436
AC_CHECK_TYPES([struct sockpeercred],,,[
437
#include <sys/types.h>
438
#include <sys/socket.h>
441
AC_SEARCH_LIBS(clock_gettime, rt, [
442
AC_DEFINE(HAVE_CLOCK_GETTIME,, Define if you have the clock_gettime function)
445
AC_CACHE_CHECK([for typeof],i_cv_have_typeof,[
456
if test $i_cv_have_typeof = yes; then
457
AC_DEFINE(HAVE_TYPEOF,, Define if you have typeof())
460
dnl strtoimax and strtoumax are macros in HP-UX, so inttypes.h must be included
461
dnl Link instead of just compiling since there's something wrong with Tru64
462
AC_CACHE_CHECK([for strtoimax],i_cv_have_strtoimax,[
464
#include <inttypes.h>
468
i_cv_have_strtoimax=yes
470
i_cv_have_strtoimax=no
473
if test $i_cv_have_strtoimax = yes; then
474
AC_DEFINE(HAVE_STRTOIMAX,, Define if you have strtoimax function)
477
AC_CACHE_CHECK([for strtoumax],i_cv_have_strtoumax,[
479
#include <inttypes.h>
483
i_cv_have_strtoumax=yes
485
i_cv_have_strtoumax=no
488
if test $i_cv_have_strtoumax = yes; then
489
AC_DEFINE(HAVE_STRTOUMAX,, Define if you have strtoumax function)
492
dnl * I/O loop function
495
if test "$ioloop" = "best" || test "$ioloop" = "epoll"; then
496
AC_CACHE_CHECK([whether we can use epoll],i_cv_epoll_works,[
498
#include <sys/epoll.h>
502
return epoll_create(5) < 1;
510
if test $i_cv_epoll_works = yes; then
511
AC_DEFINE(IOLOOP_EPOLL,, Implement I/O loop with Linux 2.6 epoll())
515
if test "$ioloop" = "epoll" ; then
516
AC_MSG_ERROR([epoll ioloop requested but epoll_create() is not available])
521
if test "$ioloop" = "best" || test "$ioloop" = "kqueue"; then
522
if test "$ac_cv_func_kqueue" = yes && test "$ac_cv_func_kevent" = yes; then
523
AC_DEFINE(IOLOOP_KQUEUE,, [Implement I/O loop with BSD kqueue()])
526
elif test "$ioloop" = "kqueue"; then
527
AC_MSG_ERROR([kqueue ioloop requested but kqueue() is not available])
531
if test "$ioloop" = "best" || test "$ioloop" = "poll"; then
532
AC_CHECK_FUNC(poll, [
533
AC_DEFINE(IOLOOP_POLL,, Implement I/O loop with poll())
539
if test "$have_ioloop" = "no"; then
540
AC_DEFINE(IOLOOP_SELECT,, Implement I/O loop with select())
546
if test "$notify" = "" || test "$notify" = "inotify" ; then
548
AC_CACHE_CHECK([whether we can use inotify],i_cv_inotify_works,[
551
#include <sys/ioctl.h>
553
#include <sys/inotify.h>
561
fd = inotify_init ();
564
perror ("inotify_init");
568
wd = inotify_add_watch (fd, fn, IN_ALL_EVENTS);
572
perror ("inotify_add_watch");
576
inotify_rm_watch (fd, wd);
582
i_cv_inotify_works=yes
584
i_cv_inotify_works=no
587
if test $i_cv_inotify_works = yes; then
590
AC_DEFINE(IOLOOP_NOTIFY_INOTIFY,, Use Linux inotify)
592
if test "$notify" = "inotify"; then
593
AC_MSG_ERROR([inotify requested but not available])
599
if (test "$notify" = "" && test "$ioloop" = kqueue) || test "$notify" = "kqueue"; then
600
dnl * BSD kqueue() notify
601
AC_MSG_CHECKING([whether we can use BSD kqueue() notify])
602
if test "$ac_cv_func_kqueue" = yes && test "$ac_cv_func_kevent" = yes ; then
606
AC_DEFINE(IOLOOP_NOTIFY_KQUEUE,,
607
Use BSD kqueue directory changes notificaton)
610
if test "$notify" = "kqueue" ; then
611
AC_MSG_ERROR([kqueue notify requested but kqueue() is not available])
617
if test "$notify" = "" || test "$notify" = "dnotify"; then
619
AC_CACHE_CHECK([whether we can use dnotify],i_cv_have_dnotify,[
626
fcntl(0, F_SETSIG, SIGRTMIN);
627
fcntl(0, F_NOTIFY, DN_CREATE | DN_DELETE | DN_RENAME | DN_MULTISHOT);
629
i_cv_have_dnotify=yes
634
if test $i_cv_have_dnotify = yes; then
635
AC_DEFINE(IOLOOP_NOTIFY_DNOTIFY,, Use Linux dnotify)
639
if test "$notify" = "dnotify"; then
640
AC_MSG_ERROR([dnotify requested but not available])
645
if test "$have_notify" = "none"; then
646
AC_DEFINE(IOLOOP_NOTIFY_NONE,, No special notify support)
649
AC_CACHE_CHECK([whether we have glibc],i_cv_have_glibc,[
661
if test "$i_cv_have_glibc" = "yes"; then
662
AC_DEFINE(PREAD_WRAPPERS,, Define if pread/pwrite needs _XOPEN_SOURCE 500)
665
dnl * Old glibcs have broken posix_fallocate(). Make sure not to use it.
666
dnl * It may also be broken in AIX.
667
AC_CACHE_CHECK([whether posix_fallocate() works],i_cv_posix_fallocate_works,[
669
#define _XOPEN_SOURCE 600
674
#if defined(__GLIBC__) && (__GLIBC__ < 2 || __GLIBC_MINOR__ < 7)
675
possibly broken posix_fallocate
678
int fd = creat("conftest.temp", 0600);
684
ret = posix_fallocate(fd, 1024, 1024) < 0 ? 1 : 0;
685
unlink("conftest.temp");
689
i_cv_posix_fallocate_works=yes
691
i_cv_posix_fallocate_works=no
694
if test $i_cv_posix_fallocate_works = yes; then
695
AC_DEFINE(HAVE_POSIX_FALLOCATE,, Define if you have a working posix_fallocate())
698
dnl * OS specific options
702
CFLAGS="$CFLAGS -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED"
703
# for getting fd_send/fd_recv working:
704
LDFLAGS="$LDFLAGS -Wl,+b,:"
706
AC_DEFINE(PREAD_BROKEN,, Defint if pread/pwrite implementation is broken)
709
AC_DEFINE(PROCTITLE_HACK,, Define if process title can be changed by modifying argv)
716
AC_CHECK_SIZEOF(long)
717
AC_CHECK_SIZEOF(void *)
718
AC_CHECK_SIZEOF(long long)
720
AC_DEFUN([AC_TYPEOF], [
721
dnl * first check if we can get the size with redefining typedefs
724
if test "$2" = ""; then
725
order="int long long-long"
730
AC_MSG_CHECKING([type of $1])
731
AC_CACHE_VAL(i_cv_typeof_$1,[
732
if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
733
dnl * try with printf() + -Werror
735
CFLAGS="$CFLAGS -Werror"
737
for type in $order; do
762
if test "$fmt" != ""; then
763
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
764
#include <sys/types.h>
767
printf("$fmt", ($1)0);
769
if test "$result" != ""; then
770
dnl * warning check isn't working
775
result="`echo $type|sed 's/-/ /g'`"
783
if test "$result" = ""; then
784
for type in $order; do
785
type="`echo $type|sed 's/-/ /g'`"
786
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
787
#include <sys/types.h>
790
if test "$result" != ""; then
791
dnl * compiler allows redefining to anything
802
if test "$result" = ""; then
803
dnl * check with sizes
805
dnl * older autoconfs don't include sys/types.h, so do it manually
806
AC_RUN_IFELSE([AC_LANG_SOURCE([[
808
#include <sys/types.h>
810
FILE *f=fopen("conftestval", "w");
812
fprintf(f, "%d\n", sizeof($1));
816
size=`cat conftestval`
819
for type in $order; do
820
actype="ac_cv_sizeof_`echo $type|sed 's/-/_/g'`"
821
if test "$size" = "`eval echo \\$$actype`"; then
822
result="`echo $type|sed 's/-/ /g'`"
823
visible="`expr $size \* 8`bit (using $result)"
827
if test "$result" = ""; then
829
visible="`expr $size \* 8`bit (unknown type)"
833
i_cv_typeof_$1=$result/$visible
836
typeof_$1=`echo $i_cv_typeof_$1 | sed s,/.*$,,`
837
visible=`echo $i_cv_typeof_$1 | sed s,^.*/,,`
838
AC_MSG_RESULT($visible)
842
AC_CHECK_TYPES(_Bool)
844
AC_CHECK_TYPE(uoff_t, [
846
AC_DEFINE(HAVE_UOFF_T,, Define if you have a native uoff_t type)
851
AC_TYPEOF(off_t, long int long-long)
852
case "$typeof_off_t" in
856
if test "$have_uoff_t" != "yes"; then
857
AC_DEFINE(UOFF_T_INT,, Define if off_t is int)
859
offt_bits=`expr 8 \* $ac_cv_sizeof_int`
864
if test "$have_uoff_t" != "yes"; then
865
AC_DEFINE(UOFF_T_LONG,, Define if off_t is long)
867
offt_bits=`expr 8 \* $ac_cv_sizeof_long`
872
if test "$have_uoff_t" != "yes"; then
873
AC_DEFINE(UOFF_T_LONG_LONG,, Define if off_t is long long)
875
offt_bits=`expr 8 \* $ac_cv_sizeof_long_long`
878
AC_MSG_ERROR([Unsupported off_t type])
882
dnl * Do we have struct dirent->d_type
883
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
889
AC_DEFINE(HAVE_DIRENT_D_TYPE,, Define if you have struct dirent->d_type)
892
dnl * Do we have OFF_T_MAX?
893
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
895
#include <sys/types.h>
901
AC_DEFINE_UNQUOTED(OFF_T_MAX, $offt_max, Maximum value of off_t)
904
AC_DEFINE_UNQUOTED(PRIuUOFF_T, "$uofft_fmt", printf() format for uoff_t)
906
dnl * make sure size_t isn't signed. we'd probably work fine with it, but
907
dnl * it's more likely vulnerable to buffer overflows. Anyway, C99 specifies
908
dnl * that it's unsigned and only some old systems define it as signed.
909
AC_CACHE_CHECK([whether size_t is signed],i_cv_signed_size_t,[
910
AC_RUN_IFELSE([AC_LANG_SOURCE([[
911
#include <sys/types.h>
913
/* return 0 if we're signed */
914
exit((size_t)(int)-1 <= 0 ? 0 : 1);
917
i_cv_signed_size_t=yes
920
echo "Your system's size_t is a signed integer, Dovecot isn't designed to"
921
echo "support it. It probably works just fine, but it's less resistant to"
922
echo "buffer overflows. If you're not worried about this and still want to"
923
echo "compile Dovecot, set ignore_signed_size=1 environment."
925
if test "$ignore_signed_size" = ""; then
926
AC_MSG_ERROR([aborting])
928
echo "..ignoring as requested.."
930
i_cv_signed_size_t=no
933
dnl Note: we check size_t rather than ssize_t here, because on OSX 10.2
934
dnl ssize_t = int and size_t = unsigned long. We're mostly concerned about
935
dnl printf format here, so check the size_t one.
936
AC_TYPEOF(size_t, unsigned-int unsigned-long unsigned-long-long)
937
case "$typeof_size_t" in
942
"unsigned long long")
947
dnl older systems didn't have ssize_t, default to int
951
if test "$typeof_size_t" = ""; then
952
AC_DEFINE(size_t, unsigned int, Define to 'unsigned int' if you don't have it)
953
AC_DEFINE(ssize_t, int, Define to 'int' if you don't have it)
958
AC_DEFINE_UNQUOTED(SSIZE_T_MAX, $ssizet_max, Maximum value of ssize_t)
959
AC_DEFINE_UNQUOTED(PRIuSIZE_T, "$sizet_fmt", printf() format for size_t)
961
AC_DEFUN([AC_CHECKTYPE2], [
962
AC_MSG_CHECKING([for $1])
963
AC_CACHE_VAL(i_cv_type_$1,
964
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
965
#include <sys/types.h>
966
$2]], [[$1 t;]])],[i_cv_type_$1=yes],[i_cv_type_$1=no])])
967
AC_MSG_RESULT($i_cv_type_$1)
970
dnl some systems don't have stdint.h, but still have some of the types
971
dnl defined elsewhere
972
AC_CHECK_HEADER(stdint.h, [
973
stdint_include="#include <stdint.h>"
976
AC_CHECKTYPE2(uintmax_t, [$stdint_include])
977
if test $i_cv_type_uintmax_t = yes; then
978
AC_DEFINE(HAVE_UINTMAX_T,, Define if you have uintmax_t (C99 type))
981
dnl use separate check, eg. Solaris 8 has uintmax_t but not uint_fast32_t
982
AC_CHECKTYPE2(uint_fast32_t, [$stdint_include])
983
if test $i_cv_type_uint_fast32_t = yes; then
984
AC_DEFINE(HAVE_UINT_FAST32_T,, Define if you have uint_fast32_t (C99 type))
987
AC_CHECKTYPE2(socklen_t, [#include <sys/socket.h>])
988
if test $i_cv_type_socklen_t = yes; then
989
AC_DEFINE(HAVE_SOCKLEN_T,, Define to 'int' if you don't have socklen_t)
992
AC_DEFINE_UNQUOTED(MEM_ALIGN_SIZE, $mem_align, Required memory alignment)
994
dnl * find random source
995
AC_MSG_CHECKING([for /dev/urandom])
996
if test -c /dev/urandom || test -s /dev/urandom; then
998
AC_DEFINE(DEV_URANDOM_PATH, "/dev/urandom", Path to /dev/urandom)
999
have_random_source=yes
1004
if test "$have_random_source" != "yes"; then
1005
AC_CHECK_HEADER(openssl/rand.h, [
1006
AC_DEFINE(HAVE_OPENSSL_RAND_H,, Define if you have openssl/rand.h)
1007
LIBS="$LIBS -lcrypto"
1011
dnl * do we have tm_gmtoff
1012
AC_MSG_CHECKING([for tm_gmtoff])
1013
AC_CACHE_VAL(i_cv_field_tm_gmtoff,
1014
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1015
#include <time.h>]],
1016
[[struct tm *tm; return tm->tm_gmtoff;]])],
1017
[i_cv_field_tm_gmtoff=yes],
1018
[i_cv_field_tm_gmtoff=no])])
1019
if test $i_cv_field_tm_gmtoff = yes; then
1020
AC_DEFINE(HAVE_TM_GMTOFF,, Define if you have struct tm->tm_gmtoff)
1022
AC_MSG_RESULT($i_cv_field_tm_gmtoff)
1024
dnl * how large time_t values does gmtime() accept?
1025
AC_CACHE_CHECK([how large time_t values gmtime() accepts],i_cv_gmtime_max_time_t,[
1026
AC_RUN_IFELSE([AC_LANG_SOURCE([[
1033
for (bits = 1; bits < sizeof(time_t)*8; bits++) {
1034
time_t t = ((time_t)1 << bits) - 1;
1035
if (gmtime(&t) == NULL) {
1041
/* Solaris 9 breaks after 55 bits. Perhaps other systems break earlier.
1042
Let's just do the same as Cyrus folks and limit it to 40 bits. */
1046
f = fopen("conftest.temp", "w");
1051
fprintf(f, "%d", bits);
1056
i_cv_gmtime_max_time_t=`cat conftest.temp`
1059
printf "check failed, assuming "
1060
i_cv_gmtime_max_time_t=31
1063
AC_DEFINE_UNQUOTED(TIME_T_MAX_BITS, $i_cv_gmtime_max_time_t, max. time_t bits gmtime() can handle)
1065
AC_CACHE_CHECK([whether time_t is signed],i_cv_signed_time_t,[
1066
AC_RUN_IFELSE([AC_LANG_SOURCE([[
1067
#include <sys/types.h>
1069
/* return 0 if we're signed */
1070
exit((time_t)(int)-1 <= 0 ? 0 : 1);
1073
i_cv_signed_time_t=yes
1075
i_cv_signed_time_t=no
1078
if test $i_cv_signed_time_t = yes; then
1079
AC_DEFINE(TIME_T_SIGNED,, Define if your time_t is signed)
1082
dnl Our implementation of AC_C_FLEXIBLE_ARRAY_MEMBER.
1083
dnl Use it until autoconf 2.61+ becomes more widely used
1084
AC_CACHE_CHECK([if we can use C99-like flexible array members],i_cv_c99_flex_arrays,[
1093
i_cv_c99_flex_arrays=yes
1095
i_cv_c99_flex_arrays=no
1099
if test $i_cv_c99_flex_arrays = yes; then
1104
AC_DEFINE_UNQUOTED(FLEXIBLE_ARRAY_MEMBER, $flexible_value, How to define flexible array members in structs)
1106
dnl * do we have struct iovec
1107
AC_MSG_CHECKING([for struct iovec])
1108
AC_CACHE_VAL(i_cv_struct_iovec,
1109
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1110
#include <sys/types.h>
1111
#include <sys/uio.h>
1112
#include <unistd.h>]],
1113
[[struct iovec *iovec;]])],
1114
[i_cv_struct_iovec=yes],
1115
[i_cv_struct_iovec=no])])
1117
if test $i_cv_struct_iovec = yes; then
1118
AC_DEFINE(HAVE_STRUCT_IOVEC,, Define if you have struct iovec)
1120
AC_MSG_RESULT($i_cv_struct_iovec)
1122
dnl * is dev_t an integer or something else?
1123
AC_CACHE_CHECK([whether dev_t is struct],i_cv_dev_t_struct,[
1124
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1125
#include <sys/types.h>
1126
struct test { dev_t a; };
1127
static struct test t = { 0 };
1130
i_cv_dev_t_struct=no
1132
i_cv_dev_t_struct=yes
1135
if test $i_cv_dev_t_struct = yes; then
1136
AC_DEFINE(DEV_T_STRUCT,, Define if your dev_t is a structure instead of integer type)
1139
dnl * Do we have RLIMIT_AS?
1140
AC_CACHE_CHECK([whether RLIMIT_AS exists],i_cv_have_rlimit_as,[
1141
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1142
#include <sys/types.h>
1143
#include <sys/time.h>
1144
#include <sys/resource.h>
1147
getrlimit(RLIMIT_AS, &r);
1149
i_cv_have_rlimit_as=yes
1151
i_cv_have_rlimit_as=no
1155
if test $i_cv_have_rlimit_as = yes; then
1156
AC_DEFINE(HAVE_RLIMIT_AS,, Define if you have RLIMIT_AS for setrlimit())
1159
dnl * Do we have RLIMIT_NPROC?
1160
AC_CACHE_CHECK([whether RLIMIT_NPROC exists],i_cv_have_rlimit_nproc,[
1161
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1162
#include <sys/types.h>
1163
#include <sys/time.h>
1164
#include <sys/resource.h>
1167
getrlimit(RLIMIT_NPROC, &r);
1169
i_cv_have_rlimit_nproc=yes
1171
i_cv_have_rlimit_nproc=no
1175
if test $i_cv_have_rlimit_nproc = yes; then
1176
AC_DEFINE(HAVE_RLIMIT_NPROC,, Define if you have RLIMIT_NPROC for setrlimit())
1179
dnl * Do we have RLIMIT_CORE?
1180
AC_CACHE_CHECK([whether RLIMIT_CORE exists],i_cv_have_rlimit_core,[
1181
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1182
#include <sys/types.h>
1183
#include <sys/time.h>
1184
#include <sys/resource.h>
1187
getrlimit(RLIMIT_CORE, &r);
1189
i_cv_have_rlimit_core=yes
1191
i_cv_have_rlimit_core=no
1195
if test $i_cv_have_rlimit_core = yes; then
1196
AC_DEFINE(HAVE_RLIMIT_CORE,, Define if you have RLIMIT_CORE for getrlimit())
1199
AC_CACHE_CHECK([whether PR_SET_DUMPABLE exists],i_cv_have_pr_set_dumpable,[
1201
#include <sys/prctl.h>
1203
prctl(PR_SET_DUMPABLE, 1, 0, 0, 0);
1205
i_cv_have_pr_set_dumpable=yes
1207
i_cv_have_pr_set_dumpable=no
1210
if test $i_cv_have_pr_set_dumpable = yes; then
1211
AC_DEFINE(HAVE_PR_SET_DUMPABLE,, Define if you have prctl(PR_SET_DUMPABLE))
1214
dnl * Linux compatible mremap()
1215
AC_CACHE_CHECK([Linux compatible mremap()],i_cv_have_linux_mremap,[
1219
#include <sys/mman.h>
1221
mremap(0, 0, 0, MREMAP_MAYMOVE);
1223
i_cv_have_linux_mremap=yes
1225
i_cv_have_linux_mremap=no
1228
if test $i_cv_have_linux_mremap = yes; then
1229
AC_DEFINE(HAVE_LINUX_MREMAP,, Define if you have Linux-compatible mremap())
1232
dnl * If mmap() plays nicely with write()
1233
AC_CACHE_CHECK([whether shared mmaps get updated by write()s],i_cv_mmap_plays_with_write,[
1236
#include <sys/types.h>
1237
#include <sys/stat.h>
1240
#include <sys/mman.h>
1242
/* return 0 if we're signed */
1243
int f = open("conftest.mmap", O_RDWR|O_CREAT|O_TRUNC, 0600);
1249
unlink("conftest.mmap");
1252
mem = mmap(NULL, 2, PROT_READ|PROT_WRITE, MAP_SHARED, f, 0);
1253
if (mem == MAP_FAILED) {
1258
msync(mem, 2, MS_SYNC);
1259
lseek(f, 0, SEEK_SET);
1262
return strcmp(mem, "3") == 0 ? 0 : 1;
1265
i_cv_mmap_plays_with_write=yes
1267
i_cv_mmap_plays_with_write=no
1270
if test $i_cv_mmap_plays_with_write = no; then
1271
AC_DEFINE(MMAP_CONFLICTS_WRITE,, [Define if shared mmaps don't get updated by write()s])
1274
dnl * see if fd passing works
1275
AC_CACHE_CHECK([whether fd passing works],i_cv_fd_passing,[
1277
old_cflags="$CFLAGS"
1278
CFLAGS="$CFLAGS -I$srcdir/src/lib $srcdir/src/lib/fdpass.c"
1279
if test $i = 2; then
1280
CFLAGS="$CFLAGS -DBUGGY_CMSG_MACROS"
1284
#include <sys/types.h>
1285
#include <sys/socket.h>
1286
#include <sys/wait.h>
1287
#include <sys/stat.h>
1296
for (i = n = 0; i < 256; i++)
1297
if (fstat(i, &sb) == 0) n++;
1302
int fd[2], send_fd, recv_fd, status, n1, n2;
1303
struct stat st, st2;
1306
send_fd = creat("conftest.fdpass", 0600);
1307
if (send_fd == -1) return 2;
1308
unlink("conftest.fdpass");
1309
if (fstat(send_fd, &st) < 0) return 2;
1310
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) < 0) return 2;
1318
if (fd_send(fd[0], send_fd, &data, 1) != 1) return 2;
1322
if (wait(&status) == -1)
1326
if (fd_read(fd[1], &data, 1, &recv_fd) != 1) return 1;
1327
if (fstat(recv_fd, &st2) < 0) return 2;
1328
/* nopen check is for making sure that only a single fd
1331
return st.st_ino == st2.st_ino && n2 == n1 + 1 ? 0 : 1;
1336
if test $i = 2; then
1337
i_cv_fd_passing=buggy_cmsg_macros
1343
dnl no, try with BUGGY_CMSG_MACROS
1352
if test "$i_cv_fd_passing" = "yes"; then
1353
i_cv_fd_passing=buggy_cmsg_macros
1358
if test $i_cv_fd_passing = buggy_cmsg_macros; then
1359
AC_DEFINE(BUGGY_CMSG_MACROS,, Define if you have buggy CMSG macros)
1361
if test $i_cv_fd_passing = no; then
1362
AC_ERROR([fd passing is required for Dovecot to work])
1365
dnl * Solaris compatible sendfile()
1366
AC_CHECK_LIB(sendfile, sendfile, [
1367
LIBS="$LIBS -lsendfile"
1368
AC_DEFINE(HAVE_SOLARIS_SENDFILE,, Define if you have Solaris-compatible sendfile())
1370
dnl * Linux compatible sendfile() - don't check if Solaris one was found.
1371
dnl * This seems to pass with Solaris for some reason..
1372
AC_CACHE_CHECK([Linux compatible sendfile()],i_cv_have_linux_sendfile,[
1374
#undef _FILE_OFFSET_BITS
1375
#include <sys/types.h>
1376
#include <sys/socket.h>
1377
#include <sys/sendfile.h>
1379
sendfile(0, 0, (void *) 0, 0);
1381
i_cv_have_linux_sendfile=yes
1383
i_cv_have_linux_sendfile=no
1386
if test $i_cv_have_linux_sendfile = yes; then
1387
AC_DEFINE(HAVE_LINUX_SENDFILE,, Define if you have Linux-compatible sendfile())
1390
dnl * FreeBSD compatible sendfile()
1391
AC_CACHE_CHECK([FreeBSD compatible sendfile()],i_cv_have_freebsd_sendfile,[
1393
#include <sys/types.h>
1394
#include <sys/socket.h>
1395
#include <sys/uio.h>
1397
struct sf_hdtr hdtr;
1398
sendfile(0, 0, 0, 0, &hdtr, (void *) 0, 0);
1400
i_cv_have_freebsd_sendfile=yes
1402
i_cv_have_freebsd_sendfile=no
1405
if test $i_cv_have_freebsd_sendfile = yes; then
1406
AC_DEFINE(HAVE_FREEBSD_SENDFILE,, Define if you have FreeBSD-compatible sendfile())
1410
AC_CACHE_CHECK([if unsetenv returns int],i_cv_unsetenv_ret_int,[
1414
if (unsetenv("env") < 0) ;
1416
i_cv_unsetenv_ret_int=yes
1418
i_cv_unsetenv_ret_int=no
1421
if test $i_cv_unsetenv_ret_int = yes; then
1422
AC_DEFINE(UNSETENV_RET_INT,, Define if unsetenv() returns int)
1425
dnl * Check for crypt() if unistd.h compiles with _XOPEN_SOURCE + _XPG6
1426
dnl * Add other macros there too "just in case".
1427
AC_CACHE_CHECK([if we should use _XPG6 macro for crypt()],i_cv_use_xpg6_crypt,[
1429
#define _XOPEN_SOURCE 4
1430
#define _XOPEN_SOURCE_EXTENDED 1
1431
#define _XOPEN_VERSION 4
1438
i_cv_use_xpg6_crypt=yes
1440
i_cv_use_xpg6_crypt=no
1443
if test $i_cv_use_xpg6_crypt = yes; then
1444
AC_DEFINE(CRYPT_USE_XPG6,, Define if _XPG6 macro is needed for crypt())
1447
AC_CACHE_CHECK([if struct stat has st_?tim timespec fields],i_cv_have_st_tim_timespec,[
1449
#include <sys/types.h>
1450
#include <sys/stat.h>
1454
unsigned long x = st.st_mtim.tv_nsec;
1458
i_cv_have_st_tim_timespec=yes
1460
i_cv_have_st_tim_timespec=no
1463
if test $i_cv_have_st_tim_timespec = yes; then
1464
AC_DEFINE(HAVE_STAT_XTIM,, Define if you have st_?tim timespec fields in struct stat)
1467
AC_CACHE_CHECK([if struct stat has st_?timespec fields],i_cv_have_st_timespec,[
1469
#include <sys/types.h>
1470
#include <sys/stat.h>
1474
unsigned long x = st.st_mtimespec.tv_nsec;
1478
i_cv_have_st_timespec=yes
1480
i_cv_have_st_timespec=no
1483
if test $i_cv_have_st_timespec = yes; then
1484
AC_DEFINE(HAVE_STAT_XTIMESPEC,, Define if you have st_?timespec fields in struct stat)
1487
dnl * Check if statvfs() can be used to find out block device for files
1488
AC_CACHE_CHECK([if statvfs.f_mntfromname exists],i_cv_have_statvfs_f_mntfromname,[
1490
#include <sys/types.h>
1491
#include <sys/statvfs.h>
1494
char *p = buf.f_mntfromname;
1498
i_cv_have_statvfs_f_mntfromname=yes
1500
i_cv_have_statvfs_f_mntfromname=no
1503
if test $i_cv_have_statvfs_f_mntfromname = yes; then
1504
AC_DEFINE(HAVE_STATVFS_MNTFROMNAME,, Define if you have statvfs.f_mntfromname)
1507
dnl * Check if statfs() can be used to find out block device for files
1508
AC_CACHE_CHECK([if statfs.f_mntfromname exists],i_cv_have_statfs_f_mntfromname,[
1510
#include <sys/param.h>
1511
#include <sys/mount.h>
1514
char *p = buf.f_mntfromname;
1518
i_cv_have_statfs_f_mntfromname=yes
1520
i_cv_have_statfs_f_mntfromname=no
1523
if test $i_cv_have_statfs_f_mntfromname = yes; then
1524
AC_DEFINE(HAVE_STATFS_MNTFROMNAME,, Define if you have statfs.f_mntfromname)
1527
dnl * Check if we have struct dqblk.dqb_curblocks
1528
AC_CACHE_CHECK([if struct dqblk.dqb_curblocks exists],i_cv_have_dqblk_dqb_curblocks,[
1530
#include <sys/types.h>
1531
#include "$srcdir/src/plugins/quota/quota-fs.h"
1534
unsigned int x = dqblk.dqb_curblocks;
1536
i_cv_have_dqblk_dqb_curblocks=yes
1538
i_cv_have_dqblk_dqb_curblocks=no
1541
if test $i_cv_have_dqblk_dqb_curblocks = yes; then
1542
AC_DEFINE(HAVE_STRUCT_DQBLK_CURBLOCKS,, Define if struct sqblk.dqb_curblocks exists)
1545
dnl * Check if we have struct dqblk.dqb_curspace
1546
AC_CACHE_CHECK([if struct dqblk.dqb_curspace exists],i_cv_have_dqblk_dqb_curspace,[
1548
#include <sys/types.h>
1549
#include "$srcdir/src/plugins/quota/quota-fs.h"
1552
unsigned int x = dqblk.dqb_curspace;
1554
i_cv_have_dqblk_dqb_curspace=yes
1556
i_cv_have_dqblk_dqb_curspace=no
1559
if test $i_cv_have_dqblk_dqb_curspace = yes; then
1560
AC_DEFINE(HAVE_STRUCT_DQBLK_CURSPACE,, Define if struct sqblk.dqb_curspace exists)
1563
dnl * Check if we have Q_QUOTACTL ioctl (Solaris)
1564
AC_CACHE_CHECK([if Q_QUOTACTL ioctl exists],i_cv_have_ioctl_q_quotactl,[
1566
#include <sys/types.h>
1567
#include <sys/fs/ufs_quota.h>
1570
ioctl(0, Q_QUOTACTL, &ctl);
1572
i_cv_have_ioctl_q_quotactl=yes
1574
i_cv_have_ioctl_q_quotactl=no
1578
if test $i_cv_have_ioctl_q_quotactl = yes; then
1579
AC_DEFINE(HAVE_Q_QUOTACTL,, Define if Q_QUOTACTL exists)
1583
dnl *** C99 vsnprintf()?
1586
AC_CACHE_CHECK([for C99 vsnprintf()],i_cv_c99_vsnprintf,[
1587
AC_RUN_IFELSE([AC_LANG_SOURCE([[
1590
static int f(const char *fmt, ...) {
1595
va_start(args, fmt);
1596
ret = vsnprintf(buf, 11, fmt, args) != 12 || buf[11-1] != '\0';
1601
return f("hello %s%d", "world", 1);
1603
[i_cv_c99_vsnprintf=yes],
1604
[i_cv_c99_vsnprintf=no])
1606
if test $i_cv_c99_vsnprintf = no; then
1607
AC_DEFINE(HAVE_OLD_VSNPRINTF,, Define if you don't have C99 compatible vsnprintf() call)
1611
dnl *** va_copy checks (from GLIB)
1614
AC_CACHE_CHECK([for an implementation of va_copy()],lib_cv_va_copy,[
1615
AC_RUN_IFELSE([AC_LANG_SOURCE([[
1617
void f (int i, ...) {
1618
va_list args1, args2;
1619
va_start (args1, i);
1620
va_copy (args2, args1);
1621
if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1623
va_end (args1); va_end (args2);
1629
[lib_cv_va_copy=yes],
1630
[lib_cv_va_copy=no],[])
1632
AC_CACHE_CHECK([for an implementation of __va_copy()],lib_cv___va_copy,[
1633
AC_RUN_IFELSE([AC_LANG_SOURCE([[
1635
void f (int i, ...) {
1636
va_list args1, args2;
1637
va_start (args1, i);
1638
__va_copy (args2, args1);
1639
if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1641
va_end (args1); va_end (args2);
1647
[lib_cv___va_copy=yes],
1648
[lib_cv___va_copy=no],[])
1651
if test "x$lib_cv_va_copy" = "xyes"; then
1652
va_copy_func=va_copy
1653
else if test "x$lib_cv___va_copy" = "xyes"; then
1654
va_copy_func=__va_copy
1658
if test -n "$va_copy_func"; then
1659
AC_DEFINE_UNQUOTED(VA_COPY,$va_copy_func,[A 'va_copy' style function])
1662
AC_CACHE_CHECK([whether va_lists can be copied by value],lib_cv_va_val_copy,[
1663
AC_RUN_IFELSE([AC_LANG_SOURCE([[
1665
void f (int i, ...) {
1666
va_list args1, args2;
1667
va_start (args1, i);
1669
if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1671
va_end (args1); va_end (args2);
1677
[lib_cv_va_val_copy=yes],
1678
[lib_cv_va_val_copy=no],[])
1681
if test "x$lib_cv_va_val_copy" = "xno"; then
1682
AC_DEFINE(VA_COPY_AS_ARRAY,1, ['va_lists' cannot be copies as values])
1685
dnl * dynamic modules?
1687
AC_CHECK_FUNC(dlopen, [
1689
MODULE_LIBS="-export-dynamic"
1691
AC_CHECK_LIB(dl, dlopen, [
1693
MODULE_LIBS="-export-dynamic -ldl"
1702
if test $ac_cv_header_sys_vmount_h = yes; then
1703
AC_MSG_CHECKING([for reasonable mntctl buffer size])
1704
AC_RUN_IFELSE([AC_LANG_SOURCE([[
1707
#include <sys/vmount.h>
1709
int size,count; char *m;
1710
FILE *f=fopen("conftestval", "w");
1712
if ((count=mntctl(MCTL_QUERY,sizeof(size),&size))!=0 || !(m=malloc(size)) ||
1713
(count=mntctl(MCTL_QUERY,size,m))<=0) exit(1);
1714
fprintf(f, "%d\n",(size * (count + 5))/count & ~1); /* 5 mounts more */
1718
size=`cat conftestval`
1720
AC_DEFINE_UNQUOTED(STATIC_MTAB_SIZE,$size, reasonable mntctl buffer size)
1721
AC_MSG_RESULT($size)
1723
AC_MSG_RESULT(default)
1734
if test $want_openssl != no && test $have_ssl = no; then
1735
if test "$PKG_CONFIG" != "" && $PKG_CONFIG --exists openssl 2>/dev/null; then
1736
PKG_CHECK_MODULES(SSL, openssl)
1737
CFLAGS="$CFLAGS $SSL_CFLAGS"
1740
# openssl 0.9.8 wants -ldl and it's required if there's only .a lib
1741
AC_CHECK_LIB(ssl, SSL_read, [
1742
AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h, [
1743
SSL_LIBS="-lssl -lcrypto $DLLIB"
1747
if test $want_openssl = yes; then
1748
AC_ERROR([Can't build with OpenSSL: openssl/ssl.h or openssl/err.h not found])
1752
if test $want_openssl = yes; then
1753
AC_ERROR([Can't build with OpenSSL: libssl not found])
1757
if test "$have_openssl" = "yes"; then
1758
AC_DEFINE(HAVE_OPENSSL,, Build with OpenSSL support)
1759
have_ssl="yes (OpenSSL)"
1761
AC_CHECK_LIB(ssl, SSL_get_current_compression, [
1762
AC_DEFINE(HAVE_SSL_COMPRESSION,, Build with OpenSSL compression)
1764
AC_CHECK_LIB(ssl, SSL_get_servername, [
1765
AC_DEFINE(HAVE_SSL_GET_SERVERNAME,, Build with TLS hostname support)
1769
AM_CONDITIONAL(BUILD_OPENSSL, test "$have_openssl" = "yes")
1771
if test $want_gnutls != no && test $have_ssl = no; then
1772
AC_CHECK_LIB(gnutls, gnutls_global_init, [
1773
AC_CHECK_HEADER(gnutls/gnutls.h, [
1774
AC_DEFINE(HAVE_GNUTLS,, Build with GNUTLS support)
1775
SSL_LIBS="-lgnutls -lgcrypt"
1777
have_ssl="yes (GNUTLS)"
1780
if test $want_gnutls = yes; then
1781
AC_ERROR([Can't build with GNUTLS: gnutls/gnutls.h not found])
1785
if test $want_gnutls = yes; then
1786
AC_ERROR([Can't build with GNUTLS: libgnutls not found])
1791
if test "$have_ssl" != "no"; then
1792
AC_DEFINE(HAVE_SSL,, Build with SSL/TLS support)
1796
dnl ** Garbage Collector
1799
if test $want_gc != no; then
1800
AC_CHECK_LIB(gc, GC_malloc, [
1801
AC_CHECK_HEADERS(gc/gc.h gc.h)
1802
AC_DEFINE(USE_GC,, Define if you want to use Boehm GC)
1805
if test $want_gc = yes; then
1806
AC_ERROR([Can't build with GC: libgc not found])
1812
dnl ** userdb and passdb checks
1820
passdb="$passdb static"
1821
userdb="$userdb static"
1823
if test $want_prefetch_userdb != no; then
1824
AC_DEFINE(USERDB_PREFETCH,, Build with prefetch userdb support)
1825
userdb="$userdb prefetch"
1827
not_userdb="$not_userdb prefetch"
1830
if test $want_passwd != no; then
1831
AC_DEFINE(USERDB_PASSWD,, Build with passwd support)
1832
AC_DEFINE(PASSDB_PASSWD,, Build with passwd support)
1833
userdb="$userdb passwd"
1834
passdb="$passdb passwd"
1836
not_passdb="$not_passdb passwd"
1837
not_userdb="$not_userdb passwd"
1840
if test $want_passwd_file != no; then
1841
AC_DEFINE(USERDB_PASSWD_FILE,, Build with passwd-file support)
1842
AC_DEFINE(PASSDB_PASSWD_FILE,, Build with passwd-file support)
1843
userdb="$userdb passwd-file"
1844
passdb="$passdb passwd-file"
1846
not_passdb="$not_passdb passwd-file"
1847
not_userdb="$not_userdb passwd-file"
1851
if test $want_shadow != no; then
1852
AC_CHECK_FUNC(getspnam, [
1853
AC_CHECK_HEADER(shadow.h, [
1854
AC_DEFINE(PASSDB_SHADOW,, Build with shadow support)
1857
if test $want_shadow = yes; then
1858
AC_ERROR([Can't build with shadow support: shadow.h not found])
1862
if test $want_shadow = yes; then
1863
AC_ERROR([Can't build with shadow support: getspnam() not found])
1867
if test $have_shadow = no; then
1868
not_passdb="$not_passdb shadow"
1870
passdb="$passdb shadow"
1873
if test $want_pam != no; then
1874
AC_CHECK_LIB(pam, pam_start, [
1876
AC_CHECK_HEADER(security/pam_appl.h, [
1877
AC_DEFINE(HAVE_SECURITY_PAM_APPL_H,,
1878
Define if you have security/pam_appl.h)
1882
AC_CHECK_HEADER(pam/pam_appl.h, [
1883
AC_DEFINE(HAVE_PAM_PAM_APPL_H,,
1884
Define if you have pam/pam_appl.h)
1888
if test $want_pam = yes; then
1889
AC_ERROR([Can't build with PAM support: libpam not found])
1894
if test "$have_pam" = "yes"; then
1895
AUTH_LIBS="$AUTH_LIBS -lpam"
1896
AC_DEFINE(PASSDB_PAM,, Build with PAM support)
1897
passdb="$passdb pam"
1899
AC_CHECK_LIB(pam, pam_setcred, [
1900
AC_DEFINE(HAVE_PAM_SETCRED,, Define if you have pam_setcred())
1902
elif test $want_pam = yes; then
1903
AC_ERROR([Can't build with PAM support: pam_appl.h not found])
1905
not_passdb="$not_passdb pam"
1908
if test $want_checkpassword != no; then
1909
AC_DEFINE(PASSDB_CHECKPASSWORD,, Build with checkpassword passdb support)
1910
AC_DEFINE(USERDB_CHECKPASSWORD,, Build with checkpassword userdb support)
1911
passdb="$passdb checkpassword"
1912
userdb="$userdb checkpassword"
1914
not_passdb="$not_passdb checkpassword"
1915
not_userdb="$not_userdb checkpassword"
1919
if test $want_bsdauth != no; then
1920
AC_CHECK_FUNC(auth_userokay, [
1921
AC_DEFINE(PASSDB_BSDAUTH,, Build with BSD authentication support)
1924
if test $want_bsdauth = yes; then
1925
AC_ERROR([Can't build with BSD authentication support: auth_userokay() not found])
1929
if test $have_bsdauth = no; then
1930
not_passdb="$not_passdb bsdauth"
1932
passdb="$passdb bsdauth"
1936
if test $want_gssapi != no; then
1937
AC_CHECK_PROG(KRB5CONFIG, krb5-config, krb5-config, NO)
1938
if test $KRB5CONFIG != NO; then
1939
if ! $KRB5CONFIG --version gssapi 2>/dev/null > /dev/null; then
1940
# krb5-config doesn't support gssapi.
1941
KRB5_LIBS="`$KRB5CONFIG --libs`"
1942
KRB5_CFLAGS=`$KRB5CONFIG --cflags`
1943
AC_CHECK_LIB(gss, gss_acquire_cred, [
1945
KRB5_LIBS="$KRB5_LIBS -lgss"
1951
KRB5_LIBS=`$KRB5CONFIG --libs gssapi`
1952
KRB5_CFLAGS=`$KRB5CONFIG --cflags gssapi`
1954
if test "$KRB5_LIBS" != ""; then
1956
AC_SUBST(KRB5_CFLAGS)
1958
# Although krb5-config exists, all systems still don't
1961
CFLAGS="$CFLAGS $KRB5_CFLAGS"
1962
AC_CHECK_HEADER([gssapi/gssapi.h], [
1963
AC_DEFINE(HAVE_GSSAPI_GSSAPI_H,, GSSAPI headers in gssapi/gssapi.h)
1966
AC_CHECK_HEADER([gssapi.h], [
1967
AC_DEFINE(HAVE_GSSAPI_H,, GSSAPI headers in gssapi.h)
1970
if test $have_gssapi != no; then
1971
if test $want_gssapi = plugin; then
1974
AC_DEFINE(HAVE_GSSAPI,, Build with GSSAPI support)
1975
AC_CHECK_HEADERS(gssapi/gssapi_ext.h gssapi_krb5.h gssapi/gssapi_krb5.h)
1976
AC_CHECK_LIB(gss, __gss_userok, [
1977
AC_DEFINE(HAVE___GSS_USEROK,,
1978
Define if you have __gss_userok())
1979
KRB5_LIBS="$KRB5_LIBS -lgss"
1982
# MIT has a #define for Heimdal acceptor_identity, but it's way too
1983
# difficult to test for it..
1985
LIBS="$LIBS $KRB5_LIBS"
1986
AC_CHECK_FUNCS(gsskrb5_register_acceptor_identity krb5_gss_register_acceptor_identity)
1988
# does the kerberos library support SPNEGO?
1989
AC_CACHE_CHECK([whether GSSAPI supports SPNEGO],i_cv_gssapi_spnego,[
1991
#ifdef HAVE_GSSAPI_H
1992
# include <gssapi.h>
1994
# include <gssapi/gssapi.h>
1999
OM_uint32 minor_status;
2000
gss_OID_set mech_set;
2001
unsigned char spnego_oid[] = { 0x2b, 0x06, 0x01, 0x05, 0x05, 0x02 };
2004
gss_indicate_mechs(&minor_status, &mech_set);
2005
for (i = 0; i < mech_set->count; i++) {
2006
if (mech_set->elements[i].length == 6 &&
2007
memcmp(mech_set->elements[i].elements,
2008
spnego_oid, 6) == 0)
2014
i_cv_gssapi_spnego=yes
2016
i_cv_gssapi_spnego=no
2019
if test "$i_cv_gssapi_spnego" = "yes"; then
2020
AC_DEFINE(HAVE_GSSAPI_SPNEGO,, GSSAPI supports SPNEGO)
2024
if test $want_gssapi != plugin; then
2025
AUTH_LIBS="$AUTH_LIBS $KRB5_LIBS"
2026
AUTH_CFLAGS="$AUTH_CFLAGS $KRB5_CFLAGS"
2027
AC_DEFINE(BUILTIN_GSSAPI,, GSSAPI support is built in)
2029
have_gssapi_plugin=yes
2032
if test $want_gssapi != auto; then
2033
AC_ERROR([Can't build with GSSAPI support: gssapi.h not found])
2039
if test $want_gssapi != auto; then
2040
AC_ERROR([Can't build with GSSAPI support: krb5-config not found])
2044
AM_CONDITIONAL(GSSAPI_PLUGIN, test "$have_gssapi_plugin" = "yes")
2047
if test $want_sia != no; then
2048
AC_CHECK_FUNC(sia_validate_user, [
2049
AC_DEFINE(PASSDB_SIA,, Build with Tru64 SIA support)
2050
AUTH_LIBS="$AUTH_LIBS -depth_ring_search"
2053
if test $want_sia = yes; then
2054
AC_ERROR([Can't build with SIA support: sia_validate_user() not found])
2059
if test $have_sia = no; then
2060
not_passdb="$not_passdb sia"
2062
passdb="$passdb sia"
2066
if test $want_ldap != no; then
2067
AC_CHECK_LIB(ldap, ldap_init, [
2068
AC_CHECK_HEADER(ldap.h, [
2069
AC_CHECK_LIB(ldap, ldap_initialize, [
2070
AC_DEFINE(LDAP_HAVE_INITIALIZE,, Define if you have ldap_initialize)
2072
AC_CHECK_LIB(ldap, ldap_start_tls_s, [
2073
AC_DEFINE(LDAP_HAVE_START_TLS_S,, Define if you have ldap_start_tls_s)
2076
AC_CHECK_LIB(ldap, ber_free, [
2077
# do nothing, default is to add -lldap to LIBS
2080
AC_CHECK_LIB(lber, ber_free, [
2081
LDAP_LIBS="$LDAP_LIBS -llber"
2085
if test $want_ldap != plugin; then
2086
AUTH_LIBS="$AUTH_LIBS $LDAP_LIBS"
2087
AC_DEFINE(BUILTIN_LDAP,, LDAP support is built in)
2090
AC_DEFINE(USERDB_LDAP,, Build with LDAP support)
2091
AC_DEFINE(PASSDB_LDAP,, Build with LDAP support)
2092
AC_CHECK_HEADERS(sasl.h sasl/sasl.h)
2095
if test $want_ldap != auto; then
2096
AC_ERROR([Can't build with LDAP support: ldap.h not found])
2100
if test $want_ldap != auto; then
2101
AC_ERROR([Can't build with LDAP support: libldap not found])
2106
if test $have_ldap = no; then
2107
not_passdb="$not_passdb ldap"
2108
not_userdb="$not_userdb ldap"
2110
userdb="$userdb ldap"
2111
passdb="$passdb ldap"
2112
if test $want_ldap = plugin; then
2113
have_ldap_plugin=yes
2114
userdb="$userdb (plugin)"
2115
passdb="$passdb (plugin)"
2118
AM_CONDITIONAL(LDAP_PLUGIN, test "$have_ldap_plugin" = "yes")
2122
if test $want_db != no; then
2123
AC_CACHE_CHECK([db_env_create in -ldb],i_cv_have_db_env_create,[
2129
db_env_create(0, 0);
2131
i_cv_have_db_env_create=yes
2133
i_cv_have_db_env_create=no
2137
if test $i_cv_have_db_env_create = yes; then
2138
AC_CHECK_HEADER(db.h, [
2139
DICT_LIBS="$DICT_LIBS -ldb"
2140
dict_drivers="$dict_drivers db"
2141
AC_DEFINE(BUILD_DB,, Build with Berkeley DB support)
2143
if test $want_db = yes; then
2144
AC_ERROR([Can't build with db support: db.h not found])
2148
if test $want_db = yes; then
2149
AC_ERROR([Can't build with db support: libdb not found])
2154
if test $want_cdb != no; then
2155
AC_CHECK_LIB(cdb, cdb_init, [
2156
AC_CHECK_HEADER(cdb.h, [
2157
DICT_LIBS="$DICT_LIBS -lcdb"
2158
AC_DEFINE(BUILD_CDB,, Build with CDB support)
2160
if test $want_cdb = yes; then
2161
AC_ERROR([Can't build with CDB support: cdb.h not found])
2165
if test $want_cdb = yes; then
2166
AC_ERROR([Can't build with CDB support: libcdb not found])
2171
if test $want_pgsql != no; then
2172
AC_CHECK_PROG(PG_CONFIG, pg_config, pg_config, NO)
2173
if test $PG_CONFIG = NO; then
2174
# based on code from PHP
2175
for i in /usr /usr/local /usr/local/pgsql; do
2176
for j in include include/pgsql include/postgres include/postgresql ""; do
2177
if test -r "$i/$j/libpq-fe.h"; then
2181
for lib in lib lib64; do
2182
for j in $lib $lib/pgsql $lib/postgres $lib/postgresql ""; do
2183
if test -f "$i/$j/libpq.so" || test -f "$i/$j/libpq.a"; then
2190
PGSQL_INCLUDE="`$PG_CONFIG --includedir`"
2191
PGSQL_LIBDIR="`$PG_CONFIG --libdir`"
2195
if test "$PGSQL_LIBDIR" != ""; then
2196
LIBS="$LIBS -L$PGSQL_LIBDIR"
2199
AC_CHECK_LIB(pq, PQconnectdb, [
2200
AC_CHECK_LIB(pq, PQescapeStringConn, [
2201
AC_DEFINE(HAVE_PQESCAPE_STRING_CONN,, Define if libpq has PQescapeStringConn function)
2203
old_CPPFLAGS=$CPPFLAGS
2204
if test "$PGSQL_INCLUDE" != ""; then
2205
CPPFLAGS="$CPPFLAGS -I$PGSQL_INCLUDE"
2207
AC_CHECK_HEADER(libpq-fe.h, [
2208
if test "$PGSQL_INCLUDE" != ""; then
2209
PGSQL_CFLAGS="$PGSQL_CFLAGS -I$PGSQL_INCLUDE"
2211
if test "$PGSQL_LIBDIR" != ""; then
2212
PGSQL_LIBS="$PGSQL_LIBS -L$PGSQL_LIBDIR"
2214
PGSQL_LIBS="$PGSQL_LIBS -lpq"
2215
AC_DEFINE(HAVE_PGSQL,, Build with PostgreSQL support)
2216
found_sql_drivers="$found_sql_drivers pgsql"
2218
if test $want_pgsql = yes; then
2219
AC_ERROR([Can't build with PostgreSQL support: libpq-fe.h not found])
2222
CPPFLAGS=$old_CPPFLAGS
2224
if test $want_pgsql = yes; then
2225
AC_ERROR([Can't build with PostgreSQL support: libpq not found])
2232
if test $want_mysql != no; then
2233
AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, mysql_config, NO)
2234
if test $MYSQL_CONFIG = NO; then
2235
# based on code from PHP
2236
MYSQL_LIBS="-lmysqlclient -lz -lm"
2237
for i in /usr /usr/local /usr/local/mysql; do
2238
for j in include include/mysql ""; do
2239
if test -r "$i/$j/mysql.h"; then
2240
MYSQL_INCLUDE="-I$i/$j"
2243
for j in lib lib/mysql lib64 lib64/mysql ""; do
2244
if test -f "$i/$j/libmysqlclient.so" || test -f "$i/$j/libmysqlclient.a"; then
2245
MYSQL_LIBS="-L$i/$j -lmysqlclient -lz -lm"
2250
MYSQL_INCLUDE="`$MYSQL_CONFIG --include`"
2251
MYSQL_LIBS="`$MYSQL_CONFIG --libs`"
2255
if test "$MYSQL_LIBS" != ""; then
2256
LIBS="$LIBS $MYSQL_LIBS"
2260
LIBS="$LIBS -lz -lm"
2261
AC_CHECK_LIB(mysqlclient, mysql_init, [
2262
old_CPPFLAGS=$CPPFLAGS
2263
if test "$MYSQL_INCLUDE" != ""; then
2264
CPPFLAGS="$CPPFLAGS $MYSQL_INCLUDE"
2266
AC_CHECK_HEADER(mysql.h, [
2267
if test "$MYSQL_INCLUDE" != ""; then
2268
MYSQL_CFLAGS="$MYSQL_CFLAGS $MYSQL_INCLUDE"
2271
AC_CHECK_LIB(mysqlclient, mysql_ssl_set, [
2272
AC_DEFINE(HAVE_MYSQL_SSL,, Define if your MySQL library has SSL functions)
2273
if test "x$have_openssl" = "yes"; then
2274
ssl_define="#define HAVE_OPENSSL"
2282
mysql_set_ssl(0, 0, 0, 0, 0, 0);
2284
AC_DEFINE(HAVE_MYSQL_SSL_CIPHER,, Define if your MySQL library supports setting cipher)
2289
AC_DEFINE(HAVE_MYSQL,, Build with MySQL support)
2290
found_sql_drivers="$found_sql_drivers mysql"
2292
if test $want_mysql = yes; then
2293
AC_ERROR([Can't build with MySQL support: mysql.h not found])
2296
CPPFLAGS=$old_CPPFLAGS
2298
if test $want_mysql = yes; then
2299
AC_ERROR([Can't build with MySQL support: libmysqlclient not found])
2303
if test $have_mysql != yes; then
2310
if test $want_sqlite != no; then
2311
AC_CHECK_LIB(sqlite3, sqlite3_open, [
2312
AC_CHECK_HEADER(sqlite3.h, [
2313
SQLITE_LIBS="$SQLITE_LIBS -lsqlite3 -lz"
2315
AC_DEFINE(HAVE_SQLITE,, Build with SQLite3 support)
2316
found_sql_drivers="$found_sql_drivers sqlite"
2318
if test $want_sqlite = yes; then
2319
AC_ERROR([Can't build with SQLite support: sqlite3.h not found])
2323
if test $want_sqlite = yes; then
2324
AC_ERROR([Can't build with SQLite support: libsqlite3 not found])
2329
SQL_CFLAGS="$MYSQL_CFLAGS $PGSQL_CFLAGS $SQLITE_CFLAGS"
2330
if test "$want_sql" != "plugin"; then
2331
SQL_LIBS="$MYSQL_LIBS $PGSQL_LIBS $SQLITE_LIBS"
2333
AC_DEFINE(SQL_DRIVER_PLUGINS,, Build SQL drivers as plugins)
2339
if test "$found_sql_drivers" != "" || test "$want_sql" != "no"; then
2340
sql_drivers="$found_sql_drivers"
2342
AC_DEFINE(PASSDB_SQL,, Build with SQL support)
2343
AC_DEFINE(USERDB_SQL,, Build with SQL support)
2344
AUTH_LIBS="$AUTH_LIBS $SQL_LIBS"
2345
passdb="$passdb sql"
2346
userdb="$userdb sql"
2348
not_passdb="$not_passdb sql"
2349
not_userdb="$not_userdb sql"
2353
if test $want_vpopmail != no; then
2354
vpop_etc="$vpopmail_home/etc"
2355
AC_MSG_CHECKING([for vpopmail configuration at $vpop_etc/lib_deps])
2356
if ! test -f $vpop_etc/lib_deps; then
2357
AC_MSG_RESULT(not found)
2358
vpop_etc="$vpopmail_home"
2359
AC_MSG_CHECKING([for vpopmail configuration at $vpop_etc/lib_deps])
2361
if test -f $vpop_etc/lib_deps; then
2362
AUTH_CFLAGS="$AUTH_CFLAGS `cat $vpop_etc/inc_deps` $CFLAGS"
2363
AUTH_LIBS="$AUTH_LIBS `cat $vpop_etc/lib_deps`"
2364
AC_DEFINE(USERDB_VPOPMAIL,, Build with vpopmail support)
2365
AC_DEFINE(PASSDB_VPOPMAIL,, Build with vpopmail support)
2366
AC_MSG_RESULT(found)
2369
AC_MSG_RESULT(not found)
2370
if test $want_vpopmail = yes; then
2371
AC_ERROR([Can't build with vpopmail support: $vpop_etc/lib_deps not found])
2376
if test $have_vpopmail = no; then
2377
not_passdb="$not_passdb vpopmail"
2378
not_userdb="$not_userdb vpopmail"
2380
userdb="$userdb vpopmail"
2381
passdb="$passdb vpopmail"
2384
AC_CHECK_FUNC(crypt,, [
2385
AC_CHECK_LIB(crypt, crypt, [
2386
AUTH_LIBS="-lcrypt $AUTH_LIBS"
2387
CRYPT_LIBS="-lcrypt"
2389
AC_MSG_ERROR([crypt() wasn't found])
2392
AC_SUBST(CRYPT_LIBS)
2394
if test $have_modules = yes; then
2395
AC_DEFINE(HAVE_MODULES,, Define if you have dynamic module support)
2396
AC_SUBST(MODULE_LIBS)
2398
# shrext_cmds comes from libtool.m4
2399
module=yes eval MODULE_SUFFIX=$shrext_cmds
2400
if test "$MODULE_SUFFIX" = ""; then
2404
AC_DEFINE_UNQUOTED(MODULE_SUFFIX,"$MODULE_SUFFIX",Dynamic module suffix)
2405
AC_SUBST(MODULE_SUFFIX)
2409
if test $want_nss != no; then
2410
if test $have_modules != yes; then
2411
if test $want_nss = yes; then
2412
AC_ERROR([Can't build with NSS support: Dynamic modules not supported])
2415
AC_CACHE_CHECK([for NSS support],i_cv_have_nss,[
2419
enum nss_status status = NSS_STATUS_TRYAGAIN;
2426
if test $i_cv_have_nss = yes; then
2427
AC_DEFINE(USERDB_NSS,, Build with NSS module support)
2430
if test $want_nss = yes; then
2431
AC_ERROR([Can't build with NSS support: nss.h not found or not usable])
2437
if test $have_nss = no; then
2438
not_userdb="$not_userdb nss"
2440
userdb="$userdb nss"
2443
AC_SUBST(AUTH_CFLAGS)
2445
AC_SUBST(SQL_CFLAGS)
2447
AC_SUBST(MYSQL_CFLAGS)
2448
AC_SUBST(MYSQL_LIBS)
2449
AC_SUBST(PGSQL_CFLAGS)
2450
AC_SUBST(PGSQL_LIBS)
2451
AC_SUBST(SQLITE_CFLAGS)
2452
AC_SUBST(SQLITE_LIBS)
2456
AC_SUBST(dict_drivers)
2462
dnl At least Apple's gcc supports __BIG_ENDIAN__ and __LITTLE_ENDIAN__
2463
dnl defines. Use them if possible to allow cross-compiling.
2464
AC_CACHE_CHECK([if __BIG_ENDIAN__ or __LITTLE_ENDIAN__ is defined],i_cv_have___big_endian__,[
2466
#if !(__BIG_ENDIAN__ || __LITTLE_ENDIAN__)
2471
i_cv_have___big_endian__=yes
2473
i_cv_have___big_endian__=no
2476
if test $i_cv_have___big_endian__ = yes; then
2477
AC_DEFINE(WORDS_BIGENDIAN, __BIG_ENDIAN__, Define if your CPU is big endian)
2487
AC_MSG_CHECKING([for IPv6])
2488
AC_CACHE_VAL(i_cv_type_in6_addr,
2489
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2490
#include <sys/types.h>
2491
#include <sys/socket.h>
2492
#include <netinet/in.h>
2494
#include <arpa/inet.h>]],
2495
[[struct in6_addr i;]])],
2496
[i_cv_type_in6_addr=yes],
2497
[i_cv_type_in6_addr=no])])
2498
if test $i_cv_type_in6_addr = yes; then
2499
AC_DEFINE(HAVE_IPV6,, Build with IPv6 support)
2502
AC_MSG_RESULT($i_cv_type_in6_addr)
2505
dnl ** storage classes
2508
maildir_libs='$(top_builddir)/src/lib-storage/index/maildir/libstorage_maildir.la'
2509
mbox_libs='$(top_builddir)/src/lib-storage/index/mbox/libstorage_mbox.la'
2510
dbox_common_libs='$(top_builddir)/src/lib-storage/index/dbox-common/libstorage_dbox_common.la'
2511
sdbox_libs='$(top_builddir)/src/lib-storage/index/dbox-single/libstorage_dbox_single.la'
2512
mdbox_libs='$(top_builddir)/src/lib-storage/index/dbox-multi/libstorage_dbox_multi.la'
2513
cydir_libs='$(top_builddir)/src/lib-storage/index/cydir/libstorage_cydir.la'
2514
imapc_libs='$(top_builddir)/src/lib-storage/index/imapc/libstorage_imapc.la $(top_builddir)/src/lib-imap-client/libimap_client.la'
2515
pop3c_libs='$(top_builddir)/src/lib-storage/index/pop3c/libstorage_pop3c.la'
2516
raw_libs='$(top_builddir)/src/lib-storage/index/raw/libstorage_raw.la'
2517
shared_libs='$(top_builddir)/src/lib-storage/index/shared/libstorage_shared.la'
2519
CORE_LIBS='$(top_builddir)/src/lib-dovecot/libdovecot.la'
2520
STORAGE_LIB='$(top_builddir)/src/lib-storage/libdovecot-storage.la'
2522
LINKED_STORAGE_LIBS=
2524
mailbox_list_drivers="maildir imapdir fs index none shared"
2526
for storage in $mail_storages; do
2527
LINKED_STORAGE_LIBS="$LINKED_STORAGE_LIBS `eval echo \\$${storage}_libs`"
2528
if test $storage = sdbox; then
2531
if test $storage = sdbox || test $storage = mdbox; then
2532
LINKED_STORAGE_LIBS="$LINKED_STORAGE_LIBS $dbox_common_libs"
2535
if test $storage = imapc; then
2536
mailbox_list_drivers="$mailbox_list_drivers imapc"
2539
LINKED_STORAGE_LDADD=
2540
AC_SUBST(LINKED_STORAGE_LIBS)
2541
AC_SUBST(LINKED_STORAGE_LDADD)
2542
AC_SUBST(mailbox_list_drivers)
2543
AC_DEFINE_UNQUOTED(MAIL_STORAGES, "$mail_storages", List of compiled in mail storages)
2545
if test $have_sdbox = yes; then
2546
# create alias for sdbox
2547
mail_storages="$mail_storages dbox"
2551
dnl ** Shared libraries usage
2554
if test "$want_shared_libs" = "yes"; then
2555
LIBDOVECOT_DEPS='$(top_builddir)/src/lib-dovecot/libdovecot.la'
2556
LIBDOVECOT="$LIBDOVECOT_DEPS \$(MODULE_LIBS)"
2557
LIBDOVECOT_STORAGE_DEPS='$(top_builddir)/src/lib-storage/libdovecot-storage.la $(top_builddir)/src/lib-imap-storage/libimap-storage.la'
2558
LIBDOVECOT_LOGIN='$(top_builddir)/src/login-common/libdovecot-login.la'
2559
LIBDOVECOT_COMPRESS='$(top_builddir)/src/lib-compression/libcompression.la'
2560
LIBDOVECOT_LDA='$(top_builddir)/src/lib-lda/libdovecot-lda.la'
2562
LIBDOVECOT_DEPS='$(top_builddir)/src/lib-master/libmaster.la $(top_builddir)/src/lib-settings/libsettings.la $(top_builddir)/src/lib-http/libhttp.la $(top_builddir)/src/lib-dict/libdict.la $(top_builddir)/src/lib-dns/libdns.la $(top_builddir)/src/lib-fs/libfs.la $(top_builddir)/src/lib-imap/libimap.la $(top_builddir)/src/lib-mail/libmail.la $(top_builddir)/src/lib-sasl/libsasl.la $(top_builddir)/src/lib-auth/libauth.la $(top_builddir)/src/lib-charset/libcharset.la $(top_builddir)/src/lib-ssl-iostream/libssl_iostream.la $(top_builddir)/src/lib-test/libtest.la $(top_builddir)/src/lib/liblib.la'
2563
LIBDOVECOT="$LIBDOVECOT_DEPS \$(LIBICONV) \$(MODULE_LIBS)"
2564
LIBDOVECOT_STORAGE_LAST='$(top_builddir)/src/lib-storage/list/libstorage_list.la $(top_builddir)/src/lib-storage/index/libstorage_index.la $(top_builddir)/src/lib-storage/libstorage.la $(top_builddir)/src/lib-index/libindex.la $(top_builddir)/src/lib-imap-storage/libimap-storage.la'
2565
LIBDOVECOT_STORAGE_FIRST='$(top_builddir)/src/lib-storage/libstorage_service.la $(top_builddir)/src/lib-storage/register/libstorage_register.la'
2566
LIBDOVECOT_STORAGE_DEPS="$LIBDOVECOT_STORAGE_FIRST $LINKED_STORAGE_LIBS $LIBDOVECOT_STORAGE_LAST"
2567
LIBDOVECOT_LOGIN='$(top_builddir)/src/login-common/liblogin.la'
2568
LIBDOVECOT_COMPRESS='$(top_builddir)/src/lib-compression/libcompression.la'
2569
LIBDOVECOT_LDA='$(top_builddir)/src/lib-lda/liblda.la'
2571
LIBDOVECOT_STORAGE="$LIBDOVECOT_STORAGE_DEPS $LINKED_STORAGE_LDADD"
2572
LIBDOVECOT_SQL='$(top_builddir)/src/lib-sql/libsql.la'
2573
AC_SUBST(LIBDOVECOT)
2574
AC_SUBST(LIBDOVECOT_DEPS)
2575
AC_SUBST(LIBDOVECOT_STORAGE)
2576
AC_SUBST(LIBDOVECOT_STORAGE_DEPS)
2577
AC_SUBST(LIBDOVECOT_LOGIN)
2578
AC_SUBST(LIBDOVECOT_SQL)
2579
AC_SUBST(LIBDOVECOT_COMPRESS)
2580
AC_SUBST(LIBDOVECOT_LDA)
2589
for driver in $sql_drivers; do
2590
if test "$driver" = "pgsql"; then
2591
AC_DEFINE(BUILD_PGSQL,, Built-in PostgreSQL support)
2593
elif test "$driver" = "mysql"; then
2594
AC_DEFINE(BUILD_MYSQL,, Built-in MySQL support)
2596
elif test "$driver" = "sqlite"; then
2597
AC_DEFINE(BUILD_SQLITE,, Built-in SQLite support)
2601
if test $build_pgsql = no; then
2602
not_sql_drivers="$not_sql_drivers pgsql"
2604
if test $build_mysql = no; then
2605
not_sql_drivers="$not_sql_drivers mysql"
2607
if test $build_sqlite = no; then
2608
not_sql_drivers="$not_sql_drivers sqlite"
2611
AC_SUBST(sql_drivers)
2612
AM_CONDITIONAL(BUILD_PGSQL, test "$build_pgsql" = "yes")
2613
AM_CONDITIONAL(BUILD_MYSQL, test "$build_mysql" = "yes")
2614
AM_CONDITIONAL(BUILD_SQLITE, test "$build_sqlite" = "yes")
2615
AM_CONDITIONAL(SQL_PLUGINS, test "$want_sql" = "plugin")
2622
if test "$want_zlib" != "no"; then
2623
AC_CHECK_HEADER(zlib.h, [
2625
have_compress_lib=yes
2626
AC_DEFINE(HAVE_ZLIB,, Define if you have zlib library)
2627
COMPRESS_LIBS="$COMPRESS_LIBS -lz"
2629
if test "$want_zlib" = "yes"; then
2630
AC_ERROR([Can't build with zlib support: zlib.h not found])
2635
if test "$want_bzlib" != "no"; then
2636
AC_CHECK_HEADER(bzlib.h, [
2637
AC_CHECK_LIB(bz2, BZ2_bzdopen, [
2639
have_compress_lib=yes
2640
AC_DEFINE(HAVE_BZLIB,, Define if you have bzlib library)
2641
COMPRESS_LIBS="$COMPRESS_LIBS -lbz2"
2643
if test "$want_bzlib" = "yes"; then
2644
AC_ERROR([Can't build with bzlib support: libbz2 not found])
2648
if test "$want_bzlib" = "yes"; then
2649
AC_ERROR([Can't build with bzlib support: bzlib.h not found])
2653
AC_SUBST(COMPRESS_LIBS)
2654
AM_CONDITIONAL(BUILD_ZLIB_PLUGIN, test "$have_compress_lib" = "yes")
2656
RPCGEN=${RPCGEN-rpcgen}
2657
if ! $RPCGEN -c /dev/null > /dev/null; then
2663
if test -f /usr/include/rpcsvc/rquota.x && test -n "$RPCGEN"; then
2664
AC_DEFINE(HAVE_RQUOTA,, Define if you wish to retrieve quota of NFS mounted mailboxes)
2667
AM_CONDITIONAL(HAVE_RQUOTA, test "$have_rquota" = "yes")
2670
AC_SEARCH_LIBS(quota_open, quota, [
2671
AC_DEFINE(HAVE_QUOTA_OPEN,, Define if you have quota_open())
2672
QUOTA_LIBS="-lquota"
2674
AC_SUBST(QUOTA_LIBS)
2677
dnl ** Full text search
2684
if test "$want_solr" != "no"; then
2686
AC_CHECK_LIB(expat, XML_Parse, [
2687
AC_CHECK_HEADER(expat.h, [
2691
if test $want_solr = yes; then
2692
AC_ERROR([Can't build with Solr support: expat.h not found])
2696
if test $want_solr = yes; then
2697
AC_ERROR([Can't build with Solr support: libexpat not found])
2701
AM_CONDITIONAL(BUILD_SOLR, test "$have_solr" = "yes")
2704
if test "$want_lucene" = "yes"; then
2705
PKG_CHECK_MODULES(CLUCENE, libclucene-core,, [
2706
# no pkg-config file for clucene. fallback to defaults.
2707
# FIXME: we should verify here that this actually works..
2708
CLUCENE_LIBS="-lclucene-shared -lclucene-core"
2710
if test $want_stemmer != no; then
2711
AC_CHECK_LIB(stemmer, sb_stemmer_new, [
2712
have_lucene_stemmer=yes
2713
AC_DEFINE(HAVE_LUCENE_STEMMER,, Define if you want stemming support for CLucene)
2714
AC_CHECK_LIB(textcat, special_textcat_Init, [
2715
have_lucene_textcat=yes
2716
AC_DEFINE(HAVE_LUCENE_TEXTCAT,, Define if you want textcat support for CLucene)
2718
AC_CHECK_LIB(exttextcat, special_textcat_Init, [
2719
have_lucene_exttextcat=yes
2720
AC_DEFINE(HAVE_LUCENE_EXTTEXTCAT,, Define if you want textcat (Debian version) support for CLucene)
2724
if test $want_stemmer = yes; then
2725
AC_ERROR([Can't build with stemmer support: libstemmer not found])
2732
AM_CONDITIONAL(BUILD_LUCENE_STEMMER, test "$have_lucene_stemmer" = "yes")
2733
AM_CONDITIONAL(BUILD_LUCENE_TEXTCAT, test "$have_lucene_textcat" = "yes")
2734
AM_CONDITIONAL(BUILD_LUCENE_EXTTEXTCAT, test "$have_lucene_exttextcat" = "yes")
2736
if test $have_lucene = no; then
2737
not_fts="$not_fts lucene"
2739
if test $have_solr = no; then
2740
not_fts="$not_fts solr"
2747
dnl get a list of setting .[ch] files, but list .h files first
2748
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/^..//`
2749
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/^..//`
2750
SETTING_FILES=`echo $FILES1 $FILES2 | sed -e s,$srcdir/src,./src,g -e 's,./src,$(top_srcdir)/src,g'`
2751
AC_SUBST(SETTING_FILES)
2757
dnl IDLE doesn't really belong to banner. It's there just to make Blackberries
2758
dnl happy, because otherwise BIS server disables push email.
2759
capability_banner="IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE"
2760
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 SPECIAL-USE BINARY MOVE"
2761
AC_DEFINE_UNQUOTED(CAPABILITY_STRING, "$capability", IMAP capabilities)
2762
AC_DEFINE_UNQUOTED(CAPABILITY_BANNER_STRING, "$capability_banner", IMAP capabilities advertised in banner)
2764
CFLAGS="$CFLAGS $EXTRA_CFLAGS"
2765
NOPLUGIN_LDFLAGS="-no-undefined"
2766
if test "$with_gnu_ld" = yes; then
2767
NOPLUGIN_LDFLAGS="$NOPLUGIN_LDFLAGS -Wl,--as-needed"
2769
LDFLAGS="\$(NOPLUGIN_LDFLAGS) $LDFLAGS"
2770
AC_SUBST(NOPLUGIN_LDFLAGS)
2772
if test "$with_gnu_ld" = yes -a "$want_shared_libs" = "no"; then
2773
# libtool can't handle using whole-archive flags, so we need to do this
2774
# with a CC wrapper.. shouldn't be much of a problem, since most people
2775
# are building with shared libs.
2776
sed "s/@CC@/$CC/" < $srcdir/cc-wrapper.sh.in > cc-wrapper.sh
2777
chmod +x cc-wrapper.sh
2778
CC=`pwd`/cc-wrapper.sh
2781
if test "$docdir" = ""; then
2782
dnl docdir supported only by autoconf v2.59c and later
2783
docdir='${datadir}/doc/${PACKAGE_TARNAME}'
2787
AC_CHECK_PROG(VALGRIND, valgrind, yes, no)
2788
if test $VALGRIND = yes; then
2789
RUN_TEST='$(SHELL) $(top_srcdir)/run-test.sh'
2794
AC_SUBST(abs_top_builddir)
2796
AC_CONFIG_HEADERS([config.h])
2802
doc/example-config/Makefile
2803
doc/example-config/conf.d/Makefile
2806
src/lib-sql/Makefile
2807
src/lib-auth/Makefile
2808
src/lib-charset/Makefile
2809
src/lib-compression/Makefile
2810
src/lib-dict/Makefile
2811
src/lib-dns/Makefile
2813
src/lib-http/Makefile
2814
src/lib-imap/Makefile
2815
src/lib-imap-storage/Makefile
2816
src/lib-imap-client/Makefile
2817
src/lib-imap-urlauth/Makefile
2818
src/lib-index/Makefile
2819
src/lib-lda/Makefile
2820
src/lib-mail/Makefile
2821
src/lib-master/Makefile
2822
src/lib-ntlm/Makefile
2823
src/lib-otp/Makefile
2824
src/lib-dovecot/Makefile
2825
src/lib-sasl/Makefile
2826
src/lib-settings/Makefile
2827
src/lib-ssl-iostream/Makefile
2828
src/lib-test/Makefile
2829
src/lib-storage/Makefile
2830
src/lib-storage/list/Makefile
2831
src/lib-storage/index/Makefile
2832
src/lib-storage/index/imapc/Makefile
2833
src/lib-storage/index/pop3c/Makefile
2834
src/lib-storage/index/maildir/Makefile
2835
src/lib-storage/index/mbox/Makefile
2836
src/lib-storage/index/dbox-common/Makefile
2837
src/lib-storage/index/dbox-multi/Makefile
2838
src/lib-storage/index/dbox-single/Makefile
2839
src/lib-storage/index/cydir/Makefile
2840
src/lib-storage/index/raw/Makefile
2841
src/lib-storage/index/shared/Makefile
2842
src/lib-storage/register/Makefile
2846
src/doveadm/Makefile
2847
src/doveadm/dsync/Makefile
2852
src/director/Makefile
2854
src/indexer/Makefile
2857
src/imap-login/Makefile
2858
src/imap-urlauth/Makefile
2859
src/login-common/Makefile
2862
src/pop3-login/Makefile
2863
src/replication/Makefile
2864
src/replication/aggregator/Makefile
2865
src/replication/replicator/Makefile
2866
src/ssl-params/Makefile
2869
src/plugins/Makefile
2870
src/plugins/acl/Makefile
2871
src/plugins/imap-acl/Makefile
2872
src/plugins/autocreate/Makefile
2873
src/plugins/expire/Makefile
2874
src/plugins/fts/Makefile
2875
src/plugins/fts-lucene/Makefile
2876
src/plugins/fts-solr/Makefile
2877
src/plugins/fts-squat/Makefile
2878
src/plugins/lazy-expunge/Makefile
2879
src/plugins/listescape/Makefile
2880
src/plugins/mail-log/Makefile
2881
src/plugins/mailbox-alias/Makefile
2882
src/plugins/notify/Makefile
2883
src/plugins/pop3-migration/Makefile
2884
src/plugins/quota/Makefile
2885
src/plugins/imap-quota/Makefile
2886
src/plugins/replication/Makefile
2887
src/plugins/snarf/Makefile
2888
src/plugins/stats/Makefile
2889
src/plugins/imap-stats/Makefile
2890
src/plugins/trash/Makefile
2891
src/plugins/virtual/Makefile
2892
src/plugins/zlib/Makefile
2893
src/plugins/imap-zlib/Makefile
2899
if test "$want_sql" = "plugin"; then
2900
sql_drivers="$sql_drivers (plugins)"
2903
not_passdb=`echo "$not_passdb"|sed 's/ / -/g'`
2904
not_userdb=`echo "$not_userdb"|sed 's/ / -/g'`
2905
not_sql_drivers=`echo "$not_sql_drivers"|sed 's/ / -/g'`
2906
not_fts=`echo "$not_fts"|sed 's/ / -/g'`
2909
echo "Install prefix . : $prefix"
2910
echo "File offsets ... : ${offt_bits}bit"
2911
echo "I/O polling .... : $ioloop"
2912
echo "I/O notifys .... : $have_notify"
2913
echo "SSL ............ : $have_ssl"
2914
echo "GSSAPI ......... : $have_gssapi"
2915
echo "passdbs ........ :$passdb"
2916
if test "$not_passdb" != ""; then
2917
echo " :$not_passdb"
2919
echo "userdbs ........ :$userdb"
2920
if test "$not_userdb" != ""; then
2921
echo " :$not_userdb"
2923
echo "SQL drivers .... :$sql_drivers"
2924
if test "$not_sql_drivers" != ""; then
2925
echo " :$not_sql_drivers"
2927
echo "Full text search :$fts"
2928
if test "$not_fts" != ""; then