root/configure.ac

Revision 5465:45ce2903b9e9, 40.0 kB (checked in by Brendan Cully <brendan@…>, 5 weeks ago)

Disable GCC long long warnings with -pedantic. Closes #2823.
Thanks to Aron Griffis for the suggestion.

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