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)
9 AM_INIT_AUTOMAKE(madmutt, devel)
13 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"
27 AC_PATH_PROG(GPERF, gperf, AC_MSG_ERROR([Could not find gperf]))
28 AC_CHECK_TOOL(AR, ar, ar)
32 AC_CHECK_SIZEOF(off_t)
34 AH_TEMPLATE([sig_atomic_t],
35 [Define to 'int' if <signal.h> doesn't define.])
36 AH_TEMPLATE([HAVE_START_COLOR],
37 [Define if you have start_color, as a function or macro.])
38 AH_TEMPLATE([HAVE_TYPEAHEAD],
39 [Define if you have typeahead, as a function or macro.])
40 AH_TEMPLATE([HAVE_BKGDSET],
41 [Define if you have bkgdset, as a function or macro.])
42 AH_TEMPLATE([HAVE_CURS_SET],
43 [Define if you have curs_set, as a function or macro.])
44 AH_TEMPLATE([HAVE_META],
45 [Define if you have meta, as a function or macro.])
46 AH_TEMPLATE([HAVE_USE_DEFAULT_COLORS],
47 [Define if you have use_default_colors, as a function or macro.])
48 AH_TEMPLATE([HAVE_RESIZETERM],
49 [Define if you have resizeterm, as a function or macro.])
50 AH_TEMPLATE([SIG_ATOMIC_VOLATILE_T],
51 [Some systems declare sig_atomic_t as volatile, some others -- no.
52 This define will have value `sig_atomic_t' or
53 `volatile sig_atomic_t' accordingly.])
55 dnl ---------------- sendmail ----------------
57 ac_aux_path_sendmail=/usr/sbin:/usr/lib
58 AC_PATH_PROG(SENDMAIL, sendmail, /usr/sbin/sendmail, $PATH:$ac_aux_path_sendmail)
59 AC_DEFINE_UNQUOTED(SENDMAIL,"$ac_cv_path_SENDMAIL",[ Where to find sendmail on your system. ])
61 dnl ---------------- lua5.1 ----------------
62 PKG_CHECK_MODULES(LUA,lua5.1,[
63 CPPFLAGS="$CPPFLAGS $LUA_CFLAGS"
64 MUTTLIBS="$MUTTLIBS $LUA_LIBS"
65 ],[AC_MSG_ERROR([could not find lua5.1])])
67 dnl ---------------- gpgme ----------------
69 AC_ARG_ENABLE(gpgme, AC_HELP_STRING([--enable-gpgme], [Enable GPGME support]),[
70 if test x$enableval = xyes; then
71 AM_PATH_GPGME(,,[AC_MSG_ERROR(GPGME not found)])
72 MUTTLIBS="$MUTTLIBS $GPGME_LIBS"
73 AC_DEFINE(CRYPT_BACKEND_GPGME, 1, [Defined, if GPGME support is enabled])
75 AC_MSG_ERROR([could not find gpgme])
79 AC_PATH_PROG(MIXMASTER, mixmaster, mixmaster)
80 AC_DEFINE_UNQUOTED(MIXMASTER,"$MIXMASTER",[Where to find mixmaster on your system.])
82 AC_ARG_WITH(slang, AC_HELP_STRING([--with-slang[=DIR]], [Use S-Lang instead of ncurses]),
83 [AC_CACHE_CHECK([if this is a BSD system], mutt_cv_bsdish,
84 [AC_TRY_RUN([#include <sys/param.h>
98 AC_MSG_CHECKING(for S-Lang)
99 if test $withval = yes; then
100 if test -d $srcdir/../slang; then
101 mutt_cv_slang=$srcdir/../slang/src
102 CFLAGS="$CFLAGS -I${mutt_cv_slang}"
103 MUTTLIBS="$MUTTLIBS -L${mutt_cv_slang}/objs"
105 if test -d ${prefix}/include/slang; then
106 CFLAGS="$CFLAGS -I${prefix}/include/slang"
107 elif test -d /usr/include/slang; then
108 CFLAGS="$CFLAGS -I/usr/include/slang"
113 dnl ---Check to see if $withval is a source directory
114 if test -f $withval/src/slang.h; then
115 mutt_cv_slang=$withval/src
116 CFLAGS="$CFLAGS -I${mutt_cv_slang}"
117 MUTTLIBS="$MUTTLIBS -L${mutt_cv_slang}/objs"
119 dnl ---Must be installed somewhere
120 mutt_cv_slang=$withval
121 if test -d $withval/include/slang; then
122 CFLAGS="$CFLAGS -I${withval}/include/slang"
123 elif test -d $withval/include; then
124 CFLAGS="$CFLAGS -I${withval}/include"
126 MUTTLIBS="$MUTTLIBS -L${withval}/lib"
129 AC_MSG_RESULT($mutt_cv_slang)
130 if test $mutt_cv_bsdish = yes; then
131 AC_CHECK_LIB(termlib, main)
133 AC_DEFINE(USE_SLANG_CURSES,1, [ Define if you compile with SLang instead of curses/ncurses. ])
135 dnl --- now that we've found it, check the link
137 AC_CHECK_LIB(slang, SLtt_get_terminfo,
138 [MUTTLIBS="$MUTTLIBS -lslang -lm"],
139 [AC_MSG_ERROR(unable to compile. check config.log)], -lm)
141 [ mutt_cv_curses=/usr
142 AC_ARG_WITH(curses, AC_HELP_STRING([--with-curses=DIR], [Where ncurses is installed]), [
143 if test $withval != yes; then
144 mutt_cv_curses=$withval
146 if test x$mutt_cv_curses != x/usr; then
147 MUTTLIBS="-L${mutt_cv_curses}/lib $MUTTLIBS"
148 CPPFLAGS="$CPPFLAGS -I${mutt_cv_curses}/include"
152 AC_CHECK_FUNC(initscr,,[
154 for lib in ncursesw ncurses; do
155 AC_CHECK_LIB($lib, waddnwstr, [cf_ncurses="$lib"; break])
157 AC_CHECK_LIB($cf_ncurses, initscr,
158 [ MUTTLIBS="$MUTTLIBS -l$cf_ncurses"
159 if test x$mutt_cv_curses = x/usr -a -d /usr/include/ncurses; then
160 CPPFLAGS="$CPPFLAGS -I/usr/include/ncurses"
163 if test "$cf_ncurses" = ncursesw; then
164 AC_CHECK_HEADERS(ncurses/ncurses.h,[cf_cv_ncurses_header="ncurses/ncurses.h"])
165 AC_CHECK_HEADERS(ncursesw/ncurses.h,[cf_cv_ncurses_header="ncursesw/ncurses.h"])
167 AC_CHECK_HEADERS(ncurses.h,[cf_cv_ncurses_header="ncurses.h"])
174 CF_CHECK_FUNCDECLS([#include <${cf_cv_ncurses_header-curses.h}>],
175 [start_color typeahead bkgdset curs_set meta use_default_colors resizeterm])
176 if test "$ac_cv_func_decl_start_color" != yes; then
177 AC_MSG_ERROR([Your curses library does not supports color.])
182 AC_CHECK_HEADERS(stdarg.h sys/ioctl.h ioctl.h sysexits.h)
183 AC_CHECK_HEADERS(sys/time.h sys/resource.h)
184 AC_CHECK_HEADERS(unix.h)
186 AC_CHECK_FUNCS(setrlimit getsid isctype)
190 AC_MSG_CHECKING(for sig_atomic_t in signal.h)
191 AC_EGREP_HEADER(sig_atomic_t,signal.h,
192 [ ac_cv_type_sig_atomic_t=yes;
193 AC_EGREP_HEADER(volatile.*sig_atomic_t,
195 [is_sig_atomic_t_volatile=yes; AC_MSG_RESULT([yes, volatile])],
196 [is_sig_atomic_t_volatile=no; AC_MSG_RESULT([yes, non volatile])])
199 AC_CHECK_TYPE(sig_atomic_t, int)
200 is_sig_atomic_t_volatile=no
202 if test $is_sig_atomic_t_volatile = 'yes'
204 AC_DEFINE(SIG_ATOMIC_VOLATILE_T, sig_atomic_t)
206 AC_DEFINE(SIG_ATOMIC_VOLATILE_T, [volatile sig_atomic_t])
212 AC_CHECK_FUNC(getopt)
213 if test $ac_cv_func_getopt = yes; then
214 AC_CHECK_HEADERS(getopt.h)
217 AC_CHECK_FUNC(regcomp)
218 if test $ac_cv_func_regcomp = yes; then
219 AC_CHECK_HEADERS(regex.h)
222 AC_ARG_WITH(homespool,
223 AC_HELP_STRING([--with-homespool[=FILE]],
224 [File in user's directory where new mail is spooled]),
225 with_homespool=${withval})
226 if test x$with_homespool != x; then
227 if test $with_homespool = yes; then
228 with_homespool=mailbox
230 AC_DEFINE_UNQUOTED(MAILPATH,"$with_homespool",[ Where new mail is spooled. ])
231 AC_DEFINE(HOMESPOOL,1,
232 [ Is mail spooled to the user's home directory? If defined,
233 MAILPATH should be set to the filename of the spool mailbox
234 relative the the home directory.
235 use: configure --with-homespool=FILE
239 AC_ARG_WITH(mailpath, AC_HELP_STRING([--with-mailpath=DIR], [Directory where spool mailboxes are located]),
240 [mutt_cv_mailpath=$withval],
241 [ AC_CACHE_CHECK(where new mail is stored, mutt_cv_mailpath,
243 if test -d /var/mail; then
244 mutt_cv_mailpath=/var/mail
245 elif test -d /var/spool/mail; then
246 mutt_cv_mailpath=/var/spool/mail
247 elif test -d /usr/spool/mail; then
248 mutt_cv_mailpath=/usr/spool/mail
249 elif test -d /usr/mail; then
250 mutt_cv_mailpath=/usr/mail
253 if test "$mutt_cv_mailpath" = no; then
254 AC_MSG_ERROR("Could not determine where new mail is stored.")
256 AC_DEFINE_UNQUOTED(MAILPATH,"$mutt_cv_mailpath",[ Where new mail is spooled. ])
258 AC_CACHE_CHECK(if $mutt_cv_mailpath is world writable, mutt_cv_worldwrite, [AC_TRY_RUN([#include <sys/types.h>
259 #include <sys/stat.h>
261 int main (int argc, char **argv)
265 stat ("$mutt_cv_mailpath", &s);
266 if (s.st_mode & S_IWOTH) exit (0);
268 }], mutt_cv_worldwrite=yes, mutt_cv_worldwrite=no, mutt_cv_worldwrite=no)])
271 if test $mutt_cv_worldwrite != yes; then
272 AC_CACHE_CHECK(if $mutt_cv_mailpath is group writable, mutt_cv_groupwrite, [AC_TRY_RUN([#include <sys/types.h>
273 #include <sys/stat.h>
275 int main (int argc, char **argv)
279 stat ("$mutt_cv_mailpath", &s);
280 if (s.st_mode & S_IWGRP) exit (0);
282 }], mutt_cv_groupwrite=yes, mutt_cv_groupwrite=no, mutt_cv_groupwrite=no)])
284 if test $mutt_cv_groupwrite = yes; then
285 AC_DEFINE(USE_SETGID,1,[ Define if mutt should run setgid "mail". ])
291 AC_MSG_CHECKING(where to put the documentation)
292 AC_ARG_WITH(docdir, AC_HELP_STRING([--with-docdir=PATH], [Specify where to put the documentation]),
293 [mutt_cv_docdir=$withval],
294 [mutt_cv_docdir="${prefix}/doc/madmutt"])
295 AC_MSG_RESULT($mutt_cv_docdir)
297 docdir=$mutt_cv_docdir
300 if test x$mutt_cv_setgid = xyes; then
302 DOTLOCK_PERMISSION=2755
305 DOTLOCK_PERMISSION=755
307 AC_SUBST(DOTLOCK_GROUP)
308 AC_SUBST(DOTLOCK_PERMISSION)
310 dnl -- socket dependencies --
312 AC_ARG_ENABLE(nntp, AC_HELP_STRING([--enable-nntp],[Enable NNTP support]),[
313 if test x$enableval = xyes ; then
314 AC_DEFINE(USE_NNTP,1,[ Compiling with newsreading support with NNTP ])
315 LIBNNTP="-Lnntp -lnntp"
316 LIBNNTPDEPS="\$(top_srcdir)/nntp/nntp.h nntp/libnntp.a"
320 AM_CONDITIONAL(BUILD_NNTP, test x$need_nntp = xyes)
322 AC_MSG_CHECKING([for socklen_t])
323 AC_EGREP_HEADER(socklen_t, sys/socket.h, AC_MSG_RESULT([yes]),
325 AC_DEFINE(socklen_t,int, [ Define to 'int' if <sys/socket.h> doesn't have it. ]))
326 AC_CHECK_FUNC(gethostent,,AC_CHECK_LIB(nsl, gethostent))
327 AC_CHECK_FUNC(setsockopt,,AC_CHECK_LIB(socket, setsockopt))
328 AC_CHECK_FUNC(getaddrinfo,,[AC_MSG_ERROR([cannot find getaddrinfo])])
330 dnl -- imap dependencies --
333 CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS"
334 MUTTLIBS="$MUTTLIBS $LIBGNUTLS_LIBS"],[AC_MSG_ERROR([could not find libgnutls])
337 AC_CHECK_LIB(sasl2, sasl_client_init,,AC_MSG_ERROR([could not find libsasl2]))
338 MUTTLIBS="$MUTTLIBS $LIBS"
341 AC_ARG_WITH(idn, AC_HELP_STRING([--with-idn], [Use GNU libidn for domain names]),[
342 if test x$with_idn != xno ; then
343 PKG_CHECK_MODULES(IDN,libidn,[
344 if $PKG_CONFIG --atleast-version=0.6; then
345 AC_MSG_ERROR([libidn is too old, want 0.6 at least])
347 CPPFLAGS="$CPPFLAGS $IDN_CFLAGS"
348 MUTTLIBS="$MUTTLIBS $IDN_LIBS"
349 AC_DEFINE(HAVE_LIBIDN, 1, [IDN Support])
350 ],[AC_MSG_ERROR([could not find libidn])])
356 AC_ARG_ENABLE(flock, AC_HELP_STRING([--enable-flock], [Use flock() to lock files]),
357 [if test $enableval = yes; then
358 AC_DEFINE(USE_FLOCK,1, [ Define to use flock() to lock mailboxes. ])
362 AC_ARG_ENABLE(fcntl, AC_HELP_STRING([--disable-fcntl], [Do NOT use fcntl() to lock files]),
363 [if test $enableval = no; then mutt_cv_fcntl=no; fi])
365 if test $mutt_cv_fcntl = yes; then
366 AC_DEFINE(USE_FCNTL,1, [ Define to use fcntl() to lock folders. ])
369 AC_MSG_CHECKING(whether struct dirent defines d_ino)
370 ac_cv_dirent_d_ino=no
371 AC_TRY_LINK([#include <dirent.h>],[struct dirent dp; (void)dp.d_ino],[ac_cv_dirent_d_ino=yes])
372 if test x$ac_cv_dirent_d_ino = xyes ; then
373 AC_DEFINE(HAVE_DIRENT_D_INO,1,
374 [Define to 1 if your system has the dirent::d_ino member])
376 AC_MSG_RESULT($ac_cv_dirent_d_ino)
378 dnl -- start cache --
379 AC_ARG_ENABLE(hcache, AC_HELP_STRING([--enable-hcache], [Enable header caching]),
380 [if test x$enableval = xyes; then
381 AC_DEFINE(USE_HCACHE, 1, [Enable header caching])
382 OLDCPPFLAGS="$CPPFLAGS"
386 AC_ARG_WITH(qdbm, AC_HELP_STRING([--without-qdbm], [Don't use qdbm even if it is available]),
387 ac_prefer_qdbm=$withval)
388 if test x$ac_prefer_qdbm != xno; then
389 PKG_CHECK_MODULES(QDBM,qdbm,[ac_qdbm_here=yes],[ac_qdbm_here=no])
393 AC_ARG_WITH(gdbm, AC_HELP_STRING([--without-gdbm], [Don't use gdbm even if it is available]),
394 ac_prefer_gdbm=$withval)
395 if test x$ac_prefer_gdbm != xno -a x$ac_qdbm_here != xyes; then
397 GDBM_DIRS="${prefix} /usr/local /usr"
398 AC_MSG_CHECKING([for gdbm_open])
399 for d in $GDBM_DIRS; do
400 if test x$ac_cv_gdbmopen = xno && test -d "$d/include" && test -d "$d/lib"; then
401 GDBM_INC="-I$d/include"
403 CPPFLAGS="$OLDCPPFLAGS $GDBM_INC"
404 LIBS="$MUTTLIBS $GDBM_LIB -lgdbm"
405 AC_TRY_LINK([#include <gdbm.h>],[gdbm_open(0,0,0,0,0);],[ac_cv_gdbmopen=yes])
408 if test x$ac_cv_gdbmopen = xyes; then
416 AC_ARG_WITH(bdb, AC_HELP_STRING([--with-bdb[=DIR]], [Use BerkeleyDB4 if gdbm is not available ]),
417 ac_bdb_prefix=$withval)
418 if test x$ac_bdb_prefix != xno -a x$ac_cv_gdbmopen != xyes -a x$ac_qdbm_here != xyes; then
419 test x$ac_bdb_prefix = xyes && ac_bdb_prefix="${prefix} /opt/csw/bdb4 /opt /usr/local /usr"
420 for d in $ac_bdb_prefix; do
422 for v in BerkeleyDB.4.3 BerkeleyDB.4.2 BerkeleyDB.4.1; do
423 bdbpfx="$bdbpfx $d/$v"
426 BDB_VERSIONS="db-4 db4 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db ''"
427 AC_MSG_CHECKING([for BerkeleyDB > 4.0])
431 for v in / $BDB_VERSIONS; do
432 if test -r "$d/include/$v/db.h"; then
433 BDB_INCLUDE_DIR="$d/include/$v"
434 if test -d "$d/lib/$v"; then
435 BDB_LIB_DIR="$d/lib/$v"
436 for l in `echo $BDB_VERSIONS`; do
437 CPPFLAGS="-I$BDB_INCLUDE_DIR $OLDCPPFLAGS"
438 LIBS="$MUTTLIBS -L$BDB_LIB_DIR -l$l"
444 db->open(db,NULL,NULL,NULL,0,0,0);
451 test x$ac_cv_dbcreate = xyes && break
455 test x$BDB_LIB != x && break
457 if test x$ac_cv_dbcreate = xyes; then
464 if test x$ac_qdbm_here = xyes; then
465 CPPFLAGS="$OLDCPPFLAGS $QDBM_CFLAGS"
466 MUTTLIBS="$MUTTLIBS $QDBM_LIBS"
467 AC_DEFINE(HAVE_QDBM, 1, [QDBM Support])
468 elif test x$ac_cv_gdbmopen = xyes; then
469 CPPFLAGS="$OLDCPPFLAGS $GDBM_INC"
470 MUTTLIBS="$MUTTLIBS $GDBM_LIB -lgdbm";
471 AC_DEFINE(HAVE_GDBM, 1, [GDBM Support])
472 elif test x$ac_cv_dbcreate = xyes; then
473 CPPFLAGS="-I$BDB_INCLUDE_DIR $OLDCPPFLAGS"
474 MUTTLIBS="$MUTTLIBS -L$BDB_LIB_DIR -l$BDB_LIB"
475 AC_DEFINE(HAVE_DB4, 1, [Sleepycat DB4 Support])
477 AC_MSG_ERROR([You need one of: QDBM, GDBM or Sleepycat DB4 for --enable-hcache])
485 AC_SUBST(LIBNNTPDEPS)
487 dnl -- iconv/gettext --
489 AC_ARG_ENABLE(iconv, AC_HELP_STRING([--disable-iconv], [Disable iconv support]),
490 [if test x$enableval = xno ; then
497 if test "$am_cv_func_iconv" != "yes"; then
498 AC_MSG_WARN([Configuring without iconv support. See INSTALL for details])
501 AC_CHECK_HEADERS(iconv.h,
502 [AC_MSG_CHECKING(whether iconv.h defines iconv_t)
503 AC_EGREP_HEADER([typedef.*iconv_t],iconv.h,
505 AC_DEFINE(HAVE_ICONV_T_DEF, 1,
506 [Define if <iconv.h> defines iconv_t.])],
509 dnl (1) Some implementations of iconv won't convert from UTF-8 to UTF-8.
510 dnl (2) In glibc-2.1.2 and earlier there is a bug that messes up ob and
511 dnl obl when args 2 and 3 are 0 (fixed in glibc-2.1.3).
512 AC_CACHE_CHECK([whether this iconv is good enough], mutt_cv_iconv_good,
524 ob = buf, obl = sizeof(buf);
525 return ((cd = iconv_open("UTF-8", "UTF-8")) != (iconv_t)(-1) &&
526 (iconv(cd, 0, 0, &ob, &obl) ||
527 !(ob == buf && obl == sizeof(buf)) ||
531 mutt_cv_iconv_good=yes,
532 mutt_cv_iconv_good=no,
533 mutt_cv_iconv_good=yes)
535 if test "$mutt_cv_iconv_good" = no; then
536 AC_MSG_ERROR(Try using libiconv instead)
543 AC_CHECK_HEADERS(locale.h wchar.h wctype.h)
544 AC_CHECK_FUNCS(iswalnum iswalpha iswcntrl iswdigit)
545 AC_CHECK_FUNCS(iswgraph iswlower iswprint iswpunct iswspace iswupper)
546 AC_CHECK_FUNCS(iswxdigit towupper towlower)
549 AC_CACHE_CHECK([for nl_langinfo and CODESET], mutt_cv_langinfo_codeset,
550 [AC_TRY_LINK([#include <langinfo.h>],
551 [char* cs = nl_langinfo(CODESET);],
552 mutt_cv_langinfo_codeset=yes,
553 mutt_cv_langinfo_codeset=no)])
554 if test $mutt_cv_langinfo_codeset = yes; then
555 AC_DEFINE(HAVE_LANGINFO_CODESET,1,
556 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
559 AC_CACHE_CHECK([for nl_langinfo and YESEXPR], mutt_cv_langinfo_yesexpr,
560 [AC_TRY_LINK([#include <langinfo.h>],
561 [char* cs = nl_langinfo(YESEXPR);],
562 mutt_cv_langinfo_yesexpr=yes,
563 mutt_cv_langinfo_yesexpr=no)])
564 if test $mutt_cv_langinfo_yesexpr = yes; then
565 AC_DEFINE(HAVE_LANGINFO_YESEXPR,1,
566 [Define if you have <langinfo.h> and nl_langinfo(YESEXPR).])
571 if test x$use_libesmtp = xyes; then
572 CFLAGS="$CFLAGS $mutt_libesmtp_cflags"
573 MUTTLIBS="$MUTTLIBS -lesmtp"
574 AC_DEFINE(USE_LIBESMTP, 1, [Define to enable the use of libesmtp])
576 dnl -- end libesmtp --
578 AC_ARG_ENABLE(doc, [ --enable-doc build documentation (needs doxygen and LaTeX)])
579 # Build documentation?
582 if test "${enable_doc}" != "no"; then
583 AC_PATH_PROG(DOXYGEN, doxygen, no)
584 if test "${DOXYGEN}" != "no"; then
585 # Build LaTeX documentation?
586 AC_PATH_PROG(LATEX, pdflatex, no)
587 AC_PATH_PROG(DVIPS, dvips, no)
588 if test "${DVIPS}" = "no"; then
591 AC_MSG_CHECKING(for a4wide.sty)
592 if test -f /usr/share/texmf/tex/latex/misc/a4wide.sty; then
594 elif test -f /usr/share/texmf-tetex/tex/latex/a4wide/a4wide.sty; then
602 AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
603 AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
609 apidoc/Makefile apidoc/doxygen.cfg