more setupts in cfg.lua
[apps/madmutt.git] / configure.ac
index 3473f36..beac5e1 100644 (file)
@@ -23,7 +23,7 @@ PKG_PROG_PKG_CONFIG
 AC_PROG_MAKE_SET
 AC_PROG_INSTALL
 AC_PROG_RANLIB
-AC_PROG_GPERF
+AC_PATH_PROG(GPERF, gperf, AC_MSG_ERROR([Could not find gperf]))
 AC_CHECK_TOOL(AR, ar, ar)
 
 AC_SYS_LARGEFILE
@@ -50,9 +50,6 @@ AH_TEMPLATE([SIG_ATOMIC_VOLATILE_T],
             [Some systems declare sig_atomic_t as volatile, some others -- no.
              This define will have value `sig_atomic_t' or
              `volatile sig_atomic_t' accordingly.])
-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.])
 
 dnl ---------------- sendmail ----------------
 
@@ -63,7 +60,7 @@ AC_DEFINE_UNQUOTED(SENDMAIL,"$ac_cv_path_SENDMAIL",[ Where to find sendmail on y
 dnl ---------------- lua5.1 ----------------
 PKG_CHECK_MODULES(LUA,lua5.1,[
     CPPFLAGS="$CPPFLAGS $LUA_CFLAGS"
-    LDFLAGS="$LDFLAGS $LUA_LIBS"
+    MUTTLIBS="$MUTTLIBS $LUA_LIBS"
 ],[AC_MSG_ERROR([could not find lua5.1])])
 
 dnl ---------------- gpgme ----------------
@@ -102,7 +99,7 @@ main ()
             if test -d $srcdir/../slang; then
                 mutt_cv_slang=$srcdir/../slang/src
                 CFLAGS="$CFLAGS -I${mutt_cv_slang}"
-                LDFLAGS="$LDFLAGS -L${mutt_cv_slang}/objs"
+                MUTTLIBS="$MUTTLIBS -L${mutt_cv_slang}/objs"
             else
                 if test -d ${prefix}/include/slang; then
                     CFLAGS="$CFLAGS -I${prefix}/include/slang"
@@ -116,7 +113,7 @@ main ()
             if test -f $withval/src/slang.h; then
                 mutt_cv_slang=$withval/src
                 CFLAGS="$CFLAGS -I${mutt_cv_slang}"
-                LDFLAGS="$LDFLAGS -L${mutt_cv_slang}/objs"
+                MUTTLIBS="$MUTTLIBS -L${mutt_cv_slang}/objs"
             else
                 dnl ---Must be installed somewhere
                 mutt_cv_slang=$withval
@@ -125,7 +122,7 @@ main ()
                 elif test -d $withval/include; then
                         CFLAGS="$CFLAGS -I${withval}/include"
                 fi
-                LDFLAGS="$LDFLAGS -L${withval}/lib"
+                MUTTLIBS="$MUTTLIBS -L${withval}/lib"
             fi
         fi
         AC_MSG_RESULT($mutt_cv_slang)
@@ -146,7 +143,7 @@ main ()
                 mutt_cv_curses=$withval
             fi
             if test x$mutt_cv_curses != x/usr; then
-                LDFLAGS="-L${mutt_cv_curses}/lib $LDFLAGS"
+                MUTTLIBS="-L${mutt_cv_curses}/lib $MUTTLIBS"
                 CPPFLAGS="$CPPFLAGS -I${mutt_cv_curses}/include"
             fi
         ])
@@ -172,14 +169,13 @@ main ()
             [CF_CURSES_LIBS])
         ])
 
-        old_LIBS="$LIBS"
-        LIBS="$LIBS $MUTTLIBS"
+        LIBS="$MUTTLIBS"
         CF_CHECK_FUNCDECLS([#include <${cf_cv_ncurses_header-curses.h}>],
                            [start_color typeahead bkgdset curs_set meta use_default_colors resizeterm])
         if test "$ac_cv_func_decl_start_color" != yes; then
             AC_MSG_ERROR([Your curses library does not supports color.])
         fi
-        LIBS="$old_LIBS"
+        LIBS=""
     ])
 
 AC_CHECK_HEADERS(stdarg.h sys/ioctl.h ioctl.h sysexits.h)
@@ -326,81 +322,20 @@ AC_MSG_CHECKING([for socklen_t])
 AC_EGREP_HEADER(socklen_t, sys/socket.h, AC_MSG_RESULT([yes]),
         AC_MSG_RESULT([no])
         AC_DEFINE(socklen_t,int, [ Define to 'int' if <sys/socket.h> doesn't have it. ]))
-AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
-AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
-AC_CHECK_FUNCS(getaddrinfo)
+AC_CHECK_FUNC(gethostent,,AC_CHECK_LIB(nsl, gethostent))
+AC_CHECK_FUNC(setsockopt,,AC_CHECK_LIB(socket, setsockopt))
+AC_CHECK_FUNC(getaddrinfo,,[AC_MSG_ERROR([cannot find getaddrinfo])])
 
 dnl -- imap dependencies --
 
-AC_ARG_WITH(gss, AC_HELP_STRING([--with-gss], [Compile in GSSAPI authentication for IMAP]),[
-    if test x$with_gss != xno; then
-        PKG_CHECK_MODULES(GSSAPI,libgssapi,[
-            CPPFLAGS="$CPPFLAGS $GSSAPI_CFLAGS"
-            MUTTLIBS="$MUTTLIBS $GSSAPI_LIBS"
-            AC_DEFINE(USE_GSS,1,[ Define if you have GSSAPI libraries available ])
-            AC_CHECK_HEADERS(xom.h)
-        ],[
-           AC_MSG_ERROR([could not find libgssapi])
-        ])
-    fi
+AM_PATH_LIBGNUTLS(,[
+    CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS"
+    MUTTLIBS="$MUTTLIBS $LIBGNUTLS_LIBS"],[AC_MSG_ERROR([could not find libgnutls])
 ])
 
-AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl[=PFX]], [Compile in SSL support for POP/IMAP]),
-[   if test "$with_ssl" != "no"; then
-        if test "$with_ssl" != "yes"; then
-            LDFLAGS="$LDFLAGS -L$withval/lib"
-            CPPFLAGS="$CPPFLAGS -I$withval/include"
-        fi
-        saved_LIBS="$LIBS"
-
-        AC_CHECK_LIB(crypto, X509_new,, AC_MSG_ERROR([Unable to find SSL library]))
-        AC_CHECK_LIB(ssl, SSL_new,, AC_MSG_ERROR([Unable to find SSL library]), -lcrypto)
-
-        AC_CHECK_FUNCS(RAND_status RAND_egd)
-
-        AC_DEFINE(USE_SSL,1,[ Define if you want support for SSL. ])
-        LIBS="$saved_LIBS"
-        MUTTLIBS="$MUTTLIBS -lssl -lcrypto"
-        need_ssl=yes
-    fi
-])
-
-AC_ARG_WITH([gnutls], AC_HELP_STRING([--with-gnutls], [Enable SSL support using gnutls]),
-            [gnutls_prefix="$withval"], [gnutls_prefix="no"])
-if test "$gnutls_prefix" != "no"; then
-    if test x"$need_ssl" = x"yes"; then
-        AC_MSG_ERROR([Only either OpenSSL or GNUTLS may be used])
-    fi
-    AM_PATH_LIBGNUTLS(,[
-        CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS"
-        MUTTLIBS="$MUTTLIBS $LIBGNUTLS_LIBS"
-        AC_DEFINE(USE_GNUTLS, 1, [Define if you want support for SSL via the gnutls library.])
-        need_ssl=yes],
-        [AC_MSG_ERROR([could not find libgnutls])
-    ])
-fi
-AM_CONDITIONAL(USE_SSL, test x$need_ssl = xyes)
-AC_SUBST(MUTT_SSL_OBJECTS)
-
-AC_ARG_WITH(sasl2, AC_HELP_STRING([--with-sasl2[=PFX]],
-            [Use Cyrus SASL library version 2 for POP/IMAP authentication]),[
-    if test "$with_sasl2" != "no"; then
-        if test "$with_sasl2" != "yes"; then
-            CPPFLAGS="$CPPFLAGS -I$with_sasl2/include"
-            LDFLAGS="$LDFLAGS -L$with_sasl2/lib"
-        fi
-
-        saved_LIBS="$LIBS"
-
-        AC_CHECK_LIB(sasl2, sasl_client_init,,AC_MSG_ERROR([could not find libsasl2]))
-        MUTTLIBS="$MUTTLIBS -lsasl2"
-        LIBS="$saved_LIBS"
-        AC_DEFINE(USE_SASL,1,
-                  [Define if want to use version 2 of the Cyrus SASL library.])
-        need_sasl=yes
-    fi
-])
-AM_CONDITIONAL(USE_SASL, test x$need_sasl = xyes)
+AC_CHECK_LIB(sasl2, sasl_client_init,,AC_MSG_ERROR([could not find libsasl2]))
+MUTTLIBS="$MUTTLIBS $LIBS"
+LIBS=""
 
 AC_ARG_WITH(idn, AC_HELP_STRING([--with-idn], [Use GNU libidn for domain names]),[
     if test x$with_idn != xno ; then
@@ -409,7 +344,7 @@ AC_ARG_WITH(idn, AC_HELP_STRING([--with-idn], [Use GNU libidn for domain names])
                 AC_MSG_ERROR([libidn is too old, want 0.6 at least])
             fi
             CPPFLAGS="$CPPFLAGS $IDN_CFLAGS"
-            LDFLAGS="$LDFLAGS $IDN_LIBS"
+            MUTTLIBS="$MUTTLIBS $IDN_LIBS"
             AC_DEFINE(HAVE_LIBIDN, 1, [IDN Support])
         ],[AC_MSG_ERROR([could not find libidn])])
     fi
@@ -443,11 +378,7 @@ dnl -- start cache --
 AC_ARG_ENABLE(hcache, AC_HELP_STRING([--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_qdbm=yes
     AC_ARG_WITH(qdbm, AC_HELP_STRING([--without-qdbm], [Don't use qdbm even if it is available]),
@@ -468,7 +399,7 @@ AC_ARG_ENABLE(hcache, AC_HELP_STRING([--enable-hcache], [Enable header caching])
             GDBM_INC="-I$d/include"
             GDBM_LIB="-L$d/lib"
             CPPFLAGS="$OLDCPPFLAGS $GDBM_INC"
-            LIBS="$OLDLIBS $GDBM_LIB -lgdbm"
+            LIBS="$MUTTLIBS $GDBM_LIB -lgdbm"
             AC_TRY_LINK([#include <gdbm.h>],[gdbm_open(0,0,0,0,0);],[ac_cv_gdbmopen=yes])
           fi
         done
@@ -479,70 +410,18 @@ AC_ARG_ENABLE(hcache, AC_HELP_STRING([--enable-hcache], [Enable header caching])
         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 -a x$ac_qdbm_here != xyes; then
-        test x$ac_bdb_prefix = xyes && ac_bdb_prefix="${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_cv_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_qdbm_here = xyes; then
         CPPFLAGS="$OLDCPPFLAGS $QDBM_CFLAGS"
-        LIBS="$OLDLIBS $QDBM_LIBS"
+        MUTTLIBS="$MUTTLIBS -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";
+        MUTTLIBS="$MUTTLIBS $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 one of: QDBM, GDBM or Sleepycat DB4 for --enable-hcache])
     fi
+    LIBS=""
 fi])
 dnl -- end cache --
 
@@ -576,8 +455,7 @@ else
     dnl (2) In glibc-2.1.2 and earlier there is a bug that messes up ob and
     dnl     obl when args 2 and 3 are 0 (fixed in glibc-2.1.3).
     AC_CACHE_CHECK([whether this iconv is good enough], mutt_cv_iconv_good,
-                   mutt_save_LIBS="$LIBS"
-                   LIBS="$LIBS $LIBICONV"
+                   LIBS="$LIBICONV"
                    AC_TRY_RUN([
 #include <iconv.h>
 int main()
@@ -598,7 +476,7 @@ changequote([, ])dnl
                    mutt_cv_iconv_good=yes,
                    mutt_cv_iconv_good=no,
                    mutt_cv_iconv_good=yes)
-                   LIBS="$mutt_save_LIBS")
+                   LIBS="")
     if test "$mutt_cv_iconv_good" = no; then
         AC_MSG_ERROR(Try using libiconv instead)
     fi
@@ -637,107 +515,45 @@ dnl -- libesmtp --
 MUTT_AM_LIBESMTP
 if test x$use_libesmtp = xyes; then
     CFLAGS="$CFLAGS $mutt_libesmtp_cflags"
-    dnl HACK MUTTLIBS="$MUTTLIBS $mutt_libesmtp_libs"
     MUTTLIBS="$MUTTLIBS -lesmtp"
     AC_DEFINE(USE_LIBESMTP, 1, [Define to enable the use of libesmtp])
 fi
 dnl -- end libesmtp --
 
-dnl -- sgml tools --
-
-dnl Documentation tools
-have_openjade="no"
-AC_PATH_PROG([OSPCAT], [ospcat], [none])
-if test "x$OSPCAT" != "xnone"; 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_ARG_ENABLE(doc,
-  [  --enable-doc            build documentation (needs doxygen and LaTeX)])
+AC_ARG_ENABLE(doc, [  --enable-doc            build documentation (needs doxygen and LaTeX)])
 # Build documentation?
 DOXYGEN="no"
 LATEX="no"
 if test "${enable_doc}" != "no"; then
-  AC_PATH_PROG(DOXYGEN, doxygen, no)
-  if test "${DOXYGEN}" != "no"; then
-    # Build LaTeX documentation?
-    AC_PATH_PROG(LATEX, pdflatex, no)
-    AC_PATH_PROG(DVIPS, dvips, no)
-    if test "${DVIPS}" = "no"; then
-      LATEX="no"
-    fi
-    AC_MSG_CHECKING(for a4wide.sty)
-    if test -f /usr/share/texmf/tex/latex/misc/a4wide.sty; then
-      AC_MSG_RESULT(yes)
-    elif test -f /usr/share/texmf-tetex/tex/latex/a4wide/a4wide.sty; then
-      AC_MSG_RESULT(yes)
-    else
-      LATEX="no"
-      AC_MSG_RESULT(no)
+    AC_PATH_PROG(DOXYGEN, doxygen, no)
+    if test "${DOXYGEN}" != "no"; then
+        # Build LaTeX documentation?
+        AC_PATH_PROG(LATEX, pdflatex, no)
+        AC_PATH_PROG(DVIPS, dvips, no)
+        if test "${DVIPS}" = "no"; then
+            LATEX="no"
+        fi
+        AC_MSG_CHECKING(for a4wide.sty)
+        if test -f /usr/share/texmf/tex/latex/misc/a4wide.sty; then
+            AC_MSG_RESULT(yes)
+        elif test -f /usr/share/texmf-tetex/tex/latex/a4wide/a4wide.sty; then
+            AC_MSG_RESULT(yes)
+        else
+            LATEX="no"
+            AC_MSG_RESULT(no)
+        fi
     fi
-  fi
 fi
 AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
 AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
 
 AC_OUTPUT(Makefile
           intl/Makefile
-          m4/Makefile
           po/Makefile.in
           apidoc/Makefile apidoc/doxygen.cfg
           lib-lib/Makefile
           lib-lua/Makefile
           lib-mime/Makefile
-          lib-hash/Makefile
           lib-mx/Makefile
           lib-sys/Makefile
           lib-ui/Makefile