mutt stable branch with some hacks
1dnl Process this file with autoconf to produce a configure script.
2
3dnl !!! WHEN ADDING NEW CONFIGURE TESTS, PLEASE ADD CODE TO MAIN.C !!!
4dnl !!! TO DUMP THEIR RESULTS WHEN MUTT -V IS CALLED !!!
5
6AC_INIT([mutt],[m4_esyscmd(tr -d \\n <VERSION)])
7AC_CONFIG_SRCDIR(mutt.h)
8AM_INIT_AUTOMAKE
9AC_CONFIG_HEADERS([config.h])
10
11AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/VERSION'])
12
13MUTT_VERSION=`env sh "$srcdir/version.sh"`
14AC_DEFINE_UNQUOTED(MUTT_VERSION,"$MUTT_VERSION", [Full textual version string.])
15
16AC_USE_SYSTEM_EXTENSIONS
17
18ALL_LINGUAS="de eu 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 ga"
19
20AC_CANONICAL_HOST
21
22AC_MSG_CHECKING([for prefix])
23if test x$prefix = xNONE; then
24 mutt_cv_prefix=$ac_default_prefix
25else
26 mutt_cv_prefix=$prefix
27fi
28AC_MSG_RESULT($mutt_cv_prefix)
29
30AC_PROG_CC
31AC_PROG_CC_C99
32AC_SEARCH_LIBS([strerror],[cposix])
33if test "x$U" != "x"; then
34 AC_MSG_ERROR(Compiler not ANSI compliant)
35fi
36AC_PROG_CPP
37AC_PROG_MAKE_SET
38AC_PROG_INSTALL
39AC_PROG_MKDIR_P
40AC_PROG_RANLIB
41AC_CHECK_TOOL(AR, ar, ar)
42
43AC_C_INLINE
44AC_C_CONST
45AC_C_BIGENDIAN
46
47AC_SYS_LARGEFILE
48AC_FUNC_FSEEKO
49AC_CHECK_SIZEOF(off_t)
50
51AC_PATH_PROG(DBX, dbx, no)
52AC_PATH_PROG(GDB, gdb, no)
53AC_PATH_PROG(SDB, sdb, no)
54
55if test $GDB != no ; then
56 DEBUGGER=$GDB
57elif test $DBX != no ; then
58 DEBUGGER=$DBX
59elif test $SDB != no ; then
60 DEBUGGER=$SDB
61else
62 DEBUGGER=no
63fi
64
65AC_SUBST([DEBUGGER])
66
67AH_TEMPLATE([sig_atomic_t],
68 [/* Define to `int' if <signal.h> doesn't define.])
69AH_TEMPLATE([HAVE_START_COLOR],
70 [Define if you have start_color, as a function or macro.])
71AH_TEMPLATE([HAVE_TYPEAHEAD],
72 [Define if you have typeahead, as a function or macro.])
73AH_TEMPLATE([HAVE_BKGDSET],
74 [Define if you have bkgdset, as a function or macro.])
75AH_TEMPLATE([HAVE_CURS_SET],
76 [Define if you have curs_set, as a function or macro.])
77AH_TEMPLATE([HAVE_META],
78 [Define if you have meta, as a function or macro.])
79AH_TEMPLATE([HAVE_USE_DEFAULT_COLORS],
80 [Define if you have use_default_colors, as a function or macro.])
81AH_TEMPLATE([HAVE_RESIZETERM],
82 [Define if you have resizeterm, as a function or macro.])
83AH_TEMPLATE([SIG_ATOMIC_VOLATILE_T],
84 [Some systems declare sig_atomic_t as volatile, some others -- no.
85 This define will have value `sig_atomic_t' or
86 `volatile sig_atomic_t' accordingly.])
87AH_TEMPLATE([ICONV_NONTRANS],
88 [Define as 1 if iconv() only converts exactly and we should treat
89 all return values other than (size_t)(-1) as equivalent.])
90
91AH_BOTTOM([/* fseeko portability defines */
92#ifdef HAVE_FSEEKO
93# define LOFF_T off_t
94# if HAVE_C99_INTTYPES && HAVE_INTTYPES_H
95# if SIZEOF_OFF_T == 8
96# define OFF_T_FMT "%" PRId64
97# else
98# define OFF_T_FMT "%" PRId32
99# endif
100# else
101# if (SIZEOF_OFF_T == 8) && (SIZEOF_LONG == 4)
102# define OFF_T_FMT "%lld"
103# else
104# define OFF_T_FMT "%ld"
105# endif
106# endif
107#else
108# define LOFF_T long
109# define fseeko fseek
110# define ftello ftell
111# define OFF_T_FMT "%ld"
112#endif
113])
114MUTT_C99_INTTYPES
115AC_TYPE_LONG_LONG_INT
116
117ac_aux_path_sendmail=/usr/sbin:/usr/lib
118AC_PATH_PROG(SENDMAIL, sendmail, /usr/sbin/sendmail, $PATH:$ac_aux_path_sendmail)
119AC_DEFINE_UNQUOTED(SENDMAIL,"$ac_cv_path_SENDMAIL", [Where to find sendmail on your system.])
120
121OPS='$(srcdir)/OPS'
122
123AC_MSG_CHECKING([whether to build with GPGME support])
124AC_ARG_ENABLE(gpgme, AS_HELP_STRING([--enable-gpgme],[Enable GPGME support]),
125[ if test x$enableval = xyes; then
126 enable_gpgme=yes
127 fi
128])
129
130if test x"$enable_gpgme" = xyes; then
131 AC_MSG_RESULT(yes)
132 AM_PATH_GPGME(1.0.0, AC_DEFINE(CRYPT_BACKEND_GPGME, 1,
133 [Defined, if GPGME support is enabled]),
134 [gpgme_found=no])
135 if test x"$gpgme_found" = xno; then
136 AC_MSG_ERROR([*** GPGME not found ***])
137 else
138 AM_PATH_GPGME(1.1.1, AC_DEFINE(HAVE_GPGME_PKA_TRUST, 1,
139 [Define if GPGME supports PKA]))
140 #needed to get GPGME_LIBS and al correctly
141 AM_PATH_GPGME(1.0.0, AC_DEFINE(CRYPT_BACKEND_GPGME, 1,
142 [Define if you use GPGME to support OpenPGP]))
143 dnl AC_CHECK_FUNCS([gpgme_op_export_keys])
144 saved_LIBS="$LIBS"
145 LIBS="$LIBS $GPGME_LIBS"
146 AC_CHECK_FUNCS([gpgme_op_export_keys])
147 LIBS="$saved_LIBS"
148 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS crypt-gpgme.o crypt-mod-pgp-gpgme.o crypt-mod-smime-gpgme.o"
149 fi
150else
151 AC_MSG_RESULT([no])
152fi
153
154AC_ARG_ENABLE(pgp, AS_HELP_STRING([--disable-pgp],[Disable PGP support]),
155[ if test x$enableval = xno ; then
156 have_pgp=no
157 fi
158])
159
160if test x$have_pgp != xno ; then
161 AC_DEFINE(CRYPT_BACKEND_CLASSIC_PGP,1, [Define if you want classic PGP support.])
162 PGPAUX_TARGET="pgpring\$(EXEEXT) pgpewrap\$(EXEEXT)"
163 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"
164fi
165
166AC_ARG_ENABLE(smime, AS_HELP_STRING([--disable-smime],[Disable SMIME support]),
167[ if test x$enableval = xno ; then
168 have_smime=no
169 fi
170])
171
172if test x$have_smime != xno ; then
173 AC_DEFINE(CRYPT_BACKEND_CLASSIC_SMIME, 1, [Define if you want classic S/MIME support.])
174 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS smime.o crypt-mod-smime-classic.o"
175 SMIMEAUX_TARGET="smime_keys"
176fi
177
178AC_ARG_ENABLE(sidebar, AC_HELP_STRING([--enable-sidebar], [Enable Sidebar support]),
179[ if test x$enableval = xyes ; then
180 AC_DEFINE(USE_SIDEBAR, 1, [Define if you want support for the sidebar.])
181 OPS="$OPS \$(srcdir)/OPS.SIDEBAR"
182 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS sidebar.o"
183 fi
184])
185
186AC_ARG_ENABLE(compressed, AC_HELP_STRING([--enable-compressed], [Enable compressed folders support]),
187 enable_compressed=$enableval, enable_compressed=no
188)
189AS_IF([test x$enable_compressed = "xyes"], [
190 AC_DEFINE(USE_COMPRESSED, 1, [Define to enable compressed folders support.])
191 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS compress.o"
192])
193AM_CONDITIONAL(BUILD_COMPRESS, test x$enable_compressed = xyes)
194
195AC_ARG_WITH(mixmaster, AS_HELP_STRING([--with-mixmaster@<:@=PATH@:>@],[Include Mixmaster support]),
196 [if test "$withval" != no
197 then
198 if test -x "$withval"
199 then
200 MIXMASTER="$withval"
201 else
202 MIXMASTER="mixmaster"
203 fi
204 OPS="$OPS \$(srcdir)/OPS.MIX"
205 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS remailer.o"
206 AC_DEFINE_UNQUOTED(MIXMASTER,"$MIXMASTER", [Where to find mixmaster on your system.])
207 fi])
208
209# We now require all OPS
210OPS="$OPS \$(srcdir)/OPS.PGP \$(srcdir)/OPS.SMIME \$(srcdir)/OPS.CRYPT "
211AC_SUBST([OPS])
212
213AC_SUBST(PGPAUX_TARGET)
214AC_SUBST(SMIMEAUX_TARGET)
215
216AC_PATH_PROG(ISPELL, ispell, no)
217if test $ISPELL != no; then
218 AC_DEFINE_UNQUOTED(ISPELL,"$ISPELL",[ Where to find ispell on your system. ])
219fi
220
221AC_ARG_WITH(slang, AS_HELP_STRING([--with-slang@<:@=DIR@:>@],[Use S-Lang instead of ncurses]),
222 [AC_CACHE_CHECK([if this is a BSD system], mutt_cv_bsdish,
223 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/param.h>
224#include <stdlib.h>
225
226main ()
227{
228#ifdef BSD
229 exit (0);
230#else
231 exit (1);
232#endif
233}]])],[mutt_cv_bsdish=yes],[mutt_cv_bsdish=no],[mutt_cv_bsdish=no])])
234
235 AC_MSG_CHECKING(for S-Lang)
236 if test $withval = yes; then
237 if test -d $srcdir/../slang; then
238 mutt_cv_slang=$srcdir/../slang/src
239 CPPFLAGS="$CPPFLAGS -I${mutt_cv_slang}"
240 LDFLAGS="$LDFLAGS -L${mutt_cv_slang}/objs"
241 else
242 if test -d $mutt_cv_prefix/include/slang; then
243 CPPFLAGS="$CPPFLAGS -I$mutt_cv_prefix/include/slang"
244 elif test -d /usr/include/slang; then
245 CPPFLAGS="$CPPFLAGS -I/usr/include/slang"
246 fi
247 mutt_cv_slang=yes
248 fi
249 else
250 dnl ---Check to see if $withval is a source directory
251 if test -f $withval/src/slang.h; then
252 mutt_cv_slang=$withval/src
253 CPPFLAGS="$CPPFLAGS -I${mutt_cv_slang}"
254 LDFLAGS="$LDFLAGS -L${mutt_cv_slang}/objs"
255 else
256 dnl ---Must be installed somewhere
257 mutt_cv_slang=$withval
258 if test -d $withval/include/slang; then
259 CPPFLAGS="$CPPFLAGS -I${withval}/include/slang"
260 elif test -d $withval/include; then
261 CPPFLAGS="$CPPFLAGS -I${withval}/include"
262 fi
263 LDFLAGS="$LDFLAGS -L${withval}/lib"
264 fi
265 fi
266 AC_MSG_RESULT($mutt_cv_slang)
267 if test $mutt_cv_bsdish = yes; then
268 AC_CHECK_LIB(termlib, main)
269 fi
270 AC_DEFINE(USE_SLANG_CURSES,1,
271 [ Define if you compile with SLang instead of curses/ncurses. ])
272 AC_DEFINE(HAVE_COLOR,1,[ Define if your curses library supports color. ])
273 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS resize.o"
274
275 dnl --- now that we've found it, check the link
276
277 AC_CHECK_LIB(slang, SLtt_get_terminfo,
278 [MUTTLIBS="$MUTTLIBS -lslang -lm"],
279 [AC_MSG_ERROR(unable to compile. check config.log)], -lm)
280
281 ],
282
283 [mutt_cv_curses=/usr
284 AC_ARG_WITH(curses, AS_HELP_STRING([--with-curses=DIR],[Where ncurses is installed]),
285 [if test x$withval != xyes; then
286 mutt_cv_curses=$withval
287 fi
288 if test x$mutt_cv_curses != x/usr; then
289 LDFLAGS="$LDFLAGS -L${mutt_cv_curses}/lib"
290 CPPFLAGS="$CPPFLAGS -I${mutt_cv_curses}/include"
291 fi])
292
293 AC_CHECK_FUNC(initscr,,[
294 cf_ncurses="ncurses"
295 for lib in ncurses ncursesw
296 do
297 AC_CHECK_LIB($lib, waddnwstr, [cf_ncurses="$lib"; break])
298 done
299 AC_CHECK_LIB($cf_ncurses, initscr,
300 [MUTTLIBS="$MUTTLIBS -l$cf_ncurses"
301
302 AC_CHECK_LIB(tinfo, tgetent, [MUTTLIBS="$MUTTLIBS -ltinfo"])
303
304 if test "$cf_ncurses" = ncursesw; then
305 AC_CHECK_HEADERS(ncursesw/ncurses.h,[cf_cv_ncurses_header="ncursesw/ncurses.h"],
306 [AC_CHECK_HEADERS(ncurses.h,[cf_cv_ncurses_header="ncurses.h"])])
307 else
308 AC_CHECK_HEADERS(ncurses/ncurses.h,[cf_cv_ncurses_header="ncurses/ncurses.h"],
309 [AC_CHECK_HEADERS(ncurses.h,[cf_cv_ncurses_header="ncurses.h"])])
310 fi],
311
312 [CF_CURSES_LIBS])
313 ])
314
315 old_LIBS="$LIBS"
316 LIBS="$LIBS $MUTTLIBS"
317 CF_CHECK_FUNCDECLS([#include <${cf_cv_ncurses_header-curses.h}>],
318 [start_color typeahead bkgdset curs_set meta use_default_colors resizeterm])
319 if test "$ac_cv_func_decl_start_color" = yes; then
320 AC_DEFINE(HAVE_COLOR,1,[ Define if your curses library supports color. ])
321 fi
322 if test "$ac_cv_func_decl_resizeterm" = yes; then
323 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS resize.o"
324 fi
325 AC_CHECK_FUNCS([use_extended_names])
326 LIBS="$old_LIBS"
327 ])
328
329AC_HEADER_STDC
330
331AC_CHECK_HEADERS(stdarg.h sys/ioctl.h ioctl.h sysexits.h)
332AC_CHECK_HEADERS(sys/time.h sys/resource.h)
333AC_CHECK_HEADERS(unix.h)
334
335AC_CHECK_FUNCS(setrlimit getsid)
336
337AC_MSG_CHECKING(for sig_atomic_t in signal.h)
338AC_EGREP_HEADER(sig_atomic_t,signal.h,
339 [
340 ac_cv_type_sig_atomic_t=yes;
341 AC_EGREP_HEADER(volatile.*sig_atomic_t,
342 signal.h,
343 [
344 is_sig_atomic_t_volatile=yes;
345 AC_MSG_RESULT([yes, volatile])
346 ],
347 [
348 is_sig_atomic_t_volatile=no;
349 AC_MSG_RESULT([yes, non volatile])
350 ])
351 ],
352 [
353 AC_MSG_RESULT(no)
354 AC_CHECK_TYPE(sig_atomic_t, int)
355 is_sig_atomic_t_volatile=no
356 ])
357if test $is_sig_atomic_t_volatile = 'yes'
358then
359 AC_DEFINE(SIG_ATOMIC_VOLATILE_T, sig_atomic_t)
360else
361 AC_DEFINE(SIG_ATOMIC_VOLATILE_T, [volatile sig_atomic_t])
362fi
363
364AC_CHECK_DECLS([sys_siglist],[],[],[#include <signal.h>
365/* NetBSD declares sys_siglist in unistd.h. */
366#ifdef HAVE_UNISTD_H
367# include <unistd.h>
368#endif
369])
370
371
372AC_TYPE_PID_T
373AC_CHECK_TYPE(ssize_t, int)
374
375AC_CHECK_FUNCS(fgetpos memmove setegid srand48 strerror)
376
377AC_REPLACE_FUNCS([setenv strcasecmp strdup strsep strtok_r wcscasecmp])
378AC_REPLACE_FUNCS([strcasestr mkdtemp])
379
380AC_CHECK_FUNC(getopt)
381if test $ac_cv_func_getopt = yes; then
382 AC_CHECK_HEADERS(getopt.h)
383fi
384
385SNPRINTFOBJS=""
386AC_CHECK_FUNC(snprintf, [mutt_cv_func_snprintf=yes], [mutt_cv_func_snprintf=no])
387AC_CHECK_FUNC(vsnprintf, [mutt_cv_func_vsnprintf=yes], [mutt_cv_func_vsnprintf=no])
388if test $mutt_cv_func_snprintf = yes; then
389AC_CACHE_CHECK([whether your system's snprintf is C99 compliant],
390 [mutt_cv_c99_snprintf],
391 AC_RUN_IFELSE([AC_LANG_SOURCE([[
392#include <stdio.h>
393int main()
394{
395changequote(, )dnl
396 char buf[8];
397 int len = snprintf(buf, 4, "1234567");
398 return (len != 7 || buf[3] != '\0');
399changequote([, ])dnl
400}
401 ]])],[mutt_cv_c99_snprintf=yes],[mutt_cv_c99_snprintf=no],[mutt_cv_c99_snprintf=no]))
402else
403 mutt_cv_c99_snprintf=no
404fi
405if test $mutt_cv_func_vsnprintf = yes; then
406AC_CACHE_CHECK([whether your system's vsnprintf is C99 compliant],
407 [mutt_cv_c99_vsnprintf],
408 AC_RUN_IFELSE([AC_LANG_SOURCE([[
409#include <stdarg.h>
410#include <stdio.h>
411int foo(const char *fmt, ...)
412{
413changequote(, )dnl
414 char buf[8];
415 int len;
416 va_list ap;
417 va_start(ap, fmt);
418 len = vsnprintf(buf, 4, fmt, ap);
419 va_end(ap);
420 return (len != 7 || buf[3] != '\0');
421changequote([, ])dnl
422}
423
424int main()
425{
426 return foo("%s", "1234567");
427}
428 ]])],[mutt_cv_c99_vsnprintf=yes],[mutt_cv_c99_vsnprintf=no],[mutt_cv_c99_vsnprintf=no]))
429else
430 mutt_cv_c99_vsnprintf=no
431fi
432if test $mutt_cv_c99_snprintf = yes; then
433 AC_DEFINE(HAVE_SNPRINTF, 1, [ Define to 1 if you have a C99 compliant snprintf function. ])
434fi
435if test $mutt_cv_c99_vsnprintf = yes; then
436 AC_DEFINE(HAVE_VSNPRINTF, 1, [ Define to 1 if you have a C99 compliant vsnprintf function. ])
437fi
438if test $mutt_cv_c99_snprintf = no -o $mutt_cv_c99_vsnprintf = no; then
439 AC_LIBOBJ(snprintf)
440fi
441
442XIPH_FUNC_VA_COPY
443
444dnl SCO uses chsize() instead of ftruncate()
445AC_CHECK_FUNCS(ftruncate, , [AC_CHECK_LIB(x, chsize)])
446
447dnl SCO has strftime() in libintl
448AC_CHECK_FUNCS(strftime, , [AC_CHECK_LIB(intl, strftime)])
449
450dnl AIX may not have fchdir()
451AC_CHECK_FUNCS(fchdir, , [mutt_cv_fchdir=no])
452
453AC_ARG_WITH(regex, AS_HELP_STRING([--with-regex],[Use the GNU regex library]),
454 [mutt_cv_regex=yes],
455 [AC_CHECK_FUNCS(regcomp, mutt_cv_regex=no, mutt_cv_regex=yes)])
456
457if test $mutt_cv_regex = no ; then
458AC_CACHE_CHECK([whether your system's regexp library is completely broken],
459 [mutt_cv_regex_broken],
460 AC_RUN_IFELSE([AC_LANG_SOURCE([[
461#include <unistd.h>
462#include <regex.h>
463main() { 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); }]])],[mutt_cv_regex_broken=no],[mutt_cv_regex_broken=yes],[mutt_cv_regex_broken=yes]))
464 if test $mutt_cv_regex_broken = yes ; then
465 echo "Using the included GNU regex instead." >&AS_MESSAGE_FD
466 mutt_cv_regex=yes
467 fi
468fi
469
470if test $mutt_cv_regex = yes; then
471 AC_DEFINE(USE_GNU_REGEX,1,[ Define if you want to use the included regex.c. ])
472 AC_LIBOBJ(regex)
473fi
474
475
476AC_ARG_WITH(homespool,
477 AS_HELP_STRING([--with-homespool@<:@=FILE@:>@],[File in user's directory where new mail is spooled]), with_homespool=${withval})
478if test x$with_homespool != x; then
479 if test $with_homespool = yes; then
480 with_homespool=mailbox
481 fi
482 AC_DEFINE_UNQUOTED(MAILPATH,"$with_homespool",[ Where new mail is spooled. ])
483 AC_DEFINE(HOMESPOOL,1,
484 [Is mail spooled to the user's home directory? If defined,
485 MAILPATH should be set to the filename of the spool mailbox
486 relative the the home directory.
487 use: configure --with-homespool=FILE])
488 AC_DEFINE(USE_DOTLOCK,1,[ Define to use dotlocking for mailboxes. ])
489 mutt_cv_setgid=no
490else
491 AC_ARG_WITH(mailpath, AS_HELP_STRING([--with-mailpath=DIR],[Directory where spool mailboxes are located]),
492 [mutt_cv_mailpath=$withval],
493 [ AC_CACHE_CHECK(where new mail is stored, mutt_cv_mailpath,
494 [mutt_cv_mailpath=no
495 if test -d /var/mail; then
496 mutt_cv_mailpath=/var/mail
497 elif test -d /var/spool/mail; then
498 mutt_cv_mailpath=/var/spool/mail
499 elif test -d /usr/spool/mail; then
500 mutt_cv_mailpath=/usr/spool/mail
501 elif test -d /usr/mail; then
502 mutt_cv_mailpath=/usr/mail
503 fi])
504 ])
505 if test "$mutt_cv_mailpath" = no; then
506 AC_MSG_ERROR("Could not determine where new mail is stored.")
507 fi
508 AC_DEFINE_UNQUOTED(MAILPATH,"$mutt_cv_mailpath",[ Where new mail is spooled. ])
509
510 AC_CACHE_CHECK(if $mutt_cv_mailpath is world writable, mutt_cv_worldwrite, [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/types.h>
511#include <sys/stat.h>
512#include <stdlib.h>
513
514int main (int argc, char **argv)
515{
516 struct stat s;
517
518 if (stat ("$mutt_cv_mailpath", &s)) exit (1);
519 if (s.st_mode & S_IWOTH) exit (0);
520 exit (1);
521}]])],[mutt_cv_worldwrite=yes],[mutt_cv_worldwrite=no],[mutt_cv_worldwrite=no])])
522
523 mutt_cv_setgid=no
524 if test $mutt_cv_worldwrite = yes; then
525 AC_DEFINE(USE_DOTLOCK,1,[ Define to use dotlocking for mailboxes. ])
526 else
527
528 AC_CACHE_CHECK(if $mutt_cv_mailpath is group writable, mutt_cv_groupwrite, [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/types.h>
529#include <sys/stat.h>
530#include <stdlib.h>
531
532int main (int argc, char **argv)
533{
534 struct stat s;
535
536 if (stat ("$mutt_cv_mailpath", &s)) exit (1);
537 if (s.st_mode & S_IWGRP) exit (0);
538 exit (1);
539}]])],[mutt_cv_groupwrite=yes],[mutt_cv_groupwrite=no],[mutt_cv_groupwrite=no])])
540
541 if test $mutt_cv_groupwrite = yes; then
542 AC_DEFINE(USE_DOTLOCK,1,[ Define to use dotlocking for mailboxes. ])
543 AC_DEFINE(USE_SETGID,1,[ Define if mutt should run setgid "mail". ])
544 mutt_cv_setgid=yes
545 fi
546 fi
547fi
548
549AC_ARG_ENABLE(external_dotlock, AS_HELP_STRING([--enable-external-dotlock],[Force use of an external dotlock program]),
550 [mutt_cv_external_dotlock="$enableval"])
551
552if test "x$mutt_cv_setgid" = "xyes" || test "x$mutt_cv_fchdir" = "xno" \
553 || test "x$mutt_cv_external_dotlock" = "xyes"
554then
555 AC_DEFINE(DL_STANDALONE,1,[ Define if you want to use an external dotlocking program. ])
556 DOTLOCK_TARGET="mutt_dotlock\$(EXEEXT)"
557else
558 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS dotlock.o"
559fi
560
561AC_SUBST(DOTLOCK_TARGET)
562
563dnl autoconf <2.60 compatibility
564if test -z "$datarootdir"; then
565 datarootdir='${prefix}/share'
566fi
567AC_SUBST([datarootdir])
568
569AC_MSG_CHECKING(where to put the documentation)
570AC_ARG_WITH(docdir, AS_HELP_STRING([--with-docdir=PATH],[Specify where to put the documentation]),
571 [mutt_cv_docdir=$withval],
572 [mutt_cv_docdir='${datarootdir}/doc/mutt'])
573AC_MSG_RESULT($mutt_cv_docdir)
574if test -z "$docdir" -o -n "$with_docdir"
575then
576 docdir=$mutt_cv_docdir
577fi
578AC_SUBST(docdir)
579
580if test x$mutt_cv_setgid = xyes; then
581 DOTLOCK_GROUP='mail'
582 DOTLOCK_PERMISSION=2755
583else
584 DOTLOCK_GROUP=''
585 DOTLOCK_PERMISSION=755
586fi
587AC_SUBST(DOTLOCK_GROUP)
588AC_SUBST(DOTLOCK_PERMISSION)
589
590AC_ARG_WITH(domain, AS_HELP_STRING([--with-domain=DOMAIN],[Specify your DNS domain name]),
591 [if test $withval != yes; then
592 if test $withval != no; then
593 AC_DEFINE_UNQUOTED(DOMAIN,"$withval",[ Define your domain name. ])
594 fi
595 fi])
596
597need_socket="no"
598
599dnl -- socket dependencies --
600
601dnl getaddrinfo is used by getdomain.c, and requires libnsl and
602dnl libsocket on some platforms
603AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
604AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
605AC_CHECK_FUNCS(getaddrinfo)
606
607AC_ARG_ENABLE(pop, AS_HELP_STRING([--enable-pop],[Enable POP3 support]),
608[ if test x$enableval = xyes ; then
609 AC_DEFINE(USE_POP,1,[ Define if you want support for the POP3 protocol. ])
610 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS pop.o pop_lib.o pop_auth.o"
611 need_pop="yes"
612 need_socket="yes"
613 need_md5="yes"
614 fi
615])
616
617AC_ARG_ENABLE(imap, AS_HELP_STRING([--enable-imap],[Enable IMAP support]),
618[ if test x$enableval = xyes ; then
619 AC_DEFINE(USE_IMAP,1,[ Define if you want support for the IMAP protocol. ])
620 LIBIMAP="-Limap -limap"
621 LIBIMAPDEPS="\$(top_srcdir)/imap/imap.h imap/libimap.a"
622 need_imap="yes"
623 need_socket="yes"
624 need_md5="yes"
625 fi
626])
627AM_CONDITIONAL(BUILD_IMAP, test x$need_imap = xyes)
628
629AC_ARG_ENABLE(smtp, AS_HELP_STRING([--enable-smtp],[include internal SMTP relay support]),
630 [if test $enableval = yes; then
631 AC_DEFINE(USE_SMTP, 1, [Include internal SMTP relay support])
632 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS smtp.o"
633 need_socket="yes"
634 fi])
635
636if test x"$need_imap" = xyes -o x"$need_pop" = xyes ; then
637 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS bcache.o"
638fi
639
640dnl -- end socket dependencies --
641
642if test "$need_socket" = "yes"
643then
644 AC_CHECK_HEADERS([sys/select.h])
645 AC_MSG_CHECKING([for socklen_t])
646 AC_EGREP_HEADER(socklen_t, sys/socket.h, AC_MSG_RESULT([yes]),
647 AC_MSG_RESULT([no])
648 AC_DEFINE(socklen_t,int,
649 [ Define to 'int' if <sys/socket.h> doesn't have it. ]))
650 AC_DEFINE(USE_SOCKET,1,
651 [ Include code for socket support. Set automatically if you enable POP3 or IMAP ])
652 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS account.o mutt_socket.o mutt_tunnel.o"
653fi
654
655dnl -- imap dependencies --
656
657AC_ARG_WITH(gss, AS_HELP_STRING([--with-gss@<:@=PFX@:>@],[Compile in GSSAPI authentication for IMAP]),
658 gss_prefix="$withval", gss_prefix="no")
659if test "$gss_prefix" != "no"
660then
661 if test "$need_imap" = "yes"
662 then
663 MUTT_AM_PATH_GSSAPI(gss_prefix)
664 AC_MSG_CHECKING(GSSAPI implementation)
665 AC_MSG_RESULT($GSSAPI_IMPL)
666 if test "$GSSAPI_IMPL" = "none"
667 then
668 AC_CACHE_SAVE
669 AC_MSG_RESULT([GSSAPI libraries not found])
670 fi
671 if test "$GSSAPI_IMPL" = "Heimdal"
672 then
673 AC_DEFINE(HAVE_HEIMDAL,1,[ Define if your GSSAPI implementation is Heimdal ])
674 fi
675 CPPFLAGS="$CPPFLAGS $GSSAPI_CFLAGS"
676 MUTTLIBS="$MUTTLIBS $GSSAPI_LIBS"
677 AC_DEFINE(USE_GSS,1,[ Define if you have GSSAPI libraries available ])
678 need_gss="yes"
679 else
680 AC_MSG_WARN([GSS was requested but IMAP is not enabled])
681 fi
682fi
683AM_CONDITIONAL(USE_GSS, test x$need_gss = xyes)
684
685dnl -- end imap dependencies --
686
687AC_ARG_WITH(ssl, AS_HELP_STRING([--with-ssl@<:@=PFX@:>@],[Enable TLS support using OpenSSL]),
688[ if test "$with_ssl" != "no"
689 then
690 if test "$need_socket" != "yes"; then
691 AC_MSG_WARN([SSL support is only useful with POP, IMAP or SMTP support])
692 else
693 if test "$with_ssl" != "yes"
694 then
695 LDFLAGS="$LDFLAGS -L$withval/lib"
696 CPPFLAGS="$CPPFLAGS -I$withval/include"
697 fi
698 saved_LIBS="$LIBS"
699
700 crypto_libs=""
701 AC_CHECK_LIB(z, deflate, [crypto_libs=-lz])
702 AC_CHECK_LIB(crypto, X509_STORE_CTX_new,
703 [crypto_libs="-lcrypto $crypto_libs"],
704 AC_MSG_ERROR([Unable to find SSL library]), [$crypto_libs])
705 AC_CHECK_LIB(ssl, SSL_new,,
706 AC_MSG_ERROR([Unable to find SSL library]), [$crypto_libs])
707
708 LIBS="$LIBS $crypto_libs"
709 AC_CHECK_FUNCS(RAND_status RAND_egd)
710 AC_CHECK_DECLS([SSL_set_mode, SSL_MODE_AUTO_RETRY],,
711 AC_MSG_ERROR([Unable to find decent SSL header]), [[#include <openssl/ssl.h>]])
712
713 AC_DEFINE(USE_SSL,1,[ Define if you want support for SSL. ])
714 AC_DEFINE(USE_SSL_OPENSSL,1,[ Define if you want support for SSL via OpenSSL. ])
715 LIBS="$saved_LIBS"
716 MUTTLIBS="$MUTTLIBS -lssl $crypto_libs"
717 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_ssl.o"
718 need_ssl=yes
719 fi
720 fi
721])
722
723AC_ARG_WITH([gnutls], AS_HELP_STRING([--with-gnutls@<:@=PFX@:>@],[enable TLS support using gnutls]),
724 [gnutls_prefix="$withval"], [gnutls_prefix="no"])
725if test "$gnutls_prefix" != "no" && test x"$need_ssl" != xyes
726then
727 if test "$need_socket" != "yes"
728 then
729 AC_MSG_WARN([SSL support is only useful with POP, IMAP or SMTP support])
730 else
731 if test "$gnutls_prefix" != "yes"
732 then
733 LDFLAGS="$LDFLAGS -L$gnutls_prefix/lib"
734 CPPFLAGS="$CPPFLAGS -I$gnutls_prefix/include"
735 fi
736 saved_LIBS="$LIBS"
737
738 AC_CHECK_LIB(gnutls, gnutls_check_version,
739 [dnl GNUTLS found
740 AC_CHECK_DECLS([GNUTLS_VERIFY_DISABLE_TIME_CHECKS], [], [],
741 [[#include <gnutls/x509.h>]])
742
743 LIBS="$LIBS -lgnutls"
744 AC_CHECK_FUNCS(gnutls_priority_set_direct)
745 AC_CHECK_TYPES([gnutls_certificate_credentials_t,
746 gnutls_certificate_status_t,
747 gnutls_datum_t,
748 gnutls_digest_algorithm_t,
749 gnutls_session_t,
750 gnutls_transport_ptr_t,
751 gnutls_x509_crt_t], [], [], [[#include <gnutls/gnutls.h>]])
752
753 LIBS="$saved_LIBS"
754 MUTTLIBS="$MUTTLIBS -lgnutls"
755
756 AC_DEFINE(USE_SSL, 1, [ Define if you want support for SSL. ])
757 AC_DEFINE(USE_SSL_GNUTLS, 1, [ Define if you want support for SSL via GNUTLS. ])
758
759 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_ssl_gnutls.o"
760 need_ssl=yes],
761 [AC_MSG_ERROR([could not find libgnutls])])
762 fi
763fi
764
765AM_CONDITIONAL(USE_SSL, test x$need_ssl = xyes)
766
767AC_ARG_WITH(sasl, AS_HELP_STRING([--with-sasl@<:@=PFX@:>@],[Use SASL network security library]),
768 [
769 if test "$with_sasl" != "no"
770 then
771 if test "$need_socket" != "yes"
772 then
773 AC_MSG_ERROR([SASL support is only useful with POP or IMAP support])
774 fi
775
776 if test "$with_sasl" != "yes"
777 then
778 CPPFLAGS="$CPPFLAGS -I$with_sasl/include"
779 LDFLAGS="$LDFLAGS -L$with_sasl/lib"
780 fi
781
782 saved_LIBS="$LIBS"
783 LIBS=
784
785 # OpenSolaris provides a SASL2 interface in libsasl
786 sasl_libs="sasl2 sasl"
787 AC_SEARCH_LIBS(sasl_encode64, [$sasl_libs],,
788 AC_MSG_ERROR([could not find sasl lib]),)
789
790 MUTTLIBS="$MUTTLIBS $LIBS"
791 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_sasl.o"
792 LIBS="$saved_LIBS"
793
794 AC_DEFINE(USE_SASL,1,
795 [ Define if want to use the SASL library for POP/IMAP authentication. ])
796 need_sasl=yes
797 fi
798 ])
799AM_CONDITIONAL(USE_SASL, test x$need_sasl = xyes)
800
801dnl -- end socket --
802
803AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],[Enable debugging support]),
804 [ if test x$enableval = xyes ; then
805 AC_DEFINE(DEBUG,1,[ Define to enable debugging info. ])
806 fi
807 ])
808
809AC_ARG_ENABLE(flock, AS_HELP_STRING([--enable-flock],[Use flock() to lock files]),
810 [if test $enableval = yes; then
811 AC_DEFINE(USE_FLOCK,1, [ Define to use flock() to lock mailboxes. ])
812 fi])
813
814mutt_cv_fcntl=yes
815AC_ARG_ENABLE(fcntl, AS_HELP_STRING([--disable-fcntl],[Do NOT use fcntl() to lock files]),
816 [if test $enableval = no; then mutt_cv_fcntl=no; fi])
817
818if test $mutt_cv_fcntl = yes; then
819 AC_DEFINE(USE_FCNTL,1, [ Define to use fcntl() to lock folders. ])
820fi
821
822AC_MSG_CHECKING(whether struct dirent defines d_ino)
823ac_cv_dirent_d_ino=no
824AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <dirent.h>]], [[struct dirent dp; (void)dp.d_ino]])],[ac_cv_dirent_d_ino=yes],[])
825if test x$ac_cv_dirent_d_ino = xyes ; then
826 AC_DEFINE(HAVE_DIRENT_D_INO,1,
827 [Define to 1 if your system has the dirent::d_ino member])
828fi
829AC_MSG_RESULT($ac_cv_dirent_d_ino)
830
831mutt_cv_warnings=yes
832AC_ARG_ENABLE(warnings, AS_HELP_STRING([--disable-warnings],[Turn off compiler warnings (not recommended)]),
833[if test $enableval = no; then
834 mutt_cv_warnings=no
835fi])
836
837if test x$GCC = xyes && test $mutt_cv_warnings = yes; then
838 CFLAGS="-Wall -pedantic -Wno-long-long $CFLAGS"
839fi
840
841AC_ARG_ENABLE(nfs-fix, AS_HELP_STRING([--enable-nfs-fix],[Work around an NFS with broken attributes caching]),
842 [if test x$enableval = xyes; then
843 AC_DEFINE(NFS_ATTRIBUTE_HACK,1,
844 [Define if you have problems with mutt not detecting
845 new/old mailboxes over NFS. Some NFS implementations
846 incorrectly cache the attributes of small files.])
847 fi])
848
849AC_ARG_ENABLE(mailtool, AS_HELP_STRING([--enable-mailtool],[Enable Sun mailtool attachments support]),
850 [if test x$enableval = xyes; then
851 AC_DEFINE(SUN_ATTACHMENT,1,[ Define to enable Sun mailtool attachments support. ])
852 fi])
853
854AC_ARG_ENABLE(locales-fix, AS_HELP_STRING([--enable-locales-fix],[The result of isprint() is unreliable]),
855 [if test x$enableval = xyes; then
856 AC_DEFINE(LOCALES_HACK,1,[ Define if the result of isprint() is unreliable. ])
857 fi])
858
859AC_ARG_WITH(exec-shell, AS_HELP_STRING([--with-exec-shell=SHELL],[Specify alternate shell (ONLY if /bin/sh is broken)]),
860 [if test $withval != yes; then
861 AC_DEFINE_UNQUOTED(EXECSHELL, "$withval",
862 [program to use for shell commands])
863 else
864 AC_DEFINE_UNQUOTED(EXECSHELL, "/bin/sh")
865 fi],
866 [AC_DEFINE_UNQUOTED(EXECSHELL, "/bin/sh")])
867
868AC_ARG_ENABLE(exact-address, AS_HELP_STRING([--enable-exact-address],[Enable regeneration of email addresses]),
869 [if test $enableval = yes; then
870 AC_DEFINE(EXACT_ADDRESS,1,
871 [Enable exact regeneration of email addresses as parsed?
872 NOTE: this requires significant more memory when defined.])
873
874 fi])
875
876dnl -- start cache --
877db_found=no
878db_requested=auto
879AC_ARG_ENABLE(hcache, AS_HELP_STRING([--enable-hcache],[Enable header caching]))
880AC_ARG_WITH(tokyocabinet, AS_HELP_STRING([--without-tokyocabinet],[Don't use tokyocabinet even if it is available]))
881AC_ARG_WITH(qdbm, AS_HELP_STRING([--without-qdbm],[Don't use qdbm even if it is available]))
882AC_ARG_WITH(gdbm, AS_HELP_STRING([--without-gdbm],[Don't use gdbm even if it is available]))
883AC_ARG_WITH(bdb, AS_HELP_STRING([--with-bdb@<:@=DIR@:>@],[Use BerkeleyDB4 if gdbm is not available]))
884
885db_found=no
886if test x$enable_hcache = xyes
887then
888 AC_DEFINE(USE_HCACHE, 1, [Enable header caching])
889 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS hcache.o"
890
891 OLDCPPFLAGS="$CPPFLAGS"
892 OLDLDFLAGS="$LDFLAGS"
893 OLDLIBS="$LIBS"
894
895 need_md5="yes"
896
897 if test -n "$with_tokyocabinet" && test "$with_tokyocabinet" != "no"
898 then
899 db_requested=tc
900 fi
901 if test -n "$with_qdbm" && test "$with_qdbm" != "no"
902 then
903 if test "$db_requested" != "auto"
904 then
905 AC_MSG_ERROR([more than one header cache engine requested.])
906 else
907 db_requested=qdbm
908 fi
909 fi
910 if test -n "$with_gdbm" && test "$with_gdbm" != "no"
911 then
912 if test "$db_requested" != "auto"
913 then
914 AC_MSG_ERROR([more than one header cache engine requested.])
915 else
916 db_requested=gdbm
917 fi
918 fi
919 if test -n "$with_bdb" && test "$with_bdb" != "no"
920 then
921 if test "$db_requested" != "auto"
922 then
923 AC_MSG_ERROR([more than one header cache engine requested.])
924 else
925 db_requested=bdb
926 fi
927 fi
928
929 dnl -- Tokyo Cabinet --
930 if test "$with_tokyocabinet" != "no" \
931 && test "$db_requested" = auto -o "$db_requested" = tc
932 then
933 if test -n "$with_tokyocabinet" && test "$with_tokyocabinet" != "yes"
934 then
935 CPPFLAGS="$CPPFLAGS -I$with_tokyocabinet/include"
936 LDFLAGS="$LDFLAGS -L$with_tokyocabinet/lib"
937 fi
938
939 AC_CHECK_HEADER(tcbdb.h,
940 AC_CHECK_LIB(tokyocabinet, tcbdbopen,
941 [MUTTLIBS="$MUTTLIBS -ltokyocabinet"
942 AC_DEFINE(HAVE_TC, 1, [Tokyo Cabinet Support])
943 db_found=tc],
944 [CPPFLAGS="$OLDCPPFLAGS"
945 LDFLAGS="$OLDLDFLAGS"]))
946 if test "$db_requested" != auto && test "$db_found" != "$db_requested"
947 then
948 AC_MSG_ERROR([Tokyo Cabinet could not be used. Check config.log for details.])
949 fi
950 fi
951
952 dnl -- QDBM --
953 if test "$with_qdbm" != "no" && test $db_found = no \
954 && test "$db_requested" = auto -o "$db_requested" = qdbm
955 then
956 if test -n "$with_qdbm" && test "$with_qdbm" != "yes"
957 then
958 if test -d $with_qdbm/include/qdbm; then
959 CPPFLAGS="$CPPFLAGS -I$with_qdbm/include/qdbm"
960 else
961 CPPFLAGS="$CPPFLAGS -I$with_qdbm/include"
962 fi
963 LDFLAGS="$LDFLAGS -L$with_qdbm/lib"
964 else
965 if test -d /usr/include/qdbm; then
966 CPPFLAGS="$CPPFLAGS -I/usr/include/qdbm"
967 fi
968 fi
969
970 saved_LIBS="$LIBS"
971 AC_CHECK_HEADERS(villa.h)
972 AC_CHECK_LIB(qdbm, vlopen,
973 [MUTTLIBS="$MUTTLIBS -lqdbm"
974 AC_DEFINE(HAVE_QDBM, 1, [QDBM Support])
975 db_found=qdbm],
976 [CPPFLAGS="$OLDCPPFLAGS"
977 LDFLAGS="$OLDLDFLAGS"])
978 LIBS="$saved_LIBS"
979 if test "$db_requested" != auto && test "$db_found" != "$db_requested"
980 then
981 AC_MSG_ERROR([QDBM could not be used. Check config.log for details.])
982 fi
983 fi
984
985 dnl -- GDBM --
986 if test x$with_gdbm != xno && test $db_found = no \
987 && test "$db_requested" = auto -o "$db_requested" = gdbm
988 then
989 if test "$with_gdbm" != "yes"
990 then
991 CPPFLAGS="$CPPFLAGS -I$with_gdbm/include"
992 LDFLAGS="$LDFLAGS -L$with_gdbm/lib"
993 fi
994 saved_LIBS="$LIBS"
995 LIBS="$LIBS -lgdbm"
996 AC_CACHE_CHECK(for gdbm_open, ac_cv_gdbmopen,[
997 ac_cv_gdbmopen=no
998 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gdbm.h>]], [[gdbm_open(0,0,0,0,0);]])],[ac_cv_gdbmopen=yes],[])
999 ])
1000 LIBS="$saved_LIBS"
1001 if test "$ac_cv_gdbmopen" = yes
1002 then
1003 AC_DEFINE(HAVE_GDBM, 1, [GDBM Support])
1004 MUTTLIBS="$MUTTLIBS -lgdbm"
1005 db_found=gdbm
1006 fi
1007 if test "$db_requested" != auto && test "$db_found" != "$db_requested"
1008 then
1009 AC_MSG_ERROR([GDBM could not be used. Check config.log for details.])
1010 fi
1011 fi
1012
1013 dnl -- BDB --
1014 ac_bdb_prefix="$with_bdb"
1015 if test x$ac_bdb_prefix != xno && test $db_found = no
1016 then
1017 if test x$ac_bdb_prefix = xyes || test x$ac_bdb_prefix = x
1018 then
1019 ac_bdb_prefix="$mutt_cv_prefix /opt/csw/bdb4 /opt /usr/local /usr"
1020 fi
1021 for d in $ac_bdb_prefix; do
1022 bdbpfx="$bdbpfx $d"
1023 for v in BerkeleyDB.4.3 BerkeleyDB.4.2 BerkeleyDB.4.1; do
1024 bdbpfx="$bdbpfx $d/$v"
1025 done
1026 done
1027 BDB_VERSIONS="db-4 db4 db-5 db5 db-5.2 db5.2 db52 db-5.1 db5.1 db51 db-5.0 db5.0 db50 db-4.8 db4.8 db48 db-4.7 db4.7 db47 db-4.6 db4.6 db46 db-4.5 db4.5 db45 db-4.4 db4.4 db44 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db ''"
1028 AC_MSG_CHECKING([for BerkeleyDB > 4.0])
1029 for d in $bdbpfx; do
1030 BDB_INCLUDE_DIR=""
1031 BDB_LIB_DIR=""
1032 for v in / $BDB_VERSIONS; do
1033 if test -r "$d/include/$v/db.h"; then
1034 BDB_INCLUDE_DIR="$d/include/$v"
1035 for bdblibdir in "$d/lib/$v" "$d/lib"; do
1036 test -d "$bdblibdir" || continue
1037 BDB_LIB_DIR="$bdblibdir"
1038 for l in `echo $BDB_VERSIONS`; do
1039 CPPFLAGS="$OLDCPPFLAGS -I$BDB_INCLUDE_DIR"
1040 LIBS="$OLDLIBS -L$BDB_LIB_DIR -l$l"
1041 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1042 #include <stdlib.h>
1043 #include <db.h>
1044 ]], [[
1045 DB *db = NULL;
1046 db->open(db,NULL,NULL,NULL,0,0,0);
1047 ]])],[
1048 ac_cv_dbcreate=yes
1049 BDB_LIB="$l"
1050 break
1051 ],[])
1052 done
1053 test x$ac_cv_dbcreate = xyes && break 2
1054 done
1055 fi
1056 done
1057 test x$BDB_LIB != x && break
1058 done
1059 if test x$ac_cv_dbcreate = xyes
1060 then
1061 AC_MSG_RESULT(yes)
1062 CPPFLAGS="$OLDCPPFLAGS -I$BDB_INCLUDE_DIR"
1063 LIBS="$OLDLIBS -L$BDB_LIB_DIR -l$BDB_LIB"
1064 AC_DEFINE(HAVE_DB4, 1, [Berkeley DB4 Support])
1065 db_found=bdb
1066 else
1067 AC_MSG_RESULT(no)
1068 fi
1069 fi
1070
1071 if test $db_found = no
1072 then
1073 AC_MSG_ERROR([You need Tokyo Cabinet, QDBM, GDBM or Berkeley DB4 for hcache])
1074 fi
1075fi
1076dnl -- end cache --
1077
1078AM_CONDITIONAL(BUILD_HCACHE, test x$db_found != xno)
1079
1080if test "$need_md5" = "yes"
1081then
1082 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS md5.o"
1083fi
1084
1085if test x$db_found != xno ; then
1086 MUTT_MD5="mutt_md5$EXEEXT"
1087fi
1088AC_SUBST(MUTT_MD5)
1089
1090AC_SUBST(MUTTLIBS)
1091AC_SUBST(MUTT_LIB_OBJECTS)
1092AC_SUBST(LIBIMAP)
1093AC_SUBST(LIBIMAPDEPS)
1094
1095dnl -- iconv/gettext --
1096
1097AC_ARG_ENABLE(iconv, AS_HELP_STRING([--disable-iconv],[Disable iconv support]),
1098 [if test x$enableval = xno ; then
1099 am_cv_func_iconv=no
1100 fi
1101])
1102
1103MUTT_AM_GNU_GETTEXT
1104
1105if test "$am_cv_func_iconv" != "yes"
1106then
1107 AC_MSG_WARN([Configuring without iconv support. See INSTALL for details])
1108else
1109
1110AC_CHECK_HEADERS(iconv.h,
1111 [AC_MSG_CHECKING(whether iconv.h defines iconv_t)
1112 AC_EGREP_HEADER([typedef.*iconv_t],iconv.h,
1113 [AC_MSG_RESULT(yes)
1114 AC_DEFINE(HAVE_ICONV_T_DEF, 1,
1115 [Define if <iconv.h> defines iconv_t.])],
1116 AC_MSG_RESULT(no))])
1117
1118dnl (1) Some implementations of iconv won't convert from UTF-8 to UTF-8.
1119dnl (2) In glibc-2.1.2 and earlier there is a bug that messes up ob and
1120dnl obl when args 2 and 3 are 0 (fixed in glibc-2.1.3).
1121AC_CACHE_CHECK([whether this iconv is good enough], mutt_cv_iconv_good,
1122 mutt_save_LIBS="$LIBS"
1123 LIBS="$LIBS $LIBICONV"
1124 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1125#include <iconv.h>
1126int main()
1127{
1128 iconv_t cd;
1129changequote(, )dnl
1130 char buf[4];
1131changequote([, ])dnl
1132 char *ob;
1133 size_t obl;
1134 ob = buf, obl = sizeof(buf);
1135 return ((cd = iconv_open("UTF-8", "UTF-8")) != (iconv_t)(-1) &&
1136 (iconv(cd, 0, 0, &ob, &obl) ||
1137 !(ob == buf && obl == sizeof(buf)) ||
1138 iconv_close(cd)));
1139}
1140 ]])],[mutt_cv_iconv_good=yes],[mutt_cv_iconv_good=no],[mutt_cv_iconv_good=yes])
1141 LIBS="$mutt_save_LIBS")
1142if test "$mutt_cv_iconv_good" = no; then
1143 AC_MSG_ERROR(Try using libiconv instead)
1144fi
1145
1146dnl This is to detect implementations such as the one in glibc-2.1,
1147dnl which always convert exactly but return the number of characters
1148dnl converted instead of the number converted inexactly.
1149AC_CACHE_CHECK([whether iconv is non-transcribing], mutt_cv_iconv_nontrans,
1150 mutt_save_LIBS="$LIBS"
1151 LIBS="$LIBS $LIBICONV"
1152 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1153#include <iconv.h>
1154#include <string.h>
1155int main()
1156{
1157 iconv_t cd;
1158 const char *ib;
1159 char *ob;
1160 size_t ibl, obl;
1161 const char *s = "\304\211";
1162changequote(, )dnl
1163 char t[3];
1164changequote([, ])dnl
1165 ib = s, ibl = 2, ob = t, obl = 3;
1166 return ((cd = iconv_open("UTF-8", "UTF-8")) == (iconv_t)(-1) ||
1167 iconv(cd, &ib, &ibl, &ob, &obl));
1168}
1169 ]])],[mutt_cv_iconv_nontrans=no],[mutt_cv_iconv_nontrans=yes],[mutt_cv_iconv_nontrans=no])
1170 LIBS="$mutt_save_LIBS")
1171if test "$mutt_cv_iconv_nontrans" = yes; then
1172 AC_DEFINE(ICONV_NONTRANS, 1)
1173else
1174 AC_DEFINE(ICONV_NONTRANS, 0)
1175fi
1176
1177CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/intl"
1178
1179if test "$BUILD_INCLUDED_LIBINTL" = "yes"; then
1180 AC_DEFINE(HAVE_BIND_TEXTDOMAIN_CODESET,1,
1181 [ Define if your gettext has bind_textdomain_codeset. ])
1182else
1183 mutt_save_LIBS="$LIBS"
1184 LIBS="$LIBS $INTLLIBS"
1185 AC_CHECK_FUNCS(bind_textdomain_codeset)
1186 LIBS="$mutt_save_LIBS"
1187fi
1188
1189fi # libiconv
1190
1191dnl -- IDN depends on iconv
1192
1193dnl mutt_idna.c will perform charset transformations (for smtputf8
1194dnl support) as long as at least iconv is installed. If there is no
1195dnl iconv, then it doesn't need to be included in the build.
1196if test "$am_cv_func_iconv" = yes; then
1197 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_idna.o"
1198fi
1199
1200AC_ARG_WITH(idn, AS_HELP_STRING([--with-idn=@<:@PFX@:>@],[Use GNU libidn for internationalized domain names]),
1201 [
1202 if test "$with_idn" != "no" ; then
1203 if test "$with_idn" != "yes" ; then
1204 CPPFLAGS="$CPPFLAGS -I$with_idn/include"
1205 LDFLAGS="$LDFLAGS -L$with_idn/lib"
1206 fi
1207 fi
1208 ],
1209 [with_idn=auto])
1210
1211if test "x$with_idn" != "xno"; then
1212 if test "$am_cv_func_iconv" != "yes"; then
1213 if test "$with_idn" != "auto"; then
1214 AC_MSG_ERROR([IDN requested but iconv is disabled or unavailable])
1215 fi
1216 else
1217 dnl Solaris 11 has /usr/include/idn
1218 have_stringprep_h=no
1219 AC_CHECK_HEADERS([stringprep.h idn/stringprep.h], [
1220 have_stringprep_h=yes
1221 break])
1222 have_idna_h=no
1223 AC_CHECK_HEADERS([idna.h idn/idna.h], [
1224 have_idna_h=yes
1225 break])
1226
1227 mutt_save_LIBS="$LIBS"
1228 LIBS=
1229
1230 AC_SEARCH_LIBS([stringprep_check_version], [idn], [
1231 AC_DEFINE([HAVE_LIBIDN], 1, [Define to 1 if you have the GNU idn library])
1232 MUTTLIBS="$MUTTLIBS $LIBS"
1233
1234 LIBS="$LIBS $LIBICONV"
1235 AC_CHECK_FUNCS(idna_to_unicode_utf8_from_utf8 idna_to_unicode_8z8z)
1236 AC_CHECK_FUNCS(idna_to_ascii_from_utf8 idna_to_ascii_8z)
1237 AC_CHECK_FUNCS(idna_to_ascii_lz idna_to_ascii_from_locale)
1238 ])
1239
1240 LIBS="$mutt_save_LIBS"
1241
1242 if test "$with_idn" != auto; then
1243 if test $have_stringprep_h = no || test $have_idna_h = no || test $ac_cv_search_stringprep_check_version = no; then
1244 AC_MSG_ERROR([IDN was requested, but libidn was not usable on this system])
1245 fi
1246 fi
1247 fi
1248fi
1249
1250dnl -- locales --
1251
1252AC_CHECK_HEADERS(wchar.h)
1253
1254AC_CACHE_CHECK([for wchar_t], mutt_cv_wchar_t,
1255 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1256#include <stddef.h>
1257#include <stdlib.h>
1258#ifdef HAVE_WCHAR_H
1259#include <wchar.h>
1260#endif
1261 ]], [[ wchar_t wc; return 0; ]])],[mutt_cv_wchar_t=yes],[mutt_cv_wchar_t=no]))
1262
1263if test "$mutt_cv_wchar_t" = no; then
1264 AC_DEFINE(wchar_t,int,[ Define to 'int' if system headers don't define. ])
1265fi
1266
1267AC_CACHE_CHECK([for wint_t], mutt_cv_wint_t,
1268 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1269#include <stddef.h>
1270#include <stdlib.h>
1271#ifdef HAVE_WCHAR_H
1272#include <wchar.h>
1273#endif
1274 ]], [[ wint_t wc; return 0; ]])],[mutt_cv_wint_t=yes],[mutt_cv_wint_t=no]))
1275
1276if test "$mutt_cv_wint_t" = no; then
1277 AC_DEFINE(wint_t,int,[ Define to 'int' if system headers don't define. ])
1278fi
1279
1280AC_CHECK_HEADERS(wctype.h)
1281AC_CHECK_FUNCS(iswalnum iswalpha iswblank iswcntrl iswdigit)
1282AC_CHECK_FUNCS(iswgraph iswlower iswprint iswpunct iswspace iswupper)
1283AC_CHECK_FUNCS(iswxdigit towupper towlower)
1284
1285AC_CACHE_CHECK([for mbstate_t], mutt_cv_mbstate_t,
1286 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1287#include <stddef.h>
1288#include <stdlib.h>
1289#ifdef HAVE_WCHAR_H
1290#include <wchar.h>
1291#endif
1292 ]], [[ mbstate_t s; return 0; ]])],[mutt_cv_mbstate_t=yes],[mutt_cv_mbstate_t=no]))
1293
1294if test "$mutt_cv_mbstate_t" = no; then
1295 AC_DEFINE(mbstate_t,int,[ Define to 'int' if system headers don't define. ])
1296fi
1297
1298wc_funcs=maybe
1299AC_ARG_WITH(wc-funcs, AS_HELP_STRING([--without-wc-funcs],[Do not use the system's wchar_t functions]),
1300 wc_funcs=$withval)
1301
1302if test "$wc_funcs" != yes && test "$wc_funcs" != no; then
1303 AC_CACHE_CHECK([for wchar_t functions], mutt_cv_wc_funcs,
1304 mutt_cv_wc_funcs=no
1305 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1306#define _XOPEN_SOURCE 600
1307#include <stddef.h>
1308#include <stdlib.h>
1309#ifdef HAVE_WCHAR_H
1310#include <wchar.h>
1311#endif
1312#ifdef HAVE_WCTYPE_H
1313#include <wctype.h>
1314#endif]], [[mbrtowc(0, 0, 0, 0); wctomb(0, 0); wcwidth(0);
1315 iswprint(0); iswspace(0); towlower(0); towupper(0); iswalnum(0)]])],[mutt_cv_wc_funcs=yes],[]))
1316 wc_funcs=$mutt_cv_wc_funcs
1317fi
1318
1319if test $wc_funcs = yes; then
1320 AC_DEFINE(HAVE_WC_FUNCS,1,[ Define if you are using the system's wchar_t functions. ])
1321else
1322 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS utf8.o wcwidth.o"
1323fi
1324
1325AC_CACHE_CHECK([for nl_langinfo and CODESET], mutt_cv_langinfo_codeset,
1326 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]], [[char* cs = nl_langinfo(CODESET);]])],[mutt_cv_langinfo_codeset=yes],[mutt_cv_langinfo_codeset=no])])
1327if test $mutt_cv_langinfo_codeset = yes; then
1328 AC_DEFINE(HAVE_LANGINFO_CODESET,1,[ Define if you have <langinfo.h> and nl_langinfo(CODESET). ])
1329fi
1330
1331AC_CACHE_CHECK([for nl_langinfo and YESEXPR], mutt_cv_langinfo_yesexpr,
1332 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]], [[char* cs = nl_langinfo(YESEXPR);]])],[mutt_cv_langinfo_yesexpr=yes],[mutt_cv_langinfo_yesexpr=no])])
1333if test $mutt_cv_langinfo_yesexpr = yes; then
1334 AC_DEFINE(HAVE_LANGINFO_YESEXPR,1,[ Define if you have <langinfo.h> and nl_langinfo(YESEXPR). ])
1335fi
1336
1337dnl Documentation tools
1338have_openjade="no"
1339AC_PATH_PROG([OSPCAT], [ospcat], [none])
1340if test "$OSPCAT" != "none"
1341then
1342 AC_MSG_CHECKING([for openjade docbook stylesheets])
1343 dslosfile=`ospcat --public-id="-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN"`
1344 DSLROOT=`echo $dslosfile | sed -n -e "s/.*SOIBASE='\(@<:@^'@:>@*\)\/catalog'.*/\1/p"`
1345 # ospcat may spit out an absolute path without an SOIBASE
1346 if test -z "$DSLROOT"
1347 then
1348 DSLROOT=`echo $dslosfile | sed -e 's|<OSFILE>\(.*\)/print/docbook.dsl|\1|'`
1349 fi
1350 if test -f $DSLROOT/print/docbook.dsl
1351 then
1352 AC_MSG_RESULT([in $DSLROOT])
1353 have_openjade="yes"
1354 else
1355 AC_MSG_RESULT([not found: PDF documentation will not be built.])
1356 fi
1357fi
1358AC_SUBST(DSLROOT)
1359
1360AC_ARG_ENABLE(doc, AS_HELP_STRING([--disable-doc],[Do not build the documentation]),
1361[ if test x$enableval = xno ; then
1362 do_build_doc=no
1363 fi
1364])
1365AM_CONDITIONAL(BUILD_DOC, test x$do_build_doc != xno)
1366
1367AC_ARG_ENABLE(full_doc,
1368 AS_HELP_STRING([--disable-full-doc],[Omit disabled variables]),
1369[ if test x$enableval = xno ; then
1370 full_doc=no
1371 fi
1372])
1373if test x$full_doc != xno ; then
1374 AC_DEFINE(MAKEDOC_FULL,1, [Define if you want complete documentation.])
1375fi
1376
1377AC_CONFIG_FILES(Makefile contrib/Makefile doc/Makefile imap/Makefile
1378 intl/Makefile m4/Makefile po/Makefile.in
1379 hcachever.sh muttbug.sh doc/instdoc.sh)
1380AC_OUTPUT