dnl Process this file with autoconf to produce a configure script.
dnl $Id$
AC_PREREQ(2.52)
-AC_INIT([Citadel], [7.10], [http://www.citadel.org/])
+AC_INIT([Citadel], [7.30], [http://www.citadel.org/])
AC_REVISION([$Revision: 5108 $])
AC_CONFIG_SRCDIR([citserver.c])
AC_PREFIX_DEFAULT(/usr/local/citadel)
-AC_ARG_ENABLE(chkpwd, [ --disable-chkpwd don't build 'chkpwd'])
-
AC_ARG_ENABLE(threaded-client, [ --disable-threaded-client
disable multithreaded client])
AC_ARG_WITH(with_ldap, [ --with-ldap use OpenLDAP client library])
AC_ARG_WITH(with_libical, [ --with-libical use libical calendaring library])
AC_ARG_WITH(with_libsieve, [ --with-libsieve use libsieve mail sorting library])
+AC_ARG_WITH(with_libdspam, [ --with-libdspam use libdspam mail spam scanning library])
+AC_ARG_WITH(with_expat, [ --with-expat use Expat XML parser])
if test "x$with_db" != xno -a "x$with_db" != xyes -a "$with_db"; then
db_dir="$with_db"
test -d /usr/local/BerkeleyDB.4.1 && db_dir=/usr/local/BerkeleyDB.4.1
test -d /usr/local/BerkeleyDB.4.2 && db_dir=/usr/local/BerkeleyDB.4.2
test -d /usr/local/BerkeleyDB.4.3 && db_dir=/usr/local/BerkeleyDB.4.3
+ test -d /usr/local/BerkeleyDB.4.4 && db_dir=/usr/local/BerkeleyDB.4.4
+ test -d /usr/local/BerkeleyDB.4.5 && db_dir=/usr/local/BerkeleyDB.4.5
fi
dnl By default, we only build the client (citadel and whobbs) unless we can
dnl Checks for programs.
AC_PROG_CC
+
+
dnl Set up system-dependent compiler flags.
if test "$GCC" = yes; then
if test "$CC" = icc; then
fi
fi
+AC_MSG_CHECKING([how to create dependancy checks])
+ if test -n "`$CC -V 2>&1 |grep Sun`"; then
+ DEPEND_FLAG=-xM;
+ else
+ DEPEND_FLAG=-M
+ fi
+AC_SUBST(DEPEND_FLAG)
+
+
AC_PROG_INSTALL
AC_PROG_YACC
-missing_dir=`cd $ac_aux_dir && pwd`
-AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
-AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
+dnl missing_dir=`cd $ac_aux_dir && pwd`
+dnl AC_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
+dnl AC_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
dnl Checks for system services.
AC_CHECK_SIZEOF(short, 0)
AC_CHECK_SIZEOF(int, 0)
AC_CHECK_SIZEOF(long, 0)
+AC_CHECK_SIZEOF(size_t, 0)
dnl AC_CHECK_SIZEOF(long long, 0)
dnl Checks for libraries.
dnl We want to test for the following in libc before checking for their
dnl respective libraries, because some systems (like Irix) have both, and the
dnl non-libc versions may be broken.
-AC_CHECK_FUNCS(crypt gethostbyname connect)
+AC_CHECK_FUNCS(crypt gethostbyname connect flock getpwnam_r getpwuid_r)
+
+
+dnl disable backtrace if we don't want it.
+AC_ARG_WITH(backtrace,
+ [ --with-backtrace enable backtrace dumps in the syslog],
+ [ if test "x$withval" != "xno" ; then
+ CFLAGS="$CFLAGS -rdynamic "
+ LDFLAGS="$LDFLAGS -rdynamic "
+ SERVER_LDFLAGS="$SERVER_LDFLAGS -rdynamic "
+ AC_CHECK_FUNCS(backtrace)
+ fi
+ ]
+)
+
+dnl disable backtrace if we don't want it.
+AC_ARG_WITH(gprof,
+ [ --with-gprof enable profiling],
+ [ if test "x$withval" != "xno" ; then
+ CFLAGS="$CFLAGS -pg "
+ LDFLAGS="$LDFLAGS -pg "
+ SERVER_LDFLAGS="$SERVER_LDFLAGS -pg "
+ fi
+ ]
+)
+
+dnl disable thread table reporting
+AC_ARG_WITH(threadlog,
+ [ --with-threadlog enable logging of thread table],
+ [ if test "x$withval" != "xno" ; then
+ AC_DEFINE(WITH_THREADLOG, [], [Define if you want logging of the thread tables.])
+ fi
+ ]
+)
+
if test "$ac_cv_func_gethostbyname" = no; then
AC_CHECK_LIB(nsl, gethostbyname)
LIBS="-lcrypt $LIBS"])
fi
fi
- if test "$ac_cv_func_crypt" = yes -o "$ac_cv_lib_crypt_crypt" = yes -o "$ac_cv_func_pam_start" = yes; then
- if test "$enable_chkpwd" != no; then
- AC_DEFINE(ENABLE_CHKPWD, [], [define this to enable use of the chkpwd program (for shadow passwords)])
- CHKPWD=chkpwd
- else
- AUTH=auth.lo
- fi
- fi
-
-test -f /usr/local/lib/libresolv.a && LDFLAGS="$LDFLAGS -L/usr/local/lib"
-AC_CHECK_LIB(resolv, res_query, RESOLV="$RESOLV -lresolv")
if test "x$with_ncurses" != "xno"; then
AC_SEARCH_LIBS(tgetent, [ncurses curses termcap])
test -d /usr/kerberos/include && CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
+
+dnl Check for libcitadel
+AC_CHECK_HEADER(libcitadel.h,
+ [AC_CHECK_LIB(citadel, libcitadel_version_string,
+ [
+ LIBS="-lcitadel $LIBS"
+ ],
+ [
+ AC_MSG_ERROR(libcitadel was not found or is not usable. Please install libcitadel.)
+ ]
+ ,
+ )],
+ [
+ AC_MSG_ERROR(libcitadel.h was not found or is not usable. Please install libcitadel.)
+ ]
+)
+
+
+
+
# The big search for OpenSSL
if test "$with_ssl" != "no"; then
saved_LIBS="$LIBS"
fi
+dnl Checks for the libdspam mail spam scanning library.
+if test "x$with_libdspam" != xno ; then
+ AC_CHECK_HEADERS(dspam/libdspam.h,
+ [AC_CHECK_LIB(dspam, dspam_init,
+ [ok_libdspam=yes],,
+ )])
+fi
+
+if test "x$ok_libdspam" = xyes ; then
+ SERVER_LIBS="-ldspam $SERVER_LIBS"
+ AC_DEFINE(HAVE_LIBDSPAM, [], [define this if you have the libdspam mail spam scanning library available])
+fi
+
+
+
+
+dnl Checks for the Expat XML parser.
+if test "x$with_expat" != xno ; then
+ AC_CHECK_HEADERS(expat.h,
+ [AC_CHECK_LIB(expat, XML_ParserCreateNS,
+ [ok_expat=yes],,
+ )])
+fi
+
+if test "x$ok_expat" = xyes ; then
+ SERVER_LIBS="-lexpat $SERVER_LIBS"
+ AC_DEFINE(HAVE_EXPAT, [], [define this if you have the Expat XML parser available])
+fi
+
+
dnl Checks for the libical calendaring library.
dnl TODO: for the DB header checks, we should check whether the headers
dnl define db_env_create, somehow
dnl
-AC_CHECK_HEADERS(curses.h dl.h fcntl.h limits.h malloc.h termios.h sys/ioctl.h sys/select.h sys/time.h sys/prctl.h syslog.h unistd.h utmp.h utmpx.h paths.h db.h db4/db.h pthread.h netinet/in.h arpa/nameser.h arpa/nameser_compat.h)
+AC_CHECK_HEADERS(curses.h dl.h fcntl.h limits.h malloc.h termios.h sys/ioctl.h sys/select.h sys/stat.h sys/time.h sys/prctl.h syslog.h unistd.h utmp.h utmpx.h paths.h db.h db4/db.h pthread.h netinet/in.h arpa/nameser.h arpa/nameser_compat.h)
dnl
dnl need to check if this is actually compilable, sometimes there are
AC_DEFINE(F_XPID_T, "%x", [whats the matching format string for xpid_t?])
fi
-dnl AC_CHECK_FUNCS(res_query)
-AC_CACHE_CHECK([for the resolver calls],
- ac_cv_resquery_ok,
-[AC_TRY_COMPILE([#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <resolv.h>],
- [
- char *domain="www.google.com";
- u_char *answer;
- int len;
- len = res_query( domain, C_IN, T_A, answer, PACKETSZ );
- ],
- ac_cv_resquery_ok=yes,
- ac_cv_resquery_ok=no)
-])
-echo "resquery: $ac_cv_resquery_ok"
-dnl if test "$ac_cv_resquery_ok" = "no" ; then
-dnl AC_DEFINE(RES_QUERY_GONE, "#error resquery not here. can't continue.")
-dnl fi
+dnl Our own happy little check for the resolver library.
+
+case "`uname -a`" in
+ OpenBSD*)
+ echo "we don't need to check for resolv on openbsd"
+ ;;
+ *)
+ test -f /usr/local/lib/libresolv.a && LDFLAGS="$LDFLAGS -L/usr/local/lib"
+ AC_CHECK_LIB(resolv, res_query,
+ RESOLV="$RESOLV -lresolv",
+ [dnl Have to include resolv.h as res_query is sometimes defined as a macro
+ AC_MSG_CHECKING([for res_query in -lresolv (with resolv.h if present)])
+ saved_libs="$LIBS"
+ LIBS="-lresolv $LIBS"
+ AC_TRY_LINK([
+ #ifdef HAVE_RESOLV_H
+ #include <resolv.h>
+ #endif],
+ [res_query(0,0,0,0,0)],
+ [AC_MSG_RESULT(yes)
+ have_res_query=yes],
+ [AC_MSG_RESULT(no)
+ AC_MSG_ERROR(libresolv was not found. Citadel requires the resolver library.)
+ ])
+ ]
+ )
+ ;;
+esac
+
AC_CACHE_CHECK([under the bed], ac_cv_under_the_bed, [
number=`date | cut -c 19`
case $number in
dnl Done! Now write the Makefile and sysdep.h
AC_SUBST(AUTH)
-AC_SUBST(CHKPWD)
AC_SUBST(RESOLV)
AC_SUBST(chkpwd_LIBS)
AC_SUBST(TARGETS)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT(database_cleanup.sh)
+
if test -z "$DATABASE"; then
AC_MSG_WARN([No database driver was found. Please install Berkeley DB.])
fi
echo 'Calendar support: ' $ok_libical
echo 'LDAP support: ' $ok_ldap
echo 'Sieve mailbox filtering support: ' $ok_libsieve
+echo 'DSpam Scanning support: ' $ok_libdspam
+echo 'Expat XML parser present: ' $ok_expat
echo
echo 'Note: if you are not using Linux, make sure you are using GNU make'
echo '(gmake) to compile Citadel.'