Andreas Krennmair:
[apps/madmutt.git] / configure.in
index 6b42629..8be4c2e 100644 (file)
@@ -11,6 +11,7 @@ mutt_cv_version=`cat $srcdir/VERSION`
 
 
 AM_INIT_AUTOMAKE(muttng, $mutt_cv_version)
+dnl AC_GNU_SOURCE
 
 ifdef([AC_LIBOBJ], , [define([AC_LIBOBJ], [LIB[]OBJS="$LIBOBJS $1.o"])])
 
@@ -105,7 +106,7 @@ else
                 AC_DEFINE(CRYPT_BACKEND_CLASSIC_PGP,1,
                     [ Define if you want classic PGP support. ])
                 PGPAUX_TARGET="pgpring pgpewrap"
-                MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS pgp.o pgpinvoke.o pgpkey.o pgplib.o gnupgparse.o pgpmicalg.o pgppacket.o"
+                MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS pgp.o pgpinvoke.o pgpkey.o pgplib.o gnupgparse.o pgpmicalg.o pgppacket.o crypt-mod-pgp-classic.o"
         fi
 
        AC_ARG_ENABLE(smime, [  --disable-smime            Disable SMIME support],
@@ -117,7 +118,7 @@ else
        if test x$have_smime != xno ; then
                AC_DEFINE(CRYPT_BACKEND_CLASSIC_SMIME,1,
                   [ Define if you want clasic S/MIME support. ])
-               MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS smime.o "
+               MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS smime.o crypt-mod-smime-classic.o"
                SMIMEAUX_TARGET="smime_keys"
        fi
   
@@ -264,7 +265,7 @@ AC_CHECK_HEADERS(stdarg.h sys/ioctl.h ioctl.h sysexits.h)
 AC_CHECK_HEADERS(sys/time.h sys/resource.h)
 AC_CHECK_HEADERS(unix.h)
 
-AC_CHECK_FUNCS(setrlimit getsid)
+AC_CHECK_FUNCS(setrlimit getsid isctype)
 
 AC_TYPE_SIGNAL
 
@@ -325,6 +326,7 @@ AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(long)
 
 AC_TYPE_PID_T
+dnl AC_CHECK_TYPE(ssize_t, int)
 
 AC_CHECK_FUNCS(fgetpos memmove setegid srand48 strerror)
 
@@ -453,7 +455,7 @@ if test "x$mutt_cv_setgid" = "xyes" || test "x$mutt_cv_fchdir" = "xno" \
         || test "x$mutt_cv_external_dotlock" = "xyes"
 then
         AC_DEFINE(DL_STANDALONE,1,[ Define if you want to use an external dotlocking program. ])
-        DOTLOCK_TARGET="mutt_dotlock"
+        DOTLOCK_TARGET="muttng_dotlock"
 else
         MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS dotlock.o"
 fi
@@ -464,7 +466,7 @@ AC_SUBST(DOTLOCK_TARGET)
 AC_MSG_CHECKING(where to put the documentation)
 AC_ARG_WITH(docdir, [  --with-docdir=PATH         Specify where to put the documentation],
         [mutt_cv_docdir=$withval],
-        [mutt_cv_docdir="$mutt_cv_prefix/doc/mutt"])
+        [mutt_cv_docdir="$mutt_cv_prefix/doc/muttng"])
 AC_MSG_RESULT($mutt_cv_docdir)
 
 docdir=$mutt_cv_docdir
@@ -494,6 +496,7 @@ AC_ARG_ENABLE(pop,  [  --enable-pop               Enable POP3 support],
                 AC_DEFINE(USE_POP,1,[ Define if you want support for the POP3 protocol. ])
                 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS pop.o pop_lib.o pop_auth.o"
                 need_socket="yes"
+               need_pop="yes"
                 need_md5="yes"
         fi
 ])
@@ -537,7 +540,7 @@ fi
 
 dnl -- imap dependencies --
 
-AC_ARG_WITH(gss, [    --with-gss[=PFX]         Compile in GSSAPI authentication for IMAP], 
+AC_ARG_WITH(gss, [  --with-gss[=PFX]           Compile in GSSAPI authentication for IMAP], 
     gss_prefix="$withval", gss_prefix="no")
 if test "$gss_prefix" != "no"
 then
@@ -596,6 +599,34 @@ AC_ARG_WITH(ssl, [  --with-ssl[=PFX]           Compile in SSL support for POP/IM
 ])
 AM_CONDITIONAL(USE_SSL, test x$need_ssl = xyes)
 
+AC_ARG_WITH(gnutls, [  --with-gnutls[=PFX]        Compile in GNU TLS support for POP/IMAP],
+[   if test "$need_ssl" = "yes"
+    then
+      AC_MSG_ERROR([In order to compile in GNU TLS support, you must first disable SSL support])
+    fi
+    if test "$with_gnutls" != "no"
+    then
+      if test "$need_socket" != "yes"; then
+        AC_MSG_ERROR([GNU TLS support is only useful with POP or IMAP support])
+      fi
+      if test "$with_gnutls" != "yes"
+      then
+        LDFLAGS="$LDFLAGS -L$withval/lib"
+        CPPFLAGS="$CPPFLAGS -I$withval/include"
+      fi
+#saved_LIBS="$LIBS"
+
+      AC_CHECK_LIB([gnutls], [gnutls_init],, AC_MSG_ERROR(Unable to find GNU TLS library))
+
+      AC_DEFINE(USE_GNUTLS,1,[ Define if you want support for GNU TLS. ])
+#LIBS="$saved_LIBS"
+#MUTTLIBS="$MUTTLIBS -lgnutls"
+      MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_ssl_gnutls.o"
+      need_gnutls=yes
+    fi
+])
+AM_CONDITIONAL(USE_GNUTLS, test x$need_gnutls = xyes)
+
 dnl SSL support via NSS
 AC_ARG_WITH(nss, [  --with-nss[=PFX]           Compile in SSL support for POP/IMAP via NSS],
 [       if test "$with_nss" != no
@@ -622,7 +653,7 @@ AC_ARG_WITH(nss, [  --with-nss[=PFX]           Compile in SSL support for POP/IM
 
 AC_ARG_WITH(sasl, [  --with-sasl[=PFX]          Use Cyrus SASL library for POP/IMAP authentication],
         [
-        if test "$need_socket" != "yes"
+        if test "$with_sasl" != "no" -a "$need_imap" != "yes" -a "$need_pop" != "yes"
         then
           AC_MSG_ERROR([SASL support is only useful with POP or IMAP support])
         fi
@@ -652,9 +683,9 @@ AM_CONDITIONAL(USE_SASL, test x$need_sasl = xyes)
 
 AC_ARG_WITH(sasl2, [  --with-sasl2[=PFX]         Use Cyrus SASL library version 2 for POP/IMAP authentication],
         [
-        if test "$need_socket" != "yes"
+        if test "$with_sasl2" != "no" -a "$need_imap" != "yes" -a "$need_pop" != "yes"
         then
-          AC_MSG_ERROR([SASL support is only useful with POP or IMAP support])
+          AC_MSG_ERROR([SASL2 support is only useful with POP or IMAP support])
         fi
 
         if test "$with_sasl2" != "no"
@@ -668,7 +699,7 @@ AC_ARG_WITH(sasl2, [  --with-sasl2[=PFX]         Use Cyrus SASL library version
           saved_LIBS="$LIBS"
 
           AC_CHECK_LIB(sasl2, sasl_client_init,,
-            AC_MSG_ERROR([could not find libsasl]),)
+            AC_MSG_ERROR([could not find libsasl2]),)
 
           MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_sasl.o"
           MUTTLIBS="$MUTTLIBS -lsasl2"
@@ -682,7 +713,7 @@ AC_ARG_WITH(sasl2, [  --with-sasl2[=PFX]         Use Cyrus SASL library version
         ])
 AM_CONDITIONAL(USE_SASL, test x$need_sasl = xyes)
 
-AC_ARG_WITH(idn, [  --with-idn=[PFX]           Use GNU libidn for domain names],
+AC_ARG_WITH(idn, [  --with-idn=[PFX]           Use GNU libidn for domain names],
                 [
                  if test "$with_idn" != "no" ; then
                        if test "$with_idn" != "yes" ; then
@@ -700,11 +731,6 @@ if test "x$with_idn" != "xno"; then
    AC_CHECK_FUNCS(idna_to_ascii_lz idna_to_ascii_from_locale)
 fi
 
-if test "$need_md5" = "yes"
-then
-        MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS md5c.o"
-fi
-
 dnl -- end socket --
 
 AC_ARG_ENABLE(debug, [  --enable-debug             Enable debugging support],
@@ -726,6 +752,14 @@ if test $mutt_cv_fcntl = yes; then
         AC_DEFINE(USE_FCNTL,1, [ Define to use fcntl() to lock folders. ])
 fi
 
+mutt_cv_inodesort=yes
+AC_ARG_ENABLE(inodesort,  [  --disable-inodesort        Do NOT read files in maildir folders sorted by inode. ],
+       [if test $enableval = no ; then mutt_cv_inodesort=no; fi])
+
+if test $mutt_cv_inodesort = yes; then
+       AC_DEFINE(USE_INODESORT, 1, [ Define to sort files in a maildir by inode number. ])
+fi
+
 mutt_cv_warnings=yes
 AC_ARG_ENABLE(warnings, [  --disable-warnings         Turn off compiler warnings (not recommended)],
 [if test $enableval = no; then
@@ -754,6 +788,11 @@ AC_ARG_ENABLE(mailtool, [  --enable-mailtool          Enable Sun mailtool attach
                 AC_DEFINE(SUN_ATTACHMENT,1,[ Define to enable Sun mailtool attachments support. ])
         fi])
 
+AC_ARG_ENABLE(compressed, [  --enable-compressed        Enable compressed folders support ],
+        [if test x$enableval = xyes; then
+                AC_DEFINE(USE_COMPRESSED)
+        fi])
+
 AC_ARG_ENABLE(locales-fix, [  --enable-locales-fix       The result of isprint() is unreliable ],
         [if test x$enableval = xyes; then
                 AC_DEFINE(LOCALES_HACK,1,[ Define if the result of isprint() is unreliable. ])
@@ -776,6 +815,90 @@ AC_ARG_ENABLE(exact-address, [  --enable-exact-address     Enable regeneration o
 
         fi])
 
+dnl -- start cache --
+AC_ARG_ENABLE(hcache, [  --enable-hcache            Enable header caching],
+[if test x$enableval = xyes; then
+    AC_DEFINE(USE_HCACHE, 1, [Enable header caching])
+
+    OLDCPPFLAGS="$CPPFLAGS"
+    OLDLIBS="$LIBS"
+
+    need_md5="yes"
+    ac_prefer_gdbm=yes
+    AC_ARG_WITH(gdbm, [  --without-gdbm             Get rid of gdbm even if it is available ],
+        ac_prefer_gdbm=$withval)
+    if test x$ac_prefer_gdbm != xno; then
+        CPPFLAGS="$OLDCPPFLAGS"
+        LIBS="$OLDLIBS -lgdbm";
+        AC_CACHE_CHECK(for gdbm_open, ac_cv_gdbmopen,[
+            ac_cv_gdbmopen=no
+            AC_TRY_LINK([#include <gdbm.h>],[gdbm_open(0,0,0,0,0);],[ac_cv_gdbmopen=yes])
+        ])
+    fi
+
+    ac_bdb_prefix=yes
+    AC_ARG_WITH(bdb, [  --with-bdb[=DIR]           Use BerkeleyDB4 if gdbm is not available ],
+        ac_bdb_prefix=$withval)
+    if test x$ac_bdb_prefix != xno -a x$ac_cv_gdbmopen != xyes; then
+        test x$ac_bdb_prefix = xyes && ac_bdb_prefix="$mutt_cv_prefix /opt/csw/bdb4 /opt /usr/local /usr"
+        for d in $ac_bdb_prefix; do
+            bdbpfx="$bdbpfx $d"
+            for v in BerkeleyDB.4.3 BerkeleyDB.4.2 BerkeleyDB.4.1; do
+                bdbpfx="$bdbpfx $d/$v"
+            done
+        done
+        BDB_VERSIONS="db-4 db4 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db ''"
+        AC_MSG_CHECKING([for BerkeleyDB > 4.0])
+        for d in $bdbpfx; do
+            BDB_INCLUDE_DIR=""
+            BDB_LIB_DIR=""
+            for v in / $BDB_VERSIONS; do
+                if test -r "$d/include/$v/db.h"; then
+                    BDB_INCLUDE_DIR="$d/include/$v"
+                    if test -d "$d/lib/$v"; then
+                        BDB_LIB_DIR="$d/lib/$v"
+                        for l in `echo $BDB_VERSIONS`; do
+                            CPPFLAGS="-I$BDB_INCLUDE_DIR $OLDCPPFLAGS"
+                            LIBS="$OLDLIBS -L$BDB_LIB_DIR -l$l"
+                            AC_TRY_LINK([
+                                #include <stdlib.h>
+                                #include <db.h>
+                            ],[
+                                DB *db = NULL;
+                                db->open(db,NULL,NULL,NULL,0,0,0);
+                            ],[
+                                ac_cv_dbcreate=yes
+                                BDB_LIB="$l"
+                                break
+                            ])
+                        done
+                        test x$ac_dbcreate = xyes && break
+                    fi
+                fi
+            done
+            test x$BDB_LIB != x && break
+        done
+        if test x$ac_cv_dbcreate = xyes; then
+            AC_MSG_RESULT(yes)
+        else
+            AC_MSG_RESULT(no)
+        fi
+    fi
+
+    if test x$ac_cv_gdbmopen = xyes; then
+        CPPFLAGS="$OLDCPPFLAGS"
+        LIBS="$OLDLIBS -lgdbm";
+        AC_DEFINE(HAVE_GDBM, 1, [GDBM Support])
+    elif test x$ac_cv_dbcreate = xyes; then
+        CPPFLAGS="-I$BDB_INCLUDE_DIR $OLDCPPFLAGS"
+        LIBS="$OLDLIBS -L$BDB_LIB_DIR -l$BDB_LIB"
+        AC_DEFINE(HAVE_DB4, 1, [Sleepycat DB4 Support])
+    else
+        AC_MSG_ERROR(You need Sleepycat DB4 or GDBM for --enable-hcache)
+    fi
+fi])
+dnl -- end cache --
+
 AC_SUBST(MUTTLIBS)
 AC_SUBST(MUTT_LIB_OBJECTS)
 AC_SUBST(LIBIMAP)
@@ -999,5 +1122,5 @@ AC_OUTPUT(Makefile intl/Makefile m4/Makefile
         po/Makefile.in doc/Makefile contrib/Makefile
         muttbug.sh
         imap/Makefile
-        Muttrc.head
+        Muttngrc.head
         doc/instdoc.sh)