configure.in revision 6defed8fef1781cb1d34353784232e87c19f173b
02c335c23bf5fa225a467c19f2c063fb0dc7b8c3Timo SirainenAC_INIT(src)
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan BoschAM_CONFIG_HEADER(config.h)
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo SirainenAM_INIT_AUTOMAKE(dovecot, 0.99.5rc1)
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan BoschAM_MAINTAINER_MODE
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan BoschAC_ISC_POSIX
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan BoschAC_PROG_CC
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan BoschAC_PROG_CPP
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan BoschAC_STDC_HEADERS
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan BoschAC_C_INLINE
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan BoschAC_ARG_PROGRAM
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan BoschAM_PROG_LIBTOOL
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan BoschAC_CHECK_HEADERS(string.h stdlib.h stdint.h unistd.h dirent.h iconv.h)
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan BoschAC_CHECK_HEADERS(sys/uio.h sys/sysmacros.h sys/resource.h linux/mman.h)
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan BoschAC_CHECK_HEADERS(sys/select.h)
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch
9b3565b09683b48f66de51aebb52786934d1c324Timo Sirainen# check posix headers
9b3565b09683b48f66de51aebb52786934d1c324Timo SirainenAC_CHECK_HEADERS(sys/time.h)
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan BoschAC_ARG_ENABLE(ipv6,
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch[ --enable-ipv6 Enable IPv6 support (default)],
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch if test x$enableval = xno; then
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch want_ipv6=no
9b3565b09683b48f66de51aebb52786934d1c324Timo Sirainen else
9b3565b09683b48f66de51aebb52786934d1c324Timo Sirainen want_ipv6=yes
9b3565b09683b48f66de51aebb52786934d1c324Timo Sirainen fi,
9b3565b09683b48f66de51aebb52786934d1c324Timo Sirainen want_ipv6=yes)
9b3565b09683b48f66de51aebb52786934d1c324Timo Sirainen
9b3565b09683b48f66de51aebb52786934d1c324Timo SirainenAC_ARG_ENABLE(debug,
9b3565b09683b48f66de51aebb52786934d1c324Timo Sirainen[ --enable-debug Enable some extra checks for debugging],
9b3565b09683b48f66de51aebb52786934d1c324Timo Sirainen if test x$enableval = xyes; then
9b3565b09683b48f66de51aebb52786934d1c324Timo Sirainen AC_DEFINE(DEBUG,, Build with extra debugging checks)
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch fi)
9b3565b09683b48f66de51aebb52786934d1c324Timo Sirainen
9b3565b09683b48f66de51aebb52786934d1c324Timo SirainenAC_ARG_ENABLE(asserts,
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch[ --enable-asserts Enable asserts (default)],
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch if test x$enableval = xno; then
9b3565b09683b48f66de51aebb52786934d1c324Timo Sirainen AC_DEFINE(DISABLE_ASSERTS,, Disable asserts)
9b3565b09683b48f66de51aebb52786934d1c324Timo Sirainen fi)
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan BoschAC_ARG_WITH(file-offset-size,
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch[ --with-file-offset-size=BITS Set size of file offsets. Usually 32 or 64.
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch (default: 64 if available)],
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch preferred_off_t_bits=$withval,
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch preferred_off_t_bits=64)
9b3565b09683b48f66de51aebb52786934d1c324Timo Sirainen
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan BoschAC_ARG_WITH(mem-align,
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch[ --with-mem-align=BYTES Set the memory alignment (default: 8)],
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch mem_align=$withval,
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch mem_align=8)
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo SirainenAC_ARG_WITH(passwd,
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen[ --with-passwd Build with /etc/passwd support (default)],
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen if test x$withval = xno; then
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen want_passwd=no
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen else
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen want_passwd=yes
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen fi,
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen want_passwd=yes)
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo SirainenAC_ARG_WITH(passwd-file,
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen[ --with-passwd-file Build with passwd-like file support (default)],
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen if test x$withval = xno; then
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen want_passwd_file=no
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen else
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen want_passwd_file=yes
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen fi,
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen want_passwd_file=yes)
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo SirainenAC_ARG_WITH(shadow,
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen[ --with-shadow Build with shadow password support (default)],
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen if test x$withval = xno; then
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen want_shadow=no
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen else
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen want_shadow=yes
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen fi,
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen want_shadow=yes)
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo SirainenAC_ARG_WITH(pam,
a071ae737f338f94d2e72c54930b51a1dc336815Timo Sirainen[ --with-pam Build with PAM support (default)],
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen if test x$withval = xno; then
a071ae737f338f94d2e72c54930b51a1dc336815Timo Sirainen want_pam=no
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen else
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen want_pam=yes
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen fi,
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen want_pam=yes)
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo SirainenAC_ARG_WITH(vpopmail,
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen[ --with-vpopmail Build with vpopmail support (default)],
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen if test x$withval = xno; then
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen want_vpopmail=no
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen else
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen want_vpopmail=yes
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen fi,
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen want_vpopmail=yes)
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo SirainenAC_ARG_WITH(rawlog,
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen[ --with-rawlog Build support for logging user traffic],
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi if test x$withval = xyes; then
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi AC_DEFINE(BUILD_RAWLOG,, Build with rawlogging feature)
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi fi)
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki TuomiAC_ARG_WITH(ssl,
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi[ --with-ssl=[gnutls|openssl] Build with GNUTLS (default) or OpenSSL],
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi if test x$withval = xno; then
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi want_gnutls=no
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi want_openssl=no
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi elif test x$withval = xgnutls; then
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi want_gnutls=yes
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi want_openssl=no
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi elif test x$withval = xopenssl; then
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi want_gnutls=no
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi want_openssl=yes
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi else
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi want_gnutls=yes
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi want_openssl=yes
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi fi, [
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi want_gnutls=yes
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi want_openssl=yes
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi ])
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan BoschAC_ARG_WITH(ssldir,
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch[ --with-ssldir=DIR SSL base directory for certificates (/etc/ssl)],
7f52e276c1bf13b4809344492023b90e46c3ac5dTimo Sirainen ssldir="$withval",
e5a55bb6b867ee3ed95ac216996ff2e24bd596ccAki Tuomi ssldir=/etc/ssl
72a7c4f2ba93a723e23c941369a2985d75f240c9Stephan Bosch)
AC_SUBST(ssldir)
dnl * gcc specific options
if test "x$ac_cv_prog_gcc" = "xyes"; then
# -Wcast-qual -Wcast-align -Wconversion # too many warnings
# -Wstrict-prototypes -Wredundant-decls # may give warnings in some systems
# -Wmissing-format-attribute -Wmissing-noreturn # a couple of warnings
CFLAGS="$CFLAGS -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast"
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, [
have_fdatasync=yes
], [
AC_CHECK_LIB(rt, fdatasync, [
have_fdatasync=yes
LIBS="$LIBS -lrt"
])
])
if test "$have_fdatasync" = "yes"; then
AC_DEFINE(HAVE_FDATASYNC,, Define if you have fdatasync())
fi
dnl * after -lsocket and -lnsl tests, inet_aton() may be in them
AC_CHECK_FUNCS(fcntl flock inet_aton sigaction getpagesize madvise \
strcasecmp stricmp vsnprintf vsyslog writev setrlimit \
setproctitle)
dnl * poll/select?
AC_CHECK_FUNC(poll, [
AC_DEFINE(IOLOOP_POLL,, Implement I/O loop with poll())
], [
AC_DEFINE(IOLOOP_SELECT,, Implement I/O loop with select())
])
dnl * memory alignment
AC_DEFINE_UNQUOTED(MEM_ALIGN_SIZE, $mem_align, Required memory alignment)
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])
if test "x$ac_cv_prog_gcc" = "xyes"; then
dnl * try with printf() + -Werror
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
for type in $order; do
case "$type" in
int)
fmt="%d"
;;
long)
fmt="%ld"
;;
long-long)
fmt="%lld"
;;
*)
fmt=""
;;
esac
if test "$fmt" != ""; then
AC_TRY_COMPILE([
#include <sys/types.h>
#include <stdio.h>
], [
printf("$fmt", ($1)0);
], [
if test "$result" != ""; then
dnl * warning check isn't working
result=""
visible="unknown"
break
fi
result="`echo $type|sed 's/-/ /g'`"
visible="$result"
])
fi
done
CFLAGS="$old_CFLAGS"
fi
if test "$result" = ""; then
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
fi
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,
[If set to 64, enables 64bit off_t for some systems (eg. Linux, Solaris)])
AC_TYPEOF(off_t, long int long-long)
case "$typeof_off_t" in
int)
offt_max=INT_MAX
uofft_fmt="u"
AC_DEFINE(UOFF_T_INT,, Define if off_t is int)
offt_bits=`expr 8 \* $ac_cv_sizeof_int`
;;
long)
offt_max=LONG_MAX
uofft_fmt="lu"
AC_DEFINE(UOFF_T_LONG,, Define if off_t is long)
offt_bits=`expr 8 \* $ac_cv_sizeof_long`
;;
"long long")
offt_max=LLONG_MAX
uofft_fmt="llu"
AC_DEFINE(UOFF_T_LONG_LONG,, Define if off_t is long long)
offt_bits=`expr 8 \* $ac_cv_sizeof_long_long`
;;
*)
AC_ERROR([Unsupported off_t type])
;;
esac
AC_DEFINE_UNQUOTED(OFF_T_MAX, $offt_max, Maximum value of off_t)
AC_DEFINE_UNQUOTED(PRIuUOFF_T, "$uofft_fmt", printf() format for uoff_t)
dnl * make sure size_t isn't signed. we'd probably work fine with it, but
dnl * it's more likely vulnerable to buffer overflows. Anyway, C99 specifies
dnl * that it's unsigned and only some old systems define it as signed.
AC_MSG_CHECKING([whether size_t is signed])
AC_TRY_RUN([
#include <sys/types.h>
int main() {
/* return 0 if we're signed */
exit((size_t)(int)-1 <= 0 ? 0 : 1);
}
], [
AC_MSG_RESULT(yes)
echo
echo "Your system's size_t is a signed integer, Dovecot isn't designed to"
echo "support it. It probably works just fine, but it's less resistant to"
echo "buffer overflows. If you're not worried about this and still want to"
echo "compile Dovecot, set ignore_signed_size=1 environment."
if test "$ignore_signed_size" = ""; then
AC_ERROR([aborting])
fi
echo "..ignoring as requested.."
], [
AC_MSG_RESULT(no)
])
AC_TYPEOF(ssize_t)
case "$typeof_ssize_t" in
long)
ssizet_max=LONG_MAX
sizet_fmt="lu"
;;
"long long")
ssizet_max=LLONG_MAX
sizet_fmt="llu"
;;
*)
dnl older systems didn't have ssize_t, default to int
ssizet_max=INT_MAX
sizet_fmt="u"
if test "$typeof_ssize_t" = ""; then
AC_DEFINE(size_t, unsigned int, Define to 'unsigned int' if you don't have it)
AC_DEFINE(ssize_t, int, Define to 'int' if you don't have it)
fi
;;
esac
AC_DEFINE_UNQUOTED(SSIZE_T_MAX, $ssizet_max, Maximum value of ssize_t)
AC_DEFINE_UNQUOTED(PRIuSIZE_T, "$sizet_fmt", printf() format for size_t)
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,, Define if you have uintmax_t (C99 type))
fi
AC_CHECKTYPE2(socklen_t, [#include <sys/socket.h>])
if test $i_cv_type_socklen_t = yes; then
AC_DEFINE(HAVE_SOCKLEN_T,, Define to 'int' if you don't 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,, Define if you have struct tm->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,, Define if you 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,, Define if your dev_t is a structure instead of integer type)
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 * Do we have RLIMIT_AS?
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
], [
struct rlimit r;
getrlimit(RLIMIT_AS, &r);
], [
AC_DEFINE(HAVE_RLIMIT_AS,, Define if you have RLIMIT_AS for setrlimit())
])
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,, Define if you have Linux-compatible mremap())
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
])
dnl * Linux compatible sendfile()
AC_MSG_CHECKING([Linux compatible sendfile()])
AC_TRY_COMPILE([
#undef _FILE_OFFSET_BITS
#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,, Define if you have Linux-compatible 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,, Define if you have FreeBSD-compatible sendfile())
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
])
dnl ***
dnl *** va_copy checks (from GLIB)
dnl ***
AC_CACHE_CHECK([for an implementation of va_copy()],lib_cv_va_copy,[
AC_TRY_RUN([
#include <stdarg.h>
void f (int i, ...) {
va_list args1, args2;
va_start (args1, i);
va_copy (args2, args1);
if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
exit (1);
va_end (args1); va_end (args2);
}
int main() {
f (0, 42);
return 0;
}],
[lib_cv_va_copy=yes],
[lib_cv_va_copy=no],
[])
])
AC_CACHE_CHECK([for an implementation of __va_copy()],lib_cv___va_copy,[
AC_TRY_RUN([
#include <stdarg.h>
void f (int i, ...) {
va_list args1, args2;
va_start (args1, i);
__va_copy (args2, args1);
if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
exit (1);
va_end (args1); va_end (args2);
}
int main() {
f (0, 42);
return 0;
}],
[lib_cv___va_copy=yes],
[lib_cv___va_copy=no],
[])
])
if test "x$lib_cv_va_copy" = "xyes"; then
va_copy_func=va_copy
else if test "x$lib_cv___va_copy" = "xyes"; then
va_copy_func=__va_copy
fi
fi
if test -n "$va_copy_func"; then
AC_DEFINE_UNQUOTED(VA_COPY,$va_copy_func,[A 'va_copy' style function])
fi
AC_CACHE_CHECK([whether va_lists can be copied by value],lib_cv_va_val_copy,[
AC_TRY_RUN([
#include <stdarg.h>
void f (int i, ...) {
va_list args1, args2;
va_start (args1, i);
args2 = args1;
if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
exit (1);
va_end (args1); va_end (args2);
}
int main() {
f (0, 42);
return 0;
}],
[lib_cv_va_val_copy=yes],
[lib_cv_va_val_copy=no],
[])
])
if test "x$lib_cv_va_val_copy" = "xno"; then
AC_DEFINE(VA_COPY_AS_ARRAY,1, ['va_lists' cannot be copies as values])
fi
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_GNUTLS,, Build with GNUTLS support)
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_OPENSSL,, Build with OpenSSL support)
SSL_LIBS="-lssl -lcrypto"
AC_SUBST(SSL_LIBS)
have_ssl="yes (OpenSSL)"
have_openssl=yes
])
],, -lcrypto)
fi
if test "$have_ssl" != "no"; then
AC_DEFINE(HAVE_SSL,, Build with SSL/TLS support)
fi
dnl **
dnl ** shadow/pam support
dnl **
need_crypt=no
auths=""
if test $want_passwd = yes; then
need_crypt=yes
AC_DEFINE(USERINFO_PASSWD,, Build with passwd support)
auths="$auths passwd"
fi
if test $want_passwd_file = yes; then
need_crypt=yes
AC_DEFINE(USERINFO_PASSWD_FILE,, Build with passwd-file support)
auths="$auths passwd-file"
fi
if test $want_shadow = yes; then
AC_CHECK_FUNC(getspnam, [
need_crypt=yes
AC_DEFINE(USERINFO_SHADOW,, Build with shadow support)
auths="$auths shadow"
])
fi
if test $want_pam = yes; then
AC_CHECK_LIB(pam, pam_start, [
have_pam=no
AC_CHECK_HEADER(security/pam_appl.h, [
AC_DEFINE(HAVE_SECURITY_PAM_APPL_H,,
Define if you have security/pam_appl.h)
have_pam=yes
])
AC_CHECK_HEADER(pam/pam_appl.h, [
AC_DEFINE(HAVE_PAM_PAM_APPL_H,,
Define if you have pam/pam_appl.h)
have_pam=yes
])
if test "$have_pam" = "yes"; then
USERINFO_LIBS="$USERINFO_LIBS -lpam"
AC_DEFINE(USERINFO_PAM,, Build with PAM support)
auths="$auths pam"
AC_CHECK_LIB(pam, pam_setcred, [
AC_DEFINE(HAVE_PAM_SETCRED,,
Define if you have pam_setcred())
])
fi
])
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,, Build with vpopmail support)
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, Index file compatibility 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,, Build with IPv6 support)
fi
AC_MSG_RESULT($i_cv_type_in6_addr)
fi
dnl **
dnl ** capabilities
dnl **
capability="IMAP4rev1 SORT"
if test "$have_ssl" != "no"; then
capability="$capability STARTTLS"
fi
AC_DEFINE_UNQUOTED(CAPABILITY_STRING, "$capability", IMAP capabilities)
dnl **
dnl ** register the storage classes
dnl **
STORAGE="maildir mbox"
file="src/lib-storage/register/mail-storage-register.c"
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
CFLAGS="$CFLAGS $EXTRA_CFLAGS"
AC_OUTPUT(
Makefile
doc/Makefile
src/Makefile
src/lib/Makefile
src/lib-charset/Makefile
src/lib-imap/Makefile
src/lib-index/Makefile
src/lib-index/maildir/Makefile
src/lib-index/mbox/Makefile
src/lib-mail/Makefile
src/lib-storage/Makefile
src/lib-storage/index/Makefile
src/lib-storage/index/maildir/Makefile
src/lib-storage/index/mbox/Makefile
src/lib-storage/subscription-file/Makefile
src/lib-storage/register/Makefile
src/auth/Makefile
src/imap/Makefile
src/login/Makefile
src/master/Makefile
stamp.h)
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"