more and more cleansing
[apps/madmutt.git] / configure.in
index 9030c92..30fdc13 100644 (file)
@@ -7,9 +7,11 @@ AC_PREREQ([2.50])
 AC_INIT([mutt.h])
 AM_CONFIG_HEADER(config.h)
 
-mutt_cv_version=`cat $srcdir/VERSION`
+mutt_cv_version=`cat "$srcdir/VERSION.in"`
 
 AM_INIT_AUTOMAKE(muttng, $mutt_cv_version)
+AC_SUBST([CONFIGURE_DEPENDENCIES], ['$(top_srcdir)/VERSION.in'])
+
 dnl AC_GNU_SOURCE
 
 ifdef([AC_LIBOBJ], , [define([AC_LIBOBJ], [LIB[]OBJS="$LIBOBJS $1.o"])])
@@ -42,6 +44,8 @@ AC_C_INLINE
 AC_C_CONST
 
 AC_SYS_LARGEFILE
+AC_FUNC_FSEEKO
+AC_CHECK_SIZEOF(off_t)
 
 AC_PATH_PROG(DBX, dbx, no)
 AC_PATH_PROG(GDB, gdb, no)
@@ -83,6 +87,21 @@ AH_TEMPLATE([ICONV_NONTRANS],
             [Define as 1 if iconv() only converts exactly and we should treat
              all return values other than (size_t)(-1) as equivalent.])
 
+AH_BOTTOM([/* fseeko portability defines */
+#ifdef HAVE_FSEEKO
+# define LOFF_T off_t
+# if SIZEOF_OFF_T == 8
+# define OFF_T_FMT "%lld"
+# else
+# define OFF_T_FMT "%ld"
+# endif
+#else
+# define LOFF_T long
+# define fseeko fseek
+# define ftello ftell
+# define OFF_T_FMT "%ld"
+#endif
+])
 MUTT_C99_INTTYPES
 
 ac_aux_path_sendmail=/usr/sbin:/usr/lib
@@ -90,10 +109,6 @@ AC_PATH_PROG(SENDMAIL, sendmail, /usr/sbin/sendmail, $PATH:$ac_aux_path_sendmail
 AC_DEFINE_UNQUOTED(SENDMAIL,"$ac_cv_path_SENDMAIL",[ Where to find sendmail on your system. ])
 
 OPS='$(srcdir)/OPS'
-if test -f $srcdir/EXPORTABLE ; then
-        SUBVERSION="us"
-else
-        SUBVERSION="i"
 
        AC_ARG_ENABLE(gpgme, AC_HELP_STRING([--enable-gpgme], [Enable GPGME support]),
        [       if test x$enableval = xyes; then
@@ -114,6 +129,7 @@ else
                else
                        LIBGPGME_CFLAGS=`$GPGME_CONFIG --cflags`
                        LIBGPGME_LIBS=`$GPGME_CONFIG --libs`
+      MUTTLIBS="$MUTTLIBS $LIBGPGME_LIBS"
                        MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS crypt-gpgme.o crypt-mod-pgp-gpgme.o crypt-mod-smime-gpgme.o"
                        AC_DEFINE(CRYPT_BACKEND_GPGME, 1,
                                  [Defined, if GPGME support is enabled])
@@ -131,7 +147,7 @@ else
         if test x$have_pgp != xno ; then
                 AC_DEFINE(CRYPT_BACKEND_CLASSIC_PGP,1,
                     [ Define if you want classic PGP support. ])
-                PGPAUX_TARGET="pgpring pgpewrap"
+                PGPAUX_TARGET="pgpringng\$(EXEEXT) pgpewrapng\$(EXEEXT)"
                 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
 
@@ -145,7 +161,7 @@ else
                AC_DEFINE(CRYPT_BACKEND_CLASSIC_SMIME,1,
                   [ Define if you want clasic S/MIME support. ])
                MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS smime.o crypt-mod-smime-classic.o"
-               SMIMEAUX_TARGET="smime_keys"
+               SMIMEAUX_TARGET="smime_keysng"
        fi
   
         AC_ARG_WITH(mixmaster, AC_HELP_STRING([--with-mixmaster[=PATH]], [Include Mixmaster support]),
@@ -160,7 +176,6 @@ else
                          [ Where to find mixmaster on your system. ])
                 ])
 
-fi
 # We now require all OPS
 OPS="$OPS \$(srcdir)/OPS.PGP \$(srcdir)/OPS.SMIME \$(srcdir)/OPS.CRYPT "
 AC_SUBST([OPS])
@@ -169,9 +184,6 @@ AC_SUBST([OPS])
 AC_SUBST(PGPAUX_TARGET)
 AC_SUBST(SMIMEAUX_TARGET)
 
-AC_DEFINE_UNQUOTED(SUBVERSION,"$SUBVERSION",[ Is this the international version? ])
-AC_SUBST([SUBVERSION])
-
 AC_PATH_PROG(ISPELL, ispell, no)
 if test $ISPELL != no; then
         AC_DEFINE_UNQUOTED(ISPELL,"$ISPELL",[ Where to find ispell on your system. ])
@@ -197,13 +209,13 @@ main ()
         if test $withval = yes; then
                 if test -d $srcdir/../slang; then
                         mutt_cv_slang=$srcdir/../slang/src
-                        CPPFLAGS="$CPPFLAGS -I${mutt_cv_slang}"
+                        CFLAGS="$CFLAGS -I${mutt_cv_slang}"
                         LDFLAGS="$LDFLAGS -L${mutt_cv_slang}/objs"
                 else
                         if test -d $mutt_cv_prefix/include/slang; then
-                                CPPFLAGS="$CPPFLAGS -I$mutt_cv_prefix/include/slang"
+                                CFLAGS="$CFLAGS -I$mutt_cv_prefix/include/slang"
                         elif test -d /usr/include/slang; then
-                                CPPFLAGS="$CPPFLAGS -I/usr/include/slang"
+                                CFLAGS="$CFLAGS -I/usr/include/slang"
                         fi
                         mutt_cv_slang=yes
                 fi
@@ -211,15 +223,15 @@ main ()
                 dnl ---Check to see if $withval is a source directory
                 if test -f $withval/src/slang.h; then
                         mutt_cv_slang=$withval/src
-                        CPPFLAGS="$CPPFLAGS -I${mutt_cv_slang}"
+                        CFLAGS="$CFLAGS -I${mutt_cv_slang}"
                         LDFLAGS="$LDFLAGS -L${mutt_cv_slang}/objs"
                 else
                         dnl ---Must be installed somewhere
                         mutt_cv_slang=$withval
                         if test -d $withval/include/slang; then
-                                CPPFLAGS="$CPPFLAGS -I${withval}/include/slang"
+                                CFLAGS="$CFLAGS -I${withval}/include/slang"
                         elif test -d $withval/include; then
-                                CPPFLAGS="$CPPFLAGS -I${withval}/include"
+                                CFLAGS="$CFLAGS -I${withval}/include"
                         fi
                         LDFLAGS="$LDFLAGS -L${withval}/lib"
                 fi
@@ -253,7 +265,7 @@ main ()
 
        AC_CHECK_FUNC(initscr,,[
        cf_ncurses="ncurses"
-       for lib in ncurses ncursesw
+       for lib in ncursesw ncurses
        do
                AC_CHECK_LIB($lib, waddnwstr, [cf_ncurses="$lib"; break])
        done
@@ -264,6 +276,7 @@ main ()
                 fi
                
                 if test "$cf_ncurses" = ncursesw; then
+                       AC_CHECK_HEADERS(ncurses/ncurses.h,[cf_cv_ncurses_header="ncurses/ncurses.h"])
                        AC_CHECK_HEADERS(ncursesw/ncurses.h,[cf_cv_ncurses_header="ncursesw/ncurses.h"])
                else
                        AC_CHECK_HEADERS(ncurses.h,[cf_cv_ncurses_header="ncurses.h"])
@@ -329,7 +342,7 @@ dnl AC_CHECK_TYPE(ssize_t, int)
 
 AC_CHECK_FUNCS(fgetpos memmove setegid srand48 strerror)
 
-AC_REPLACE_FUNCS(strcasecmp strdup)
+AC_REPLACE_FUNCS(strcasecmp strdup setenv)
 
 AC_CHECK_FUNC(getopt)
 if test $ac_cv_func_getopt = yes; then
@@ -466,7 +479,7 @@ AC_SUBST(DOTLOCK_TARGET)
 AC_MSG_CHECKING(where to put the documentation)
 AC_ARG_WITH(docdir, AC_HELP_STRING([--with-docdir=PATH], [Specify where to put the documentation]),
         [mutt_cv_docdir=$withval],
-        [mutt_cv_docdir="$mutt_cv_prefix/doc/muttng"])
+        [mutt_cv_docdir="${prefix}/doc/muttng"])
 AC_MSG_RESULT($mutt_cv_docdir)
 
 docdir=$mutt_cv_docdir
@@ -484,7 +497,9 @@ AC_SUBST(DOTLOCK_PERMISSION)
 
 AC_ARG_WITH(domain, AC_HELP_STRING([--with-domain=DOMAIN], [Specify your DNS domain name]),
         [if test $withval != yes; then
-                AC_DEFINE_UNQUOTED(DOMAIN,"$withval",[ Define your domain name. ])
+         if test $withval != no; then
+           AC_DEFINE_UNQUOTED(DOMAIN,"$withval",[ Define your domain name. ])
+         fi
         fi])
 
 need_socket="no"
@@ -494,12 +509,14 @@ dnl -- socket dependencies --
 AC_ARG_ENABLE(pop,  AC_HELP_STRING([--enable-pop], [Enable POP3 support]),
 [       if test x$enableval = xyes ; then
                 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"
+                LIBPOP="-Lpop -lpop"
+                LIBPOPDEPS="\$(top_srcdir)/pop/pop.h pop/libpop.a"
                 need_socket="yes"
                need_pop="yes"
                 need_md5="yes"
         fi
 ])
+AM_CONDITIONAL(BUILD_POP, test x$need_pop = xyes)
 
 AC_ARG_ENABLE(imap, AC_HELP_STRING([--enable-imap], [Enable IMAP support]),
 [       if test x$enableval = xyes ; then
@@ -515,11 +532,14 @@ AM_CONDITIONAL(BUILD_IMAP, test x$need_imap = xyes)
 
 AC_ARG_ENABLE(nntp, [  --enable-nntp              Enable NNTP support],
 [      if test x$enableval = xyes ; then
-               AC_DEFINE(USE_NNTP)
-               MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS nntp.o newsrc.o"
+               AC_DEFINE(USE_NNTP,1,[ Compiling with newsreading support with NNTP ])
+                LIBNNTP="-Lnntp -lnntp"
+                LIBNNTPDEPS="\$(top_srcdir)/nntp/nntp.h nntp/libnntp.a"
+                need_nntp="yes"
                need_socket="yes"
        fi
 ])
+AM_CONDITIONAL(BUILD_NNTP, test x$need_nntp = xyes)
 
 dnl -- end socket dependencies --
 
@@ -597,59 +617,6 @@ AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl[=PFX]], [Compile in SSL support for
 
         fi
 ])
-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, AC_HELP_STRING([--with-nss[=PFX]], [Compile in SSL support for POP/IMAP via NSS]),
-[       if test "$with_nss" != no
-        then
-          if test "$need_socket" != "yes"; then
-           AC_MSG_ERROR([SSL support is only useful with POP or IMAP support])
-          fi
-
-          if test "$with_nss" != "yes"
-          then
-           LDFLAGS="$LDFLAGS -L$withval/lib"
-           CPPFLAGS="$CPPFLAGS -I$withval/include -I$withval/public/security"
-          fi
-
-          AC_DEFINE(USE_NSS,1,[ Define if you want support for SSL via the NSS library. ])
-          MUTTLIBS="$MUTTLIBS -lssl -lnss -lcertdb -lcerthi -lcryptohi"
-          MUTTLIBS="$MUTTLIBS -lpk11wrap -lsoftoken -lsecutil -ldbm -lplds4 -lplc4 -lfreebl"
-          MUTTLIBS="$MUTTLIBS -lnspr4"
-
-          MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_ssl_nss.o"
-          need_ssl=yes
-        fi
-])
 
 AC_ARG_WITH([gnutls], AC_HELP_STRING([--with-gnutls[=PFX]], [Enable SSL support using gnutls]),
     [gnutls_prefix="$withval"], [gnutls_prefix="no"])
@@ -659,6 +626,10 @@ then
   then
     AC_MSG_ERROR([SSL support is only useful with POP or IMAP support])
   fi
+  if test x"$need_ssl" = x"yes"
+  then
+    AC_MSG_ERROR([Only either OpenSSL or GNUTLS may be used])
+  fi
   MUTT_AM_PATH_GNUTLS([$gnutls_prefix],
     [dnl GNUTLS found
     CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS"
@@ -672,35 +643,7 @@ then
     ])
 fi
 
-AC_ARG_WITH(sasl, AC_HELP_STRING([--with-sasl[=PFX]], [Use Cyrus SASL library for POP/IMAP authentication]),
-        [
-        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
-
-        if test "$with_sasl" != "no"
-        then
-          if test "$with_sasl" != "yes"
-          then
-            CPPFLAGS="$CPPFLAGS -I$with_sasl/include"
-            LDFLAGS="$LDFLAGS -L$with_sasl/lib"
-          fi
-
-          saved_LIBS="$LIBS"
-
-          AC_CHECK_LIB(sasl, sasl_client_init,,
-            AC_MSG_ERROR([could not find libsasl]),)
-
-          MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_sasl.o"
-          MUTTLIBS="$MUTTLIBS -lsasl"
-          LIBS="$saved_LIBS"
-          AC_DEFINE(USE_SASL,1,
-                  [ Define if want to use the Cyrus SASL library for POP/IMAP authentication. ])
-          need_sasl=yes
-        fi
-        ])
-AM_CONDITIONAL(USE_SASL, test x$need_sasl = xyes)
+AM_CONDITIONAL(USE_SSL, test x$need_ssl = xyes)
 
 AC_ARG_WITH(sasl2, AC_HELP_STRING([--with-sasl2[=PFX]], [Use Cyrus SASL library version 2 for POP/IMAP authentication]),
         [
@@ -726,8 +669,6 @@ AC_ARG_WITH(sasl2, AC_HELP_STRING([--with-sasl2[=PFX]], [Use Cyrus SASL library
           MUTTLIBS="$MUTTLIBS -lsasl2"
           LIBS="$saved_LIBS"
           AC_DEFINE(USE_SASL,1,
-                  [ Define if want to use the Cyrus SASL library for POP/IMAP authentication. ])
-          AC_DEFINE(USE_SASL2,1,
                   [ Define if want to use version 2 of the Cyrus SASL library. ])
           need_sasl=yes
         fi
@@ -773,11 +714,20 @@ if test $mutt_cv_fcntl = yes; then
         AC_DEFINE(USE_FCNTL,1, [ Define to use fcntl() to lock folders. ])
 fi
 
+AC_MSG_CHECKING(whether struct dirent defines d_ino)
+ac_cv_dirent_d_ino=no
+AC_TRY_LINK([#include <dirent.h>],[struct dirent dp; (void)dp.d_ino],[ac_cv_dirent_d_ino=yes])
+if test x$ac_cv_dirent_d_ino = xyes ; then
+  AC_DEFINE(HAVE_DIRENT_D_INO,1,
+            [Define to 1 if your system has the dirent::d_ino member])
+fi
+AC_MSG_RESULT($ac_cv_dirent_d_ino)
+
 dnl This may look cumbersome -- please keep it that way, so we can
 dnl quickly change the default to "yes" again.
 mutt_cv_inodesort=no
 AC_ARG_ENABLE(inodesort,  AC_HELP_STRING([--enable-inodesort], [Read files in maildir folders sorted by inode.]),
-       [if test x$enableval = xyes ; then mutt_cv_inodesort=yes; fi])
+       [if test x$enableval = xyes -a x$ac_cv_dirent_d_ino = xyes ; then mutt_cv_inodesort=yes; fi])
 
 if test $mutt_cv_inodesort = yes; then
        AC_DEFINE(USE_INODESORT, 1, [ Define to sort files in a maildir by inode number. ])
@@ -813,7 +763,7 @@ AC_ARG_ENABLE(mailtool, AC_HELP_STRING([--enable-mailtool], [Enable Sun mailtool
 
 AC_ARG_ENABLE(compressed, [  --enable-compressed        Enable compressed folders support ],
         [if test x$enableval = xyes; then
-                AC_DEFINE(USE_COMPRESSED)
+                AC_DEFINE(USE_COMPRESSED,1,[ The compressed mailboxes support ])
         fi])
 
 AC_ARG_ENABLE(locales-fix, AC_HELP_STRING([--enable-locales-fix], [The result of isprint() is unreliable ]),
@@ -830,14 +780,6 @@ AC_ARG_WITH(exec-shell, AC_HELP_STRING([--with-exec-shell=SHELL], [Specify alter
         fi],
         [AC_DEFINE_UNQUOTED(EXECSHELL, "/bin/sh")])
 
-AC_ARG_ENABLE(exact-address, AC_HELP_STRING([--enable-exact-address], [Enable regeneration of email addresses]),
-        [if test $enableval = yes; then
-                AC_DEFINE(EXACT_ADDRESS,1,
-                  [Enable exact regeneration of email addresses as parsed?
-                   NOTE: this requires significant more memory when defined.])
-
-        fi])
-
 dnl -- start cache --
 AC_ARG_ENABLE(hcache, AC_HELP_STRING([--enable-hcache], [Enable header caching]),
 [if test x$enableval = xyes; then
@@ -847,22 +789,57 @@ AC_ARG_ENABLE(hcache, AC_HELP_STRING([--enable-hcache], [Enable header caching])
     OLDLIBS="$LIBS"
 
     need_md5="yes"
+
+    ac_prefer_qdbm=yes
+    AC_ARG_WITH(qdbm, AC_HELP_STRING([--without-qdbm], [Don't use qdbm even if it is available]),
+        ac_prefer_qdbm=$withval)
+    if test x$ac_prefer_qdbm != xno; then
+        ac_cv_vlopen=no
+        QDBM_DIRS="$mutt_cv_prefix /usr/local /usr"
+        AC_MSG_CHECKING([for vlopen])
+        for d in $QDBM_DIRS; do
+          if test x$ac_cv_vlopen = xno && test -d "$d/include" && test -d "$d/lib"; then
+            QDBM_INC="-I$d/include"
+            QDBM_LIB="-L$d/lib"
+            CPPFLAGS="$OLDCPPFLAGS $QDBM_INC"
+            LIBS="$OLDLIBS $QDBM_LIB -lqdbm"
+            AC_TRY_LINK([#include <villa.h>],[vlopen(0,0,0);],[ac_cv_vlopen=yes])
+          fi
+        done
+        if test x$ac_cv_vlopen = xyes; then
+          AC_MSG_RESULT(yes)
+        else
+          AC_MSG_RESULT(no)
+        fi
+    fi
+
     ac_prefer_gdbm=yes
     AC_ARG_WITH(gdbm, AC_HELP_STRING([--without-gdbm], [Don't use 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
+    if test x$ac_prefer_gdbm != xno -a x$ac_cv_vlopen != xyes; then
+        ac_cv_gdbmopen=no
+        GDBM_DIRS="$mutt_cv_prefix /usr/local /usr"
+        AC_MSG_CHECKING([for gdbm_open])
+        for d in $GDBM_DIRS; do
+          if test x$ac_cv_gdbmopen = xno && test -d "$d/include" && test -d "$d/lib"; then
+            GDBM_INC="-I$d/include"
+            GDBM_LIB="-L$d/lib"
+            CPPFLAGS="$OLDCPPFLAGS $GDBM_INC"
+            LIBS="$OLDLIBS $GDBM_LIB -lgdbm"
             AC_TRY_LINK([#include <gdbm.h>],[gdbm_open(0,0,0,0,0);],[ac_cv_gdbmopen=yes])
-        ])
+          fi
+        done
+        if test x$ac_cv_gdbmopen = xyes; then
+          AC_MSG_RESULT(yes)
+        else
+          AC_MSG_RESULT(no)
+        fi
     fi
-
+   
     ac_bdb_prefix=yes
     AC_ARG_WITH(bdb, AC_HELP_STRING([--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
+    if test x$ac_bdb_prefix != xno -a x$ac_cv_gdbmopen != xyes -a x$ac_cv_vlopen != 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"
@@ -895,7 +872,7 @@ AC_ARG_ENABLE(hcache, AC_HELP_STRING([--enable-hcache], [Enable header caching])
                                 break
                             ])
                         done
-                        test x$ac_dbcreate = xyes && break
+                        test x$ac_cv_dbcreate = xyes && break
                     fi
                 fi
             done
@@ -908,16 +885,20 @@ AC_ARG_ENABLE(hcache, AC_HELP_STRING([--enable-hcache], [Enable header caching])
         fi
     fi
 
-    if test x$ac_cv_gdbmopen = xyes; then
-        CPPFLAGS="$OLDCPPFLAGS"
-        LIBS="$OLDLIBS -lgdbm";
+    if test x$ac_cv_vlopen = xyes; then
+        CPPFLAGS="$OLDCPPFLAGS $QDBM_INC"
+        LIBS="$OLDLIBS $QDBM_LIB -lqdbm"
+        AC_DEFINE(HAVE_QDBM, 1, [QDBM Support])
+    elif test x$ac_cv_gdbmopen = xyes; then
+        CPPFLAGS="$OLDCPPFLAGS $GDBM_INC"
+        LIBS="$OLDLIBS $GDBM_LIB -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)
+        AC_MSG_ERROR([You need one of: QDBM, GDBM or Sleepycat DB4 for --enable-hcache])
     fi
 fi])
 dnl -- end cache --
@@ -926,6 +907,10 @@ AC_SUBST(MUTTLIBS)
 AC_SUBST(MUTT_LIB_OBJECTS)
 AC_SUBST(LIBIMAP)
 AC_SUBST(LIBIMAPDEPS)
+AC_SUBST(LIBPOP)
+AC_SUBST(LIBPOPDEPS)
+AC_SUBST(LIBNNTP)
+AC_SUBST(LIBNNTPDEPS)
 
 dnl -- iconv/gettext --
 
@@ -1141,9 +1126,76 @@ if test x$use_libesmtp = xyes; then
 fi
 dnl -- end libesmtp --
 
+dnl -- sgml tools --
+
+dnl Documentation tools
+have_openjade="no"
+AC_PATH_PROG([OSPCAT], [ospcat], [none])
+if test "$OSPCAT" != "none"
+then
+  AC_MSG_CHECKING([for openjade docbook stylesheets])
+  dslosfile=`ospcat --public-id="-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN"`
+  DSLROOT=`echo $dslosfile | sed -n -e "s/.*SOIBASE='\(@<:@^'@:>@*\)\/catalog'.*/\1/p"`
+  # ospcat may spit out an absolute path without an SOIBASE
+  if test -z "$DSLROOT"
+  then
+    DSLROOT=`echo $dslosfile | sed -e 's|<OSFILE>\(.*\)/print/docbook.dsl|\1|'`
+  fi
+  if test -f $DSLROOT/print/docbook.dsl
+  then
+    AC_MSG_RESULT([in $DSLROOT])
+    have_openjade="yes"
+  else
+    AC_MSG_RESULT([not found: PDF documentation will not be built.])
+  fi
+fi
+AC_SUBST(DSLROOT)
+
+AC_MSG_CHECKING([for lynx])
+AC_PATH_PROG([HTML2TXT_CMD], [lynx], [none])
+if test x"$HTML2TXT_CMD" = x"none"
+then
+  AC_MSG_CHECKING([for w3m])
+  AC_PATH_PROG([HTML2TXT_CMD], [w3m], [none])
+fi
+if test x"$HTML2TXT_CMD" = x"none"
+then
+  AC_MSG_CHECKING([for elinks])
+  AC_PATH_PROG([HTML2TXT_CMD], [elinks], [none])
+fi
+case "$HTML2TXT_CMD" in
+  *elinks*)
+    HTML2TXT_CMD="$HTML2TXT_CMD -dump -no-numbering -no-references \$^ > \$@"
+    ;;
+  *lynx*)
+    HTML2TXT_CMD="$HTML2TXT_CMD -dump -nolist -with_backspaces \$^ > \$@"
+    ;;
+  *w3m*)
+    HTML2TXT_CMD="$HTML2TXT_CMD -dump \$^ > \$@"
+    ;;
+  *)
+    HTML2TXT_CMD="true"
+    ;;
+esac
+AC_SUBST(HTML2TXT_CMD)
+
+AC_MSG_CHECKING([for tidy])
+AC_PATH_PROG([HTMLCLEAN_CMD], [tidy], [none])
+
+if test x"$HTMLCLEAN_CMD" != x"none"
+then
+  HTMLCLEAN_CMD="$HTMLCLEAN_CMD -q -i -m -asxml -utf8 "
+else
+  HTMLCLEAN_CMD="echo "
+fi
+AC_SUBST(HTMLCLEAN_CMD)
+
 AC_OUTPUT(Makefile intl/Makefile m4/Makefile
         po/Makefile.in doc/Makefile contrib/Makefile
         muttbug.sh
+        lib/Makefile
         imap/Makefile
+        pop/Makefile
+        nntp/Makefile
         Muttngrc.head
         doc/instdoc.sh)