dnl Process this file with autoconf to produce a configure script. dnl dnl Copyright (c) 1998-2000 Carnegie Mellon University. All rights reserved. dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions dnl are met: dnl dnl 1. Redistributions of source code must retain the above copyright dnl notice, this list of conditions and the following disclaimer. dnl dnl 2. Redistributions in binary form must reproduce the above copyright dnl notice, this list of conditions and the following disclaimer in dnl the documentation and/or other materials provided with the dnl distribution. dnl dnl 3. The name "Carnegie Mellon University" must not be used to dnl endorse or promote products derived from this software without dnl prior written permission. For permission or any other legal dnl details, please contact dnl Office of Technology Transfer dnl Carnegie Mellon University dnl 5000 Forbes Avenue dnl Pittsburgh, PA 15213-3890 dnl (412) 268-4387, fax: (412) 268-7395 dnl tech-transfer@andrew.cmu.edu dnl dnl 4. Redistributions of any form whatsoever must retain the following dnl acknowledgment: dnl \"This product includes software developed by Computing Services dnl at Carnegie Mellon University (http://www.cmu.edu/computing/).\" dnl dnl CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO dnl THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY dnl AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE dnl FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN dnl AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING dnl OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. dnl dnl dnl configure.in for the Cyrus imapd dnl $Id: configure.in,v 1.297 2006/11/30 17:11:16 murch Exp $ dnl AC_INIT(imap/imapd.c) AC_PREREQ([2.54]) AC_CONFIG_HEADER(config.h) AC_CANONICAL_HOST dnl Useful hook for distributions AC_ARG_WITH(extraident,[ --with-extraident=STRING use STRING as extra version information], [AC_DEFINE_UNQUOTED(EXTRA_IDENT,"$withval", [Extra version information for imap/version.h])]) AC_CHECK_PROG(MAKEDEPEND,makedepend,makedepend,[`cd ${srcdir};pwd`/tools/not-mkdep]) if test "$MAKEDEPEND" != "makedepend"; then AC_MSG_WARN([Makedepend is not installed on this system. You should compile and install the version from the makedepend subdirectory.]) fi AC_ARG_WITH(login,,AC_ERROR([--with-login is no longer supported. Configure SASL appropriately instead.])) AC_ARG_WITH(cyrus-prefix,[ --with-cyrus-prefix=DIR use DIR as cyrus server install directory], cyrus_prefix="$withval",cyrus_prefix="/usr/cyrus") AC_SUBST(cyrus_prefix) AC_DEFINE_UNQUOTED(CYRUS_PATH,"$cyrus_prefix",[Where will we be installed?]) AC_ARG_WITH(service-path,[ --with-service-path=DIR use DIR as service install directory], service_path="$withval",service_path="$cyrus_prefix/bin") AC_SUBST(service_path) AC_DEFINE_UNQUOTED(SERVICE_PATH,"$service_path",[Directiory to use for service binaries]) AC_ARG_WITH(cyrus-user,[ --with-cyrus-user=USERID use USERID cyrus userid], cyrus_user="$withval",cyrus_user="cyrus") AC_SUBST(cyrus_user) AC_DEFINE_UNQUOTED(CYRUS_USER, "$cyrus_user",[What user will we run as?]) AC_ARG_WITH(cyrus-group,[ --with-cyrus-group=GROUPID use GROUPID cyrus group], cyrus_group="$withval",cyrus_group="mail") AC_SUBST(cyrus_group) dnl allow users to override $sysconfdir, but retain old default (/etc) dnl if not specified if test $sysconfdir = '${prefix}/etc'; then sysconfdir="/etc" fi AC_DEFINE_UNQUOTED(SYSCONFDIR,"$sysconfdir",[Config File Location]) AC_PROG_CC AC_PROG_RANLIB AC_PROG_MAKE_SET AC_PROG_INSTALL AC_AIX AC_ISC_POSIX AC_PROG_AWK AC_C_CONST AC_SYS_LONG_FILE_NAMES if test $ac_cv_sys_long_file_names = no; then AC_MSG_ERROR(The Cyrus IMAPD requires support for long file names) fi AC_C_INLINE AC_CHECK_SIZEOF(long) dnl Check if `long long int' is available AC_CHECK_SIZEOF(long long int) AC_CHECK_SIZEOF(unsigned long long int) if test "$ac_cv_sizeof_long_long_int" -eq 8 -a \ "$ac_cv_sizeof_unsigned_long_long_int" -eq 8; then AC_DEFINE(HAVE_LONG_LONG_INT,[],[Does the compiler support long long int?]) AC_C_BIGENDIAN fi CMU_C___ATTRIBUTE__ CMU_C_FPIC dnl check for -R, etc. switch CMU_GUESS_RUNPATH_SWITCH AC_CHECK_HEADERS(unistd.h sys/select.h sys/param.h stdarg.h) AC_REPLACE_FUNCS(memmove strcasecmp ftruncate strerror) AC_CHECK_FUNCS(strlcat strlcpy) AC_HEADER_DIRENT dnl do this before Berkeley DB/IPv6 detection CMU_SOCKETS LIBS="$LIBS ${LIB_SOCKET}" dnl check for IPv6 functions (fall back to sasl's if we don't have them) cyrus_cv_getaddrinfo=yes IPv6_CHECK_FUNC(getaddrinfo, [IPv6_CHECK_FUNC(gai_strerror, AC_DEFINE(HAVE_GETADDRINFO,[],[Do we have a getaddrinfo?]), cyrus_cv_getaddrinfo=no)], cyrus_cv_getaddrinfo=no) if test $cyrus_cv_getaddrinfo = no; then IPV6_OBJS="getaddrinfo.o" fi cyrus_cv_getnameinfo=yes IPv6_CHECK_FUNC(getnameinfo, AC_DEFINE(HAVE_GETNAMEINFO,[],[Do we have a getnameinfo?]), cyrus_cv_getnameinfo=no) if test $cyrus_cv_getnameinfo = no; then IPV6_OBJS="$IPV6_OBJS getnameinfo.o" fi IPv6_CHECK_SS_FAMILY() IPv6_CHECK_SA_LEN() AC_SUBST(IPV6_OBJS) dnl this is to check for time things AC_CHECK_HEADERS(sys/time.h) AC_HEADER_TIME AC_STRUCT_TM AC_STRUCT_TIMEZONE AC_SUBST(CPPFLAGS) AC_SUBST(PRE_SUBDIRS) AC_SUBST(EXTRA_SUBDIRS) AC_SUBST(DEPLIBS) AC_SUBST(LOCALDEFS) AC_FUNC_VPRINTF dnl function for doing each of the database backends dnl parameters: backend name, variable to set, withval CYRUSDB_OBJS="cyrusdb_flat.o cyrusdb_skiplist.o cyrusdb_quotalegacy.o" dnl Berkeley DB Detection AC_ARG_WITH(bdb, [ --with-bdb=DIR use Berkeley DB (in DIR) [[yes]] ], with_bdb=$withval, with_bdb="yes") dnl support old-style AC_ARG_WITH(dbdir,, with_bdb=$withval) case "$with_bdb" in no) use_berkeley="no" ;; yes) use_berkeley="yes" with_bdb_lib=none with_bdb_inc=none ;; *) use_berkeley="yes" with_bdb_lib="$with_bdb/lib" with_bdb_inc="$with_bdb/include" ;; esac if test "$use_berkeley" != "no"; then CYRUS_BERKELEY_DB_CHK() if test "$dblib" = "no"; then AC_ERROR([Berkeley DB 3.x or later was not found. You may need to supply the --with-bdb-libdir or --with-bdb-incdir configure options.]) fi if test "$with_bdb_lib" != "none"; then CMU_ADD_LIBPATH($with_bdb_lib) fi BDB_INC=${BDB_INCADD} BDB_LIB=${BDB_LIBADD} AC_SUBST(BDB_INC) AC_SUBST(BDB_LIB) LIBS="${LIBS} ${BDB_LIBADD}" CPPFLAGS="${BDB_INCADD} ${CPPFLAGS}" CYRUSDB_OBJS="$CYRUSDB_OBJS cyrusdb_berkeley.o" AC_DEFINE(HAVE_BDB,[],[Build in Berkeley DB support?]) fi dnl End Berkeley DB Detection AC_SUBST(CYRUSDB_OBJS) SIEVE_SUBDIRS="" sievedir="sieve" AC_ARG_ENABLE(sieve, [ --disable-sieve disable Sieve support], if test "$enableval" = no; then sievedir="no" fi) if test "$sievedir" != "no"; then SIEVE_OBJS="lmtp_sieve.o smtpclient.o" AC_SUBST(SIEVE_OBJS) SIEVE_LIBS="../${sievedir}/libsieve.a" AC_SUBST(SIEVE_LIBS) SIEVE_CPPFLAGS="-I\$(srcdir)/../$sievedir" AC_SUBST(SIEVE_CPPFLAGS) AC_DEFINE(USE_SIEVE,[],[Build in Sieve support?]) dnl Sieve configure stuff AC_PROG_YACC AC_PROG_LEX AC_CHECK_LIB(fl,main) AC_SEARCH_LIBS(regcomp, rx regex, [ AC_DEFINE(ENABLE_REGEX,[],[Do we have a decent regex library?]) AC_CHECK_HEADER(rxposix.h, AC_DEFINE(HAVE_RX,[],[Do we have rxposix.h?]))]) SIEVE_SUBDIRS="${SIEVE_SUBDIRS} $sievedir" EXTRA_OUTPUT="${EXTRA_OUTPUT} $sievedir/Makefile" fi AC_SUBST(SIEVE_SUBDIRS) dnl for et routines AC_FUNC_CHECK(strerror,AC_DEFINE(HAS_STRERROR,[],[Do we have strerror()?]), AC_DEFINE(NEED_SYS_ERRLIST,[],[Do we have a sys_errlist?])) dnl for master fd limits AC_CHECK_HEADERS(sys/resource.h) AC_CHECK_FUNCS(setrlimit) AC_CHECK_FUNCS(getrlimit) dnl for detaching terminal AC_CHECK_FUNCS(daemon setsid) dnl for turning off sockets AC_CHECK_FUNCS(shutdown) AC_EGREP_HEADER(socklen_t, sys/socket.h, AC_DEFINE(HAVE_SOCKLEN_T,[],[Do we have a socklen_t?])) AC_EGREP_HEADER(sockaddr_storage, sys/socket.h, AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE,[],[Do we have a sockaddr_storage?])) AC_EGREP_HEADER(rlim_t, sys/resource.h, AC_DEFINE(HAVE_RLIM_T,[],[Do we have an rlim_t?])) dnl Bunch of setproctitle stuff spt_type="" AC_CHECK_FUNC(setproctitle,spt_type=SPT_BUILTIN) if test "$spt_type" = ""; then dnl BSD/OS and FreeBSD put it in -lutil AC_CHECK_LIB(util,setproctitle,spt_type=SPT_BUILTIN LIBS="${LIBS} -lutil") fi if test "$spt_type" = ""; then AC_CHECK_HEADER(sys/pstat.h,spt_type=SPT_PSTAT) fi if test "$spt_type" = ""; then AC_CHECK_HEADER(sys/sysnews.h,spt_type=SPT_SYSMIPS) fi if test "$spt_type" = ""; then AC_MSG_CHECKING(for PS_STRINGS) AC_CACHE_VAL(cyrus_cv_sys_psstrings, AC_TRY_CPP([ #include <machine/vmparam.h> #include <sys/exec.h> #ifndef PS_STRINGS #include </nonexistent> #endif],cyrus_cv_sys_psstrings=yes,cyrus_cv_sys_psstrings=no)) if test $cyrus_cv_sys_psstrings = yes; then spt_type=SPT_PSSTRINGS fi AC_MSG_RESULT($cyrus_cv_sys_psstrings) fi if test "$spt_type" = ""; then AC_MSG_CHECKING(for SCO) AC_CACHE_VAL(cyrus_cv_sys_sco, AC_TRY_CPP([ #ifndef _SCO_unix_ #include </nonexistent> #endif],cyrus_cv_sys_sco=yes,cyrus_cv_sys_sco=no)) if test $cyrus_cv_sys_sco = yes; then spt_type=SPT_SCO fi AC_MSG_RESULT($cyrus_cv_sys_sco) fi if test "$spt_type" = ""; then AC_MSG_CHECKING(for setproctitle usability) AC_CACHE_VAL(cyrus_cv_sys_setproctitle, AC_TRY_CPP([ #if defined(DGUX) || defined(_SEQUENT_) || defined(apollo) #include </nonexistent> #endif],cyrus_cv_sys_setproctitle=yes,cyrus_cv_sys_setproctitle=no)) if test $cyrus_cv_sys_setproctitle = no; then spt_type=SPT_NONE fi AC_MSG_RESULT($cyrus_cv_sys_setproctitle) fi if test "$spt_type" != ""; then AC_DEFINE_UNQUOTED(SPT_TYPE,$spt_type,[Do we already have setproctitle?]) fi AC_MSG_CHECKING(nonblocking method) AC_CACHE_VAL(cyrus_cv_sys_nonblock,AC_TRY_LINK([#include <sys/types.h> #include <sys/file.h> #include <fcntl.h> #ifndef FNDELAY #define FNDELAY O_NDELAY #endif],[fcntl(0, F_GETFL, 0)&FNDELAY], cyrus_cv_sys_nonblock=fcntl,cyrus_cv_sys_nonblock=ioctl)) WITH_NONBLOCK=$cyrus_cv_sys_nonblock AC_SUBST(WITH_NONBLOCK) AC_MSG_RESULT($WITH_NONBLOCK) AC_MSG_CHECKING(timezone GMT offset method) AC_CACHE_VAL(cyrus_cv_struct_sys_gmtoff,AC_TRY_COMPILE([ #include <time.h>],[struct tm tm; tm.tm_gmtoff = 0; ],cyrus_cv_struct_sys_gmtoff=tm,cyrus_cv_struct_sys_gmtoff=gmtime)) WITH_GMTOFF=$cyrus_cv_struct_sys_gmtoff AC_SUBST(WITH_GMTOFF) AC_MSG_RESULT($WITH_GMTOFF) AC_MSG_CHECKING(for shared mmap) AC_CACHE_VAL(cyrus_cv_func_mmap_shared,AC_TRY_RUN([ #include <sys/types.h> #include <sys/mman.h> #include <fcntl.h> main() { char *base; int fd = open("conftestmmap", O_RDWR|O_CREAT|O_TRUNC, 0666); if (fd == -1) exit(1); if (write(fd, "test", 4) != 4) exit(1); fsync(fd); base = mmap((caddr_t)0, 100, PROT_READ, MAP_SHARED #ifdef MAP_FILE | MAP_FILE #endif #ifdef MAP_VARIABLE | MAP_VARIABLE #endif , fd, 0L); if (base == (caddr_t)-1) exit(1); if (strncmp(base, "test", 4) != 0) exit(1); if (write(fd, "test", 4) != 4) exit(1); fsync(fd); if (strncmp(base+4, "test", 4) != 0) exit(1); exit(0);} ],cyrus_cv_func_mmap_shared=yes,cyrus_cv_func_mmap_shared=no, cyrus_cv_func_mmap_shared=no)) AC_MSG_RESULT($cyrus_cv_func_mmap_shared) if test $cyrus_cv_func_mmap_shared = yes; then WITH_MAP="shared" else AC_MSG_CHECKING(for stupid shared mmap) AC_CACHE_VAL(cyrus_cv_func_mmap_stupidshared,AC_TRY_RUN([ #include <sys/types.h> #include <sys/mman.h> #include <fcntl.h> main() { char *base; int fd = open("conftestmmap", O_RDWR|O_CREAT|O_TRUNC, 0666); if (fd == -1) exit(1); if (write(fd, "test", 4) != 4) exit(1); fsync(fd); base = mmap((caddr_t)0, 4, PROT_READ, MAP_SHARED #ifdef MAP_FILE | MAP_FILE #endif #ifdef MAP_VARIABLE | MAP_VARIABLE #endif , fd, 0L); if (base == (caddr_t)-1) exit(1); if (strncmp(base, "test", 4) != 0) exit(1); lseek(fd, 0L, 0); if (write(fd, "xyzz", 4) != 4) exit(1); fsync(fd); if (strncmp(base, "xyzz", 4) != 0) exit(1); exit(0);} ],cyrus_cv_func_mmap_stupidshared=yes,cyrus_cv_func_mmap_stupidshared=no, cyrus_cv_func_mmap_stupidshared=no)) AC_MSG_RESULT($cyrus_cv_func_mmap_stupidshared) if test $cyrus_cv_func_mmap_stupidshared = yes; then WITH_MAP="stupidshared" else AC_MSG_WARN([*** This system does not have a working mmap()]) AC_MSG_WARN(*** Expect a considerable performance penalty) WITH_MAP=nommap fi fi AC_SUBST(WITH_MAP) AC_ARG_WITH(lock, [ --with-lock=METHOD force use of METHOD for locking (flock or fcntl)], WITH_LOCK="$withval", [ AC_CHECK_FUNC(fcntl,WITH_LOCK="fcntl",[ AC_CHECK_FUNC(flock,WITH_LOCK="flock",[ AC_ERROR(unable to detect locking method) ]) ]) ]) AC_SUBST(WITH_LOCK) dnl check for fdatasync (used by cyrusdb_skiplist) LIB_RT="" AC_CHECK_FUNC(fdatasync, AC_DEFINE(HAVE_FDATASYNC,[],[Do we have fdatasync()?]), [ AC_CHECK_LIB(rt, fdatasync, [ LIB_RT="-lrt" AC_DEFINE(HAVE_FDATASYNC,[],[Do we have fdatasync()?]) ]) ]) dnl for makedepend and AFS. cant_find_sigvec=no AC_CACHE_VAL(cyrus_sigveclib,[ dnl bsd classic flavor AC_CHECK_FUNC(sigvec, [ cyrus_sigveclib="" ], [ dnl hp flavor AC_CHECK_LIB(BSD, sigvec, cyrus_sigveclib="-lBSD", [ dnl not hp flavor SAVE_LDFLAGS="$LDFLAGS" dnl solaris flavor LDFLAGS="-L/usr/ucblib -R/usr/ucblib $LDFLAGS" AC_CHECK_LIB(ucb, sigvec, [ dnl more solaris flavor cyrus_sigveclib="-lc -L/usr/ucblib -R/usr/ucblib -lucb"], [ cant_find_sigvec=yes ]) LDFLAGS="$SAVE_LDFLAGS"]) ]) ]) AC_SUBST(cyrus_sigveclib) # ok, we still look for this stuff because of checking groups, but # all authentication goes through SASL AC_ARG_WITH(afs,[ --with-afs=PATH use AFS libraries from PATH], with_afs="${withval}", with_afs="no") AC_ARG_WITH(ldap, [ --with-ldap=DIR use LDAP (in DIR) (experimental) [/usr/local] ], with_ldap="${withval}", with_ldap="no") dnl select mode of afspts AC_ARG_ENABLE(krb5afspts,[ --enable-krb5afspts compile afskrb PTS module with krb5 support], [SASL_SET_GSSAPI_LIBS AC_DEFINE(AFSPTS_USE_KRB5,[],[Should the AFS PTS plugin use krb5?])]) if test "x$with_afs" != "xno"; then if test ! -d $with_afs; then $with_afs=/usr/local fi CFLAGS="${CFLAGS} -I${with_afs}/include" AFS_LIBS="${with_afs}/lib/afs/libkauth.a ${with_afs}/lib/afs/libprot.a ${with_afs}/lib/afs/libauth.a ${with_afs}/lib/afs/libsys.a ${with_afs}/lib/librxkad.a ${with_afs}/lib/librx.a ${with_afs}/lib/afs/libsys.a ${with_afs}/lib/libubik.a ${with_afs}/lib/liblwp.a ${with_afs}/lib/afs/util.a" if test -f ${with_afs}/lib/afs/libaudit.a; then AFS_LIBS="$AFS_LIBS ${with_afs}/lib/afs/libaudit.a" fi if test -f /usr/ucblib/libucb.a; then CMU_ADD_LIBPATH_TO(/usr/ucblib, AFS_LDFLAGS) AFS_LIBS="$AFS_LIBS -lc -lucb" fi AC_CACHE_VAL(cyrus_afs_sigvec,[ SAVE_LIBS="$LIBS" LIBS="${with_afs}/lib/liblwp.a" AC_MSG_CHECKING(if AFS libraries need sigvec) dnl Does AFS need sigvec? We have to link against lwp and see dnl if IOMGR_Initialize wants it AC_TRY_LINK([IOMGR_Initialize();], [IOMGR_Initialize()], [ dnl it linked; don't need it AC_MSG_RESULT(no) cyrus_afs_sigvec="no" ], [ dnl didn't link; pick up sigvec AC_MSG_RESULT(yes) cyrus_afs_sigvec="yes" ]) ]) if test "$cyrus_afs_sigvec" = yes; then if test "$cant_find_sigvec" = yes; then AC_MSG_WARN([Can't find a sigvec for AFS libraries which seem to need one.]) else AFS_LIBS="${AFS_LIBS} $cyrus_sigveclib" AC_SUBST(AFS_LIBS) AC_SUBST(AFS_LDFLAGS) AC_DEFINE(HAVE_AFSKRB,[],[Should we build afskrb pts module?]) fi else AFS_LIBS="${AFS_LIBS}" AC_SUBST(AFS_LIBS) AC_SUBST(AFS_LDFLAGS) AC_DEFINE(HAVE_AFSKRB,[],[Should we build afskrb pts module?]) fi LIBS="$SAVE_LIBS" fi LDAP_CPPFLAGS="" LDAP_LDFLAGS="" LDAP_LIBS="" if test "x$with_ldap" != "xno"; then if test ! -d $with_ldap; then $with_ldap=/usr/local fi LDAP_CPPFLAGS="$CPPFLAGS -I${with_ldap}/include" LDAP_LDFLAGS="$LDFLAGS -L${with_ldap}/lib" LDAP_LIBS="" save_CPPFLAGS=$CPPFLAGS save_LDFLAGS=$LDFLAGS CPPFLAGS=$LDAP_CPPFLAGS LDFLAGS=$LDAP_LDFLAGS AC_CHECK_LIB(ldap, ldap_initialize, [ AC_DEFINE(HAVE_LDAP,[],[Should we build ldap pts module?]) AC_SUBST(LDAP_CPPFLAGS) AC_SUBST(LDAP_LDFLAGS) AC_SUBST(LDAP_LIBS) LDAP_LIBS="-lldap -llber" ],,-llber) CPPFLAGS=$save_CPPFLAGS LDFLAGS=$LDAP_LDFLAGS AC_CHECK_LIB(ldap, ldap_initialize, [ AC_DEFINE(HAVE_LDAP,[],[Should we build ldap pts module?]) AC_SUBST(LDAP_CPPFLAGS) AC_SUBST(LDAP_LDFLAGS) AC_SUBST(LDAP_LIBS) LDAP_LIBS="-lldap -llber" ],,-llber) CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS fi if test "x$with_afs" != "xno" -o "x$with_ldap" != "xno"; then EXTRA_SUBDIRS="${EXTRA_SUBDIRS} ptclient" EXTRA_OUTPUT="${EXTRA_OUTPUT} ptclient/Makefile" AC_DEFINE(WITH_PTS,[],[Build in PTS support?]) fi SERVER_SUBDIRS="master imap" AC_ARG_ENABLE(server, [ --disable-server disable compiling servers], if test "$enableval" = no; then SERVER_SUBDIRS="" fi) AC_SUBST(SERVER_SUBDIRS) # We always output a server makefile (just because we can) dnl this is the new simple check for kerberos; since the person had to dnl compile SASL, we might as well use the same checks. AC_ARG_WITH(krb,[ --with-krb=PATH use Kerberos from PATH], with_krb="$withval", with_krb="no") AC_ARG_WITH(krbimpl,[ --with-krbimpl=\[kth|mit\] assume Kerberos 4 from KTH or MIT], with_krbimpl="$withval", with_krbimpl="kth") AC_ARG_ENABLE(statickrb, [ --enable-statickrb link Kerberos statically], with_statickrb="yes", with_statickrb="no") dnl In order to compile kerberos4, we need libkrb and libdes. dnl we might need -lresolv for kerberos AC_CHECK_LIB(resolv,res_search) if test "$with_statickrb" = "yes" -a ! -d "$with_krb"; then AC_MSG_ERROR([--enable-statickrb specified but --with-krb did not specify a valid directory]) fi if test "$with_krb" != "no"; then dnl Do we need DES for kerberos? AC_ARG_WITH(krbdes,[ --with-krbdes use Kerberos DES implementation [[yes]]], with_krbdes="$withval", with_krbdes="yes") if test "$with_krbdes" = "yes"; then AC_CHECK_LIB(des,des_ecb_encrypt, if test "$with_statickrb" = "yes"; then KRB_LIBS="$with_krb/lib/libdes.a" else KRB_LIBS="-ldes" fi, AC_MSG_ERROR([The Kerberos DES library is required for Kerberos support. You might want --with-auth=unix.])) fi fi dnl if we were ambitious, we'd look more aggressively for the dnl krb4 install if test -d ${with_krb}; then AC_CACHE_CHECK(for Kerberos includes, cyrus_krbinclude, [ for krbhloc in include/kerberosIV include do if test -f ${with_krb}/${krbhloc}/krb.h ; then cyrus_krbinclude=${with_krb}/${krbhloc} break fi done ]) if test -n "${cyrus_krbinclude}"; then CPPFLAGS="$CPPFLAGS -I${cyrus_krbinclude}" fi CMU_ADD_LIBPATH(${with_krb}/lib) fi if test "$with_krbimpl" != "kth"; then KRBLIB="krb4" else KRBLIB="krb" fi if test "$with_des" != no; then AC_CHECK_HEADER(krb.h, AC_CHECK_LIB(${KRBLIB}, krb_mk_priv, if test "$with_statickrb" = "yes"; then KRB_LIBS="$KRB_LIBS $with_krb/lib/lib${KRBLIB}.a" else KRB_LIBS="$KRB_LIBS -l${KRBLIB}" fi, AC_WARN(No Kerberos V4 found); krb4=no, $KRB_LIBS), AC_WARN(No Kerberos V4 found); krb4=no) else AC_WARN(No DES library found for Kerberos V4 support) krb4=no fi if test "${krb4}" != no; then AC_DEFINE(HAVE_KRB,[],[Support for Kerberos?]) fi LIBS="$KRB_LIBS $LIBS" SASL_SET_GSSAPI_LIBS dnl dnl Test for OpenSSL dnl IMAP_PROGS="" AC_ARG_WITH(openssl,[ --with-openssl=PATH use OpenSSL from PATH], with_openssl="${withval}") OPENSSL_INC= OPENSSL_LIB= case "$with_openssl" in no) with_openssl="no";; ""|yes) dnl if openssl has been compiled with the rsaref2 libraries, dnl we need to include the rsaref libraries in the crypto check LIB_RSAREF="" AC_CHECK_LIB(rsaref, RSAPublicEncrypt, LIB_RSAREF="-lRSAglue -lrsaref"; cmu_have_rsaref=yes, cmu_have_rsaref=no) with_openssl="yes" AC_CHECK_LIB(crypto,BIO_accept, LIBS="-lcrypto $LIB_RSAREF ${LIBS}", with_openssl="no", $LIB_RSAREF) AC_CHECK_LIB(ssl, SSL_CTX_new, LIBS="-lssl ${LIBS}", with_openssl="no", -lcrypto $LIB_RSAREF) ;; *) OPENSSL_INC="-I${with_openssl}/include" OPENSSL_LIBPATH="${with_openssl}/lib" OPENSSL_LIB="-L${OPENSSL_LIBPATH}" CPPFLAGS="${CPPFLAGS} ${OPENSSL_INC}" CMU_ADD_LIBPATH(${OPENSSL_LIBPATH}) CMU_ADD_LIBPATH_TO(${OPENSSL_LIBPATH}, OPENSSL_LIB) LIBS="${LIBS} -lssl -lcrypto";; esac AC_MSG_CHECKING(for openssl) AC_MSG_RESULT($with_openssl) if test "$with_openssl" != "no"; then AC_DEFINE(HAVE_SSL,[],[Build with SSL support?]) IMAP_PROGS="$IMAP_PROGS tls_prune" if test "${krb4}" != no; then AC_DEFINE(OPENSSL_ENABLE_OLD_DES_SUPPORT,[],[Configure OpenSSL to provide legacy des apis]) AC_DEFINE(OPENSSL_DES_LIBDES_COMPATIBILITY,[],[Configure OpenSSL to provide krb4-compatible legacy des apis]) fi fi AC_SUBST(OPENSSL_INC) AC_SUBST(OPENSSL_LIB) dnl dnl Allow for setting EGD socket file on systems without /dev/*random. dnl AC_ARG_WITH(egd-socket, [ --with-egd-socket=FILE Entropy Gathering Daemon socket pathname for systems without /dev/urandom], [ EGD_SOCKET="$withval" ] ) if test -n "$EGD_SOCKET" ; then AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET", [Alternative to /dev/urandom?]) fi dnl dnl Test for Zephyr dnl AC_ARG_WITH(zephyr,[ --with-zephyr[=PATH] enable Zephyr notification (installed on PATH)], with_zephyr="${withval}") if test -z "$with_zephyr"; then if test -f /usr/local/lib/libzephyr.a; then with_zephyr="/usr/local" elif test -f /usr/lib/libzephyr.a; then with_zephyr="/usr" fi fi ZEPHYR_LIBS="" ZEPHYR_CPPFLAGS="" case "$with_zephyr" in no) true;; ""|yes) AC_CHECK_LIB(zephyr,ZInitialize,ZEPHYR_LIBS="-lzephyr", with_zephyr="no",);; *) if test -d ${with_zephyr}/include/zephyr; then ZEPHYR_CPPFLAGS="-I${with_zephyr}/include/zephyr" else ZEPHYR_CPPFLAGS="-I${with_zephyr}/include" fi ZEPHYR_LIBS="-lzephyr";; esac AC_SUBST(ZEPHYR_LIBS) AC_SUBST(ZEPHYR_CPPFLAGS) if test "$with_zephyr" != "no"; then AC_DEFINE(HAVE_ZEPHYR,[],[Build with Zephyr support?]) fi dnl dnl Set pidfile location dnl AC_ARG_WITH(pidfile,[ --with-pidfile[=PATH] pidfile in PATH (/var/run/cyrus-master.pid)], [MASTERPIDFILE="$withval"], [MASTERPIDFILE="/var/run/cyrus-master.pid"]) MASTERPIDFILE="\"$MASTERPIDFILE\"" AC_DEFINE_UNQUOTED(MASTER_PIDFILE, $MASTERPIDFILE,[Name of the pidfile for master]) dnl dnl see if we're compiling with IMAP idled support dnl AC_ARG_ENABLE(idled, [ --enable-idled enable IMAP idled support], if test "$enable_val" != no; then IMAP_PROGS="$IMAP_PROGS idled" fi) dnl dnl see if we're compiling with NNTP support dnl ENABLE_NNTP=no AC_ARG_ENABLE(nntp, [ --enable-nntp enable NNTP support], ENABLE_NNTP=$enableval if test "$ENABLE_NNTP" != no; then IMAP_PROGS="$IMAP_PROGS nntpd fetchnews" fi) dnl dnl see if we're compiling the Murder support programs dnl ENABLE_MURDER=no AC_ARG_ENABLE(murder, [ --enable-murder enable IMAP Murder support], ENABLE_MURDER=$enableval) if test "$ENABLE_MURDER" != no; then IMAP_PROGS="$IMAP_PROGS mupdate" # for master/slave auto-selection AC_CHECK_HEADERS(sys/sockio.h) fi dnl dnl see if we're compiling replication support programs dnl ENABLE_REPLICATION=no AC_ARG_ENABLE(replication, [ --enable-replication enable replication support (experimental)], ENABLE_REPLICATION=$enableval if test "$ENABLE_REPLICATION" != no; then IMAP_PROGS="$IMAP_PROGS sync_client sync_server sync_reset make_md5" fi) AC_SUBST(IMAP_PROGS) dnl dnl Try and find a system version of com_err. dnl If we see something that looks a little wacky, ignore it (there are many dnl deficient installs of com_err, unfortunately, which leave out compile_et) dnl AC_ARG_WITH(com_err, [ --with-com_err=PATH use com_err from path -- includes in PATH/include, libs in PATH/lib, and compile_et in PATH/bin]) if test -z "$with_com_err"; then # no value supplied AC_CHECK_LIB(com_err, com_err, [ # com_err is already in library path # guess we're okay # can use system com_err with_com_err="" AC_CHECK_HEADER(et/com_err.h, [AC_DEFINE(HAVE_ET_COM_ERR_H,[],[We need et/com_err.h])], [AC_CHECK_HEADER(com_err.h,[],[AC_ERROR([cannot locate com_err.h])])]) AC_PATH_PROG(COMPILE_ET, compile_et, [no compile et]) ], [ if test -f /usr/local/include/com_err.h -o -f /usr/local/include/et/com_err.h; then with_com_err="/usr/local" AC_PATH_PROG(COMPILE_ET, /usr/local/bin/compile_et, [no compile et]) elif test -f /usr/include/com_err.h -o -f /usr/include/et/com_err.h; then with_com_err="/usr" AC_PATH_PROG(COMPILE_ET, /usr/bin/compile_et, [no compile et]) else # use ours with_com_err=yes fi ]) if test "${with_com_err}" = "no"; then AC_MSG_WARN([com_err is required; included version will be used.]) with_com_err="yes" fi if test "${COMPILE_ET}" = "no compile et" -o "${COMPILE_ET}" = ""; then AC_MSG_WARN([Parts of com_err distribuion were found, but not compile_et.]) AC_MSG_WARN([Will build com_err from included sources.]) with_com_err="yes" # build it ourselves fi fi case "$with_com_err" in # built-in et yes) # use the com_err we're gonna build COM_ERR_LIBS="../et/libcom_err.a" COMPILE_ET="../et/compile_et" COM_ERR_LDFLAGS="" COM_ERR_CPPFLAGS="-I\${top_srcdir}/et" PRE_SUBDIRS="et ${PRE_SUBDIRS}" EXTRA_OUTPUT="${EXTRA_OUTPUT} et/Makefile" ;; "") # no problem, we already have it in the paths # we do nothing to pick it up COM_ERR_LIBS="-lcom_err" # hope it's not shared # we already set COMPILE_ET, or we didn't get here COM_ERR_LDFLAGS="" COM_ERR_CPPFLAGS="" ;; *) # use whatever they told us, or whatever we found COMPILE_ET="${with_com_err}/bin/compile_et" COM_ERR_LIBS="${with_com_err}/lib/libcom_err.a" COM_ERR_CPPFLAGS="-I${with_com_err}/include" # Ever get the feeling people hide this stuff on purpose? if test -d "${with_com_err}/include/et" ; then COM_ERR_CPPFLAGS="-I${with_com_err}/include/et" fi dnl CMU_ADD_LIBPATH_TO(${with_com_err}/lib, COM_ERR_LDFLAGS) COMPILE_ET="${with_com_err}/bin/compile_et" esac AC_SUBST(COMPILE_ET) AC_SUBST(COM_ERR_LIBS) AC_SUBST(COM_ERR_LDFLAGS) AC_SUBST(COM_ERR_CPPFLAGS) AC_MSG_CHECKING(for modern syslog) AC_CACHE_VAL(cyrus_cv_lib_syslog, AC_TRY_CPP([#include <syslog.h> #ifndef LOG_LOCAL6 #include </nonexistent> #endif],cyrus_cv_lib_syslog=yes,cyrus_cv_lib_syslog=no)) if test $cyrus_cv_lib_syslog = no; then PRE_SUBDIRS="${PRE_SUBDIRS} syslog" EXTRA_OUTPUT="${EXTRA_OUTPUT} syslog/Makefile" DEPLIBS="${DEPLIBS} ../syslog/libsyslog.a" CPPFLAGS="$CPPFLAGS -I\$(srcdir)/../syslog" fi AC_MSG_RESULT($cyrus_cv_lib_syslog) AC_MSG_CHECKING(which syslog facility to use) SYSLOG_FACILITY=LOG_LOCAL6 AC_ARG_WITH(syslogfacility,[ --with-syslogfacility=FACILITY set the syslog facility to use (default LOCAL6)], [ if test "$withval" != "yes" -a "$withval" != "no" ; then SYSLOG_FACILITY=LOG_$withval fi; ]) AC_DEFINE_UNQUOTED(SYSLOG_FACILITY, $SYSLOG_FACILITY, [Syslog facility to use.]) AC_MSG_RESULT($SYSLOG_FACILITY) dnl Have to check getdtabalesize after adding ossup, as some ossups define it AC_REPLACE_FUNCS(getdtablesize) AC_ARG_ENABLE(cmulocal, [ --enable-cmulocal enable CMU-specific local support], if test "$enableval" = yes; then EXTRA_SUBDIRS="${EXTRA_SUBDIRS} netnews depot" EXTRA_OUTPUT="${EXTRA_OUTPUT} depot/Makefile" fi) AC_MSG_CHECKING(to use old sieve service name) AC_ARG_ENABLE(oldsievename, [ --enable-oldsievename enable the use of 'imap' as the sieve service name], if test "$enableval" = yes; then AC_MSG_RESULT(yes) AC_DEFINE(OLD_SIEVE_SERVICE_NAME,[],[Use "imap" as sieve service name?]) else AC_MSG_RESULT(no) fi, AC_MSG_RESULT(no)) AC_ARG_ENABLE(listext, [ --enable-listext enable IMAP List extensions], if test "$enableval" = yes; then AC_DEFINE(ENABLE_LISTEXT,[],[Enable the LISTEXT extension?]) fi) AC_ARG_ENABLE(netscapehack, [ --enable-netscapehack enable Netscape hack for the menu option in Communicator to Administrate Mail], if test "$enableval" = yes; then AC_DEFINE(ENABLE_X_NETSCAPE_HACK,[],[Enable Netscape Menu Option Hack?]) fi) AC_CHECK_FUNC(dlopen,,[AC_CHECK_LIB(dl, dlopen)]) CMU_SASL2_REQUIRE_VER(2,1,7) CMU_SASL2_CHECKAPOP_REQUIRED AC_ARG_WITH(perl, [ --with-perl=PERL use PERL for perl], with_perl="$withval", with_perl="perl") if test "${with_perl}" = yes; then with_perl="perl" fi if test "${with_perl}" != no; then if test ${using_static_sasl} = "staticonly"; then AC_MSG_WARN([Cannot compile perl utilities using static libsasl]) with_perl="no" else AC_CHECK_PROGS(PERL, ${with_perl} perl, with_perl=notfound) fi fi if test "$with_perl" = "notfound"; then AC_MSG_WARN(Perl not found: Administrative tools won't be available) elif test "${with_perl}" != "no"; then dnl compile perl stuff EXTRA_SUBDIRS="${EXTRA_SUBDIRS} perl" dnl and compile perl/cyradm PERL_SUBDIRS="imap" PERL="${with_perl}" dnl add perl cccdlflags when building libraries -- this ensures that the dnl libraries will be compiled as PIC if perl requires PIC objects dnl -- this is needed on NetBSD, but seems to cause problems on atleast Solaris -- dnl eval `${PERL} -V:cccdlflags` PERL_CCCDLFLAGS="$cccdlflags" AC_SUBST(PERL_CCCDLFLAGS) fi dnl for timsieved if test "$sievedir" != "no"; then EXTRA_SUBDIRS="${EXTRA_SUBDIRS} timsieved notifyd" EXTRA_OUTPUT="${EXTRA_OUTPUT} timsieved/Makefile notifyd/Makefile" PERL_SUBDIRS="${PERL_SUBDIRS} sieve" PERL_DEPSUBDIRS="sieve" EXTRA_OUTPUT="${EXTRA_OUTPUT} perl/sieve/Makefile perl/sieve/lib/Makefile" else PERL_DEPSUBDIRS="none" fi dnl Check for MD5 functions AC_FUNC_CHECK(MD5Init,, AC_CHECK_LIB(md, MD5Init, LIBS="${LIBS} -lmd", MD5OBJ="md5.o")) AC_SUBST(MD5OBJ) dnl snmp dnl (agentx was depricated, but SNMP_SUBDIRS is conveinent as a placeholder) SNMP_SUBDIRS="" AC_SUBST(SNMP_SUBDIRS) CMU_LIBWRAP CMU_UCDSNMP # Figure out what directories we're linking against. # Lots of fun for the whole family. # This probably chokes on anything with spaces in it. # All we want is the list of -L directories, and -L may or may not be # followed by a space. isdir=no libpath="" #echo "debug ldflags: << ${ldflags} >>" #echo "debug default_ldflags: << ${default_ldflags} >>" for flag in ${ldflags} ${default_ldflags}; do case $flag in -L) # it's a split -L option, we'll mark the next option as a dir. isdir=yes ;; -L*) # attached -L option: split off the directory larg=`echo $flag | sed -e 's:-L\(..*\):\1:'` libpath="${libpath} ${larg}" ;; *) if test $isdir = yes ; then libpath="${libpath} ${flag}" isdir=no fi esac done IMAP_COM_ERR_LIBS="${COM_ERR_LIBS}" IMAP_LIBS="${LIB_SASL} ${LIBS}" AC_SUBST(LIB_RT) AC_SUBST(IMAP_COM_ERR_LIBS) AC_SUBST(IMAP_LIBS) dnl AC_OUTPUT_COMMANDS([ dnl if test "$with_perl" != "no"; then dnl (cd perl/sieve/managesieve; $perl Makefile.PL PREFIX=$prefix) dnl (cd perl/imap; $perl Makefile.PL PREFIX=$prefix) dnl fi dnl ], perl=$PERL; with_perl=$with_perl; prefix=$prefix; SASL_LIB="$LIB_SASL"; SASL_INC="$SASLFLAGS"; export SASL_LIB SASL_INC) AC_SUBST(PERL_SUBDIRS) AC_SUBST(PERL_DEPSUBDIRS) AC_SUBST(PERL) AH_TOP([ /* $Id: configure.in,v 1.297 2006/11/30 17:11:16 murch Exp $ */ /* * Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The name "Carnegie Mellon University" must not be used to * endorse or promote products derived from this software without * prior written permission. For permission or any other legal * details, please contact * Office of Technology Transfer * Carnegie Mellon University * 5000 Forbes Avenue * Pittsburgh, PA 15213-3890 * (412) 268-4387, fax: (412) 268-7395 * tech-transfer@andrew.cmu.edu * * 4. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by Computing Services * at Carnegie Mellon University (http://www.cmu.edu/computing/)." * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef _CYRUS_IMAPD_CONFIG_H_ #define _CYRUS_IMAPD_CONFIG_H_ ]) AH_BOTTOM([ /* time.h */ #if TIME_WITH_SYS_TIME # include <sys/time.h> # include <time.h> #else # if HAVE_SYS_TIME_H # include <sys/time.h> # else # include <time.h> # endif #endif /* com_err.h, as needed */ #ifndef IN_COM_ERR #ifdef HAVE_ET_COM_ERR_H #include <et/com_err.h> #else #include <com_err.h> #endif /* HAVE_ET_COM_ERR_H */ #endif /* IN_COM_ERR */ /* This allows us to work even when we don't have an fdatasync */ #ifndef HAVE_FDATASYNC #define fdatasync(fd) fsync(fd) #endif /* A similar setup for not having O_DSYNC */ #include <fcntl.h> #ifndef O_DSYNC # ifdef O_SYNC # define O_DSYNC O_SYNC /* POSIX */ # else # define O_DSYNC O_FSYNC /* BSD */ # endif #endif #ifndef HAVE___ATTRIBUTE__ /* Can't use attributes... */ #define __attribute__(foo) #endif #ifndef HAVE_SOCKLEN_T typedef unsigned int socklen_t; #endif #ifndef HAVE_RLIM_T typedef int rlim_t; #endif /* some potentially memory saving tradeoffs, preconfigured in memory-saving mode */ /* save the cmdlines for the ID command */ #undef ID_SAVE_CMDLINE /* IPv6 things */ #include <netdb.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #ifndef HAVE_STRUCT_SOCKADDR_STORAGE #define _SS_MAXSIZE 128 /* Implementation specific max size */ #define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr)) struct sockaddr_storage { struct sockaddr ss_sa; char __ss_pad2[_SS_PADSIZE]; }; # define ss_family ss_sa.sa_family # define HAVE_SS_FAMILY #endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */ #ifndef HAVE_SS_FAMILY #define ss_family __ss_family #endif #ifndef AF_INET6 /* Define it to something that should never appear */ #define AF_INET6 AF_MAX #endif #if !defined(HAVE_GETADDRINFO) || !defined(HAVE_GETNAMEINFO) #include "gai.h" #endif /* End IPv6 things */ #ifdef OLD_SIEVE_SERVICE_NAME #define SIEVE_SERVICE_NAME "imap" #else #define SIEVE_SERVICE_NAME "sieve" #endif /* filenames */ #define FNAME_DBDIR "/db" #define FNAME_USERDIR "/user/" #define FNAME_DOMAINDIR "/domain/" #define FNAME_LOGDIR "/log/" #define FNAME_PTSDB "/ptclient/ptscache.db" #define CONFIG_FILENAME (SYSCONFDIR "/imapd.conf") #define DEFAULT_MASTER_CONFIG_FILENAME (SYSCONFDIR "/cyrus.conf") #ifndef HAVE_SHUTDOWN #define shutdown(fd, mode) 0 #endif /* compile time options; think carefully before modifying */ enum { /* should we send an UNAVAILABLE message to master when * a service is exiting (master is already going to be * informed of the exit by the SIGCHLD signal anyway) ? */ MESSAGE_MASTER_ON_EXIT = 0, /* should a hierarchical rename stop on error? */ RENAME_STOP_ON_ERROR = 1, /* should we call fsync() to maybe help with softupdates? (it should) */ APPEND_ULTRA_PARANOID = 1, /* should we log extra information at the DEBUG level for DB stuff? * 0 -> nothing; 1 -> some; higher -> even more */ CONFIG_DB_VERBOSE = 1, /* log timing information to LOG_DEBUG */ CONFIG_TIMING_VERBOSE = 0, /* should we be pedantic about namespace or sleezy? */ SLEEZY_NAMESPACE = 1, /* should we do a fast TLS session shutdown? */ TLS_FAST_SHUTDOWN = 1, /* should we use the SQUAT engine to accelerate SEARCH? */ SQUAT_ENGINE = 1, /* should we have long LMTP error messages? */ LMTP_LONG_ERROR_MSGS = 1 }; #endif /* _CYRUS_IMAPD_CONFIG_H_ */ ]) dnl make sure that Makefile is the last thing output AC_OUTPUT(man/Makefile master/Makefile lib/Makefile imap/Makefile imtest/Makefile netnews/Makefile perl/Makefile $EXTRA_OUTPUT Makefile)