1 dnl Process this file with autoconf to produce a configure script.
3 dnl !!! WHEN ADDING NEW CONFIGURE TESTS, PLEASE ADD CODE TO MAIN.C !!!
4 dnl !!! TO DUMP THEIR RESULTS WHEN MUTT -V IS CALLED !!!
8 AM_CONFIG_HEADER(config.h)
10 mutt_cv_version=`cat "$srcdir/VERSION.in"`
12 AM_INIT_AUTOMAKE(madmutt, $mutt_cv_version)
13 AC_SUBST([CONFIGURE_DEPENDENCIES], ['$(top_srcdir)/VERSION.in'])
17 ALL_LINGUAS="de ru it es uk fr pl nl cs id sk ko el zh_TW zh_CN pt_BR eo gl sv da lt tr ja hu et ca bg"
21 AC_MSG_CHECKING([for prefix])
22 if test x$prefix = xNONE; then
23 mutt_cv_prefix=$ac_default_prefix
25 mutt_cv_prefix=$prefix
27 AC_MSG_RESULT($mutt_cv_prefix)
32 if test "x$U" != "x"; then
33 AC_MSG_ERROR(Compiler not ANSI compliant)
41 AC_CHECK_TOOL(AR, ar, ar)
48 AC_CHECK_SIZEOF(off_t)
50 AC_PATH_PROG(DBX, dbx, no)
51 AC_PATH_PROG(GDB, gdb, no)
52 AC_PATH_PROG(SDB, sdb, no)
54 if test $GDB != no ; then
56 elif test $DBX != no ; then
58 elif test $SDB != no ; then
66 AH_TEMPLATE([sig_atomic_t],
67 [Define to 'int' if <signal.h> doesn't define.])
68 AH_TEMPLATE([HAVE_START_COLOR],
69 [Define if you have start_color, as a function or macro.])
70 AH_TEMPLATE([HAVE_TYPEAHEAD],
71 [Define if you have typeahead, as a function or macro.])
72 AH_TEMPLATE([HAVE_BKGDSET],
73 [Define if you have bkgdset, as a function or macro.])
74 AH_TEMPLATE([HAVE_CURS_SET],
75 [Define if you have curs_set, as a function or macro.])
76 AH_TEMPLATE([HAVE_META],
77 [Define if you have meta, as a function or macro.])
78 AH_TEMPLATE([HAVE_USE_DEFAULT_COLORS],
79 [Define if you have use_default_colors, as a function or macro.])
80 AH_TEMPLATE([HAVE_RESIZETERM],
81 [Define if you have resizeterm, as a function or macro.])
82 AH_TEMPLATE([SIG_ATOMIC_VOLATILE_T],
83 [Some systems declare sig_atomic_t as volatile, some others -- no.
84 This define will have value `sig_atomic_t' or
85 `volatile sig_atomic_t' accordingly.])
86 AH_TEMPLATE([ICONV_NONTRANS],
87 [Define as 1 if iconv() only converts exactly and we should treat
88 all return values other than (size_t)(-1) as equivalent.])
92 dnl ---------------- sendmail ----------------
94 ac_aux_path_sendmail=/usr/sbin:/usr/lib
95 AC_PATH_PROG(SENDMAIL, sendmail, /usr/sbin/sendmail, $PATH:$ac_aux_path_sendmail)
96 AC_DEFINE_UNQUOTED(SENDMAIL,"$ac_cv_path_SENDMAIL",[ Where to find sendmail on your system. ])
101 dnl ---------------- gpgme ----------------
103 AC_ARG_ENABLE(gpgme, AC_HELP_STRING([--enable-gpgme], [Enable GPGME support]),
104 [ if test x$enableval = xyes; then
108 if test x$have_gpgme = xyes; then
109 AM_PATH_GPGME(,,[AC_MSG_ERROR(GPGME not found)])
110 MUTTLIBS="$MUTTLIBS $GPGME_LIBS"
111 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS crypt-gpgme.o crypt-mod-pgp-gpgme.o crypt-mod-smime-gpgme.o"
112 AC_DEFINE(CRYPT_BACKEND_GPGME, 1, [Defined, if GPGME support is enabled])
115 dnl ---------------- mixmaster ----------------
117 AC_ARG_WITH(mixmaster, AC_HELP_STRING([--with-mixmaster[=PATH]], [Include Mixmaster support]),
118 [ if test -x "$withval" ; then
121 MIXMASTER="mixmaster"
123 OPS="$OPS \$(srcdir)/OPS.MIX"
124 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS remailer.o"
125 AC_DEFINE_UNQUOTED(MIXMASTER,"$MIXMASTER", [ Where to find mixmaster on your system. ])
128 # We now require all OPS
129 OPS="$OPS \$(srcdir)/OPS.PGP \$(srcdir)/OPS.SMIME \$(srcdir)/OPS.CRYPT "
132 AC_PATH_PROG(ISPELL, ispell, no)
133 if test $ISPELL != no; then
134 AC_DEFINE_UNQUOTED(ISPELL,"$ISPELL",[ Where to find ispell on your system. ])
137 AC_ARG_WITH(slang, AC_HELP_STRING([--with-slang[=DIR]], [Use S-Lang instead of ncurses]),
138 [AC_CACHE_CHECK([if this is a BSD system], mutt_cv_bsdish,
139 [AC_TRY_RUN([#include <sys/param.h>
153 AC_MSG_CHECKING(for S-Lang)
154 if test $withval = yes; then
155 if test -d $srcdir/../slang; then
156 mutt_cv_slang=$srcdir/../slang/src
157 CFLAGS="$CFLAGS -I${mutt_cv_slang}"
158 LDFLAGS="$LDFLAGS -L${mutt_cv_slang}/objs"
160 if test -d $mutt_cv_prefix/include/slang; then
161 CFLAGS="$CFLAGS -I$mutt_cv_prefix/include/slang"
162 elif test -d /usr/include/slang; then
163 CFLAGS="$CFLAGS -I/usr/include/slang"
168 dnl ---Check to see if $withval is a source directory
169 if test -f $withval/src/slang.h; then
170 mutt_cv_slang=$withval/src
171 CFLAGS="$CFLAGS -I${mutt_cv_slang}"
172 LDFLAGS="$LDFLAGS -L${mutt_cv_slang}/objs"
174 dnl ---Must be installed somewhere
175 mutt_cv_slang=$withval
176 if test -d $withval/include/slang; then
177 CFLAGS="$CFLAGS -I${withval}/include/slang"
178 elif test -d $withval/include; then
179 CFLAGS="$CFLAGS -I${withval}/include"
181 LDFLAGS="$LDFLAGS -L${withval}/lib"
184 AC_MSG_RESULT($mutt_cv_slang)
185 if test $mutt_cv_bsdish = yes; then
186 AC_CHECK_LIB(termlib, main)
188 AC_DEFINE(USE_SLANG_CURSES,1, [ Define if you compile with SLang instead of curses/ncurses. ])
189 AC_DEFINE(HAVE_COLOR,1,[ Define if your curses library supports color. ])
190 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS resize.o"
192 dnl --- now that we've found it, check the link
194 AC_CHECK_LIB(slang, SLtt_get_terminfo,
195 [MUTTLIBS="$MUTTLIBS -lslang -lm"],
196 [AC_MSG_ERROR(unable to compile. check config.log)], -lm)
199 [ mutt_cv_curses=/usr
200 AC_ARG_WITH(curses, AC_HELP_STRING([--with-curses=DIR], [Where ncurses is installed]),
201 [ if test $withval != yes; then
202 mutt_cv_curses=$withval
204 if test x$mutt_cv_curses != x/usr; then
205 LDFLAGS="-L${mutt_cv_curses}/lib $LDFLAGS"
206 CPPFLAGS="$CPPFLAGS -I${mutt_cv_curses}/include"
210 AC_CHECK_FUNC(initscr,,[
212 for lib in ncursesw ncurses; do
213 AC_CHECK_LIB($lib, waddnwstr, [cf_ncurses="$lib"; break])
215 AC_CHECK_LIB($cf_ncurses, initscr,
216 [ MUTTLIBS="$MUTTLIBS -l$cf_ncurses"
217 if test x$mutt_cv_curses = x/usr -a -d /usr/include/ncurses; then
218 CPPFLAGS="$CPPFLAGS -I/usr/include/ncurses"
221 if test "$cf_ncurses" = ncursesw; then
222 AC_CHECK_HEADERS(ncurses/ncurses.h,[cf_cv_ncurses_header="ncurses/ncurses.h"])
223 AC_CHECK_HEADERS(ncursesw/ncurses.h,[cf_cv_ncurses_header="ncursesw/ncurses.h"])
225 AC_CHECK_HEADERS(ncurses.h,[cf_cv_ncurses_header="ncurses.h"])
232 LIBS="$LIBS $MUTTLIBS"
233 CF_CHECK_FUNCDECLS([#include <${cf_cv_ncurses_header-curses.h}>],
234 [start_color typeahead bkgdset curs_set meta use_default_colors resizeterm])
235 if test "$ac_cv_func_decl_start_color" = yes; then
236 AC_DEFINE(HAVE_COLOR,1,[ Define if your curses library supports color. ])
238 if test "$ac_cv_func_decl_resizeterm" = yes; then
239 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS resize.o"
246 AC_CHECK_HEADERS(stdarg.h sys/ioctl.h ioctl.h sysexits.h)
247 AC_CHECK_HEADERS(sys/time.h sys/resource.h)
248 AC_CHECK_HEADERS(unix.h)
250 AC_CHECK_FUNCS(setrlimit getsid isctype)
254 AC_MSG_CHECKING(for sig_atomic_t in signal.h)
255 AC_EGREP_HEADER(sig_atomic_t,signal.h,
256 [ ac_cv_type_sig_atomic_t=yes;
257 AC_EGREP_HEADER(volatile.*sig_atomic_t,
259 [is_sig_atomic_t_volatile=yes; AC_MSG_RESULT([yes, volatile])],
260 [is_sig_atomic_t_volatile=no; AC_MSG_RESULT([yes, non volatile])])
263 AC_CHECK_TYPE(sig_atomic_t, int)
264 is_sig_atomic_t_volatile=no
266 if test $is_sig_atomic_t_volatile = 'yes'
268 AC_DEFINE(SIG_ATOMIC_VOLATILE_T, sig_atomic_t)
270 AC_DEFINE(SIG_ATOMIC_VOLATILE_T, [volatile sig_atomic_t])
277 AC_CHECK_FUNCS(fgetpos memmove setegid srand48 strerror)
278 AC_REPLACE_FUNCS(strcasecmp setenv)
279 AC_CHECK_FUNCS(snprintf vsnprintf)
281 AC_CHECK_FUNC(getopt)
282 if test $ac_cv_func_getopt = yes; then
283 AC_CHECK_HEADERS(getopt.h)
286 AC_ARG_WITH(regex, AC_HELP_STRING([--with-regex], [Use the GNU regex library]),
288 [AC_CHECK_FUNCS(regcomp, mutt_cv_regex=no, mutt_cv_regex=yes)])
290 if test $mutt_cv_regex = no ; then
291 AC_CACHE_CHECK([whether your system's regexp library is completely broken],
292 [mutt_cv_regex_broken],
296 main() { regex_t blah ; regmatch_t p; p.rm_eo = p.rm_eo; return regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0); }],
297 mutt_cv_regex_broken=no, mutt_cv_regex_broken=yes, mutt_cv_regex_broken=yes))
298 if test $mutt_cv_regex_broken = yes ; then
299 echo "Using the included GNU regex instead." >&AC_FD_MSG
304 if test $mutt_cv_regex = yes; then
305 AC_DEFINE(USE_GNU_REGEX,1,[ Define if you want to use the included regex.c. ])
306 LIBOBJS="$LIBOBJS regex.o"
310 AC_ARG_WITH(homespool,
311 AC_HELP_STRING([--with-homespool[=FILE]],
312 [File in user's directory where new mail is spooled]),
313 with_homespool=${withval})
314 if test x$with_homespool != x; then
315 if test $with_homespool = yes; then
316 with_homespool=mailbox
318 AC_DEFINE_UNQUOTED(MAILPATH,"$with_homespool",[ Where new mail is spooled. ])
319 AC_DEFINE(HOMESPOOL,1,
320 [ Is mail spooled to the user's home directory? If defined,
321 MAILPATH should be set to the filename of the spool mailbox
322 relative the the home directory.
323 use: configure --with-homespool=FILE
325 AC_DEFINE(USE_DOTLOCK,1,[ Define to use dotlocking for mailboxes. ])
328 AC_ARG_WITH(mailpath, AC_HELP_STRING([--with-mailpath=DIR], [Directory where spool mailboxes are located]),
329 [mutt_cv_mailpath=$withval],
330 [ AC_CACHE_CHECK(where new mail is stored, mutt_cv_mailpath,
332 if test -d /var/mail; then
333 mutt_cv_mailpath=/var/mail
334 elif test -d /var/spool/mail; then
335 mutt_cv_mailpath=/var/spool/mail
336 elif test -d /usr/spool/mail; then
337 mutt_cv_mailpath=/usr/spool/mail
338 elif test -d /usr/mail; then
339 mutt_cv_mailpath=/usr/mail
342 if test "$mutt_cv_mailpath" = no; then
343 AC_MSG_ERROR("Could not determine where new mail is stored.")
345 AC_DEFINE_UNQUOTED(MAILPATH,"$mutt_cv_mailpath",[ Where new mail is spooled. ])
347 AC_CACHE_CHECK(if $mutt_cv_mailpath is world writable, mutt_cv_worldwrite, [AC_TRY_RUN([#include <sys/types.h>
348 #include <sys/stat.h>
350 int main (int argc, char **argv)
354 stat ("$mutt_cv_mailpath", &s);
355 if (s.st_mode & S_IWOTH) exit (0);
357 }], mutt_cv_worldwrite=yes, mutt_cv_worldwrite=no, mutt_cv_worldwrite=no)])
360 if test $mutt_cv_worldwrite = yes; then
361 AC_DEFINE(USE_DOTLOCK,1,[ Define to use dotlocking for mailboxes. ])
364 AC_CACHE_CHECK(if $mutt_cv_mailpath is group writable, mutt_cv_groupwrite, [AC_TRY_RUN([#include <sys/types.h>
365 #include <sys/stat.h>
367 int main (int argc, char **argv)
371 stat ("$mutt_cv_mailpath", &s);
372 if (s.st_mode & S_IWGRP) exit (0);
374 }], mutt_cv_groupwrite=yes, mutt_cv_groupwrite=no, mutt_cv_groupwrite=no)])
376 if test $mutt_cv_groupwrite = yes; then
377 AC_DEFINE(USE_DOTLOCK,1,[ Define to use dotlocking for mailboxes. ])
378 AC_DEFINE(USE_SETGID,1,[ Define if mutt should run setgid "mail". ])
384 AC_MSG_CHECKING(where to put the documentation)
385 AC_ARG_WITH(docdir, AC_HELP_STRING([--with-docdir=PATH], [Specify where to put the documentation]),
386 [mutt_cv_docdir=$withval],
387 [mutt_cv_docdir="${prefix}/doc/madmutt"])
388 AC_MSG_RESULT($mutt_cv_docdir)
390 docdir=$mutt_cv_docdir
393 if test x$mutt_cv_setgid = xyes; then
395 DOTLOCK_PERMISSION=2755
398 DOTLOCK_PERMISSION=755
400 AC_SUBST(DOTLOCK_GROUP)
401 AC_SUBST(DOTLOCK_PERMISSION)
403 dnl -- socket dependencies --
405 AC_ARG_ENABLE(nntp, [ --enable-nntp Enable NNTP support],
406 [ if test x$enableval = xyes ; then
407 AC_DEFINE(USE_NNTP,1,[ Compiling with newsreading support with NNTP ])
408 LIBNNTP="-Lnntp -lnntp"
409 LIBNNTPDEPS="\$(top_srcdir)/nntp/nntp.h nntp/libnntp.a"
413 AM_CONDITIONAL(BUILD_NNTP, test x$need_nntp = xyes)
415 dnl -- end socket dependencies --
417 AC_MSG_CHECKING([for socklen_t])
418 AC_EGREP_HEADER(socklen_t, sys/socket.h, AC_MSG_RESULT([yes]),
420 AC_DEFINE(socklen_t,int, [ Define to 'int' if <sys/socket.h> doesn't have it. ]))
421 AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
422 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
423 AC_CHECK_FUNCS(getaddrinfo)
425 dnl -- imap dependencies --
427 AC_ARG_WITH(gss, AC_HELP_STRING([--with-gss[=PFX]], [Compile in GSSAPI authentication for IMAP]),
428 gss_prefix="$withval", gss_prefix="no")
429 if test "$gss_prefix" != "no"
431 MUTT_AM_PATH_GSSAPI(gss_prefix)
432 AC_MSG_CHECKING(GSSAPI implementation)
433 AC_MSG_RESULT($GSSAPI_IMPL)
434 if test "$GSSAPI_IMPL" = "none"
437 AC_MSG_RESULT([GSSAPI libraries not found])
439 if test "$GSSAPI_IMPL" = "Heimdal"
441 AC_DEFINE(HAVE_HEIMDAL,1,[ Define if your GSSAPI implementation is Heimdal ])
443 CPPFLAGS="$CPPFLAGS $GSSAPI_CFLAGS"
444 MUTTLIBS="$MUTTLIBS $GSSAPI_LIBS"
445 AC_DEFINE(USE_GSS,1,[ Define if you have GSSAPI libraries available ])
448 AM_CONDITIONAL(USE_GSS, test x$need_gss = xyes)
450 dnl -- end imap dependencies --
452 AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl[=PFX]], [Compile in SSL support for POP/IMAP]),
453 [ if test "$with_ssl" != "no"
455 if test "$with_ssl" != "yes"
457 LDFLAGS="$LDFLAGS -L$withval/lib"
458 CPPFLAGS="$CPPFLAGS -I$withval/include"
462 AC_CHECK_LIB(crypto, X509_new,, AC_MSG_ERROR([Unable to find SSL library]))
463 AC_CHECK_LIB(ssl, SSL_new,, AC_MSG_ERROR([Unable to find SSL library]), -lcrypto)
465 AC_CHECK_FUNCS(RAND_status RAND_egd)
467 AC_DEFINE(USE_SSL,1,[ Define if you want support for SSL. ])
469 MUTTLIBS="$MUTTLIBS -lssl -lcrypto"
470 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_ssl.o"
476 AC_ARG_WITH([gnutls], AC_HELP_STRING([--with-gnutls[=PFX]], [Enable SSL support using gnutls]),
477 [gnutls_prefix="$withval"], [gnutls_prefix="no"])
478 if test "$gnutls_prefix" != "no"
480 if test x"$need_ssl" = x"yes"
482 AC_MSG_ERROR([Only either OpenSSL or GNUTLS may be used])
484 MUTT_AM_PATH_GNUTLS([$gnutls_prefix],
486 CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS"
487 MUTTLIBS="$MUTTLIBS $LIBGNUTLS_LIBS"
488 AC_DEFINE(USE_GNUTLS, 1, [Define if you want support for SSL via the gnutls library.])
490 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_ssl_gnutls.o"
492 [dnl GNUTLS not found
493 AC_MSG_ERROR([could not find libgnutls])
497 AM_CONDITIONAL(USE_SSL, test x$need_ssl = xyes)
499 AC_ARG_WITH(sasl2, AC_HELP_STRING([--with-sasl2[=PFX]],
500 [Use Cyrus SASL library version 2 for POP/IMAP authentication]),
502 if test "$with_sasl2" != "no"
504 if test "$with_sasl2" != "yes"
506 CPPFLAGS="$CPPFLAGS -I$with_sasl2/include"
507 LDFLAGS="$LDFLAGS -L$with_sasl2/lib"
512 AC_CHECK_LIB(sasl2, sasl_client_init,,
513 AC_MSG_ERROR([could not find libsasl2]),)
515 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_sasl.o"
516 MUTTLIBS="$MUTTLIBS -lsasl2"
518 AC_DEFINE(USE_SASL,1,
519 [ Define if want to use version 2 of the Cyrus SASL library. ])
523 AM_CONDITIONAL(USE_SASL, test x$need_sasl = xyes)
525 AC_ARG_WITH(idn, AC_HELP_STRING([--with-idn=[PFX]], [Use GNU libidn for domain names]),
527 if test "$with_idn" != "no" ; then
528 if test "$with_idn" != "yes" ; then
529 CPPFLAGS="$CPPFLAGS -I$with_idn/include"
530 LDFLAGS="$LDFLAGS -L$with_idn/lib"
536 if test "x$with_idn" != "xno"; then
537 AC_CHECK_LIB(idn, stringprep_check_version)
538 AC_CHECK_FUNCS(idna_to_unicode_utf8_from_utf8 idna_to_unicode_8z8z)
539 AC_CHECK_FUNCS(idna_to_ascii_from_utf8 idna_to_ascii_8z)
540 AC_CHECK_FUNCS(idna_to_ascii_lz idna_to_ascii_from_locale)
545 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging support]),
546 [ if test x$enableval = xyes ; then
547 AC_DEFINE(DEBUG,1,[ Define to enable debugging info. ])
551 AC_ARG_ENABLE(flock, AC_HELP_STRING([--enable-flock], [Use flock() to lock files]),
552 [if test $enableval = yes; then
553 AC_DEFINE(USE_FLOCK,1, [ Define to use flock() to lock mailboxes. ])
557 AC_ARG_ENABLE(fcntl, AC_HELP_STRING([--disable-fcntl], [Do NOT use fcntl() to lock files]),
558 [if test $enableval = no; then mutt_cv_fcntl=no; fi])
560 if test $mutt_cv_fcntl = yes; then
561 AC_DEFINE(USE_FCNTL,1, [ Define to use fcntl() to lock folders. ])
564 AC_MSG_CHECKING(whether struct dirent defines d_ino)
565 ac_cv_dirent_d_ino=no
566 AC_TRY_LINK([#include <dirent.h>],[struct dirent dp; (void)dp.d_ino],[ac_cv_dirent_d_ino=yes])
567 if test x$ac_cv_dirent_d_ino = xyes ; then
568 AC_DEFINE(HAVE_DIRENT_D_INO,1,
569 [Define to 1 if your system has the dirent::d_ino member])
571 AC_MSG_RESULT($ac_cv_dirent_d_ino)
573 AC_ARG_ENABLE(buffy-size, AC_HELP_STRING([--enable-buffy-size], [Use file size attribute instead of access time]),
574 [if test x$enableval = xyes; then
575 AC_DEFINE(BUFFY_SIZE,1,[ Define to enable the "buffy_size" feature. ])
578 dnl -- start cache --
579 AC_ARG_ENABLE(hcache, AC_HELP_STRING([--enable-hcache], [Enable header caching]),
580 [if test x$enableval = xyes; then
581 AC_DEFINE(USE_HCACHE, 1, [Enable header caching])
583 OLDCPPFLAGS="$CPPFLAGS"
589 AC_ARG_WITH(qdbm, AC_HELP_STRING([--without-qdbm], [Don't use qdbm even if it is available]),
590 ac_prefer_qdbm=$withval)
591 if test x$ac_prefer_qdbm != xno; then
592 PKG_CHECK_MODULES(QDBM,qdbm,[ac_qdbm_here=yes],[ac_qdbm_here=no])
596 AC_ARG_WITH(gdbm, AC_HELP_STRING([--without-gdbm], [Don't use gdbm even if it is available]),
597 ac_prefer_gdbm=$withval)
598 if test x$ac_prefer_gdbm != xno -a x$ac_qdbm_here != xyes; then
600 GDBM_DIRS="$mutt_cv_prefix /usr/local /usr"
601 AC_MSG_CHECKING([for gdbm_open])
602 for d in $GDBM_DIRS; do
603 if test x$ac_cv_gdbmopen = xno && test -d "$d/include" && test -d "$d/lib"; then
604 GDBM_INC="-I$d/include"
606 CPPFLAGS="$OLDCPPFLAGS $GDBM_INC"
607 LIBS="$OLDLIBS $GDBM_LIB -lgdbm"
608 AC_TRY_LINK([#include <gdbm.h>],[gdbm_open(0,0,0,0,0);],[ac_cv_gdbmopen=yes])
611 if test x$ac_cv_gdbmopen = xyes; then
619 AC_ARG_WITH(bdb, AC_HELP_STRING([--with-bdb[=DIR]], [Use BerkeleyDB4 if gdbm is not available ]),
620 ac_bdb_prefix=$withval)
621 if test x$ac_bdb_prefix != xno -a x$ac_cv_gdbmopen != xyes -a x$ac_qdbm_here != xyes; then
622 test x$ac_bdb_prefix = xyes && ac_bdb_prefix="$mutt_cv_prefix /opt/csw/bdb4 /opt /usr/local /usr"
623 for d in $ac_bdb_prefix; do
625 for v in BerkeleyDB.4.3 BerkeleyDB.4.2 BerkeleyDB.4.1; do
626 bdbpfx="$bdbpfx $d/$v"
629 BDB_VERSIONS="db-4 db4 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db ''"
630 AC_MSG_CHECKING([for BerkeleyDB > 4.0])
634 for v in / $BDB_VERSIONS; do
635 if test -r "$d/include/$v/db.h"; then
636 BDB_INCLUDE_DIR="$d/include/$v"
637 if test -d "$d/lib/$v"; then
638 BDB_LIB_DIR="$d/lib/$v"
639 for l in `echo $BDB_VERSIONS`; do
640 CPPFLAGS="-I$BDB_INCLUDE_DIR $OLDCPPFLAGS"
641 LIBS="$OLDLIBS -L$BDB_LIB_DIR -l$l"
647 db->open(db,NULL,NULL,NULL,0,0,0);
654 test x$ac_cv_dbcreate = xyes && break
658 test x$BDB_LIB != x && break
660 if test x$ac_cv_dbcreate = xyes; then
667 if test x$ac_qdbm_here = xyes; then
668 CPPFLAGS="$OLDCPPFLAGS $QDBM_CFLAGS"
669 LIBS="$OLDLIBS $QDBM_LIBS"
670 AC_DEFINE(HAVE_QDBM, 1, [QDBM Support])
671 elif test x$ac_cv_gdbmopen = xyes; then
672 CPPFLAGS="$OLDCPPFLAGS $GDBM_INC"
673 LIBS="$OLDLIBS $GDBM_LIB -lgdbm";
674 AC_DEFINE(HAVE_GDBM, 1, [GDBM Support])
675 elif test x$ac_cv_dbcreate = xyes; then
676 CPPFLAGS="-I$BDB_INCLUDE_DIR $OLDCPPFLAGS"
677 LIBS="$OLDLIBS -L$BDB_LIB_DIR -l$BDB_LIB"
678 AC_DEFINE(HAVE_DB4, 1, [Sleepycat DB4 Support])
680 AC_MSG_ERROR([You need one of: QDBM, GDBM or Sleepycat DB4 for --enable-hcache])
686 AC_SUBST(MUTT_LIB_OBJECTS)
688 AC_SUBST(LIBNNTPDEPS)
690 dnl -- iconv/gettext --
692 AC_ARG_ENABLE(iconv, AC_HELP_STRING([--disable-iconv], [Disable iconv support]),
693 [if test x$enableval = xno ; then
700 if test "$am_cv_func_iconv" != "yes"
702 AC_MSG_WARN([Configuring without iconv support. See INSTALL for details])
705 AC_CHECK_HEADERS(iconv.h,
706 [AC_MSG_CHECKING(whether iconv.h defines iconv_t)
707 AC_EGREP_HEADER([typedef.*iconv_t],iconv.h,
709 AC_DEFINE(HAVE_ICONV_T_DEF, 1,
710 [Define if <iconv.h> defines iconv_t.])],
713 dnl (1) Some implementations of iconv won't convert from UTF-8 to UTF-8.
714 dnl (2) In glibc-2.1.2 and earlier there is a bug that messes up ob and
715 dnl obl when args 2 and 3 are 0 (fixed in glibc-2.1.3).
716 AC_CACHE_CHECK([whether this iconv is good enough], mutt_cv_iconv_good,
717 mutt_save_LIBS="$LIBS"
718 LIBS="$LIBS $LIBICONV"
729 ob = buf, obl = sizeof(buf);
730 return ((cd = iconv_open("UTF-8", "UTF-8")) != (iconv_t)(-1) &&
731 (iconv(cd, 0, 0, &ob, &obl) ||
732 !(ob == buf && obl == sizeof(buf)) ||
736 mutt_cv_iconv_good=yes,
737 mutt_cv_iconv_good=no,
738 mutt_cv_iconv_good=yes)
739 LIBS="$mutt_save_LIBS")
740 if test "$mutt_cv_iconv_good" = no; then
741 AC_MSG_ERROR(Try using libiconv instead)
744 dnl This is to detect implementations such as the one in glibc-2.1,
745 dnl which always convert exactly but return the number of characters
746 dnl converted instead of the number converted inexactly.
747 AC_CACHE_CHECK([whether iconv is non-transcribing], mutt_cv_iconv_nontrans,
748 mutt_save_LIBS="$LIBS"
749 LIBS="$LIBS $LIBICONV"
759 const char *s = "\304\211";
763 ib = s, ibl = 2, ob = t, obl = 3;
764 return ((cd = iconv_open("UTF-8", "UTF-8")) == (iconv_t)(-1) ||
765 iconv(cd, &ib, &ibl, &ob, &obl));
768 mutt_cv_iconv_nontrans=no,
769 mutt_cv_iconv_nontrans=yes,
770 mutt_cv_iconv_nontrans=no)
771 LIBS="$mutt_save_LIBS")
772 if test "$mutt_cv_iconv_nontrans" = yes; then
773 AC_DEFINE(ICONV_NONTRANS, 1)
775 AC_DEFINE(ICONV_NONTRANS, 0)
778 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/intl"
780 if test "$BUILD_INCLUDED_LIBINTL" = "yes"; then
781 AC_DEFINE(HAVE_BIND_TEXTDOMAIN_CODESET,1,
782 [ Define if your gettext has bind_textdomain_codeset. ])
784 AC_CHECK_FUNCS(bind_textdomain_codeset)
791 AC_CHECK_HEADERS(wchar.h)
793 AC_CACHE_CHECK([for wchar_t], mutt_cv_wchar_t,
801 [ wchar_t wc; return 0; ],
805 if test "$mutt_cv_wchar_t" = no; then
806 AC_DEFINE(wchar_t,int,[ Define to 'int' if system headers don't define. ])
809 AC_CACHE_CHECK([for wint_t], mutt_cv_wint_t,
817 [ wint_t wc; return 0; ],
821 if test "$mutt_cv_wint_t" = no; then
822 AC_DEFINE(wint_t,int,[ Define to 'int' if system headers don't define. ])
825 AC_CHECK_HEADERS(wctype.h)
826 AC_CHECK_FUNCS(iswalnum iswalpha iswcntrl iswdigit)
827 AC_CHECK_FUNCS(iswgraph iswlower iswprint iswpunct iswspace iswupper)
828 AC_CHECK_FUNCS(iswxdigit towupper towlower)
830 AC_CACHE_CHECK([for mbstate_t], mutt_cv_mbstate_t,
838 [ mbstate_t s; return 0; ],
839 mutt_cv_mbstate_t=yes,
840 mutt_cv_mbstate_t=no))
842 if test "$mutt_cv_mbstate_t" = no; then
843 AC_DEFINE(mbstate_t,int,[ Define to 'int' if system headers don't define. ])
847 AC_ARG_WITH(wc-funcs, AC_HELP_STRING([--without-wc-funcs], [Do not use the system's wchar_t functions]),
850 if test "$wc_funcs" != yes -a "$wc_funcs" != no; then
851 AC_CACHE_CHECK([for wchar_t functions], mutt_cv_wc_funcs,
854 #define _XOPEN_SOURCE 1
863 [mbrtowc(0, 0, 0, 0); wctomb(0, 0); wcwidth(0);
864 iswprint(0); iswspace(0); towlower(0); towupper(0); iswalnum(0)],
865 mutt_cv_wc_funcs=yes))
866 wc_funcs=$mutt_cv_wc_funcs
869 if test $wc_funcs = yes; then
870 AC_DEFINE(HAVE_WC_FUNCS,1,[ Define if you are using the system's wchar_t functions. ])
873 AC_CACHE_CHECK([for nl_langinfo and CODESET], mutt_cv_langinfo_codeset,
874 [AC_TRY_LINK([#include <langinfo.h>],
875 [char* cs = nl_langinfo(CODESET);],
876 mutt_cv_langinfo_codeset=yes,
877 mutt_cv_langinfo_codeset=no)])
878 if test $mutt_cv_langinfo_codeset = yes; then
879 AC_DEFINE(HAVE_LANGINFO_CODESET,1,[ Define if you have <langinfo.h> and nl_langinfo(CODESET). ])
882 AC_CACHE_CHECK([for nl_langinfo and YESEXPR], mutt_cv_langinfo_yesexpr,
883 [AC_TRY_LINK([#include <langinfo.h>],
884 [char* cs = nl_langinfo(YESEXPR);],
885 mutt_cv_langinfo_yesexpr=yes,
886 mutt_cv_langinfo_yesexpr=no)])
887 if test $mutt_cv_langinfo_yesexpr = yes; then
888 AC_DEFINE(HAVE_LANGINFO_YESEXPR,1,[ Define if you have <langinfo.h> and nl_langinfo(YESEXPR). ])
893 if test x$use_libesmtp = xyes; then
894 CFLAGS="$CFLAGS $mutt_libesmtp_cflags"
895 MUTTLIBS="$MUTTLIBS $mutt_libesmtp_libs"
896 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_libesmtp.o"
898 AC_DEFINE(USE_LIBESMTP,
900 [Define to enable the use of libesmtp])
902 dnl -- end libesmtp --
906 dnl Documentation tools
908 AC_PATH_PROG([OSPCAT], [ospcat], [none])
909 if test "$OSPCAT" != "none"
911 AC_MSG_CHECKING([for openjade docbook stylesheets])
912 dslosfile=`ospcat --public-id="-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN"`
913 DSLROOT=`echo $dslosfile | sed -n -e "s/.*SOIBASE='\(@<:@^'@:>@*\)\/catalog'.*/\1/p"`
914 # ospcat may spit out an absolute path without an SOIBASE
915 if test -z "$DSLROOT"
917 DSLROOT=`echo $dslosfile | sed -e 's|<OSFILE>\(.*\)/print/docbook.dsl|\1|'`
919 if test -f $DSLROOT/print/docbook.dsl
921 AC_MSG_RESULT([in $DSLROOT])
924 AC_MSG_RESULT([not found: PDF documentation will not be built.])
929 AC_MSG_CHECKING([for lynx])
930 AC_PATH_PROG([HTML2TXT_CMD], [lynx], [none])
931 if test x"$HTML2TXT_CMD" = x"none"
933 AC_MSG_CHECKING([for w3m])
934 AC_PATH_PROG([HTML2TXT_CMD], [w3m], [none])
936 if test x"$HTML2TXT_CMD" = x"none"
938 AC_MSG_CHECKING([for elinks])
939 AC_PATH_PROG([HTML2TXT_CMD], [elinks], [none])
941 case "$HTML2TXT_CMD" in
943 HTML2TXT_CMD="$HTML2TXT_CMD -dump -no-numbering -no-references \$^ > \$@"
946 HTML2TXT_CMD="$HTML2TXT_CMD -dump -nolist -with_backspaces \$^ > \$@"
949 HTML2TXT_CMD="$HTML2TXT_CMD -dump \$^ > \$@"
955 AC_SUBST(HTML2TXT_CMD)
957 AC_MSG_CHECKING([for tidy])
958 AC_PATH_PROG([HTMLCLEAN_CMD], [tidy], [none])
960 if test x"$HTMLCLEAN_CMD" != x"none"
962 HTMLCLEAN_CMD="$HTMLCLEAN_CMD -q -i -m -asxml -utf8 "
964 HTMLCLEAN_CMD="echo "
966 AC_SUBST(HTMLCLEAN_CMD)
968 AC_OUTPUT(Makefile intl/Makefile m4/Makefile
969 po/Makefile.in doc/Makefile contrib/Makefile