configure.in revision 9b8f902f6718ce16f40a850e5def64f3564f997f
AC_INIT(src)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(dovecot, 0.99.2)
AM_MAINTAINER_MODE
AC_ISC_POSIX
AC_PROG_CC
AC_PROG_CPP
AC_STDC_HEADERS
AC_C_INLINE
AC_ARG_PROGRAM
AM_PROG_LIBTOOL
# check posix headers
AC_CHECK_HEADERS(sys/time.h)
AC_ARG_ENABLE(ipv6,
[ --enable-ipv6 Enable IPv6 support (default)],
if test x$enableval = xno; then
want_ipv6=no
else
want_ipv6=yes
fi,
want_ipv6=yes)
AC_ARG_ENABLE(debug,
[ --enable-debug Enable some extra checks for debugging],
if test x$enableval = xyes; then
AC_DEFINE(DEBUG)
fi)
AC_ARG_ENABLE(asserts,
[ --enable-asserts Enable asserts (default)],
if test x$enableval = xno; then
AC_DEFINE(DISABLE_ASSERTS)
fi)
AC_ARG_WITH(file-offset-size,
[ --with-file-offset-size=BITS Set size of file offsets. Usually 32 or 64.
(default: 64 if available)],
preferred_off_t_bits=$withval,
preferred_off_t_bits=64)
AC_ARG_WITH(mem-align,
[ --with-mem-align=BYTES Set the memory alignment (default: 8)],
mem_align=$withval,
mem_align=8)
AC_ARG_WITH(passwd,
[ --with-passwd Build with /etc/passwd support (default)],
if test x$withval = xno; then
want_passwd=no
else
want_passwd=yes
fi,
want_passwd=yes)
AC_ARG_WITH(passwd-file,
[ --with-passwd-file Build with passwd-like file support (default)],
if test x$withval = xno; then
want_passwd_file=no
else
want_passwd_file=yes
fi,
want_passwd_file=yes)
AC_ARG_WITH(shadow,
[ --with-shadow Build with shadow password support (default)],
if test x$withval = xno; then
want_shadow=no
else
want_shadow=yes
fi,
want_shadow=yes)
AC_ARG_WITH(pam,
[ --with-pam Build with PAM support (default)],
if test x$withval = xno; then
want_pam=no
else
want_pam=yes
fi,
want_pam=yes)
AC_ARG_WITH(vpopmail,
[ --with-vpopmail Build with vpopmail support (default)],
if test x$withval = xno; then
want_vpopmail=no
else
want_vpopmail=yes
fi,
want_vpopmail=yes)
AC_ARG_WITH(rawlog,
[ --with-rawlog Build support for logging user traffic],
if test x$withval = xyes; then
AC_DEFINE(BUILD_RAWLOG)
fi)
AC_ARG_WITH(ssl,
[ --with-ssl=[gnutls|openssl] Build with GNUTLS (default) or OpenSSL],
if test x$withval = xno; then
want_gnutls=no
want_openssl=no
elif test x$withval = xgnutls; then
want_gnutls=yes
want_openssl=no
elif test x$withval = xopenssl; then
want_gnutls=no
want_openssl=yes
else
want_gnutls=yes
want_openssl=yes
fi, [
want_gnutls=yes
want_openssl=yes
])
AC_ARG_WITH(ssldir,
[ --with-ssldir=DIR SSL base directory for certificates (/etc/ssl)],
ssldir="$withval",
ssldir=/etc/ssl
)
dnl * gcc specific options
if test "x$ac_cv_prog_gcc" = "xyes"; then
# -Wchar-subscripts -Wpointer-arith -Wcast-qual -Wcast-align -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
CFLAGS="$CFLAGS -Wall -W"
fi
dnl **
dnl ** just some generic stuff...
dnl **
AC_CHECK_FUNC(socket, [], [
AC_CHECK_LIB(socket, socket, [
LIBS="$LIBS -lsocket"
])
])
AC_CHECK_FUNC(inet_addr, [], [
AC_CHECK_LIB(nsl, inet_addr, [
LIBS="$LIBS -lnsl"
])
])
AC_CHECK_FUNC(fdatasync, [
AC_DEFINE([HAVE_FDATASYNC])
], [
AC_CHECK_LIB(rt, fdatasync, [
AC_DEFINE([HAVE_FDATASYNC])
LIBS="$LIBS -lrt"
])
])
dnl * after -lsocket and -lnsl tests, inet_aton() may be in them
AC_CHECK_FUNCS(fcntl flock inet_aton sigaction getpagesize madvise setreuid)
AC_CHECK_FUNCS(strcasecmp stricmp vsnprintf memmove vsyslog writev)
dnl * poll/select?
AC_CHECK_FUNC(poll, [
AC_DEFINE(IOLOOP_POLL)
], [
AC_DEFINE(IOLOOP_SELECT)
])
dnl * memory alignment
AC_DEFINE_UNQUOTED(MEM_ALIGN_SIZE, $mem_align)
dnl * OS specific options
case "$host_os" in
hpux*)
CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
;;
*)
;;
esac
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(long long)
AC_DEFUN(AC_TYPEOF, [
dnl * first check if we can get the size with redefining typedefs
order="$2"
if test "$2" = ""; then
order="int long long-long"
fi
result=""
visible="unknown"
AC_MSG_CHECKING([type of $1])
for type in $order; do
type="`echo $type|sed 's/-/ /g'`"
AC_TRY_COMPILE([
#include <sys/types.h>
typedef $type $1;
],, [
if test "$result" != ""; then
dnl * compiler allows redefining to anything
result=""
visible="unknown"
break
fi
result="$type"
visible="$type"
])
done
if test "$result" = ""; then
dnl * check with sizes
dnl * older autoconfs don't include sys/types.h, so do it manually
AC_TRY_RUN([
#include <stdio.h>
#include <sys/types.h>
int main() {
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
fprintf(f, "%d\n", sizeof($1));
exit(0);
}
], [
size=`cat conftestval`
rm -f conftestval
for type in $order; do
actype="ac_cv_sizeof_`echo $type|sed 's/-/_/g'`"
if test "$size" = "`eval \"echo \\$$actype\"`"; then
result="`echo $type|sed 's/-/ /g'`"
visible="`expr $size \* 8`bit (using $result)"
break
fi
done
if test "$result" = ""; then
visible="`expr $size \* 8`bit (unknown type)"
fi
])
fi
typeof_$1=$result
AC_MSG_RESULT($visible)
])
dnl * off_t checks, try to make it 64bit
AC_DEFINE_UNQUOTED(_FILE_OFFSET_BITS, $preferred_off_t_bits)
AC_TYPEOF(off_t, long int long-long)
case "$typeof_off_t" in
int)
AC_DEFINE_UNQUOTED(OFF_T_MAX, LONG_MAX)
AC_DEFINE_UNQUOTED(PRIuUOFF_T, "lu")
AC_DEFINE(UOFF_T_LONG)
offt_bits=`expr 8 \* $ac_cv_sizeof_int`
;;
long)
AC_DEFINE_UNQUOTED(OFF_T_MAX, INT_MAX)
AC_DEFINE_UNQUOTED(PRIuUOFF_T, "u")
AC_DEFINE(UOFF_T_INT)
offt_bits=`expr 8 \* $ac_cv_sizeof_long`
;;
"long long")
AC_DEFINE_UNQUOTED(OFF_T_MAX, LLONG_MAX)
AC_DEFINE_UNQUOTED(PRIuUOFF_T, "llu")
AC_DEFINE(UOFF_T_LONG_LONG)
offt_bits=`expr 8 \* $ac_cv_sizeof_long_long`
;;
*)
AC_ERROR([Unsupported off_t type])
;;
esac
AC_TYPEOF(ssize_t)
case "$typeof_ssize_t" in
long)
AC_DEFINE_UNQUOTED(SSIZE_T_MAX, LONG_MAX)
AC_DEFINE_UNQUOTED(PRIuSIZE_T, "lu")
;;
"long long")
AC_DEFINE_UNQUOTED(SSIZE_T_MAX, LLONG_MAX)
AC_DEFINE_UNQUOTED(PRIuSIZE_T, "llu")
;;
*)
dnl older systems didn't have ssize_t, default to int
AC_DEFINE_UNQUOTED(SSIZE_T_MAX, INT_MAX)
AC_DEFINE_UNQUOTED(PRIuSIZE_T, "u")
;;
esac
AC_DEFUN(AC_CHECKTYPE2, [
AC_MSG_CHECKING([for $1])
AC_CACHE_VAL(i_cv_type_$1,
[AC_TRY_COMPILE([
#include <sys/types.h>
$2],
[$1 t;],
i_cv_type_$1=yes,
i_cv_type_$1=no,
)])
AC_MSG_RESULT($i_cv_type_$1)
])
AC_CHECKTYPE2(uintmax_t, [#include <inttypes.h>])
if test $i_cv_type_uintmax_t = yes; then
AC_DEFINE(HAVE_UINTMAX_T)
fi
AC_CHECKTYPE2(socklen_t, [#include <sys/socket.h>])
if test $i_cv_type_socklen_t = yes; then
AC_DEFINE(HAVE_SOCKLEN_T)
fi
dnl * do we have tm_gmtoff
AC_MSG_CHECKING([for tm_gmtoff])
AC_CACHE_VAL(i_cv_field_tm_gmtoff,
[AC_TRY_COMPILE([
#include <time.h>],
[struct tm *tm; return tm->tm_gmtoff;],
i_cv_field_tm_gmtoff=yes,
i_cv_field_tm_gmtoff=no,
)])
if test $i_cv_field_tm_gmtoff = yes; then
AC_DEFINE(HAVE_TM_GMTOFF)
fi
AC_MSG_RESULT($i_cv_field_tm_gmtoff)
dnl * do we have struct iovec
AC_MSG_CHECKING([for struct iovec])
AC_CACHE_VAL(i_cv_struct_iovec,
[AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>],
[struct iovec *iovec;],
i_cv_struct_iovec=yes,
i_cv_struct_iovec=no)])
if test $i_cv_struct_iovec = yes; then
AC_DEFINE(HAVE_STRUCT_IOVEC)
fi
AC_MSG_RESULT($i_cv_struct_iovec)
dnl * is dev_t an integer or something else?
AC_TRY_COMPILE([
#include <sys/types.h>
struct test { dev_t a; };
static struct test t = { 0 };
],,, [
AC_DEFINE(DEV_T_STRUCT)
dnl we can't initialize structures, so don't warn about them either
if test "x$ac_cv_prog_gcc" = "xyes"; then
CFLAGS=`echo $CFLAGS|sed 's/ -W\b//'`
fi
])
dnl * Linux compatible mremap()
AC_MSG_CHECKING([Linux compatible mremap()])
AC_TRY_COMPILE([
#include <unistd.h>
#define __USE_GNU
#include <sys/mman.h>
], [
mremap(0, 0, 0, MREMAP_MAYMOVE);
], [
AC_DEFINE(HAVE_LINUX_MREMAP)
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
])
dnl * Linux compatible sendfile()
AC_MSG_CHECKING([Linux compatible sendfile()])
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <sys/sendfile.h>
], [
sendfile(0, 0, (void *) 0, 0);
], [
AC_DEFINE(HAVE_LINUX_SENDFILE)
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
])
dnl * FreeBSD compatible sendfile()
AC_MSG_CHECKING([FreeBSD compatible sendfile()])
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
], [
struct sf_hdtr hdtr;
sendfile(0, 0, 0, 0, &hdtr, (void *) 0, 0);
], [
AC_DEFINE(HAVE_FREEBSD_SENDFILE)
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
])
dnl **
dnl ** SSL
dnl **
have_ssl=no
if test $want_gnutls = yes; then
AC_CHECK_LIB(gnutls, gnutls_global_init, [
AC_CHECK_HEADERS(gnutls/gnutls.h, [
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_GNUTLS)
SSL_LIBS="-lgnutls -lgcrypt"
AC_SUBST(SSL_LIBS)
have_ssl="yes (GNUTLS)"
have_gnutls=yes
])
],, -lgcrypt)
fi
if test "$want_openssl" = "yes" -a "$have_ssl" = "no"; then
AC_CHECK_LIB(ssl, SSL_read, [
AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h, [
AC_DEFINE(HAVE_SSL)
AC_DEFINE(HAVE_OPENSSL)
SSL_LIBS="-lssl -lcrypto"
AC_SUBST(SSL_LIBS)
have_ssl="yes (OpenSSL)"
have_openssl=yes
])
],, -lcrypto)
fi
dnl **
dnl ** shadow/pam support
dnl **
need_crypt=no
auths=""
if test $want_passwd = yes; then
need_crypt=yes
AC_DEFINE(USERINFO_PASSWD)
auths="$auths passwd"
fi
if test $want_passwd_file = yes; then
need_crypt=yes
AC_DEFINE(USERINFO_PASSWD_FILE)
auths="$auths passwd-file"
fi
if test $want_shadow = yes; then
AC_CHECK_FUNC(getspnam, [
need_crypt=yes
AC_DEFINE(USERINFO_SHADOW)
auths="$auths shadow"
])
fi
if test $want_pam = yes; then
AC_CHECK_LIB(pam, pam_start, [
AC_CHECK_HEADER(security/pam_appl.h, [
USERINFO_LIBS="$USERINFO_LIBS -lpam"
AC_DEFINE(USERINFO_PAM)
auths="$auths pam"
AC_CHECK_LIB(pam, pam_setcred, [
AC_DEFINE(HAVE_PAM_SETCRED)
])
])
])
fi
if test $want_vpopmail = yes; then
vpopmail_home="`echo ~vpopmail`"
vpop_libdeps="$vpopmail_home/etc/lib_deps"
AC_MSG_CHECKING([for vpopmail configuration at $vpop_libdeps])
if test -f $vpop_libdeps; then
need_crypt=yes
VPOPMAIL_CFLAGS="`cat $vpopmail_home/etc/inc_deps` $CFLAGS"
VPOPMAIL_LIBS="`cat $vpop_libdeps`"
AC_DEFINE(USERINFO_VPOPMAIL)
auths="$auths vpopmail"
AC_MSG_RESULT(found)
else
want_vpopmail=no
AC_MSG_RESULT(not found)
fi
fi
AC_SUBST(VPOPMAIL_CFLAGS)
AC_SUBST(VPOPMAIL_LIBS)
if test $need_crypt = yes; then
AC_CHECK_LIB(crypt, crypt, [
USERINFO_LIBS="$USERINFO_LIBS -lcrypt"
], [
AC_CHECK_FUNC(crypt,, [
AC_ERROR([crypt() wasn't found])
])
])
fi
AC_SUBST(USERINFO_LIBS)
dnl **
dnl ** Index file compatibility flags
dnl **
dnl * currently just checking for endianess
AC_C_BIGENDIAN
if test $ac_cv_c_bigendian = yes; then
flags=0
else
flags=1
fi
AC_DEFINE_UNQUOTED(MAIL_INDEX_COMPAT_FLAGS, $flags)
dnl **
dnl ** IPv6 support
dnl **
if test "x$want_ipv6" = "xyes"; then
AC_MSG_CHECKING([for IPv6])
AC_CACHE_VAL(i_cv_type_in6_addr,
[AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>],
[struct in6_addr i;],
i_cv_type_in6_addr=yes,
i_cv_type_in6_addr=no,
)])
if test $i_cv_type_in6_addr = yes; then
AC_DEFINE(HAVE_IPV6)
fi
AC_MSG_RESULT($i_cv_type_in6_addr)
fi
dnl **
dnl ** capabilities
dnl **
capability="IMAP4rev1"
if test "$have_ssl" != "no"; then
capability="$capability STARTTLS"
fi
AC_DEFINE_UNQUOTED(CAPABILITY_STRING, "$capability")
dnl **
dnl ** register the storage classes
dnl **
STORAGE="maildir mbox"
echo "/* this file is generated by configure */" > $file
echo '#include "lib.h"' >> $file
echo '#include "mail-storage.h"' >> $file
for storage in $STORAGE; do
echo "extern MailStorage ${storage}_storage;" >> $file
done
echo "void mail_storage_register_all(void) {" >> $file
for storage in $STORAGE; do
echo "mail_storage_class_register(&${storage}_storage);" >> $file
done
echo "}" >> $file
AC_OUTPUT(
Makefile
echo
echo "Install prefix ............. : $prefix"
echo "File offsets ............... : ${offt_bits}bit"
echo "Building with auth modules . :$auths"
echo "Building with SSL support .. : $have_ssl"
echo "Building with IPv6 support . : $want_ipv6"