Rocco Rutte
[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 # lib-prefix.m4 serial 3 (gettext-0.13)
14 dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
15 dnl This file is free software, distributed under the terms of the GNU
16 dnl General Public License.  As a special exception to the GNU General
17 dnl Public License, this file may be distributed as part of a program
18 dnl that contains a configuration script generated by Autoconf, under
19 dnl the same distribution terms as the rest of that program.
20
21 dnl From Bruno Haible.
22
23 dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
24 dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
25 dnl require excessive bracketing.
26 ifdef([AC_HELP_STRING],
27 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
28 [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
29
30 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
31 dnl to access previously installed libraries. The basic assumption is that
32 dnl a user will want packages to use other packages he previously installed
33 dnl with the same --prefix option.
34 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
35 dnl libraries, but is otherwise very convenient.
36 AC_DEFUN([AC_LIB_PREFIX],
37 [
38   AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
39   AC_REQUIRE([AC_PROG_CC])
40   AC_REQUIRE([AC_CANONICAL_HOST])
41   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
42   dnl By default, look in $includedir and $libdir.
43   use_additional=yes
44   AC_LIB_WITH_FINAL_PREFIX([
45     eval additional_includedir=\"$includedir\"
46     eval additional_libdir=\"$libdir\"
47   ])
48   AC_LIB_ARG_WITH([lib-prefix],
49 [  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
50   --without-lib-prefix    don't search for libraries in includedir and libdir],
51 [
52     if test "X$withval" = "Xno"; then
53       use_additional=no
54     else
55       if test "X$withval" = "X"; then
56         AC_LIB_WITH_FINAL_PREFIX([
57           eval additional_includedir=\"$includedir\"
58           eval additional_libdir=\"$libdir\"
59         ])
60       else
61         additional_includedir="$withval/include"
62         additional_libdir="$withval/lib"
63       fi
64     fi
65 ])
66   if test $use_additional = yes; then
67     dnl Potentially add $additional_includedir to $CPPFLAGS.
68     dnl But don't add it
69     dnl   1. if it's the standard /usr/include,
70     dnl   2. if it's already present in $CPPFLAGS,
71     dnl   3. if it's /usr/local/include and we are using GCC on Linux,
72     dnl   4. if it doesn't exist as a directory.
73     if test "X$additional_includedir" != "X/usr/include"; then
74       haveit=
75       for x in $CPPFLAGS; do
76         AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
77         if test "X$x" = "X-I$additional_includedir"; then
78           haveit=yes
79           break
80         fi
81       done
82       if test -z "$haveit"; then
83         if test "X$additional_includedir" = "X/usr/local/include"; then
84           if test -n "$GCC"; then
85             case $host_os in
86               linux*) haveit=yes;;
87             esac
88           fi
89         fi
90         if test -z "$haveit"; then
91           if test -d "$additional_includedir"; then
92             dnl Really add $additional_includedir to $CPPFLAGS.
93             CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
94           fi
95         fi
96       fi
97     fi
98     dnl Potentially add $additional_libdir to $LDFLAGS.
99     dnl But don't add it
100     dnl   1. if it's the standard /usr/lib,
101     dnl   2. if it's already present in $LDFLAGS,
102     dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
103     dnl   4. if it doesn't exist as a directory.
104     if test "X$additional_libdir" != "X/usr/lib"; then
105       haveit=
106       for x in $LDFLAGS; do
107         AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
108         if test "X$x" = "X-L$additional_libdir"; then
109           haveit=yes
110           break
111         fi
112       done
113       if test -z "$haveit"; then
114         if test "X$additional_libdir" = "X/usr/local/lib"; then
115           if test -n "$GCC"; then
116             case $host_os in
117               linux*) haveit=yes;;
118             esac
119           fi
120         fi
121         if test -z "$haveit"; then
122           if test -d "$additional_libdir"; then
123             dnl Really add $additional_libdir to $LDFLAGS.
124             LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
125           fi
126         fi
127       fi
128     fi
129   fi
130 ])
131
132 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
133 dnl acl_final_exec_prefix, containing the values to which $prefix and
134 dnl $exec_prefix will expand at the end of the configure script.
135 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
136 [
137   dnl Unfortunately, prefix and exec_prefix get only finally determined
138   dnl at the end of configure.
139   if test "X$prefix" = "XNONE"; then
140     acl_final_prefix="$ac_default_prefix"
141   else
142     acl_final_prefix="$prefix"
143   fi
144   if test "X$exec_prefix" = "XNONE"; then
145     acl_final_exec_prefix='${prefix}'
146   else
147     acl_final_exec_prefix="$exec_prefix"
148   fi
149   acl_save_prefix="$prefix"
150   prefix="$acl_final_prefix"
151   eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
152   prefix="$acl_save_prefix"
153 ])
154
155 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
156 dnl variables prefix and exec_prefix bound to the values they will have
157 dnl at the end of the configure script.
158 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
159 [
160   acl_save_prefix="$prefix"
161   prefix="$acl_final_prefix"
162   acl_save_exec_prefix="$exec_prefix"
163   exec_prefix="$acl_final_exec_prefix"
164   $1
165   exec_prefix="$acl_save_exec_prefix"
166   prefix="$acl_save_prefix"
167 ])
168
169 # lib-link.m4 serial 4 (gettext-0.12)
170 dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
171 dnl This file is free software, distributed under the terms of the GNU
172 dnl General Public License.  As a special exception to the GNU General
173 dnl Public License, this file may be distributed as part of a program
174 dnl that contains a configuration script generated by Autoconf, under
175 dnl the same distribution terms as the rest of that program.
176
177 dnl From Bruno Haible.
178
179 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
180 dnl the libraries corresponding to explicit and implicit dependencies.
181 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
182 dnl augments the CPPFLAGS variable.
183 AC_DEFUN([AC_LIB_LINKFLAGS],
184 [
185   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
186   AC_REQUIRE([AC_LIB_RPATH])
187   define([Name],[translit([$1],[./-], [___])])
188   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
189                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
190   AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
191     AC_LIB_LINKFLAGS_BODY([$1], [$2])
192     ac_cv_lib[]Name[]_libs="$LIB[]NAME"
193     ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
194     ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
195   ])
196   LIB[]NAME="$ac_cv_lib[]Name[]_libs"
197   LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
198   INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
199   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
200   AC_SUBST([LIB]NAME)
201   AC_SUBST([LTLIB]NAME)
202   dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
203   dnl results of this search when this library appears as a dependency.
204   HAVE_LIB[]NAME=yes
205   undefine([Name])
206   undefine([NAME])
207 ])
208
209 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
210 dnl searches for libname and the libraries corresponding to explicit and
211 dnl implicit dependencies, together with the specified include files and
212 dnl the ability to compile and link the specified testcode. If found, it
213 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
214 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
215 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
216 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
217 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
218 [
219   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
220   AC_REQUIRE([AC_LIB_RPATH])
221   define([Name],[translit([$1],[./-], [___])])
222   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
223                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
224
225   dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
226   dnl accordingly.
227   AC_LIB_LINKFLAGS_BODY([$1], [$2])
228
229   dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
230   dnl because if the user has installed lib[]Name and not disabled its use
231   dnl via --without-lib[]Name-prefix, he wants to use it.
232   ac_save_CPPFLAGS="$CPPFLAGS"
233   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
234
235   AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
236     ac_save_LIBS="$LIBS"
237     LIBS="$LIBS $LIB[]NAME"
238     AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
239     LIBS="$ac_save_LIBS"
240   ])
241   if test "$ac_cv_lib[]Name" = yes; then
242     HAVE_LIB[]NAME=yes
243     AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
244     AC_MSG_CHECKING([how to link with lib[]$1])
245     AC_MSG_RESULT([$LIB[]NAME])
246   else
247     HAVE_LIB[]NAME=no
248     dnl If $LIB[]NAME didn't lead to a usable library, we don't need
249     dnl $INC[]NAME either.
250     CPPFLAGS="$ac_save_CPPFLAGS"
251     LIB[]NAME=
252     LTLIB[]NAME=
253   fi
254   AC_SUBST([HAVE_LIB]NAME)
255   AC_SUBST([LIB]NAME)
256   AC_SUBST([LTLIB]NAME)
257   undefine([Name])
258   undefine([NAME])
259 ])
260
261 dnl Determine the platform dependent parameters needed to use rpath:
262 dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
263 dnl hardcode_direct, hardcode_minus_L.
264 AC_DEFUN([AC_LIB_RPATH],
265 [
266   AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
267   AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
268   AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
269   AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
270   AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
271     CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
272     ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
273     . ./conftest.sh
274     rm -f ./conftest.sh
275     acl_cv_rpath=done
276   ])
277   wl="$acl_cv_wl"
278   libext="$acl_cv_libext"
279   shlibext="$acl_cv_shlibext"
280   hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
281   hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
282   hardcode_direct="$acl_cv_hardcode_direct"
283   hardcode_minus_L="$acl_cv_hardcode_minus_L"
284   dnl Determine whether the user wants rpath handling at all.
285   AC_ARG_ENABLE(rpath,
286     [  --disable-rpath         do not hardcode runtime library paths],
287     :, enable_rpath=yes)
288 ])
289
290 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
291 dnl the libraries corresponding to explicit and implicit dependencies.
292 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
293 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
294 [
295   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
296                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
297   dnl By default, look in $includedir and $libdir.
298   use_additional=yes
299   AC_LIB_WITH_FINAL_PREFIX([
300     eval additional_includedir=\"$includedir\"
301     eval additional_libdir=\"$libdir\"
302   ])
303   AC_LIB_ARG_WITH([lib$1-prefix],
304 [  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
305   --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
306 [
307     if test "X$withval" = "Xno"; then
308       use_additional=no
309     else
310       if test "X$withval" = "X"; then
311         AC_LIB_WITH_FINAL_PREFIX([
312           eval additional_includedir=\"$includedir\"
313           eval additional_libdir=\"$libdir\"
314         ])
315       else
316         additional_includedir="$withval/include"
317         additional_libdir="$withval/lib"
318       fi
319     fi
320 ])
321   dnl Search the library and its dependencies in $additional_libdir and
322   dnl $LDFLAGS. Using breadth-first-seach.
323   LIB[]NAME=
324   LTLIB[]NAME=
325   INC[]NAME=
326   rpathdirs=
327   ltrpathdirs=
328   names_already_handled=
329   names_next_round='$1 $2'
330   while test -n "$names_next_round"; do
331     names_this_round="$names_next_round"
332     names_next_round=
333     for name in $names_this_round; do
334       already_handled=
335       for n in $names_already_handled; do
336         if test "$n" = "$name"; then
337           already_handled=yes
338           break
339         fi
340       done
341       if test -z "$already_handled"; then
342         names_already_handled="$names_already_handled $name"
343         dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
344         dnl or AC_LIB_HAVE_LINKFLAGS call.
345         uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
346         eval value=\"\$HAVE_LIB$uppername\"
347         if test -n "$value"; then
348           if test "$value" = yes; then
349             eval value=\"\$LIB$uppername\"
350             test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
351             eval value=\"\$LTLIB$uppername\"
352             test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
353           else
354             dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
355             dnl that this library doesn't exist. So just drop it.
356             :
357           fi
358         else
359           dnl Search the library lib$name in $additional_libdir and $LDFLAGS
360           dnl and the already constructed $LIBNAME/$LTLIBNAME.
361           found_dir=
362           found_la=
363           found_so=
364           found_a=
365           if test $use_additional = yes; then
366             if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
367               found_dir="$additional_libdir"
368               found_so="$additional_libdir/lib$name.$shlibext"
369               if test -f "$additional_libdir/lib$name.la"; then
370                 found_la="$additional_libdir/lib$name.la"
371               fi
372             else
373               if test -f "$additional_libdir/lib$name.$libext"; then
374                 found_dir="$additional_libdir"
375                 found_a="$additional_libdir/lib$name.$libext"
376                 if test -f "$additional_libdir/lib$name.la"; then
377                   found_la="$additional_libdir/lib$name.la"
378                 fi
379               fi
380             fi
381           fi
382           if test "X$found_dir" = "X"; then
383             for x in $LDFLAGS $LTLIB[]NAME; do
384               AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
385               case "$x" in
386                 -L*)
387                   dir=`echo "X$x" | sed -e 's/^X-L//'`
388                   if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
389                     found_dir="$dir"
390                     found_so="$dir/lib$name.$shlibext"
391                     if test -f "$dir/lib$name.la"; then
392                       found_la="$dir/lib$name.la"
393                     fi
394                   else
395                     if test -f "$dir/lib$name.$libext"; then
396                       found_dir="$dir"
397                       found_a="$dir/lib$name.$libext"
398                       if test -f "$dir/lib$name.la"; then
399                         found_la="$dir/lib$name.la"
400                       fi
401                     fi
402                   fi
403                   ;;
404               esac
405               if test "X$found_dir" != "X"; then
406                 break
407               fi
408             done
409           fi
410           if test "X$found_dir" != "X"; then
411             dnl Found the library.
412             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
413             if test "X$found_so" != "X"; then
414               dnl Linking with a shared library. We attempt to hardcode its
415               dnl directory into the executable's runpath, unless it's the
416               dnl standard /usr/lib.
417               if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
418                 dnl No hardcoding is needed.
419                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
420               else
421                 dnl Use an explicit option to hardcode DIR into the resulting
422                 dnl binary.
423                 dnl Potentially add DIR to ltrpathdirs.
424                 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
425                 haveit=
426                 for x in $ltrpathdirs; do
427                   if test "X$x" = "X$found_dir"; then
428                     haveit=yes
429                     break
430                   fi
431                 done
432                 if test -z "$haveit"; then
433                   ltrpathdirs="$ltrpathdirs $found_dir"
434                 fi
435                 dnl The hardcoding into $LIBNAME is system dependent.
436                 if test "$hardcode_direct" = yes; then
437                   dnl Using DIR/libNAME.so during linking hardcodes DIR into the
438                   dnl resulting binary.
439                   LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
440                 else
441                   if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
442                     dnl Use an explicit option to hardcode DIR into the resulting
443                     dnl binary.
444                     LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
445                     dnl Potentially add DIR to rpathdirs.
446                     dnl The rpathdirs will be appended to $LIBNAME at the end.
447                     haveit=
448                     for x in $rpathdirs; do
449                       if test "X$x" = "X$found_dir"; then
450                         haveit=yes
451                         break
452                       fi
453                     done
454                     if test -z "$haveit"; then
455                       rpathdirs="$rpathdirs $found_dir"
456                     fi
457                   else
458                     dnl Rely on "-L$found_dir".
459                     dnl But don't add it if it's already contained in the LDFLAGS
460                     dnl or the already constructed $LIBNAME
461                     haveit=
462                     for x in $LDFLAGS $LIB[]NAME; do
463                       AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
464                       if test "X$x" = "X-L$found_dir"; then
465                         haveit=yes
466                         break
467                       fi
468                     done
469                     if test -z "$haveit"; then
470                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
471                     fi
472                     if test "$hardcode_minus_L" != no; then
473                       dnl FIXME: Not sure whether we should use
474                       dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
475                       dnl here.
476                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
477                     else
478                       dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
479                       dnl here, because this doesn't fit in flags passed to the
480                       dnl compiler. So give up. No hardcoding. This affects only
481                       dnl very old systems.
482                       dnl FIXME: Not sure whether we should use
483                       dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
484                       dnl here.
485                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
486                     fi
487                   fi
488                 fi
489               fi
490             else
491               if test "X$found_a" != "X"; then
492                 dnl Linking with a static library.
493                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
494               else
495                 dnl We shouldn't come here, but anyway it's good to have a
496                 dnl fallback.
497                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
498               fi
499             fi
500             dnl Assume the include files are nearby.
501             additional_includedir=
502             case "$found_dir" in
503               */lib | */lib/)
504                 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
505                 additional_includedir="$basedir/include"
506                 ;;
507             esac
508             if test "X$additional_includedir" != "X"; then
509               dnl Potentially add $additional_includedir to $INCNAME.
510               dnl But don't add it
511               dnl   1. if it's the standard /usr/include,
512               dnl   2. if it's /usr/local/include and we are using GCC on Linux,
513               dnl   3. if it's already present in $CPPFLAGS or the already
514               dnl      constructed $INCNAME,
515               dnl   4. if it doesn't exist as a directory.
516               if test "X$additional_includedir" != "X/usr/include"; then
517                 haveit=
518                 if test "X$additional_includedir" = "X/usr/local/include"; then
519                   if test -n "$GCC"; then
520                     case $host_os in
521                       linux*) haveit=yes;;
522                     esac
523                   fi
524                 fi
525                 if test -z "$haveit"; then
526                   for x in $CPPFLAGS $INC[]NAME; do
527                     AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
528                     if test "X$x" = "X-I$additional_includedir"; then
529                       haveit=yes
530                       break
531                     fi
532                   done
533                   if test -z "$haveit"; then
534                     if test -d "$additional_includedir"; then
535                       dnl Really add $additional_includedir to $INCNAME.
536                       INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
537                     fi
538                   fi
539                 fi
540               fi
541             fi
542             dnl Look for dependencies.
543             if test -n "$found_la"; then
544               dnl Read the .la file. It defines the variables
545               dnl dlname, library_names, old_library, dependency_libs, current,
546               dnl age, revision, installed, dlopen, dlpreopen, libdir.
547               save_libdir="$libdir"
548               case "$found_la" in
549                 */* | *\\*) . "$found_la" ;;
550                 *) . "./$found_la" ;;
551               esac
552               libdir="$save_libdir"
553               dnl We use only dependency_libs.
554               for dep in $dependency_libs; do
555                 case "$dep" in
556                   -L*)
557                     additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
558                     dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
559                     dnl But don't add it
560                     dnl   1. if it's the standard /usr/lib,
561                     dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
562                     dnl   3. if it's already present in $LDFLAGS or the already
563                     dnl      constructed $LIBNAME,
564                     dnl   4. if it doesn't exist as a directory.
565                     if test "X$additional_libdir" != "X/usr/lib"; then
566                       haveit=
567                       if test "X$additional_libdir" = "X/usr/local/lib"; then
568                         if test -n "$GCC"; then
569                           case $host_os in
570                             linux*) haveit=yes;;
571                           esac
572                         fi
573                       fi
574                       if test -z "$haveit"; then
575                         haveit=
576                         for x in $LDFLAGS $LIB[]NAME; do
577                           AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
578                           if test "X$x" = "X-L$additional_libdir"; then
579                             haveit=yes
580                             break
581                           fi
582                         done
583                         if test -z "$haveit"; then
584                           if test -d "$additional_libdir"; then
585                             dnl Really add $additional_libdir to $LIBNAME.
586                             LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
587                           fi
588                         fi
589                         haveit=
590                         for x in $LDFLAGS $LTLIB[]NAME; do
591                           AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
592                           if test "X$x" = "X-L$additional_libdir"; then
593                             haveit=yes
594                             break
595                           fi
596                         done
597                         if test -z "$haveit"; then
598                           if test -d "$additional_libdir"; then
599                             dnl Really add $additional_libdir to $LTLIBNAME.
600                             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
601                           fi
602                         fi
603                       fi
604                     fi
605                     ;;
606                   -R*)
607                     dir=`echo "X$dep" | sed -e 's/^X-R//'`
608                     if test "$enable_rpath" != no; then
609                       dnl Potentially add DIR to rpathdirs.
610                       dnl The rpathdirs will be appended to $LIBNAME at the end.
611                       haveit=
612                       for x in $rpathdirs; do
613                         if test "X$x" = "X$dir"; then
614                           haveit=yes
615                           break
616                         fi
617                       done
618                       if test -z "$haveit"; then
619                         rpathdirs="$rpathdirs $dir"
620                       fi
621                       dnl Potentially add DIR to ltrpathdirs.
622                       dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
623                       haveit=
624                       for x in $ltrpathdirs; do
625                         if test "X$x" = "X$dir"; then
626                           haveit=yes
627                           break
628                         fi
629                       done
630                       if test -z "$haveit"; then
631                         ltrpathdirs="$ltrpathdirs $dir"
632                       fi
633                     fi
634                     ;;
635                   -l*)
636                     dnl Handle this in the next round.
637                     names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
638                     ;;
639                   *.la)
640                     dnl Handle this in the next round. Throw away the .la's
641                     dnl directory; it is already contained in a preceding -L
642                     dnl option.
643                     names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
644                     ;;
645                   *)
646                     dnl Most likely an immediate library name.
647                     LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
648                     LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
649                     ;;
650                 esac
651               done
652             fi
653           else
654             dnl Didn't find the library; assume it is in the system directories
655             dnl known to the linker and runtime loader. (All the system
656             dnl directories known to the linker should also be known to the
657             dnl runtime loader, otherwise the system is severely misconfigured.)
658             LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
659             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
660           fi
661         fi
662       fi
663     done
664   done
665   if test "X$rpathdirs" != "X"; then
666     if test -n "$hardcode_libdir_separator"; then
667       dnl Weird platform: only the last -rpath option counts, the user must
668       dnl pass all path elements in one option. We can arrange that for a
669       dnl single library, but not when more than one $LIBNAMEs are used.
670       alldirs=
671       for found_dir in $rpathdirs; do
672         alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
673       done
674       dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
675       acl_save_libdir="$libdir"
676       libdir="$alldirs"
677       eval flag=\"$hardcode_libdir_flag_spec\"
678       libdir="$acl_save_libdir"
679       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
680     else
681       dnl The -rpath options are cumulative.
682       for found_dir in $rpathdirs; do
683         acl_save_libdir="$libdir"
684         libdir="$found_dir"
685         eval flag=\"$hardcode_libdir_flag_spec\"
686         libdir="$acl_save_libdir"
687         LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
688       done
689     fi
690   fi
691   if test "X$ltrpathdirs" != "X"; then
692     dnl When using libtool, the option that works for both libraries and
693     dnl executables is -R. The -R options are cumulative.
694     for found_dir in $ltrpathdirs; do
695       LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
696     done
697   fi
698 ])
699
700 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
701 dnl unless already present in VAR.
702 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
703 dnl contains two or three consecutive elements that belong together.
704 AC_DEFUN([AC_LIB_APPENDTOVAR],
705 [
706   for element in [$2]; do
707     haveit=
708     for x in $[$1]; do
709       AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
710       if test "X$x" = "X$element"; then
711         haveit=yes
712         break
713       fi
714     done
715     if test -z "$haveit"; then
716       [$1]="${[$1]}${[$1]:+ }$element"
717     fi
718   done
719 ])
720
721 # lib-ld.m4 serial 3 (gettext-0.13)
722 dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
723 dnl This file is free software, distributed under the terms of the GNU
724 dnl General Public License.  As a special exception to the GNU General
725 dnl Public License, this file may be distributed as part of a program
726 dnl that contains a configuration script generated by Autoconf, under
727 dnl the same distribution terms as the rest of that program.
728
729 dnl Subroutines of libtool.m4,
730 dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
731 dnl with libtool.m4.
732
733 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
734 AC_DEFUN([AC_LIB_PROG_LD_GNU],
735 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
736 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
737 case `$LD -v 2>&1 </dev/null` in
738 *GNU* | *'with BFD'*)
739   acl_cv_prog_gnu_ld=yes ;;
740 *)
741   acl_cv_prog_gnu_ld=no ;;
742 esac])
743 with_gnu_ld=$acl_cv_prog_gnu_ld
744 ])
745
746 dnl From libtool-1.4. Sets the variable LD.
747 AC_DEFUN([AC_LIB_PROG_LD],
748 [AC_ARG_WITH(gnu-ld,
749 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
750 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
751 AC_REQUIRE([AC_PROG_CC])dnl
752 AC_REQUIRE([AC_CANONICAL_HOST])dnl
753 # Prepare PATH_SEPARATOR.
754 # The user is always right.
755 if test "${PATH_SEPARATOR+set}" != set; then
756   echo "#! /bin/sh" >conf$$.sh
757   echo  "exit 0"   >>conf$$.sh
758   chmod +x conf$$.sh
759   if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
760     PATH_SEPARATOR=';'
761   else
762     PATH_SEPARATOR=:
763   fi
764   rm -f conf$$.sh
765 fi
766 ac_prog=ld
767 if test "$GCC" = yes; then
768   # Check if gcc -print-prog-name=ld gives a path.
769   AC_MSG_CHECKING([for ld used by GCC])
770   case $host in
771   *-*-mingw*)
772     # gcc leaves a trailing carriage return which upsets mingw
773     ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
774   *)
775     ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
776   esac
777   case $ac_prog in
778     # Accept absolute paths.
779     [[\\/]* | [A-Za-z]:[\\/]*)]
780       [re_direlt='/[^/][^/]*/\.\./']
781       # Canonicalize the path of ld
782       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
783       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
784         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
785       done
786       test -z "$LD" && LD="$ac_prog"
787       ;;
788   "")
789     # If it fails, then pretend we aren't using GCC.
790     ac_prog=ld
791     ;;
792   *)
793     # If it is relative, then search for the first ld in PATH.
794     with_gnu_ld=unknown
795     ;;
796   esac
797 elif test "$with_gnu_ld" = yes; then
798   AC_MSG_CHECKING([for GNU ld])
799 else
800   AC_MSG_CHECKING([for non-GNU ld])
801 fi
802 AC_CACHE_VAL(acl_cv_path_LD,
803 [if test -z "$LD"; then
804   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
805   for ac_dir in $PATH; do
806     test -z "$ac_dir" && ac_dir=.
807     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
808       acl_cv_path_LD="$ac_dir/$ac_prog"
809       # Check to see if the program is GNU ld.  I'd rather use --version,
810       # but apparently some GNU ld's only accept -v.
811       # Break only if it was the GNU/non-GNU ld that we prefer.
812       case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
813       *GNU* | *'with BFD'*)
814         test "$with_gnu_ld" != no && break ;;
815       *)
816         test "$with_gnu_ld" != yes && break ;;
817       esac
818     fi
819   done
820   IFS="$ac_save_ifs"
821 else
822   acl_cv_path_LD="$LD" # Let the user override the test with a path.
823 fi])
824 LD="$acl_cv_path_LD"
825 if test -n "$LD"; then
826   AC_MSG_RESULT($LD)
827 else
828   AC_MSG_RESULT(no)
829 fi
830 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
831 AC_LIB_PROG_LD_GNU
832 ])
833
834 # Like AC_CONFIG_HEADER, but automatically create stamp file.
835
836 AC_DEFUN(AM_CONFIG_HEADER,
837 [AC_PREREQ([2.12])
838 AC_CONFIG_HEADER([$1])
839 dnl When config.status generates a header, we must update the stamp-h file.
840 dnl This file resides in the same directory as the config header
841 dnl that is generated.  We must strip everything past the first ":",
842 dnl and everything past the last "/".
843 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
844 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
845 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
846 <<am_indx=1
847 for am_file in <<$1>>; do
848   case " <<$>>CONFIG_HEADERS " in
849   *" <<$>>am_file "*<<)>>
850     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
851     ;;
852   esac
853   am_indx=`expr "<<$>>am_indx" + 1`
854 done<<>>dnl>>)
855 changequote([,]))])
856
857 # Do all the work for Automake.  This macro actually does too much --
858 # some checks are only needed if your package does certain things.
859 # But this isn't really a big deal.
860
861 # serial 1
862
863 dnl Usage:
864 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
865
866 AC_DEFUN(AM_INIT_AUTOMAKE,
867 [AC_REQUIRE([AC_PROG_INSTALL])
868 PACKAGE=[$1]
869 AC_SUBST(PACKAGE)
870 VERSION=[$2]
871 AC_SUBST(VERSION)
872 dnl test to see if srcdir already configured
873 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
874   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
875 fi
876 ifelse([$3],,
877 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
878 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
879 AC_REQUIRE([AM_SANITY_CHECK])
880 AC_REQUIRE([AC_ARG_PROGRAM])
881 dnl FIXME This is truly gross.
882 missing_dir=`cd $ac_aux_dir && pwd`
883 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
884 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
885 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
886 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
887 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
888 AC_REQUIRE([AC_PROG_MAKE_SET])])
889
890 #
891 # Check to make sure that the build environment is sane.
892 #
893
894 AC_DEFUN(AM_SANITY_CHECK,
895 [AC_MSG_CHECKING([whether build environment is sane])
896 # Just in case
897 sleep 1
898 echo timestamp > conftestfile
899 # Do `set' in a subshell so we don't clobber the current shell's
900 # arguments.  Must try -L first in case configure is actually a
901 # symlink; some systems play weird games with the mod time of symlinks
902 # (eg FreeBSD returns the mod time of the symlink's containing
903 # directory).
904 if (
905    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
906    if test "[$]*" = "X"; then
907       # -L didn't work.
908       set X `ls -t $srcdir/configure conftestfile`
909    fi
910    if test "[$]*" != "X $srcdir/configure conftestfile" \
911       && test "[$]*" != "X conftestfile $srcdir/configure"; then
912
913       # If neither matched, then we have a broken ls.  This can happen
914       # if, for instance, CONFIG_SHELL is bash and it inherits a
915       # broken ls alias from the environment.  This has actually
916       # happened.  Such a system could not be considered "sane".
917       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
918 alias in your environment])
919    fi
920
921    test "[$]2" = conftestfile
922    )
923 then
924    # Ok.
925    :
926 else
927    AC_MSG_ERROR([newly created file is older than distributed files!
928 Check your system clock])
929 fi
930 rm -f conftest*
931 AC_MSG_RESULT(yes)])
932
933 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
934 dnl The program must properly implement --version.
935 AC_DEFUN(AM_MISSING_PROG,
936 [AC_MSG_CHECKING(for working $2)
937 # Run test in a subshell; some versions of sh will print an error if
938 # an executable is not found, even if stderr is redirected.
939 # Redirect stdin to placate older versions of autoconf.  Sigh.
940 if ($2 --version) < /dev/null > /dev/null 2>&1; then
941    $1=$2
942    AC_MSG_RESULT(found)
943 else
944    $1="$3/missing $2"
945    AC_MSG_RESULT(missing)
946 fi
947 AC_SUBST($1)])
948
949 # isc-posix.m4 serial 2 (gettext-0.11.2)
950 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
951 dnl This file is free software, distributed under the terms of the GNU
952 dnl General Public License.  As a special exception to the GNU General
953 dnl Public License, this file may be distributed as part of a program
954 dnl that contains a configuration script generated by Autoconf, under
955 dnl the same distribution terms as the rest of that program.
956
957 # This file is not needed with autoconf-2.53 and newer.  Remove it in 2005.
958
959 # This test replaces the one in autoconf.
960 # Currently this macro should have the same name as the autoconf macro
961 # because gettext's gettext.m4 (distributed in the automake package)
962 # still uses it.  Otherwise, the use in gettext.m4 makes autoheader
963 # give these diagnostics:
964 #   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
965 #   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
966
967 undefine([AC_ISC_POSIX])
968
969 AC_DEFUN([AC_ISC_POSIX],
970   [
971     dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
972     AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
973   ]
974 )
975
976
977 # serial 1
978
979 AC_DEFUN(AM_C_PROTOTYPES,
980 [AC_REQUIRE([AM_PROG_CC_STDC])
981 AC_REQUIRE([AC_PROG_CPP])
982 AC_MSG_CHECKING([for function prototypes])
983 if test "$am_cv_prog_cc_stdc" != no; then
984   AC_MSG_RESULT(yes)
985   AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
986   U= ANSI2KNR=
987 else
988   AC_MSG_RESULT(no)
989   U=_ ANSI2KNR=./ansi2knr
990   # Ensure some checks needed by ansi2knr itself.
991   AC_HEADER_STDC
992   AC_CHECK_HEADERS(string.h)
993 fi
994 AC_SUBST(U)dnl
995 AC_SUBST(ANSI2KNR)dnl
996 ])
997
998
999 # serial 1
1000
1001 # @defmac AC_PROG_CC_STDC
1002 # @maindex PROG_CC_STDC
1003 # @ovindex CC
1004 # If the C compiler in not in ANSI C mode by default, try to add an option
1005 # to output variable @code{CC} to make it so.  This macro tries various
1006 # options that select ANSI C on some system or another.  It considers the
1007 # compiler to be in ANSI C mode if it handles function prototypes correctly.
1008 #
1009 # If you use this macro, you should check after calling it whether the C
1010 # compiler has been set to accept ANSI C; if not, the shell variable
1011 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
1012 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
1013 # program @code{ansi2knr}, which comes with Ghostscript.
1014 # @end defmac
1015
1016 AC_DEFUN(AM_PROG_CC_STDC,
1017 [AC_REQUIRE([AC_PROG_CC])
1018 AC_BEFORE([$0], [AC_C_INLINE])
1019 AC_BEFORE([$0], [AC_C_CONST])
1020 dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
1021 dnl a magic option to avoid problems with ANSI preprocessor commands
1022 dnl like #elif.
1023 dnl FIXME: can't do this because then AC_AIX won't work due to a
1024 dnl circular dependency.
1025 dnl AC_BEFORE([$0], [AC_PROG_CPP])
1026 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
1027 AC_CACHE_VAL(am_cv_prog_cc_stdc,
1028 [am_cv_prog_cc_stdc=no
1029 ac_save_CC="$CC"
1030 # Don't try gcc -ansi; that turns off useful extensions and
1031 # breaks some systems' header files.
1032 # AIX                   -qlanglvl=ansi
1033 # Ultrix and OSF/1      -std1
1034 # HP-UX                 -Aa -D_HPUX_SOURCE
1035 # SVR4                  -Xc -D__EXTENSIONS__
1036 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
1037 do
1038   CC="$ac_save_CC $ac_arg"
1039   AC_TRY_COMPILE(
1040 [#include <stdarg.h>
1041 #include <stdio.h>
1042 #include <sys/types.h>
1043 #include <sys/stat.h>
1044 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
1045 struct buf { int x; };
1046 FILE * (*rcsopen) (struct buf *, struct stat *, int);
1047 static char *e (p, i)
1048      char **p;
1049      int i;
1050 {
1051   return p[i];
1052 }
1053 static char *f (char * (*g) (char **, int), char **p, ...)
1054 {
1055   char *s;
1056   va_list v;
1057   va_start (v,p);
1058   s = g (p, va_arg (v,int));
1059   va_end (v);
1060   return s;
1061 }
1062 int test (int i, double x);
1063 struct s1 {int (*f) (int a);};
1064 struct s2 {int (*f) (double a);};
1065 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
1066 int argc;
1067 char **argv;
1068 ], [
1069 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
1070 ],
1071 [am_cv_prog_cc_stdc="$ac_arg"; break])
1072 done
1073 CC="$ac_save_CC"
1074 ])
1075 if test -z "$am_cv_prog_cc_stdc"; then
1076   AC_MSG_RESULT([none needed])
1077 else
1078   AC_MSG_RESULT($am_cv_prog_cc_stdc)
1079 fi
1080 case "x$am_cv_prog_cc_stdc" in
1081   x|xno) ;;
1082   *) CC="$CC $am_cv_prog_cc_stdc" ;;
1083 esac
1084 ])
1085
1086 dnl types.m4
1087 dnl macros for type checks not covered by autoconf
1088
1089 dnl MUTT_C99_INTTYPES
1090 dnl Brendan Cully
1091 dnl
1092 # MUTT_C99_INTTYPES
1093 # Check for C99 integer type definitions, or define if missing
1094 AC_DEFUN([MUTT_C99_INTTYPES],
1095 [dnl
1096 AC_CHECK_HEADERS([inttypes.h])
1097 AC_CHECK_TYPE([uint32_t],
1098   [AC_DEFINE(HAVE_C99_INTTYPES, 1, [Define if you have the C99 integer types])],
1099   [AC_CHECK_SIZEOF(short)
1100    AC_CHECK_SIZEOF(int)
1101    AC_CHECK_SIZEOF(long)
1102    AC_CHECK_SIZEOF(long long)])
1103 AH_VERBATIM([X_HAVE_C99_INTTYPES],
1104   [#ifndef HAVE_C99_INTTYPES
1105 #  if SIZEOF_SHORT == 4
1106 typedef unsigned short uint32_t;
1107 #  elif SIZEOF_INT == 4
1108 typedef unsigned int uint32_t;
1109 #  elif SIZEOF_LONG == 4
1110 typedef unsigned long uint32_t;
1111 #  endif
1112 #  if SIZEOF_INT == 8
1113 typedef unsigned int uint64_t;
1114 #  elif SIZEOF_LONG == 8
1115 typedef unsigned long uint64_t;
1116 #  elif SIZEOF_LONG_LONG == 8
1117 typedef unsigned long long uint64_t;
1118 #  endif
1119 #endif
1120   ])
1121 ])
1122
1123 dnl ---------------------------------------------------------------------------
1124 dnl Look for the curses libraries.  Older curses implementations may require
1125 dnl termcap/termlib to be linked as well.
1126 AC_DEFUN([CF_CURSES_LIBS],[
1127 AC_CHECK_FUNC(initscr,,[
1128 case $host_os in #(vi
1129 freebsd*) #(vi
1130         AC_CHECK_LIB(mytinfo,tgoto,[LIBS="-lmytinfo $LIBS"])
1131         ;;
1132 hpux10.*|hpux11.*)
1133         AC_CHECK_LIB(cur_colr,initscr,[
1134                 LIBS="-lcur_colr $LIBS"
1135                 CFLAGS="-I/usr/include/curses_colr $CFLAGS"
1136                 ac_cv_func_initscr=yes
1137                 ],[
1138         AC_CHECK_LIB(Hcurses,initscr,[
1139                 # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
1140                 LIBS="-lHcurses $LIBS"
1141                 CFLAGS="-D__HP_CURSES -D_HP_CURSES $CFLAGS"
1142                 ac_cv_func_initscr=yes
1143                 ])])
1144         ;;
1145 linux*) # Suse Linux does not follow /usr/lib convention
1146         LIBS="$LIBS -L/lib"
1147         ;;
1148 esac
1149
1150 if test ".$With5lib" != ".no" ; then
1151 if test -d /usr/5lib ; then
1152         # SunOS 3.x or 4.x
1153         CPPFLAGS="$CPPFLAGS -I/usr/5include"
1154         LIBS="$LIBS -L/usr/5lib"
1155 fi
1156 fi
1157
1158 if test ".$ac_cv_func_initscr" != .yes ; then
1159         cf_save_LIBS="$LIBS"
1160         cf_term_lib=""
1161         cf_curs_lib=""
1162
1163         # Check for library containing tgoto.  Do this before curses library
1164         # because it may be needed to link the test-case for initscr.
1165         AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
1166                 for cf_term_lib in termcap termlib unknown
1167                 do
1168                         AC_CHECK_LIB($cf_term_lib,tgoto,[break])
1169                 done
1170         ])
1171
1172         # Check for library containing initscr
1173         test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
1174         for cf_curs_lib in cursesX curses ncurses xcurses jcurses unknown
1175         do
1176                 AC_CHECK_LIB($cf_curs_lib,initscr,[break])
1177         done
1178         test $cf_curs_lib = unknown && AC_ERROR(no curses library found)
1179
1180         LIBS="-l$cf_curs_lib $cf_save_LIBS"
1181         if test "$cf_term_lib" = unknown ; then
1182                 AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
1183                 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
1184                         [initscr()],
1185                         [cf_result=yes],
1186                         [cf_result=no])
1187                 AC_MSG_RESULT($cf_result)
1188                 test $cf_result = no && AC_ERROR(Cannot link curses library)
1189         elif test "$cf_term_lib" != predefined ; then
1190                 AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
1191                 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
1192                         [initscr(); tgoto((char *)0, 0, 0);],
1193                         [cf_result=no],
1194                         [
1195                         LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
1196                         AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
1197                                 [initscr()],
1198                                 [cf_result=yes],
1199                                 [cf_result=error])
1200                         ])
1201                 AC_MSG_RESULT($cf_result)
1202         fi
1203 fi
1204
1205 ])])
1206
1207 dnl ---------------------------------------------------------------------------
1208 dnl Check if a function is declared by including a set of include files.
1209 dnl Invoke the corresponding actions according to whether it is found or not.
1210 dnl
1211 dnl Gcc (unlike other compilers) will only warn about the miscast assignment
1212 dnl in the first test, but most compilers will oblige with an error in the
1213 dnl second test.
1214 dnl
1215 dnl CF_CHECK_FUNCDECL(INCLUDES, FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1216 AC_DEFUN([CF_CHECK_FUNCDECL],
1217 [
1218 AC_MSG_CHECKING([for $2 declaration])
1219 AC_CACHE_VAL(ac_cv_func_decl_$2,
1220 [AC_TRY_COMPILE([$1],
1221 [#ifndef ${ac_func}
1222 extern  int     ${ac_func}();
1223 #endif],[
1224 AC_TRY_COMPILE([$1],
1225 [#ifndef ${ac_func}
1226 int     (*p)() = ${ac_func};
1227 #endif],[
1228 eval "ac_cv_func_decl_$2=yes"],[
1229 eval "ac_cv_func_decl_$2=no"])],[
1230 eval "ac_cv_func_decl_$2=yes"])])
1231 if eval "test \"`echo '$ac_cv_func_'decl_$2`\" = yes"; then
1232   AC_MSG_RESULT(yes)
1233   ifelse([$3], , :, [$3])
1234 else
1235   AC_MSG_RESULT(no)
1236 ifelse([$4], , , [$4
1237 ])dnl
1238 fi
1239 ])dnl
1240 dnl ---------------------------------------------------------------------------
1241 dnl Check if functions are declared by including a set of include files.
1242 dnl and define DECL_XXX if not.
1243 dnl
1244 dnl CF_CHECK_FUNCDECLS(INCLUDES, FUNCTION... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1245 AC_DEFUN([CF_CHECK_FUNCDECLS],
1246 [for ac_func in $2
1247 do
1248 CF_CHECK_FUNCDECL([$1], $ac_func,
1249 [
1250   CF_UPPER(ac_tr_func,HAVE_$ac_func)
1251   AC_DEFINE_UNQUOTED($ac_tr_func) $3],
1252 [$4])dnl
1253 dnl [$3],
1254 dnl [
1255 dnl   CF_UPPER(ac_tr_func,DECL_$ac_func)
1256 dnl   AC_DEFINE_UNQUOTED($ac_tr_func) $4])dnl
1257 done
1258 ])dnl
1259 dnl ---------------------------------------------------------------------------
1260 dnl Make an uppercase version of a variable
1261 dnl $1=uppercase($2)
1262 AC_DEFUN([CF_UPPER],
1263 [
1264 changequote(,)dnl
1265 $1=`echo $2 | tr '[a-z]' '[A-Z]'`
1266 changequote([,])dnl
1267 ])dnl
1268 dnl ---------------------------------------------------------------------------
1269
1270 # Define a conditional.
1271
1272 AC_DEFUN(AM_CONDITIONAL,
1273 [AC_SUBST($1_TRUE)
1274 AC_SUBST($1_FALSE)
1275 if $2; then
1276   $1_TRUE=
1277   $1_FALSE='#'
1278 else
1279   $1_TRUE='#'
1280   $1_FALSE=
1281 fi])
1282
1283 # gssapi.m4: Find GSSAPI libraries in either Heimdal or MIT implementations
1284 # Brendan Cully <brendan@kublai.com> 20010529
1285
1286 dnl MUTT_AM_PATH_GSSAPI(PREFIX)
1287 dnl Search for a GSSAPI implementation in the standard locations plus PREFIX,
1288 dnl if it is set and not "yes".
1289 dnl Defines GSSAPI_CFLAGS and GSSAPI_LIBS if found.
1290 dnl Defines GSSAPI_IMPL to "Heimdal", "MIT", or "OldMIT", or "none" if not found
1291 AC_DEFUN([MUTT_AM_PATH_GSSAPI],
1292 [
1293   GSSAPI_PREFIX=[$]$1
1294   GSSAPI_IMPL="none"
1295   saved_CPPFLAGS="$CPPFLAGS"
1296   saved_LDFLAGS="$LDFLAGS"
1297   saved_LIBS="$LIBS"
1298   dnl First try krb5-config
1299   if test "$GSSAPI_PREFIX" != "yes"
1300   then
1301     krb5_path="$GSSAPI_PREFIX/bin"
1302   else
1303     krb5_path="$PATH"
1304   fi
1305   AC_PATH_PROG(KRB5CFGPATH, krb5-config, none, $krb5_path)
1306   if test "$KRB5CFGPATH" != "none"
1307   then
1308     GSSAPI_CFLAGS="$CPPFLAGS `$KRB5CFGPATH --cflags gssapi`"
1309     GSSAPI_LIBS="$MUTTLIBS `$KRB5CFGPATH --libs gssapi`"
1310     case "`$KRB5CFGPATH --version`" in
1311       "Kerberos 5 "*)   GSSAPI_IMPL="MIT";;
1312       ?eimdal*)         GSSAPI_IMPL="Heimdal";;
1313       *)                GSSAPI_IMPL="Unknown";;
1314    esac
1315   else
1316     dnl No krb5-config, run the old code
1317     if test "$GSSAPI_PREFIX" != "yes"
1318     then
1319       GSSAPI_CFLAGS="-I$GSSAPI_PREFIX/include"
1320       GSSAPI_LDFLAGS="-L$GSSAPI_PREFIX/lib"
1321       CPPFLAGS="$CPPFLAGS $GSSAPI_CFLAGS"
1322       LDFLAGS="$LDFLAGS $GSSAPI_LDFLAGS"
1323     fi
1324
1325     dnl New MIT kerberos V support
1326     AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context, [
1327       GSSAPI_IMPL="MIT",
1328       GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err"
1329       ],, -lkrb5 -lk5crypto -lcom_err)
1330
1331     dnl Heimdal kerberos V support
1332     if test "$GSSAPI_IMPL" = "none"
1333     then
1334       AC_CHECK_LIB(gssapi, gss_init_sec_context, [
1335           GSSAPI_IMPL="Heimdal"
1336           GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi -lkrb5 -ldes -lasn1 -lroken"
1337           GSSAPI_LIBS="$GSSAPI_LIBS -lcrypt -lcom_err"
1338           ],, -lkrb5 -ldes -lasn1 -lroken -lcrypt -lcom_err)
1339     fi
1340
1341     dnl Old MIT Kerberos V
1342     dnl Note: older krb5 distributions use -lcrypto instead of
1343     dnl -lk5crypto, which collides with OpenSSL.  One way of dealing
1344     dnl with that is to extract all objects from krb5's libcrypto
1345     dnl and from openssl's libcrypto into the same directory, then
1346     dnl to create a new libcrypto from these.
1347     if test "$GSSAPI_IMPL" = "none"
1348     then
1349       AC_CHECK_LIB(gssapi_krb5, g_order_init, [
1350         GSSAPI_IMPL="OldMIT",
1351         GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi_krb5 -lkrb5 -lcrypto -lcom_err"
1352         ],, -lkrb5 -lcrypto -lcom_err)
1353     fi
1354   fi
1355
1356   CPPFLAGS="$saved_CPPFLAGS"
1357   LDFLAGS="$saved_LDFLAGS"
1358   LIBS="$saved_LIBS"
1359 ])
1360
1361 dnl Autoconf macros for libgnutls
1362 dnl $id$
1363
1364 # Modified for mutt 20050210 Brendan Cully
1365 # Modified for LIBGNUTLS -- nmav
1366 # Configure paths for LIBGCRYPT
1367 # Shamelessly stolen from the one of XDELTA by Owen Taylor
1368 # Werner Koch   99-12-09
1369
1370 dnl MUTT_AM_PATH_GNUTLS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
1371 dnl Test for libgnutls, and define LIBGNUTLS_CFLAGS and LIBGNUTLS_LIBS
1372 dnl
1373 AC_DEFUN([MUTT_AM_PATH_GNUTLS],
1374 [dnl
1375 dnl Get the cflags and libraries from the libgnutls-config script
1376 dnl
1377   libgnutls_config_prefix=$1
1378   min_libgnutls_version=0.1.0
1379
1380   if test x$libgnutls_config_prefix != x ; then
1381      if test x${LIBGNUTLS_CONFIG+set} != xset ; then
1382         LIBGNUTLS_CONFIG=$libgnutls_config_prefix/bin/libgnutls-config
1383      fi
1384   fi
1385
1386   AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no)
1387   AC_MSG_CHECKING(for libgnutls - version >= $min_libgnutls_version)
1388   no_libgnutls=""
1389   if test "$LIBGNUTLS_CONFIG" = "no" ; then
1390     no_libgnutls=yes
1391   else
1392     LIBGNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --cflags`
1393     LIBGNUTLS_LIBS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs`
1394     libgnutls_config_version=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version`
1395
1396
1397       ac_save_CFLAGS="$CFLAGS"
1398       ac_save_LIBS="$LIBS"
1399       CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
1400       LIBS="$LIBS $LIBGNUTLS_LIBS"
1401
1402 dnl
1403 dnl Now check if the installed libgnutls is sufficiently new. Also sanity
1404 dnl checks the results of libgnutls-config to some extent
1405 dnl
1406       rm -f conf.libgnutlstest
1407       AC_TRY_RUN([
1408 #include <stdio.h>
1409 #include <stdlib.h>
1410 #include <string.h>
1411 #include <gnutls/gnutls.h>
1412
1413 int
1414 main ()
1415 {
1416     system ("touch conf.libgnutlstest");
1417
1418     if( strcmp( gnutls_check_version(NULL), "$libgnutls_config_version" ) )
1419     {
1420       printf("\n*** 'libgnutls-config --version' returned %s, but LIBGNUTLS (%s)\n",
1421              "$libgnutls_config_version", gnutls_check_version(NULL) );
1422       printf("*** was found! If libgnutls-config was correct, then it is best\n");
1423       printf("*** to remove the old version of LIBGNUTLS. You may also be able to fix the error\n");
1424       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
1425       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
1426       printf("*** required on your system.\n");
1427       printf("*** If libgnutls-config was wrong, set the environment variable LIBGNUTLS_CONFIG\n");
1428       printf("*** to point to the correct copy of libgnutls-config, and remove the file config.cache\n");
1429       printf("*** before re-running configure\n");
1430     }
1431     else if ( strcmp(gnutls_check_version(NULL), LIBGNUTLS_VERSION ) )
1432     {
1433       printf("\n*** LIBGNUTLS header file (version %s) does not match\n", LIBGNUTLS_VERSION);
1434       printf("*** library (version %s)\n", gnutls_check_version(NULL) );
1435     }
1436     else
1437     {
1438       if ( gnutls_check_version( "$min_libgnutls_version" ) )
1439       {
1440         return 0;
1441       }
1442      else
1443       {
1444         printf("no\n*** An old version of LIBGNUTLS (%s) was found.\n",
1445                 gnutls_check_version(NULL) );
1446         printf("*** You need a version of LIBGNUTLS newer than %s. The latest version of\n",
1447                "$min_libgnutls_version" );
1448         printf("*** LIBGNUTLS is always available from ftp://gnutls.hellug.gr/pub/gnutls.\n");
1449         printf("*** \n");
1450         printf("*** If you have already installed a sufficiently new version, this error\n");
1451         printf("*** probably means that the wrong copy of the libgnutls-config shell script is\n");
1452         printf("*** being found. The easiest way to fix this is to remove the old version\n");
1453         printf("*** of LIBGNUTLS, but you can also set the LIBGNUTLS_CONFIG environment to point to the\n");
1454         printf("*** correct copy of libgnutls-config. (In this case, you will have to\n");
1455         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
1456         printf("*** so that the correct libraries are found at run-time))\n");
1457       }
1458     }
1459   return 1;
1460 }
1461 ],, no_libgnutls=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1462        CFLAGS="$ac_save_CFLAGS"
1463        LIBS="$ac_save_LIBS"
1464   fi
1465
1466   if test "x$no_libgnutls" = x ; then
1467      AC_MSG_RESULT(yes)
1468      dnl some openssl compatibility code was moved in gnutls 1.2
1469      AC_CHECK_HEADERS([gnutls/openssl.h])
1470      ifelse([$2], , :, [$2])
1471   else
1472      if test -f conf.libgnutlstest ; then
1473         :
1474      else
1475         AC_MSG_RESULT(no)
1476      fi
1477      if test "$LIBGNUTLS_CONFIG" = "no" ; then
1478        echo "*** The libgnutls-config script installed by LIBGNUTLS could not be found"
1479        echo "*** If LIBGNUTLS was installed in PREFIX, make sure PREFIX/bin is in"
1480        echo "*** your path, or set the LIBGNUTLS_CONFIG environment variable to the"
1481        echo "*** full path to libgnutls-config."
1482      else
1483        if test -f conf.libgnutlstest ; then
1484         :
1485        else
1486           echo "*** Could not run libgnutls test program, checking why..."
1487           CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
1488           LIBS="$LIBS $LIBGNUTLS_LIBS"
1489           AC_TRY_LINK([
1490 #include <stdio.h>
1491 #include <stdlib.h>
1492 #include <string.h>
1493 #include <gnutls/gnutls.h>
1494 ],      [ return !!gnutls_check_version(NULL); ],
1495         [ echo "*** The test program compiled, but did not run. This usually means"
1496           echo "*** that the run-time linker is not finding LIBGNUTLS or finding the wrong"
1497           echo "*** version of LIBGNUTLS. If it is not finding LIBGNUTLS, you'll need to set your"
1498           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1499           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1500           echo "*** is required on your system"
1501           echo "***"
1502           echo "*** If you have an old version installed, it is best to remove it, although"
1503           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
1504           echo "***" ],
1505         [ echo "*** The test program failed to compile or link. See the file config.log for the"
1506           echo "*** exact error that occured. This usually means LIBGNUTLS was incorrectly installed"
1507           echo "*** or that you have moved LIBGNUTLS since it was installed. In the latter case, you"
1508           echo "*** may want to edit the libgnutls-config script: $LIBGNUTLS_CONFIG" ])
1509           CFLAGS="$ac_save_CFLAGS"
1510           LIBS="$ac_save_LIBS"
1511        fi
1512      fi
1513      LIBGNUTLS_CFLAGS=""
1514      LIBGNUTLS_LIBS=""
1515      ifelse([$3], , :, [$3])
1516   fi
1517   rm -f conf.libgnutlstest
1518   AC_SUBST(LIBGNUTLS_CFLAGS)
1519   AC_SUBST(LIBGNUTLS_LIBS)
1520 ])
1521
1522 dnl *-*wedit:notab*-*  Please keep this as the last line.
1523
1524 # Macro to add for using GNU gettext.
1525 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1526
1527 #
1528 # Slightly modified by Thomas Roessler <roessler@does-not-exist.org>
1529 # Updated to gettext-0.10.38 by Edmund Grimley Evans <edmundo@rano.org>
1530 # Updated to gettext-0.10.40 by Andrew W. Nosenko <awn@bcs.zp.ua>
1531 #
1532
1533 # This file can be copied and used freely without restrictions.  It can
1534 # be used in projects which are not available under the GNU General Public
1535 # License or the GNU Library General Public License but which still want
1536 # to provide support for the GNU gettext functionality.
1537 # Please note that the actual code of the GNU gettext library is covered
1538 # by the GNU Library General Public License, and the rest of the GNU
1539 # gettext package package is covered by the GNU General Public License.
1540 # They are *not* in the public domain.
1541
1542 # serial 10
1543
1544 dnl Usage: MUTT_AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
1545 dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
1546 dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
1547 dnl    depending on --{enable,disable}-{shared,static} and on the presence of
1548 dnl    AM-DISABLE-SHARED). Otherwise, a static library
1549 dnl    $(top_builddir)/intl/libintl.a will be created.
1550 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
1551 dnl    implementations (in libc or libintl) without the ngettext() function
1552 dnl    will be ignored.
1553 dnl LIBDIR is used to find the intl libraries.  If empty,
1554 dnl    the value `$(top_builddir)/intl/' is used.
1555 dnl
1556 dnl The result of the configuration is one of three cases:
1557 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
1558 dnl    and used.
1559 dnl    Catalog format: GNU --> install in $(datadir)
1560 dnl    Catalog extension: .mo after installation, .gmo in source tree
1561 dnl 2) GNU gettext has been found in the system's C library.
1562 dnl    Catalog format: GNU --> install in $(datadir)
1563 dnl    Catalog extension: .mo after installation, .gmo in source tree
1564 dnl 3) No internationalization, always use English msgid.
1565 dnl    Catalog format: none
1566 dnl    Catalog extension: none
1567 dnl The use of .gmo is historical (it was needed to avoid overwriting the
1568 dnl GNU format catalogs when building on a platform with an X/Open gettext),
1569 dnl but we keep it in order not to force irrelevant filename changes on the
1570 dnl maintainers.
1571 dnl
1572 AC_DEFUN([MUTT_AM_WITH_NLS],
1573   [AC_MSG_CHECKING([whether NLS is requested])
1574     dnl Default is enabled NLS
1575     AC_ARG_ENABLE(nls,
1576       AC_HELP_STRING([--disable-nls], [Do not use Native Language Support]),
1577       USE_NLS=$enableval, USE_NLS=yes)
1578     AC_MSG_RESULT($USE_NLS)
1579     AC_SUBST(USE_NLS)
1580
1581     BUILD_INCLUDED_LIBINTL=no
1582     USE_INCLUDED_LIBINTL=no
1583     INTLLIBS=
1584
1585     dnl If we use NLS figure out what method
1586     if test "$USE_NLS" = "yes"; then
1587       AC_DEFINE(ENABLE_NLS, 1,
1588         [Define to 1 if translation of program messages to the user's native language
1589    is requested.])
1590       AC_MSG_CHECKING([whether included gettext is requested])
1591       AC_ARG_WITH(included-gettext,
1592         AC_HELP_STRING([--with-included-gettext], [Use the GNU gettext library included here]),
1593         nls_cv_force_use_gnu_gettext=$withval,
1594         nls_cv_force_use_gnu_gettext=no)
1595       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
1596
1597       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
1598       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
1599         dnl User does not insist on using GNU NLS library.  Figure out what
1600         dnl to use.  If GNU gettext is available we use this.  Else we have
1601         dnl to fall back to GNU NLS library.
1602         CATOBJEXT=NONE
1603
1604         dnl Add a version number to the cache macros.
1605         define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
1606         define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
1607
1608         AC_CHECK_HEADER(libintl.h,
1609           [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
1610             [AC_TRY_LINK([#include <libintl.h>
1611 extern int _nl_msg_cat_cntr;],
1612                [bindtextdomain ("", "");
1613 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
1614                gt_cv_func_gnugettext_libc=yes,
1615                gt_cv_func_gnugettext_libc=no)])
1616
1617            if test "$gt_cv_func_gnugettext_libc" != "yes"; then
1618              AC_CACHE_CHECK([for GNU gettext in libintl],
1619                gt_cv_func_gnugettext_libintl,
1620                [gt_save_LIBS="$LIBS"
1621                 LIBS="$LIBS -lintl $LIBICONV"
1622                 AC_TRY_LINK([#include <libintl.h>
1623 extern int _nl_msg_cat_cntr;],
1624                   [bindtextdomain ("", "");
1625 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
1626                   gt_cv_func_gnugettext_libintl=yes,
1627                   gt_cv_func_gnugettext_libintl=no)
1628                 LIBS="$gt_save_LIBS"])
1629            fi
1630
1631            dnl If an already present or preinstalled GNU gettext() is found,
1632            dnl use it.  But if this macro is used in GNU gettext, and GNU
1633            dnl gettext is already preinstalled in libintl, we update this
1634            dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
1635            if test "$gt_cv_func_gnugettext_libc" = "yes" \
1636               || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
1637                    && test "$PACKAGE" != gettext; }; then
1638              AC_DEFINE(HAVE_GETTEXT, 1,
1639                [Define if the GNU gettext() function is already present or preinstalled.])
1640
1641              if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
1642                dnl If iconv() is in a separate libiconv library, then anyone
1643                dnl linking with libintl{.a,.so} also needs to link with
1644                dnl libiconv.
1645                INTLLIBS="-lintl $LIBICONV"
1646              fi
1647
1648              gt_save_LIBS="$LIBS"
1649              LIBS="$LIBS $INTLLIBS"
1650              AC_CHECK_FUNCS(dcgettext)
1651              LIBS="$gt_save_LIBS"
1652
1653              dnl Search for GNU msgfmt in the PATH.
1654              MUTT_AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1655                [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
1656              AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1657
1658              dnl Search for GNU xgettext in the PATH.
1659              MUTT_AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1660                [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
1661
1662              CATOBJEXT=.gmo
1663            fi
1664         ])
1665
1666         if test "$CATOBJEXT" = "NONE"; then
1667           dnl GNU gettext is not found in the C library.
1668           dnl Fall back on GNU gettext library.
1669           nls_cv_use_gnu_gettext=yes
1670         fi
1671       fi
1672
1673       if test "$nls_cv_use_gnu_gettext" = "yes"; then
1674         dnl Mark actions used to generate GNU NLS library.
1675         INTLOBJS="\$(GETTOBJS)"
1676         MUTT_AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1677           [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
1678         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1679         MUTT_AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1680           [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
1681         AC_SUBST(MSGFMT)
1682         BUILD_INCLUDED_LIBINTL=yes
1683         USE_INCLUDED_LIBINTL=yes
1684         CATOBJEXT=.gmo
1685         INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
1686         LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
1687       fi
1688
1689       dnl This could go away some day; the MUTT_PATH_PROG_WITH_TEST already does it.
1690       dnl Test whether we really found GNU msgfmt.
1691       if test "$GMSGFMT" != ":"; then
1692         dnl If it is no GNU msgfmt we define it as : so that the
1693         dnl Makefiles still can work.
1694         if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
1695           : ;
1696         else
1697           AC_MSG_RESULT(
1698             [found msgfmt program is not GNU msgfmt; ignore it])
1699           GMSGFMT=":"
1700         fi
1701       fi
1702
1703       dnl This could go away some day; the MUTT_PATH_PROG_WITH_TEST already does it.
1704       dnl Test whether we really found GNU xgettext.
1705       if test "$XGETTEXT" != ":"; then
1706         dnl If it is no GNU xgettext we define it as : so that the
1707         dnl Makefiles still can work.
1708         if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
1709           : ;
1710         else
1711           AC_MSG_RESULT(
1712             [found xgettext program is not GNU xgettext; ignore it])
1713           XGETTEXT=":"
1714         fi
1715       fi
1716
1717       dnl We need to process the po/ directory.
1718       POSUB=po
1719     fi
1720     AC_OUTPUT_COMMANDS(
1721      [for ac_file in $CONFIG_FILES; do
1722         # Support "outfile[:infile[:infile...]]"
1723         case "$ac_file" in
1724           *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
1725         esac
1726         # PO directories have a Makefile.in generated from Makefile.in.in.
1727         case "$ac_file" in */Makefile.in)
1728           # Adjust a relative srcdir.
1729           ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
1730           ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
1731           ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
1732           # In autoconf-2.13 it is called $ac_given_srcdir.
1733           # In autoconf-2.50 it is called $srcdir.
1734           test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
1735           case "$ac_given_srcdir" in
1736             .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
1737             /*) top_srcdir="$ac_given_srcdir" ;;
1738             *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
1739           esac
1740           if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
1741             rm -f "$ac_dir/POTFILES"
1742             test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
1743             sed -e "/^#/d" -e "/^[      ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
1744             test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
1745             sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
1746           fi
1747           ;;
1748         esac
1749       done])
1750
1751
1752     dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
1753     dnl to 'yes' because some of the testsuite requires it.
1754     if test "$PACKAGE" = gettext; then
1755       BUILD_INCLUDED_LIBINTL=yes
1756     fi
1757
1758     dnl intl/plural.c is generated from intl/plural.y. It requires bison,
1759     dnl because plural.y uses bison specific features. It requires at least
1760     dnl bison-1.26 because earlier versions generate a plural.c that doesn't
1761     dnl compile.
1762     dnl bison is only needed for the maintainer (who touches plural.y). But in
1763     dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
1764     dnl the rule in general Makefile. Now, some people carelessly touch the
1765     dnl files or have a broken "make" program, hence the plural.c rule will
1766     dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
1767     dnl present or too old.
1768     AC_CHECK_PROGS([INTLBISON], [bison])
1769     if test -z "$INTLBISON"; then
1770       ac_verc_fail=yes
1771     else
1772       dnl Found it, now check the version.
1773       AC_MSG_CHECKING([version of bison])
1774 changequote(<<,>>)dnl
1775       ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
1776       case $ac_prog_version in
1777         '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
1778         1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
1779 changequote([,])dnl
1780            ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
1781         *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
1782       esac
1783       AC_MSG_RESULT([$ac_prog_version])
1784     fi
1785     if test $ac_verc_fail = yes; then
1786       INTLBISON=:
1787     fi
1788
1789     dnl These rules are solely for the distribution goal.  While doing this
1790     dnl we only have to keep exactly one list of the available catalogs
1791     dnl in configure.in.
1792     for lang in $ALL_LINGUAS; do
1793       GMOFILES="$GMOFILES $lang.gmo"
1794       POFILES="$POFILES $lang.po"
1795     done
1796
1797     dnl Make all variables we use known to autoconf.
1798     AC_SUBST(BUILD_INCLUDED_LIBINTL)
1799     AC_SUBST(USE_INCLUDED_LIBINTL)
1800     AC_SUBST(CATALOGS)
1801     AC_SUBST(CATOBJEXT)
1802     AC_SUBST(GMOFILES)
1803     AC_SUBST(INTLLIBS)
1804     AC_SUBST(INTLOBJS)
1805     AC_SUBST(POFILES)
1806     AC_SUBST(POSUB)
1807
1808     dnl For backward compatibility. Some configure.ins may be using this.
1809     nls_cv_header_intl=
1810     nls_cv_header_libgt=
1811
1812     dnl For backward compatibility. Some Makefiles may be using this.
1813     DATADIRNAME=share
1814     AC_SUBST(DATADIRNAME)
1815
1816     dnl For backward compatibility. Some Makefiles may be using this.
1817     INSTOBJEXT=.mo
1818     AC_SUBST(INSTOBJEXT)
1819
1820     dnl For backward compatibility. Some Makefiles may be using this.
1821     GENCAT=gencat
1822     AC_SUBST(GENCAT)
1823   ])
1824
1825 dnl Usage: Just like MUTT_AM_WITH_NLS, which see.
1826 AC_DEFUN([MUTT_AM_GNU_GETTEXT],
1827   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1828    AC_REQUIRE([AC_PROG_CC])dnl
1829    AC_REQUIRE([AC_CANONICAL_HOST])dnl
1830    AC_REQUIRE([AC_PROG_RANLIB])dnl
1831    AC_REQUIRE([AC_ISC_POSIX])dnl
1832    AC_REQUIRE([AC_HEADER_STDC])dnl
1833    AC_REQUIRE([AC_C_CONST])dnl
1834    AC_REQUIRE([AC_C_INLINE])dnl
1835    AC_REQUIRE([AC_TYPE_OFF_T])dnl
1836    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1837    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1838    AC_REQUIRE([AC_FUNC_MMAP])dnl
1839    AC_REQUIRE([MUTT_jm_GLIBC21])dnl
1840
1841    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
1842 stdlib.h string.h unistd.h sys/param.h])
1843    AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
1844 getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
1845 strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
1846
1847    MUTT_AM_ICONV
1848    MUTT_AM_LANGINFO_CODESET
1849    MUTT_AM_LC_MESSAGES
1850    MUTT_AM_WITH_NLS([$1],[$2],[$3])
1851
1852    if test "x$CATOBJEXT" != "x"; then
1853      if test "x$ALL_LINGUAS" = "x"; then
1854        LINGUAS=
1855      else
1856        AC_MSG_CHECKING(for catalogs to be installed)
1857        NEW_LINGUAS=
1858        for presentlang in $ALL_LINGUAS; do
1859          useit=no
1860          for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
1861            # Use the presentlang catalog if desiredlang is
1862            #   a. equal to presentlang, or
1863            #   b. a variant of presentlang (because in this case,
1864            #      presentlang can be used as a fallback for messages
1865            #      which are not translated in the desiredlang catalog).
1866            case "$desiredlang" in
1867              "$presentlang"*) useit=yes;;
1868            esac
1869          done
1870          if test $useit = yes; then
1871            NEW_LINGUAS="$NEW_LINGUAS $presentlang"
1872          fi
1873        done
1874        LINGUAS=$NEW_LINGUAS
1875        AC_MSG_RESULT($LINGUAS)
1876      fi
1877
1878      dnl Construct list of names of catalog files to be constructed.
1879      if test -n "$LINGUAS"; then
1880        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
1881      fi
1882    fi
1883
1884    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1885    dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
1886    dnl Try to locate is.
1887    MKINSTALLDIRS=
1888    if test -n "$ac_aux_dir"; then
1889      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
1890    fi
1891    if test -z "$MKINSTALLDIRS"; then
1892      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1893    fi
1894    AC_SUBST(MKINSTALLDIRS)
1895
1896    dnl Enable libtool support if the surrounding package wishes it.
1897    INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
1898    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
1899   ])
1900
1901 # Search path for a program which passes the given test.
1902 # Ulrich Drepper <drepper@cygnus.com>, 1996.
1903 #
1904 # This file can be copied and used freely without restrictions.  It can
1905 # be used in projects which are not available under the GNU General Public
1906 # License or the GNU Library General Public License but which still want
1907 # to provide support for the GNU gettext functionality.
1908 # Please note that the actual code of the GNU gettext library is covered
1909 # by the GNU Library General Public License, and the rest of the GNU
1910 # gettext package package is covered by the GNU General Public License.
1911 # They are *not* in the public domain.
1912
1913 # serial 2
1914
1915 dnl MUTT_AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
1916 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1917 AC_DEFUN([MUTT_AM_PATH_PROG_WITH_TEST],
1918 [# Extract the first word of "$2", so it can be a program name with args.
1919 set dummy $2; ac_word=[$]2
1920 AC_MSG_CHECKING([for $ac_word])
1921 AC_CACHE_VAL(ac_cv_path_$1,
1922 [case "[$]$1" in
1923   /*)
1924   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1925   ;;
1926   *)
1927   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1928   for ac_dir in ifelse([$5], , $PATH, [$5]); do
1929     test -z "$ac_dir" && ac_dir=.
1930     if test -f $ac_dir/$ac_word; then
1931       if [$3]; then
1932         ac_cv_path_$1="$ac_dir/$ac_word"
1933         break
1934       fi
1935     fi
1936   done
1937   IFS="$ac_save_ifs"
1938 dnl If no 4th arg is given, leave the cache variable unset,
1939 dnl so AC_PATH_PROGS will keep looking.
1940 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1941 ])dnl
1942   ;;
1943 esac])dnl
1944 $1="$ac_cv_path_$1"
1945 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
1946   AC_MSG_RESULT([$]$1)
1947 else
1948   AC_MSG_RESULT(no)
1949 fi
1950 AC_SUBST($1)dnl
1951 ])
1952
1953 # glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
1954 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
1955 dnl This file is free software, distributed under the terms of the GNU
1956 dnl General Public License.  As a special exception to the GNU General
1957 dnl Public License, this file may be distributed as part of a program
1958 dnl that contains a configuration script generated by Autoconf, under
1959 dnl the same distribution terms as the rest of that program.
1960
1961 # Test for the GNU C Library, version 2.1 or newer.
1962 # From Bruno Haible.
1963
1964 AC_DEFUN([jm_GLIBC21],
1965   [
1966     AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
1967       ac_cv_gnu_library_2_1,
1968       [AC_EGREP_CPP([Lucky GNU user],
1969         [
1970 #include <features.h>
1971 #ifdef __GNU_LIBRARY__
1972  #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
1973   Lucky GNU user
1974  #endif
1975 #endif
1976         ],
1977         ac_cv_gnu_library_2_1=yes,
1978         ac_cv_gnu_library_2_1=no)
1979       ]
1980     )
1981     AC_SUBST(GLIBC21)
1982     GLIBC21="$ac_cv_gnu_library_2_1"
1983   ]
1984 )
1985
1986 #serial AM2
1987
1988 dnl From Bruno Haible.
1989
1990 AC_DEFUN([MUTT_AM_ICONV],
1991 [
1992   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
1993   dnl those with the standalone portable GNU libiconv installed).
1994
1995   AC_ARG_WITH([libiconv-prefix],
1996 AC_HELP_STRING([--with-libiconv-prefix=DIR], [Search for libiconv in DIR/include and DIR/lib]), [
1997     for dir in `echo "$withval" | tr : ' '`; do
1998       if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
1999       if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
2000     done
2001    ])
2002
2003   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
2004     am_cv_func_iconv="no, consider installing GNU libiconv"
2005     am_cv_lib_iconv=no
2006     AC_TRY_LINK([#include <stdlib.h>
2007 #include <iconv.h>],
2008       [iconv_t cd = iconv_open("","");
2009        iconv(cd,NULL,NULL,NULL,NULL);
2010        iconv_close(cd);],
2011       am_cv_func_iconv=yes)
2012     if test "$am_cv_func_iconv" != yes; then
2013       am_save_LIBS="$LIBS"
2014       LIBS="$LIBS -liconv"
2015       AC_TRY_LINK([#include <stdlib.h>
2016 #include <iconv.h>],
2017         [iconv_t cd = iconv_open("","");
2018          iconv(cd,NULL,NULL,NULL,NULL);
2019          iconv_close(cd);],
2020         am_cv_lib_iconv=yes
2021         am_cv_func_iconv=yes)
2022       LIBS="$am_save_LIBS"
2023     fi
2024   ])
2025   if test "$am_cv_func_iconv" = yes; then
2026     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
2027     AC_MSG_CHECKING([for iconv declaration])
2028     AC_CACHE_VAL(am_cv_proto_iconv, [
2029       AC_TRY_COMPILE([
2030 #include <stdlib.h>
2031 #include <iconv.h>
2032 extern
2033 #ifdef __cplusplus
2034 "C"
2035 #endif
2036 #if defined(__STDC__) || defined(__cplusplus)
2037 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
2038 #else
2039 size_t iconv();
2040 #endif
2041 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
2042       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);"])
2043     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
2044     AC_MSG_RESULT([$]{ac_t:-
2045          }[$]am_cv_proto_iconv)
2046     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
2047       [Define as const if the declaration of iconv() needs const.])
2048   fi
2049   LIBICONV=
2050   if test "$am_cv_lib_iconv" = yes; then
2051     LIBICONV="-liconv"
2052   fi
2053   AC_SUBST(LIBICONV)
2054 ])
2055
2056 #serial AM1
2057
2058 dnl From Bruno Haible.
2059
2060 AC_DEFUN([MUTT_AM_LANGINFO_CODESET],
2061 [
2062   AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
2063     [AC_TRY_LINK([#include <langinfo.h>],
2064       [char* cs = nl_langinfo(CODESET);],
2065       am_cv_langinfo_codeset=yes,
2066       am_cv_langinfo_codeset=no)
2067     ])
2068   if test $am_cv_langinfo_codeset = yes; then
2069     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
2070       [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
2071   fi
2072 ])
2073
2074 # Check whether LC_MESSAGES is available in <locale.h>.
2075 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2076 #
2077 # This file can be copied and used freely without restrictions.  It can
2078 # be used in projects which are not available under the GNU General Public
2079 # License or the GNU Library General Public License but which still want
2080 # to provide support for the GNU gettext functionality.
2081 # Please note that the actual code of the GNU gettext library is covered
2082 # by the GNU Library General Public License, and the rest of the GNU
2083 # gettext package package is covered by the GNU General Public License.
2084 # They are *not* in the public domain.
2085
2086 # serial 2
2087
2088 AC_DEFUN([MUTT_AM_LC_MESSAGES],
2089   [if test $ac_cv_header_locale_h = yes; then
2090     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
2091       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2092        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
2093     if test $am_cv_val_LC_MESSAGES = yes; then
2094       AC_DEFINE(HAVE_LC_MESSAGES, 1,
2095         [Define if your <locale.h> file defines LC_MESSAGES.])
2096     fi
2097   fi])
2098
2099 #serial 2
2100
2101 # Test for the GNU C Library, version 2.1 or newer.
2102 # From Bruno Haible.
2103
2104 AC_DEFUN([MUTT_jm_GLIBC21],
2105   [
2106     AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
2107       ac_cv_gnu_library_2_1,
2108       [AC_EGREP_CPP([Lucky GNU user],
2109         [
2110 #include <features.h>
2111 #ifdef __GNU_LIBRARY__
2112  #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
2113   Lucky GNU user
2114  #endif
2115 #endif
2116         ],
2117         ac_cv_gnu_library_2_1=yes,
2118         ac_cv_gnu_library_2_1=no)
2119       ]
2120     )
2121     AC_SUBST(GLIBC21)
2122     GLIBC21="$ac_cv_gnu_library_2_1"
2123   ]
2124 )
2125
2126 dnl vim:ft=config:
2127
2128 dnl Search for libesmtp, by Steven Engelhardt <sengelha@yahoo.com>
2129 dnl
2130 dnl libesmtp often requires linking against -lpthread or -lc_r (BSD).
2131 dnl This macro attempts to centralize this code.
2132
2133 AC_DEFUN([MUTT_AM_LIBESMTP],
2134 [
2135   AC_ARG_WITH(
2136     [libesmtp],
2137     [  --with-libesmtp=DIR      Compile in support for libesmtp for the MTA],
2138     [ if test "$with_libesmtp" != "no"
2139       then
2140         mutt_libesmtp_check_path="$PATH"
2141
2142         if test "$with_libesmtp" != "yes"
2143         then
2144           mutt_libesmtp_check_path="$tmp_path:$withval/bin"
2145         fi
2146
2147         dnl 1. Find libesmtp-config
2148         AC_PATH_PROG([mutt_libesmtp_config_path],
2149                      [libesmtp-config],
2150                      [no],
2151                      [$mutt_libesmtp_check_path])
2152
2153         if test "$mutt_libesmtp_config_path" = "no"
2154         then
2155           AC_MSG_ERROR([libesmtp-config binary not found.])
2156         fi
2157
2158         dnl 2. Get CFLAGS and LIBS from libesmtp-config
2159         mutt_libesmtp_cflags=`$mutt_libesmtp_config_path --cflags`
2160         mutt_libesmtp_libs=`$mutt_libesmtp_config_path --libs`
2161
2162         dnl 3. Verify libesmtp.h can be found with these settings
2163         temp_CFLAGS="$CFLAGS"
2164         CFLAGS="$CFLAGS $mutt_libesmtp_cflags"
2165         AC_CHECK_HEADER([libesmtp.h],
2166                         [],
2167                         AC_MSG_ERROR([Could not find libesmtp.h]))
2168         CFLAGS="$temp_CFLAGS"
2169
2170         dnl 4. Verify the libesmtp library can be linked in
2171         temp_CFLAGS="$CFLAGS"
2172         temp_LIBS="$LIBS"
2173         CFLAGS="$CFLAGS $mutt_libesmtp_cflags"
2174         LIBS="$LIBS $mutt_libesmtp_libs"
2175         AC_CHECK_LIB([esmtp],
2176                      [smtp_create_session],
2177                      [],
2178                      AC_MSG_ERROR([Could not find libesmtp]))
2179         CFLAGS="$temp_CFLAGS"
2180         LIBS="$temp_LIBS"
2181
2182         dnl 5. Export use_libesmtp variable so configure.in can
2183         dnl    act accordingly.
2184         use_libesmtp=yes
2185       fi
2186     ]
2187   )
2188 ])
2189