c86e1908a045a19049a378bf2d7452fefe80d87a
[apps/madmutt.git] / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4-p4
2
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 # Like AC_CONFIG_HEADER, but automatically create stamp file.
14
15 AC_DEFUN(AM_CONFIG_HEADER,
16 [AC_PREREQ([2.12])
17 AC_CONFIG_HEADER([$1])
18 dnl When config.status generates a header, we must update the stamp-h file.
19 dnl This file resides in the same directory as the config header
20 dnl that is generated.  We must strip everything past the first ":",
21 dnl and everything past the last "/".
22 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
23 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
24 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
25 <<am_indx=1
26 for am_file in <<$1>>; do
27   case " <<$>>CONFIG_HEADERS " in
28   *" <<$>>am_file "*<<)>>
29     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
30     ;;
31   esac
32   am_indx=`expr "<<$>>am_indx" + 1`
33 done<<>>dnl>>)
34 changequote([,]))])
35
36 # Do all the work for Automake.  This macro actually does too much --
37 # some checks are only needed if your package does certain things.
38 # But this isn't really a big deal.
39
40 # serial 1
41
42 dnl Usage:
43 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
44
45 AC_DEFUN(AM_INIT_AUTOMAKE,
46 [AC_REQUIRE([AC_PROG_INSTALL])
47 PACKAGE=[$1]
48 AC_SUBST(PACKAGE)
49 VERSION=[$2]
50 AC_SUBST(VERSION)
51 dnl test to see if srcdir already configured
52 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
53   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
54 fi
55 ifelse([$3],,
56 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
57 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
58 AC_REQUIRE([AM_SANITY_CHECK])
59 AC_REQUIRE([AC_ARG_PROGRAM])
60 dnl FIXME This is truly gross.
61 missing_dir=`cd $ac_aux_dir && pwd`
62 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
63 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
64 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
65 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
66 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
67 AC_REQUIRE([AC_PROG_MAKE_SET])])
68
69 #
70 # Check to make sure that the build environment is sane.
71 #
72
73 AC_DEFUN(AM_SANITY_CHECK,
74 [AC_MSG_CHECKING([whether build environment is sane])
75 # Just in case
76 sleep 1
77 echo timestamp > conftestfile
78 # Do `set' in a subshell so we don't clobber the current shell's
79 # arguments.  Must try -L first in case configure is actually a
80 # symlink; some systems play weird games with the mod time of symlinks
81 # (eg FreeBSD returns the mod time of the symlink's containing
82 # directory).
83 if (
84    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
85    if test "[$]*" = "X"; then
86       # -L didn't work.
87       set X `ls -t $srcdir/configure conftestfile`
88    fi
89    if test "[$]*" != "X $srcdir/configure conftestfile" \
90       && test "[$]*" != "X conftestfile $srcdir/configure"; then
91
92       # If neither matched, then we have a broken ls.  This can happen
93       # if, for instance, CONFIG_SHELL is bash and it inherits a
94       # broken ls alias from the environment.  This has actually
95       # happened.  Such a system could not be considered "sane".
96       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
97 alias in your environment])
98    fi
99
100    test "[$]2" = conftestfile
101    )
102 then
103    # Ok.
104    :
105 else
106    AC_MSG_ERROR([newly created file is older than distributed files!
107 Check your system clock])
108 fi
109 rm -f conftest*
110 AC_MSG_RESULT(yes)])
111
112 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
113 dnl The program must properly implement --version.
114 AC_DEFUN(AM_MISSING_PROG,
115 [AC_MSG_CHECKING(for working $2)
116 # Run test in a subshell; some versions of sh will print an error if
117 # an executable is not found, even if stderr is redirected.
118 # Redirect stdin to placate older versions of autoconf.  Sigh.
119 if ($2 --version) < /dev/null > /dev/null 2>&1; then
120    $1=$2
121    AC_MSG_RESULT(found)
122 else
123    $1="$3/missing $2"
124    AC_MSG_RESULT(missing)
125 fi
126 AC_SUBST($1)])
127
128 #serial 1
129 # This test replaces the one in autoconf.
130 # Currently this macro should have the same name as the autoconf macro
131 # because gettext's gettext.m4 (distributed in the automake package)
132 # still uses it.  Otherwise, the use in gettext.m4 makes autoheader
133 # give these diagnostics:
134 #   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
135 #   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
136
137 undefine([AC_ISC_POSIX])
138
139 AC_DEFUN([AC_ISC_POSIX],
140   [
141     dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
142     AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
143   ]
144 )
145
146
147 # serial 1
148
149 AC_DEFUN(AM_C_PROTOTYPES,
150 [AC_REQUIRE([AM_PROG_CC_STDC])
151 AC_REQUIRE([AC_PROG_CPP])
152 AC_MSG_CHECKING([for function prototypes])
153 if test "$am_cv_prog_cc_stdc" != no; then
154   AC_MSG_RESULT(yes)
155   AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
156   U= ANSI2KNR=
157 else
158   AC_MSG_RESULT(no)
159   U=_ ANSI2KNR=./ansi2knr
160   # Ensure some checks needed by ansi2knr itself.
161   AC_HEADER_STDC
162   AC_CHECK_HEADERS(string.h)
163 fi
164 AC_SUBST(U)dnl
165 AC_SUBST(ANSI2KNR)dnl
166 ])
167
168
169 # serial 1
170
171 # @defmac AC_PROG_CC_STDC
172 # @maindex PROG_CC_STDC
173 # @ovindex CC
174 # If the C compiler in not in ANSI C mode by default, try to add an option
175 # to output variable @code{CC} to make it so.  This macro tries various
176 # options that select ANSI C on some system or another.  It considers the
177 # compiler to be in ANSI C mode if it handles function prototypes correctly.
178 #
179 # If you use this macro, you should check after calling it whether the C
180 # compiler has been set to accept ANSI C; if not, the shell variable
181 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
182 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
183 # program @code{ansi2knr}, which comes with Ghostscript.
184 # @end defmac
185
186 AC_DEFUN(AM_PROG_CC_STDC,
187 [AC_REQUIRE([AC_PROG_CC])
188 AC_BEFORE([$0], [AC_C_INLINE])
189 AC_BEFORE([$0], [AC_C_CONST])
190 dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
191 dnl a magic option to avoid problems with ANSI preprocessor commands
192 dnl like #elif.
193 dnl FIXME: can't do this because then AC_AIX won't work due to a
194 dnl circular dependency.
195 dnl AC_BEFORE([$0], [AC_PROG_CPP])
196 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
197 AC_CACHE_VAL(am_cv_prog_cc_stdc,
198 [am_cv_prog_cc_stdc=no
199 ac_save_CC="$CC"
200 # Don't try gcc -ansi; that turns off useful extensions and
201 # breaks some systems' header files.
202 # AIX                   -qlanglvl=ansi
203 # Ultrix and OSF/1      -std1
204 # HP-UX                 -Aa -D_HPUX_SOURCE
205 # SVR4                  -Xc -D__EXTENSIONS__
206 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
207 do
208   CC="$ac_save_CC $ac_arg"
209   AC_TRY_COMPILE(
210 [#include <stdarg.h>
211 #include <stdio.h>
212 #include <sys/types.h>
213 #include <sys/stat.h>
214 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
215 struct buf { int x; };
216 FILE * (*rcsopen) (struct buf *, struct stat *, int);
217 static char *e (p, i)
218      char **p;
219      int i;
220 {
221   return p[i];
222 }
223 static char *f (char * (*g) (char **, int), char **p, ...)
224 {
225   char *s;
226   va_list v;
227   va_start (v,p);
228   s = g (p, va_arg (v,int));
229   va_end (v);
230   return s;
231 }
232 int test (int i, double x);
233 struct s1 {int (*f) (int a);};
234 struct s2 {int (*f) (double a);};
235 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
236 int argc;
237 char **argv;
238 ], [
239 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
240 ],
241 [am_cv_prog_cc_stdc="$ac_arg"; break])
242 done
243 CC="$ac_save_CC"
244 ])
245 if test -z "$am_cv_prog_cc_stdc"; then
246   AC_MSG_RESULT([none needed])
247 else
248   AC_MSG_RESULT($am_cv_prog_cc_stdc)
249 fi
250 case "x$am_cv_prog_cc_stdc" in
251   x|xno) ;;
252   *) CC="$CC $am_cv_prog_cc_stdc" ;;
253 esac
254 ])
255
256 dnl ---------------------------------------------------------------------------
257 dnl Look for the curses libraries.  Older curses implementations may require
258 dnl termcap/termlib to be linked as well.
259 AC_DEFUN([CF_CURSES_LIBS],[
260 AC_CHECK_FUNC(initscr,,[
261 case $host_os in #(vi
262 freebsd*) #(vi
263         AC_CHECK_LIB(mytinfo,tgoto,[LIBS="-lmytinfo $LIBS"])
264         ;;
265 hpux10.*|hpux11.*)
266         AC_CHECK_LIB(cur_colr,initscr,[
267                 LIBS="-lcur_colr $LIBS"
268                 CFLAGS="-I/usr/include/curses_colr $CFLAGS"
269                 ac_cv_func_initscr=yes
270                 ],[
271         AC_CHECK_LIB(Hcurses,initscr,[
272                 # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
273                 LIBS="-lHcurses $LIBS"
274                 CFLAGS="-D__HP_CURSES -D_HP_CURSES $CFLAGS"
275                 ac_cv_func_initscr=yes
276                 ])])
277         ;;
278 linux*) # Suse Linux does not follow /usr/lib convention
279         LIBS="$LIBS -L/lib"
280         ;;
281 esac
282
283 if test ".$With5lib" != ".no" ; then
284 if test -d /usr/5lib ; then
285         # SunOS 3.x or 4.x
286         CPPFLAGS="$CPPFLAGS -I/usr/5include"
287         LIBS="$LIBS -L/usr/5lib"
288 fi
289 fi
290
291 if test ".$ac_cv_func_initscr" != .yes ; then
292         cf_save_LIBS="$LIBS"
293         cf_term_lib=""
294         cf_curs_lib=""
295
296         # Check for library containing tgoto.  Do this before curses library
297         # because it may be needed to link the test-case for initscr.
298         AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
299                 for cf_term_lib in termcap termlib unknown
300                 do
301                         AC_CHECK_LIB($cf_term_lib,tgoto,[break])
302                 done
303         ])
304
305         # Check for library containing initscr
306         test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
307         for cf_curs_lib in cursesX curses ncurses xcurses jcurses unknown
308         do
309                 AC_CHECK_LIB($cf_curs_lib,initscr,[break])
310         done
311         test $cf_curs_lib = unknown && AC_ERROR(no curses library found)
312
313         LIBS="-l$cf_curs_lib $cf_save_LIBS"
314         if test "$cf_term_lib" = unknown ; then
315                 AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
316                 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
317                         [initscr()],
318                         [cf_result=yes],
319                         [cf_result=no])
320                 AC_MSG_RESULT($cf_result)
321                 test $cf_result = no && AC_ERROR(Cannot link curses library)
322         elif test "$cf_term_lib" != predefined ; then
323                 AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
324                 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
325                         [initscr(); tgoto((char *)0, 0, 0);],
326                         [cf_result=no],
327                         [
328                         LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
329                         AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
330                                 [initscr()],
331                                 [cf_result=yes],
332                                 [cf_result=error])
333                         ])
334                 AC_MSG_RESULT($cf_result)
335         fi
336 fi
337
338 ])])
339
340 dnl ---------------------------------------------------------------------------
341 dnl Check if a function is declared by including a set of include files.
342 dnl Invoke the corresponding actions according to whether it is found or not.
343 dnl
344 dnl Gcc (unlike other compilers) will only warn about the miscast assignment
345 dnl in the first test, but most compilers will oblige with an error in the
346 dnl second test.
347 dnl
348 dnl CF_CHECK_FUNCDECL(INCLUDES, FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
349 AC_DEFUN([CF_CHECK_FUNCDECL],
350 [
351 AC_MSG_CHECKING([for $2 declaration])
352 AC_CACHE_VAL(ac_cv_func_decl_$2,
353 [AC_TRY_COMPILE([$1],
354 [#ifndef ${ac_func}
355 extern  int     ${ac_func}();
356 #endif],[
357 AC_TRY_COMPILE([$1],
358 [#ifndef ${ac_func}
359 int     (*p)() = ${ac_func};
360 #endif],[
361 eval "ac_cv_func_decl_$2=yes"],[
362 eval "ac_cv_func_decl_$2=no"])],[
363 eval "ac_cv_func_decl_$2=yes"])])
364 if eval "test \"`echo '$ac_cv_func_'decl_$2`\" = yes"; then
365   AC_MSG_RESULT(yes)
366   ifelse([$3], , :, [$3])
367 else
368   AC_MSG_RESULT(no)
369 ifelse([$4], , , [$4
370 ])dnl
371 fi
372 ])dnl
373 dnl ---------------------------------------------------------------------------
374 dnl Check if functions are declared by including a set of include files.
375 dnl and define DECL_XXX if not.
376 dnl
377 dnl CF_CHECK_FUNCDECLS(INCLUDES, FUNCTION... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
378 AC_DEFUN([CF_CHECK_FUNCDECLS],
379 [for ac_func in $2
380 do
381 CF_CHECK_FUNCDECL([$1], $ac_func,
382 [
383   CF_UPPER(ac_tr_func,HAVE_$ac_func)
384   AC_DEFINE_UNQUOTED($ac_tr_func) $3],
385 [$4])dnl
386 dnl [$3],
387 dnl [
388 dnl   CF_UPPER(ac_tr_func,DECL_$ac_func)
389 dnl   AC_DEFINE_UNQUOTED($ac_tr_func) $4])dnl
390 done
391 ])dnl
392 dnl ---------------------------------------------------------------------------
393 dnl Make an uppercase version of a variable
394 dnl $1=uppercase($2)
395 AC_DEFUN([CF_UPPER],
396 [
397 changequote(,)dnl
398 $1=`echo $2 | tr '[a-z]' '[A-Z]'`
399 changequote([,])dnl
400 ])dnl
401 dnl ---------------------------------------------------------------------------
402
403 # Define a conditional.
404
405 AC_DEFUN(AM_CONDITIONAL,
406 [AC_SUBST($1_TRUE)
407 AC_SUBST($1_FALSE)
408 if $2; then
409   $1_TRUE=
410   $1_FALSE='#'
411 else
412   $1_TRUE='#'
413   $1_FALSE=
414 fi])
415
416 # gssapi.m4: Find GSSAPI libraries in either Heimdal or MIT implementations
417 # Brendan Cully <brendan@kublai.com> 20010529
418
419 dnl MUTT_AM_PATH_GSSAPI(PREFIX)
420 dnl Search for a GSSAPI implementation in the standard locations plus PREFIX,
421 dnl if it is set and not "yes".
422 dnl Defines GSSAPI_CFLAGS and GSSAPI_LIBS if found.
423 dnl Defines GSSAPI_IMPL to "Heimdal", "MIT", or "OldMIT", or "none" if not found
424 AC_DEFUN([MUTT_AM_PATH_GSSAPI],
425 [
426   GSSAPI_PREFIX=[$]$1
427   GSSAPI_IMPL="none"
428   saved_CPPFLAGS="$CPPFLAGS"
429   saved_LDFLAGS="$LDFLAGS"
430   saved_LIBS="$LIBS"
431   dnl First try krb5-config
432   if test "$GSSAPI_PREFIX" != "yes"
433   then
434     krb5_path="$GSSAPI_PREFIX/bin"
435   else
436     krb5_path="$PATH"
437   fi
438   AC_PATH_PROG(KRB5CFGPATH, krb5-config, none, $krb5_path)
439   if test "$KRB5CFGPATH" != "none"
440   then
441     GSSAPI_CFLAGS="$CPPFLAGS `$KRB5CFGPATH --cflags gssapi`"
442     GSSAPI_LIBS="$MUTTLIBS `$KRB5CFGPATH --libs gssapi`"
443     case "`$KRB5CFGPATH --version`" in
444       "Kerberos 5 "*)   GSSAPI_IMPL="MIT";;
445       ?eimdal*)         GSSAPI_IMPL="Heimdal";;
446       *)                GSSAPI_IMPL="Unknown";;
447    esac
448   else
449     dnl No krb5-config, run the old code
450     if test "$GSSAPI_PREFIX" != "yes"
451     then
452       GSSAPI_CFLAGS="-I$GSSAPI_PREFIX/include"
453       GSSAPI_LDFLAGS="-L$GSSAPI_PREFIX/lib"
454       CPPFLAGS="$CPPFLAGS $GSSAPI_CFLAGS"
455       LDFLAGS="$LDFLAGS $GSSAPI_LDFLAGS"
456     fi
457
458     dnl New MIT kerberos V support
459     AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context, [
460       GSSAPI_IMPL="MIT",
461       GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err"
462       ],, -lkrb5 -lk5crypto -lcom_err)
463
464     dnl Heimdal kerberos V support
465     if test "$GSSAPI_IMPL" = "none"
466     then
467       AC_CHECK_LIB(gssapi, gss_init_sec_context, [
468           GSSAPI_IMPL="Heimdal"
469           GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi -lkrb5 -ldes -lasn1 -lroken"
470           GSSAPI_LIBS="$GSSAPI_LIBS -lcrypt -lcom_err"
471           ],, -lkrb5 -ldes -lasn1 -lroken -lcrypt -lcom_err)
472     fi
473
474     dnl Old MIT Kerberos V
475     dnl Note: older krb5 distributions use -lcrypto instead of
476     dnl -lk5crypto, which collides with OpenSSL.  One way of dealing
477     dnl with that is to extract all objects from krb5's libcrypto
478     dnl and from openssl's libcrypto into the same directory, then
479     dnl to create a new libcrypto from these.
480     if test "$GSSAPI_IMPL" = "none"
481     then
482       AC_CHECK_LIB(gssapi_krb5, g_order_init, [
483         GSSAPI_IMPL="OldMIT",
484         GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi_krb5 -lkrb5 -lcrypto -lcom_err"
485         ],, -lkrb5 -lcrypto -lcom_err)
486     fi
487   fi
488
489   CPPFLAGS="$saved_CPPFLAGS"
490   LDFLAGS="$saved_LDFLAGS"
491   LIBS="$saved_LIBS"
492 ])
493
494 # Macro to add for using GNU gettext.
495 # Ulrich Drepper <drepper@cygnus.com>, 1995.
496
497 #
498 # Slightly modified by Thomas Roessler <roessler@does-not-exist.org>
499 # Updated to gettext-0.10.38 by Edmund Grimley Evans <edmundo@rano.org>
500 # Updated to gettext-0.10.40 by Andrew W. Nosenko <awn@bcs.zp.ua>
501 #
502
503 # This file can be copied and used freely without restrictions.  It can
504 # be used in projects which are not available under the GNU General Public
505 # License or the GNU Library General Public License but which still want
506 # to provide support for the GNU gettext functionality.
507 # Please note that the actual code of the GNU gettext library is covered
508 # by the GNU Library General Public License, and the rest of the GNU
509 # gettext package package is covered by the GNU General Public License.
510 # They are *not* in the public domain.
511
512 # serial 10
513
514 dnl Usage: MUTT_AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
515 dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
516 dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
517 dnl    depending on --{enable,disable}-{shared,static} and on the presence of
518 dnl    AM-DISABLE-SHARED). Otherwise, a static library
519 dnl    $(top_builddir)/intl/libintl.a will be created.
520 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
521 dnl    implementations (in libc or libintl) without the ngettext() function
522 dnl    will be ignored.
523 dnl LIBDIR is used to find the intl libraries.  If empty,
524 dnl    the value `$(top_builddir)/intl/' is used.
525 dnl
526 dnl The result of the configuration is one of three cases:
527 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
528 dnl    and used.
529 dnl    Catalog format: GNU --> install in $(datadir)
530 dnl    Catalog extension: .mo after installation, .gmo in source tree
531 dnl 2) GNU gettext has been found in the system's C library.
532 dnl    Catalog format: GNU --> install in $(datadir)
533 dnl    Catalog extension: .mo after installation, .gmo in source tree
534 dnl 3) No internationalization, always use English msgid.
535 dnl    Catalog format: none
536 dnl    Catalog extension: none
537 dnl The use of .gmo is historical (it was needed to avoid overwriting the
538 dnl GNU format catalogs when building on a platform with an X/Open gettext),
539 dnl but we keep it in order not to force irrelevant filename changes on the
540 dnl maintainers.
541 dnl
542 AC_DEFUN([MUTT_AM_WITH_NLS],
543   [AC_MSG_CHECKING([whether NLS is requested])
544     dnl Default is enabled NLS
545     AC_ARG_ENABLE(nls,
546       [  --disable-nls              Do not use Native Language Support],
547       USE_NLS=$enableval, USE_NLS=yes)
548     AC_MSG_RESULT($USE_NLS)
549     AC_SUBST(USE_NLS)
550
551     BUILD_INCLUDED_LIBINTL=no
552     USE_INCLUDED_LIBINTL=no
553     INTLLIBS=
554
555     dnl If we use NLS figure out what method
556     if test "$USE_NLS" = "yes"; then
557       AC_DEFINE(ENABLE_NLS, 1,
558         [Define to 1 if translation of program messages to the user's native language
559    is requested.])
560       AC_MSG_CHECKING([whether included gettext is requested])
561       AC_ARG_WITH(included-gettext,
562         [  --with-included-gettext    Use the GNU gettext library included here],
563         nls_cv_force_use_gnu_gettext=$withval,
564         nls_cv_force_use_gnu_gettext=no)
565       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
566
567       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
568       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
569         dnl User does not insist on using GNU NLS library.  Figure out what
570         dnl to use.  If GNU gettext is available we use this.  Else we have
571         dnl to fall back to GNU NLS library.
572         CATOBJEXT=NONE
573
574         dnl Add a version number to the cache macros.
575         define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
576         define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
577
578         AC_CHECK_HEADER(libintl.h,
579           [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
580             [AC_TRY_LINK([#include <libintl.h>
581 extern int _nl_msg_cat_cntr;],
582                [bindtextdomain ("", "");
583 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
584                gt_cv_func_gnugettext_libc=yes,
585                gt_cv_func_gnugettext_libc=no)])
586
587            if test "$gt_cv_func_gnugettext_libc" != "yes"; then
588              AC_CACHE_CHECK([for GNU gettext in libintl],
589                gt_cv_func_gnugettext_libintl,
590                [gt_save_LIBS="$LIBS"
591                 LIBS="$LIBS -lintl $LIBICONV"
592                 AC_TRY_LINK([#include <libintl.h>
593 extern int _nl_msg_cat_cntr;],
594                   [bindtextdomain ("", "");
595 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
596                   gt_cv_func_gnugettext_libintl=yes,
597                   gt_cv_func_gnugettext_libintl=no)
598                 LIBS="$gt_save_LIBS"])
599            fi
600
601            dnl If an already present or preinstalled GNU gettext() is found,
602            dnl use it.  But if this macro is used in GNU gettext, and GNU
603            dnl gettext is already preinstalled in libintl, we update this
604            dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
605            if test "$gt_cv_func_gnugettext_libc" = "yes" \
606               || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
607                    && test "$PACKAGE" != gettext; }; then
608              AC_DEFINE(HAVE_GETTEXT, 1,
609                [Define if the GNU gettext() function is already present or preinstalled.])
610
611              if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
612                dnl If iconv() is in a separate libiconv library, then anyone
613                dnl linking with libintl{.a,.so} also needs to link with
614                dnl libiconv.
615                INTLLIBS="-lintl $LIBICONV"
616              fi
617
618              gt_save_LIBS="$LIBS"
619              LIBS="$LIBS $INTLLIBS"
620              AC_CHECK_FUNCS(dcgettext)
621              LIBS="$gt_save_LIBS"
622
623              dnl Search for GNU msgfmt in the PATH.
624              MUTT_AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
625                [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
626              AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
627
628              dnl Search for GNU xgettext in the PATH.
629              MUTT_AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
630                [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
631
632              CATOBJEXT=.gmo
633            fi
634         ])
635
636         if test "$CATOBJEXT" = "NONE"; then
637           dnl GNU gettext is not found in the C library.
638           dnl Fall back on GNU gettext library.
639           nls_cv_use_gnu_gettext=yes
640         fi
641       fi
642
643       if test "$nls_cv_use_gnu_gettext" = "yes"; then
644         dnl Mark actions used to generate GNU NLS library.
645         INTLOBJS="\$(GETTOBJS)"
646         MUTT_AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
647           [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
648         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
649         MUTT_AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
650           [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
651         AC_SUBST(MSGFMT)
652         BUILD_INCLUDED_LIBINTL=yes
653         USE_INCLUDED_LIBINTL=yes
654         CATOBJEXT=.gmo
655         INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
656         LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
657       fi
658
659       dnl This could go away some day; the MUTT_PATH_PROG_WITH_TEST already does it.
660       dnl Test whether we really found GNU msgfmt.
661       if test "$GMSGFMT" != ":"; then
662         dnl If it is no GNU msgfmt we define it as : so that the
663         dnl Makefiles still can work.
664         if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
665           : ;
666         else
667           AC_MSG_RESULT(
668             [found msgfmt program is not GNU msgfmt; ignore it])
669           GMSGFMT=":"
670         fi
671       fi
672
673       dnl This could go away some day; the MUTT_PATH_PROG_WITH_TEST already does it.
674       dnl Test whether we really found GNU xgettext.
675       if test "$XGETTEXT" != ":"; then
676         dnl If it is no GNU xgettext we define it as : so that the
677         dnl Makefiles still can work.
678         if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
679           : ;
680         else
681           AC_MSG_RESULT(
682             [found xgettext program is not GNU xgettext; ignore it])
683           XGETTEXT=":"
684         fi
685       fi
686
687       dnl We need to process the po/ directory.
688       POSUB=po
689     fi
690     AC_OUTPUT_COMMANDS(
691      [for ac_file in $CONFIG_FILES; do
692         # Support "outfile[:infile[:infile...]]"
693         case "$ac_file" in
694           *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
695         esac
696         # PO directories have a Makefile.in generated from Makefile.in.in.
697         case "$ac_file" in */Makefile.in)
698           # Adjust a relative srcdir.
699           ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
700           ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
701           ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
702           # In autoconf-2.13 it is called $ac_given_srcdir.
703           # In autoconf-2.50 it is called $srcdir.
704           test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
705           case "$ac_given_srcdir" in
706             .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
707             /*) top_srcdir="$ac_given_srcdir" ;;
708             *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
709           esac
710           if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
711             rm -f "$ac_dir/POTFILES"
712             test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
713             sed -e "/^#/d" -e "/^[      ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
714             test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
715             sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
716           fi
717           ;;
718         esac
719       done])
720
721
722     dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
723     dnl to 'yes' because some of the testsuite requires it.
724     if test "$PACKAGE" = gettext; then
725       BUILD_INCLUDED_LIBINTL=yes
726     fi
727
728     dnl intl/plural.c is generated from intl/plural.y. It requires bison,
729     dnl because plural.y uses bison specific features. It requires at least
730     dnl bison-1.26 because earlier versions generate a plural.c that doesn't
731     dnl compile.
732     dnl bison is only needed for the maintainer (who touches plural.y). But in
733     dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
734     dnl the rule in general Makefile. Now, some people carelessly touch the
735     dnl files or have a broken "make" program, hence the plural.c rule will
736     dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
737     dnl present or too old.
738     AC_CHECK_PROGS([INTLBISON], [bison])
739     if test -z "$INTLBISON"; then
740       ac_verc_fail=yes
741     else
742       dnl Found it, now check the version.
743       AC_MSG_CHECKING([version of bison])
744 changequote(<<,>>)dnl
745       ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
746       case $ac_prog_version in
747         '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
748         1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
749 changequote([,])dnl
750            ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
751         *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
752       esac
753       AC_MSG_RESULT([$ac_prog_version])
754     fi
755     if test $ac_verc_fail = yes; then
756       INTLBISON=:
757     fi
758
759     dnl These rules are solely for the distribution goal.  While doing this
760     dnl we only have to keep exactly one list of the available catalogs
761     dnl in configure.in.
762     for lang in $ALL_LINGUAS; do
763       GMOFILES="$GMOFILES $lang.gmo"
764       POFILES="$POFILES $lang.po"
765     done
766
767     dnl Make all variables we use known to autoconf.
768     AC_SUBST(BUILD_INCLUDED_LIBINTL)
769     AC_SUBST(USE_INCLUDED_LIBINTL)
770     AC_SUBST(CATALOGS)
771     AC_SUBST(CATOBJEXT)
772     AC_SUBST(GMOFILES)
773     AC_SUBST(INTLLIBS)
774     AC_SUBST(INTLOBJS)
775     AC_SUBST(POFILES)
776     AC_SUBST(POSUB)
777
778     dnl For backward compatibility. Some configure.ins may be using this.
779     nls_cv_header_intl=
780     nls_cv_header_libgt=
781
782     dnl For backward compatibility. Some Makefiles may be using this.
783     DATADIRNAME=share
784     AC_SUBST(DATADIRNAME)
785
786     dnl For backward compatibility. Some Makefiles may be using this.
787     INSTOBJEXT=.mo
788     AC_SUBST(INSTOBJEXT)
789
790     dnl For backward compatibility. Some Makefiles may be using this.
791     GENCAT=gencat
792     AC_SUBST(GENCAT)
793   ])
794
795 dnl Usage: Just like MUTT_AM_WITH_NLS, which see.
796 AC_DEFUN([MUTT_AM_GNU_GETTEXT],
797   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
798    AC_REQUIRE([AC_PROG_CC])dnl
799    AC_REQUIRE([AC_CANONICAL_HOST])dnl
800    AC_REQUIRE([AC_PROG_RANLIB])dnl
801    AC_REQUIRE([AC_ISC_POSIX])dnl
802    AC_REQUIRE([AC_HEADER_STDC])dnl
803    AC_REQUIRE([AC_C_CONST])dnl
804    AC_REQUIRE([AC_C_INLINE])dnl
805    AC_REQUIRE([AC_TYPE_OFF_T])dnl
806    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
807    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
808    AC_REQUIRE([AC_FUNC_MMAP])dnl
809    AC_REQUIRE([MUTT_jm_GLIBC21])dnl
810
811    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
812 stdlib.h string.h unistd.h sys/param.h])
813    AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
814 getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
815 strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
816
817    MUTT_AM_ICONV
818    MUTT_AM_LANGINFO_CODESET
819    MUTT_AM_LC_MESSAGES
820    MUTT_AM_WITH_NLS([$1],[$2],[$3])
821
822    if test "x$CATOBJEXT" != "x"; then
823      if test "x$ALL_LINGUAS" = "x"; then
824        LINGUAS=
825      else
826        AC_MSG_CHECKING(for catalogs to be installed)
827        NEW_LINGUAS=
828        for presentlang in $ALL_LINGUAS; do
829          useit=no
830          for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
831            # Use the presentlang catalog if desiredlang is
832            #   a. equal to presentlang, or
833            #   b. a variant of presentlang (because in this case,
834            #      presentlang can be used as a fallback for messages
835            #      which are not translated in the desiredlang catalog).
836            case "$desiredlang" in
837              "$presentlang"*) useit=yes;;
838            esac
839          done
840          if test $useit = yes; then
841            NEW_LINGUAS="$NEW_LINGUAS $presentlang"
842          fi
843        done
844        LINGUAS=$NEW_LINGUAS
845        AC_MSG_RESULT($LINGUAS)
846      fi
847
848      dnl Construct list of names of catalog files to be constructed.
849      if test -n "$LINGUAS"; then
850        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
851      fi
852    fi
853
854    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
855    dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
856    dnl Try to locate is.
857    MKINSTALLDIRS=
858    if test -n "$ac_aux_dir"; then
859      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
860    fi
861    if test -z "$MKINSTALLDIRS"; then
862      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
863    fi
864    AC_SUBST(MKINSTALLDIRS)
865
866    dnl Enable libtool support if the surrounding package wishes it.
867    INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
868    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
869   ])
870
871 # Search path for a program which passes the given test.
872 # Ulrich Drepper <drepper@cygnus.com>, 1996.
873 #
874 # This file can be copied and used freely without restrictions.  It can
875 # be used in projects which are not available under the GNU General Public
876 # License or the GNU Library General Public License but which still want
877 # to provide support for the GNU gettext functionality.
878 # Please note that the actual code of the GNU gettext library is covered
879 # by the GNU Library General Public License, and the rest of the GNU
880 # gettext package package is covered by the GNU General Public License.
881 # They are *not* in the public domain.
882
883 # serial 2
884
885 dnl MUTT_AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
886 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
887 AC_DEFUN([MUTT_AM_PATH_PROG_WITH_TEST],
888 [# Extract the first word of "$2", so it can be a program name with args.
889 set dummy $2; ac_word=[$]2
890 AC_MSG_CHECKING([for $ac_word])
891 AC_CACHE_VAL(ac_cv_path_$1,
892 [case "[$]$1" in
893   /*)
894   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
895   ;;
896   *)
897   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
898   for ac_dir in ifelse([$5], , $PATH, [$5]); do
899     test -z "$ac_dir" && ac_dir=.
900     if test -f $ac_dir/$ac_word; then
901       if [$3]; then
902         ac_cv_path_$1="$ac_dir/$ac_word"
903         break
904       fi
905     fi
906   done
907   IFS="$ac_save_ifs"
908 dnl If no 4th arg is given, leave the cache variable unset,
909 dnl so AC_PATH_PROGS will keep looking.
910 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
911 ])dnl
912   ;;
913 esac])dnl
914 $1="$ac_cv_path_$1"
915 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
916   AC_MSG_RESULT([$]$1)
917 else
918   AC_MSG_RESULT(no)
919 fi
920 AC_SUBST($1)dnl
921 ])
922
923 #serial 2
924
925 # Test for the GNU C Library, version 2.1 or newer.
926 # From Bruno Haible.
927
928 AC_DEFUN([jm_GLIBC21],
929   [
930     AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
931       ac_cv_gnu_library_2_1,
932       [AC_EGREP_CPP([Lucky GNU user],
933         [
934 #include <features.h>
935 #ifdef __GNU_LIBRARY__
936  #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
937   Lucky GNU user
938  #endif
939 #endif
940         ],
941         ac_cv_gnu_library_2_1=yes,
942         ac_cv_gnu_library_2_1=no)
943       ]
944     )
945     AC_SUBST(GLIBC21)
946     GLIBC21="$ac_cv_gnu_library_2_1"
947   ]
948 )
949
950 #serial AM2
951
952 dnl From Bruno Haible.
953
954 AC_DEFUN([MUTT_AM_ICONV],
955 [
956   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
957   dnl those with the standalone portable GNU libiconv installed).
958
959   AC_ARG_WITH([libiconv-prefix],
960 [  --with-libiconv-prefix=DIR Search for libiconv in DIR/include and DIR/lib], [
961     for dir in `echo "$withval" | tr : ' '`; do
962       if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
963       if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
964     done
965    ])
966
967   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
968     am_cv_func_iconv="no, consider installing GNU libiconv"
969     am_cv_lib_iconv=no
970     AC_TRY_LINK([#include <stdlib.h>
971 #include <iconv.h>],
972       [iconv_t cd = iconv_open("","");
973        iconv(cd,NULL,NULL,NULL,NULL);
974        iconv_close(cd);],
975       am_cv_func_iconv=yes)
976     if test "$am_cv_func_iconv" != yes; then
977       am_save_LIBS="$LIBS"
978       LIBS="$LIBS -liconv"
979       AC_TRY_LINK([#include <stdlib.h>
980 #include <iconv.h>],
981         [iconv_t cd = iconv_open("","");
982          iconv(cd,NULL,NULL,NULL,NULL);
983          iconv_close(cd);],
984         am_cv_lib_iconv=yes
985         am_cv_func_iconv=yes)
986       LIBS="$am_save_LIBS"
987     fi
988   ])
989   if test "$am_cv_func_iconv" = yes; then
990     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
991     AC_MSG_CHECKING([for iconv declaration])
992     AC_CACHE_VAL(am_cv_proto_iconv, [
993       AC_TRY_COMPILE([
994 #include <stdlib.h>
995 #include <iconv.h>
996 extern
997 #ifdef __cplusplus
998 "C"
999 #endif
1000 #if defined(__STDC__) || defined(__cplusplus)
1001 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1002 #else
1003 size_t iconv();
1004 #endif
1005 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
1006       am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
1007     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
1008     AC_MSG_RESULT([$]{ac_t:-
1009          }[$]am_cv_proto_iconv)
1010     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
1011       [Define as const if the declaration of iconv() needs const.])
1012   fi
1013   LIBICONV=
1014   if test "$am_cv_lib_iconv" = yes; then
1015     LIBICONV="-liconv"
1016   fi
1017   AC_SUBST(LIBICONV)
1018 ])
1019
1020 #serial AM1
1021
1022 dnl From Bruno Haible.
1023
1024 AC_DEFUN([MUTT_AM_LANGINFO_CODESET],
1025 [
1026   AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
1027     [AC_TRY_LINK([#include <langinfo.h>],
1028       [char* cs = nl_langinfo(CODESET);],
1029       am_cv_langinfo_codeset=yes,
1030       am_cv_langinfo_codeset=no)
1031     ])
1032   if test $am_cv_langinfo_codeset = yes; then
1033     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
1034       [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
1035   fi
1036 ])
1037
1038 # Check whether LC_MESSAGES is available in <locale.h>.
1039 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1040 #
1041 # This file can be copied and used freely without restrictions.  It can
1042 # be used in projects which are not available under the GNU General Public
1043 # License or the GNU Library General Public License but which still want
1044 # to provide support for the GNU gettext functionality.
1045 # Please note that the actual code of the GNU gettext library is covered
1046 # by the GNU Library General Public License, and the rest of the GNU
1047 # gettext package package is covered by the GNU General Public License.
1048 # They are *not* in the public domain.
1049
1050 # serial 2
1051
1052 AC_DEFUN([MUTT_AM_LC_MESSAGES],
1053   [if test $ac_cv_header_locale_h = yes; then
1054     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1055       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1056        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1057     if test $am_cv_val_LC_MESSAGES = yes; then
1058       AC_DEFINE(HAVE_LC_MESSAGES, 1,
1059         [Define if your <locale.h> file defines LC_MESSAGES.])
1060     fi
1061   fi])
1062
1063 #serial 2
1064
1065 # Test for the GNU C Library, version 2.1 or newer.
1066 # From Bruno Haible.
1067
1068 AC_DEFUN([MUTT_jm_GLIBC21],
1069   [
1070     AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
1071       ac_cv_gnu_library_2_1,
1072       [AC_EGREP_CPP([Lucky GNU user],
1073         [
1074 #include <features.h>
1075 #ifdef __GNU_LIBRARY__
1076  #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
1077   Lucky GNU user
1078  #endif
1079 #endif
1080         ],
1081         ac_cv_gnu_library_2_1=yes,
1082         ac_cv_gnu_library_2_1=no)
1083       ]
1084     )
1085     AC_SUBST(GLIBC21)
1086     GLIBC21="$ac_cv_gnu_library_2_1"
1087   ]
1088 )
1089
1090 dnl vim:ft=config:
1091
1092 dnl Search for libesmtp, by Steven Engelhardt <sengelha@yahoo.com>
1093 dnl
1094 dnl libesmtp often requires linking against -lpthread or -lc_r (BSD).
1095 dnl This macro attempts to centralize this code.
1096
1097 AC_DEFUN([MUTT_AM_LIBESMTP],
1098 [
1099   AC_ARG_WITH(
1100     [libesmtp],
1101     [  --with-libesmtp=DIR      Compile in support for libesmtp for the MTA],
1102     [ if test "$with_libesmtp" != "no"
1103       then
1104         mutt_libesmtp_check_path="$PATH"
1105
1106         if test "$with_libesmtp" != "yes"
1107         then
1108           mutt_libesmtp_check_path="$tmp_path:$withval/bin"
1109         fi
1110
1111         dnl 1. Find libesmtp-config
1112         AC_PATH_PROG([mutt_libesmtp_config_path],
1113                      [libesmtp-config],
1114                      [no],
1115                      [$mutt_libesmtp_check_path])
1116
1117         if test "$mutt_libesmtp_config_path" = "no"
1118         then
1119           AC_MSG_ERROR([libesmtp-config binary not found.])
1120         fi
1121
1122         dnl 2. Get CFLAGS and LIBS from libesmtp-config
1123         mutt_libesmtp_cflags=`$mutt_libesmtp_config_path --cflags`
1124         mutt_libesmtp_libs=`$mutt_libesmtp_config_path --libs`
1125
1126         dnl 3. Verify libesmtp.h can be found with these settings
1127         temp_CFLAGS="$CFLAGS"
1128         CFLAGS="$CFLAGS $mutt_libesmtp_cflags"
1129         AC_CHECK_HEADER([libesmtp.h],
1130                         [],
1131                         AC_MSG_ERROR([Could not find libesmtp.h]))
1132         CFLAGS="$temp_CFLAGS"
1133
1134         dnl 4. Verify the libesmtp library can be linked in
1135         temp_CFLAGS="$CFLAGS"
1136         temp_LIBS="$LIBS"
1137         CFLAGS="$CFLAGS $mutt_libesmtp_cflags"
1138         LIBS="$LIBS $mutt_libesmtp_libs"
1139         AC_CHECK_LIB([esmtp],
1140                      [smtp_create_session],
1141                      [],
1142                      AC_MSG_ERROR([Could not find libesmtp]))
1143         CFLAGS="$temp_CFLAGS"
1144         LIBS="$temp_LIBS"
1145
1146         dnl 5. Export use_libesmtp variable so configure.in can
1147         dnl    act accordingly.
1148         use_libesmtp=yes
1149       fi
1150     ]
1151   )
1152 ])
1153