Andreas Krennmair:
[apps/madmutt.git] / aclocal.m4
1 # generated automatically by aclocal 1.7.6 -*- Autoconf -*-
2
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
4 # Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 # Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*-
15
16 # Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
17
18 # This program is free software; you can redistribute it and/or modify
19 # it under the terms of the GNU General Public License as published by
20 # the Free Software Foundation; either version 2, or (at your option)
21 # any later version.
22
23 # This program is distributed in the hope that it will be useful,
24 # but WITHOUT ANY WARRANTY; without even the implied warranty of
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26 # GNU General Public License for more details.
27
28 # You should have received a copy of the GNU General Public License
29 # along with this program; if not, write to the Free Software
30 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
31 # 02111-1307, USA.
32
33 AC_PREREQ([2.52])
34
35 # serial 6
36
37 # AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
38 AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
39
40 # Do all the work for Automake.                            -*- Autoconf -*-
41
42 # This macro actually does too much some checks are only needed if
43 # your package does certain things.  But this isn't really a big deal.
44
45 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
46 # Free Software Foundation, Inc.
47
48 # This program is free software; you can redistribute it and/or modify
49 # it under the terms of the GNU General Public License as published by
50 # the Free Software Foundation; either version 2, or (at your option)
51 # any later version.
52
53 # This program is distributed in the hope that it will be useful,
54 # but WITHOUT ANY WARRANTY; without even the implied warranty of
55 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
56 # GNU General Public License for more details.
57
58 # You should have received a copy of the GNU General Public License
59 # along with this program; if not, write to the Free Software
60 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
61 # 02111-1307, USA.
62
63 # serial 10
64
65 AC_PREREQ([2.54])
66
67 # Autoconf 2.50 wants to disallow AM_ names.  We explicitly allow
68 # the ones we care about.
69 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
70
71 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
72 # AM_INIT_AUTOMAKE([OPTIONS])
73 # -----------------------------------------------
74 # The call with PACKAGE and VERSION arguments is the old style
75 # call (pre autoconf-2.50), which is being phased out.  PACKAGE
76 # and VERSION should now be passed to AC_INIT and removed from
77 # the call to AM_INIT_AUTOMAKE.
78 # We support both call styles for the transition.  After
79 # the next Automake release, Autoconf can make the AC_INIT
80 # arguments mandatory, and then we can depend on a new Autoconf
81 # release and drop the old call support.
82 AC_DEFUN([AM_INIT_AUTOMAKE],
83 [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
84  AC_REQUIRE([AC_PROG_INSTALL])dnl
85 # test to see if srcdir already configured
86 if test "`cd $srcdir && pwd`" != "`pwd`" &&
87    test -f $srcdir/config.status; then
88   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
89 fi
90
91 # test whether we have cygpath
92 if test -z "$CYGPATH_W"; then
93   if (cygpath --version) >/dev/null 2>/dev/null; then
94     CYGPATH_W='cygpath -w'
95   else
96     CYGPATH_W=echo
97   fi
98 fi
99 AC_SUBST([CYGPATH_W])
100
101 # Define the identity of the package.
102 dnl Distinguish between old-style and new-style calls.
103 m4_ifval([$2],
104 [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
105  AC_SUBST([PACKAGE], [$1])dnl
106  AC_SUBST([VERSION], [$2])],
107 [_AM_SET_OPTIONS([$1])dnl
108  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
109  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
110
111 _AM_IF_OPTION([no-define],,
112 [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
113  AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
114
115 # Some tools Automake needs.
116 AC_REQUIRE([AM_SANITY_CHECK])dnl
117 AC_REQUIRE([AC_ARG_PROGRAM])dnl
118 AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
119 AM_MISSING_PROG(AUTOCONF, autoconf)
120 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
121 AM_MISSING_PROG(AUTOHEADER, autoheader)
122 AM_MISSING_PROG(MAKEINFO, makeinfo)
123 AM_MISSING_PROG(AMTAR, tar)
124 AM_PROG_INSTALL_SH
125 AM_PROG_INSTALL_STRIP
126 # We need awk for the "check" target.  The system "awk" is bad on
127 # some platforms.
128 AC_REQUIRE([AC_PROG_AWK])dnl
129 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
130 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
131
132 _AM_IF_OPTION([no-dependencies],,
133 [AC_PROVIDE_IFELSE([AC_PROG_CC],
134                   [_AM_DEPENDENCIES(CC)],
135                   [define([AC_PROG_CC],
136                           defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
137 AC_PROVIDE_IFELSE([AC_PROG_CXX],
138                   [_AM_DEPENDENCIES(CXX)],
139                   [define([AC_PROG_CXX],
140                           defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
141 ])
142 ])
143
144
145 # When config.status generates a header, we must update the stamp-h file.
146 # This file resides in the same directory as the config header
147 # that is generated.  The stamp files are numbered to have different names.
148
149 # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
150 # loop where config.status creates the headers, so we can generate
151 # our stamp files there.
152 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
153 [# Compute $1's index in $config_headers.
154 _am_stamp_count=1
155 for _am_header in $config_headers :; do
156   case $_am_header in
157     $1 | $1:* )
158       break ;;
159     * )
160       _am_stamp_count=`expr $_am_stamp_count + 1` ;;
161   esac
162 done
163 echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
164
165 # Copyright 2002  Free Software Foundation, Inc.
166
167 # This program is free software; you can redistribute it and/or modify
168 # it under the terms of the GNU General Public License as published by
169 # the Free Software Foundation; either version 2, or (at your option)
170 # any later version.
171
172 # This program is distributed in the hope that it will be useful,
173 # but WITHOUT ANY WARRANTY; without even the implied warranty of
174 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
175 # GNU General Public License for more details.
176
177 # You should have received a copy of the GNU General Public License
178 # along with this program; if not, write to the Free Software
179 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
180
181 # AM_AUTOMAKE_VERSION(VERSION)
182 # ----------------------------
183 # Automake X.Y traces this macro to ensure aclocal.m4 has been
184 # generated from the m4 files accompanying Automake X.Y.
185 AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"])
186
187 # AM_SET_CURRENT_AUTOMAKE_VERSION
188 # -------------------------------
189 # Call AM_AUTOMAKE_VERSION so it can be traced.
190 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
191 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
192          [AM_AUTOMAKE_VERSION([1.7.6])])
193
194 # Helper functions for option handling.                    -*- Autoconf -*-
195
196 # Copyright 2001, 2002  Free Software Foundation, Inc.
197
198 # This program is free software; you can redistribute it and/or modify
199 # it under the terms of the GNU General Public License as published by
200 # the Free Software Foundation; either version 2, or (at your option)
201 # any later version.
202
203 # This program is distributed in the hope that it will be useful,
204 # but WITHOUT ANY WARRANTY; without even the implied warranty of
205 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
206 # GNU General Public License for more details.
207
208 # You should have received a copy of the GNU General Public License
209 # along with this program; if not, write to the Free Software
210 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
211 # 02111-1307, USA.
212
213 # serial 2
214
215 # _AM_MANGLE_OPTION(NAME)
216 # -----------------------
217 AC_DEFUN([_AM_MANGLE_OPTION],
218 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
219
220 # _AM_SET_OPTION(NAME)
221 # ------------------------------
222 # Set option NAME.  Presently that only means defining a flag for this option.
223 AC_DEFUN([_AM_SET_OPTION],
224 [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
225
226 # _AM_SET_OPTIONS(OPTIONS)
227 # ----------------------------------
228 # OPTIONS is a space-separated list of Automake options.
229 AC_DEFUN([_AM_SET_OPTIONS],
230 [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
231
232 # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
233 # -------------------------------------------
234 # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
235 AC_DEFUN([_AM_IF_OPTION],
236 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
237
238 #
239 # Check to make sure that the build environment is sane.
240 #
241
242 # Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
243
244 # This program is free software; you can redistribute it and/or modify
245 # it under the terms of the GNU General Public License as published by
246 # the Free Software Foundation; either version 2, or (at your option)
247 # any later version.
248
249 # This program is distributed in the hope that it will be useful,
250 # but WITHOUT ANY WARRANTY; without even the implied warranty of
251 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
252 # GNU General Public License for more details.
253
254 # You should have received a copy of the GNU General Public License
255 # along with this program; if not, write to the Free Software
256 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
257 # 02111-1307, USA.
258
259 # serial 3
260
261 # AM_SANITY_CHECK
262 # ---------------
263 AC_DEFUN([AM_SANITY_CHECK],
264 [AC_MSG_CHECKING([whether build environment is sane])
265 # Just in case
266 sleep 1
267 echo timestamp > conftest.file
268 # Do `set' in a subshell so we don't clobber the current shell's
269 # arguments.  Must try -L first in case configure is actually a
270 # symlink; some systems play weird games with the mod time of symlinks
271 # (eg FreeBSD returns the mod time of the symlink's containing
272 # directory).
273 if (
274    set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
275    if test "$[*]" = "X"; then
276       # -L didn't work.
277       set X `ls -t $srcdir/configure conftest.file`
278    fi
279    rm -f conftest.file
280    if test "$[*]" != "X $srcdir/configure conftest.file" \
281       && test "$[*]" != "X conftest.file $srcdir/configure"; then
282
283       # If neither matched, then we have a broken ls.  This can happen
284       # if, for instance, CONFIG_SHELL is bash and it inherits a
285       # broken ls alias from the environment.  This has actually
286       # happened.  Such a system could not be considered "sane".
287       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
288 alias in your environment])
289    fi
290
291    test "$[2]" = conftest.file
292    )
293 then
294    # Ok.
295    :
296 else
297    AC_MSG_ERROR([newly created file is older than distributed files!
298 Check your system clock])
299 fi
300 AC_MSG_RESULT(yes)])
301
302 #  -*- Autoconf -*-
303
304
305 # Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
306
307 # This program is free software; you can redistribute it and/or modify
308 # it under the terms of the GNU General Public License as published by
309 # the Free Software Foundation; either version 2, or (at your option)
310 # any later version.
311
312 # This program is distributed in the hope that it will be useful,
313 # but WITHOUT ANY WARRANTY; without even the implied warranty of
314 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
315 # GNU General Public License for more details.
316
317 # You should have received a copy of the GNU General Public License
318 # along with this program; if not, write to the Free Software
319 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
320 # 02111-1307, USA.
321
322 # serial 3
323
324 # AM_MISSING_PROG(NAME, PROGRAM)
325 # ------------------------------
326 AC_DEFUN([AM_MISSING_PROG],
327 [AC_REQUIRE([AM_MISSING_HAS_RUN])
328 $1=${$1-"${am_missing_run}$2"}
329 AC_SUBST($1)])
330
331
332 # AM_MISSING_HAS_RUN
333 # ------------------
334 # Define MISSING if not defined so far and test if it supports --run.
335 # If it does, set am_missing_run to use it, otherwise, to nothing.
336 AC_DEFUN([AM_MISSING_HAS_RUN],
337 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
338 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
339 # Use eval to expand $SHELL
340 if eval "$MISSING --run true"; then
341   am_missing_run="$MISSING --run "
342 else
343   am_missing_run=
344   AC_MSG_WARN([`missing' script is too old or missing])
345 fi
346 ])
347
348 # AM_AUX_DIR_EXPAND
349
350 # Copyright 2001 Free Software Foundation, Inc.
351
352 # This program is free software; you can redistribute it and/or modify
353 # it under the terms of the GNU General Public License as published by
354 # the Free Software Foundation; either version 2, or (at your option)
355 # any later version.
356
357 # This program is distributed in the hope that it will be useful,
358 # but WITHOUT ANY WARRANTY; without even the implied warranty of
359 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
360 # GNU General Public License for more details.
361
362 # You should have received a copy of the GNU General Public License
363 # along with this program; if not, write to the Free Software
364 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
365 # 02111-1307, USA.
366
367 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
368 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
369 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
370 #
371 # Of course, Automake must honor this variable whenever it calls a
372 # tool from the auxiliary directory.  The problem is that $srcdir (and
373 # therefore $ac_aux_dir as well) can be either absolute or relative,
374 # depending on how configure is run.  This is pretty annoying, since
375 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
376 # source directory, any form will work fine, but in subdirectories a
377 # relative path needs to be adjusted first.
378 #
379 # $ac_aux_dir/missing
380 #    fails when called from a subdirectory if $ac_aux_dir is relative
381 # $top_srcdir/$ac_aux_dir/missing
382 #    fails if $ac_aux_dir is absolute,
383 #    fails when called from a subdirectory in a VPATH build with
384 #          a relative $ac_aux_dir
385 #
386 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
387 # are both prefixed by $srcdir.  In an in-source build this is usually
388 # harmless because $srcdir is `.', but things will broke when you
389 # start a VPATH build or use an absolute $srcdir.
390 #
391 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
392 # iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
393 #   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
394 # and then we would define $MISSING as
395 #   MISSING="\${SHELL} $am_aux_dir/missing"
396 # This will work as long as MISSING is not called from configure, because
397 # unfortunately $(top_srcdir) has no meaning in configure.
398 # However there are other variables, like CC, which are often used in
399 # configure, and could therefore not use this "fixed" $ac_aux_dir.
400 #
401 # Another solution, used here, is to always expand $ac_aux_dir to an
402 # absolute PATH.  The drawback is that using absolute paths prevent a
403 # configured tree to be moved without reconfiguration.
404
405 # Rely on autoconf to set up CDPATH properly.
406 AC_PREREQ([2.50])
407
408 AC_DEFUN([AM_AUX_DIR_EXPAND], [
409 # expand $ac_aux_dir to an absolute path
410 am_aux_dir=`cd $ac_aux_dir && pwd`
411 ])
412
413 # AM_PROG_INSTALL_SH
414 # ------------------
415 # Define $install_sh.
416
417 # Copyright 2001 Free Software Foundation, Inc.
418
419 # This program is free software; you can redistribute it and/or modify
420 # it under the terms of the GNU General Public License as published by
421 # the Free Software Foundation; either version 2, or (at your option)
422 # any later version.
423
424 # This program is distributed in the hope that it will be useful,
425 # but WITHOUT ANY WARRANTY; without even the implied warranty of
426 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
427 # GNU General Public License for more details.
428
429 # You should have received a copy of the GNU General Public License
430 # along with this program; if not, write to the Free Software
431 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
432 # 02111-1307, USA.
433
434 AC_DEFUN([AM_PROG_INSTALL_SH],
435 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
436 install_sh=${install_sh-"$am_aux_dir/install-sh"}
437 AC_SUBST(install_sh)])
438
439 # AM_PROG_INSTALL_STRIP
440
441 # Copyright 2001 Free Software Foundation, Inc.
442
443 # This program is free software; you can redistribute it and/or modify
444 # it under the terms of the GNU General Public License as published by
445 # the Free Software Foundation; either version 2, or (at your option)
446 # any later version.
447
448 # This program is distributed in the hope that it will be useful,
449 # but WITHOUT ANY WARRANTY; without even the implied warranty of
450 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
451 # GNU General Public License for more details.
452
453 # You should have received a copy of the GNU General Public License
454 # along with this program; if not, write to the Free Software
455 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
456 # 02111-1307, USA.
457
458 # One issue with vendor `install' (even GNU) is that you can't
459 # specify the program used to strip binaries.  This is especially
460 # annoying in cross-compiling environments, where the build's strip
461 # is unlikely to handle the host's binaries.
462 # Fortunately install-sh will honor a STRIPPROG variable, so we
463 # always use install-sh in `make install-strip', and initialize
464 # STRIPPROG with the value of the STRIP variable (set by the user).
465 AC_DEFUN([AM_PROG_INSTALL_STRIP],
466 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
467 # Installed binaries are usually stripped using `strip' when the user
468 # run `make install-strip'.  However `strip' might not be the right
469 # tool to use in cross-compilation environments, therefore Automake
470 # will honor the `STRIP' environment variable to overrule this program.
471 dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
472 if test "$cross_compiling" != no; then
473   AC_CHECK_TOOL([STRIP], [strip], :)
474 fi
475 INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
476 AC_SUBST([INSTALL_STRIP_PROGRAM])])
477
478 #                                                          -*- Autoconf -*-
479 # Copyright (C) 2003  Free Software Foundation, Inc.
480
481 # This program is free software; you can redistribute it and/or modify
482 # it under the terms of the GNU General Public License as published by
483 # the Free Software Foundation; either version 2, or (at your option)
484 # any later version.
485
486 # This program is distributed in the hope that it will be useful,
487 # but WITHOUT ANY WARRANTY; without even the implied warranty of
488 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
489 # GNU General Public License for more details.
490
491 # You should have received a copy of the GNU General Public License
492 # along with this program; if not, write to the Free Software
493 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
494 # 02111-1307, USA.
495
496 # serial 1
497
498 # Check whether the underlying file-system supports filenames
499 # with a leading dot.  For instance MS-DOS doesn't.
500 AC_DEFUN([AM_SET_LEADING_DOT],
501 [rm -rf .tst 2>/dev/null
502 mkdir .tst 2>/dev/null
503 if test -d .tst; then
504   am__leading_dot=.
505 else
506   am__leading_dot=_
507 fi
508 rmdir .tst 2>/dev/null
509 AC_SUBST([am__leading_dot])])
510
511 # serial 5                                              -*- Autoconf -*-
512
513 # Copyright (C) 1999, 2000, 2001, 2002, 2003  Free Software Foundation, Inc.
514
515 # This program is free software; you can redistribute it and/or modify
516 # it under the terms of the GNU General Public License as published by
517 # the Free Software Foundation; either version 2, or (at your option)
518 # any later version.
519
520 # This program is distributed in the hope that it will be useful,
521 # but WITHOUT ANY WARRANTY; without even the implied warranty of
522 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
523 # GNU General Public License for more details.
524
525 # You should have received a copy of the GNU General Public License
526 # along with this program; if not, write to the Free Software
527 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
528 # 02111-1307, USA.
529
530
531 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
532 # written in clear, in which case automake, when reading aclocal.m4,
533 # will think it sees a *use*, and therefore will trigger all it's
534 # C support machinery.  Also note that it means that autoscan, seeing
535 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
536
537
538
539 # _AM_DEPENDENCIES(NAME)
540 # ----------------------
541 # See how the compiler implements dependency checking.
542 # NAME is "CC", "CXX", "GCJ", or "OBJC".
543 # We try a few techniques and use that to set a single cache variable.
544 #
545 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
546 # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
547 # dependency, and given that the user is not expected to run this macro,
548 # just rely on AC_PROG_CC.
549 AC_DEFUN([_AM_DEPENDENCIES],
550 [AC_REQUIRE([AM_SET_DEPDIR])dnl
551 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
552 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
553 AC_REQUIRE([AM_DEP_TRACK])dnl
554
555 ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
556        [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
557        [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
558        [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
559                    [depcc="$$1"   am_compiler_list=])
560
561 AC_CACHE_CHECK([dependency style of $depcc],
562                [am_cv_$1_dependencies_compiler_type],
563 [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
564   # We make a subdir and do the tests there.  Otherwise we can end up
565   # making bogus files that we don't know about and never remove.  For
566   # instance it was reported that on HP-UX the gcc test will end up
567   # making a dummy file named `D' -- because `-MD' means `put the output
568   # in D'.
569   mkdir conftest.dir
570   # Copy depcomp to subdir because otherwise we won't find it if we're
571   # using a relative directory.
572   cp "$am_depcomp" conftest.dir
573   cd conftest.dir
574   # We will build objects and dependencies in a subdirectory because
575   # it helps to detect inapplicable dependency modes.  For instance
576   # both Tru64's cc and ICC support -MD to output dependencies as a
577   # side effect of compilation, but ICC will put the dependencies in
578   # the current directory while Tru64 will put them in the object
579   # directory.
580   mkdir sub
581
582   am_cv_$1_dependencies_compiler_type=none
583   if test "$am_compiler_list" = ""; then
584      am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
585   fi
586   for depmode in $am_compiler_list; do
587     # Setup a source with many dependencies, because some compilers
588     # like to wrap large dependency lists on column 80 (with \), and
589     # we should not choose a depcomp mode which is confused by this.
590     #
591     # We need to recreate these files for each test, as the compiler may
592     # overwrite some of them when testing with obscure command lines.
593     # This happens at least with the AIX C compiler.
594     : > sub/conftest.c
595     for i in 1 2 3 4 5 6; do
596       echo '#include "conftst'$i'.h"' >> sub/conftest.c
597       : > sub/conftst$i.h
598     done
599     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
600
601     case $depmode in
602     nosideeffect)
603       # after this tag, mechanisms are not by side-effect, so they'll
604       # only be used when explicitly requested
605       if test "x$enable_dependency_tracking" = xyes; then
606         continue
607       else
608         break
609       fi
610       ;;
611     none) break ;;
612     esac
613     # We check with `-c' and `-o' for the sake of the "dashmstdout"
614     # mode.  It turns out that the SunPro C++ compiler does not properly
615     # handle `-M -o', and we need to detect this.
616     if depmode=$depmode \
617        source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
618        depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
619        $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
620          >/dev/null 2>conftest.err &&
621        grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
622        grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
623        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
624       # icc doesn't choke on unknown options, it will just issue warnings
625       # (even with -Werror).  So we grep stderr for any message
626       # that says an option was ignored.
627       if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
628         am_cv_$1_dependencies_compiler_type=$depmode
629         break
630       fi
631     fi
632   done
633
634   cd ..
635   rm -rf conftest.dir
636 else
637   am_cv_$1_dependencies_compiler_type=none
638 fi
639 ])
640 AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
641 AM_CONDITIONAL([am__fastdep$1], [
642   test "x$enable_dependency_tracking" != xno \
643   && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
644 ])
645
646
647 # AM_SET_DEPDIR
648 # -------------
649 # Choose a directory name for dependency files.
650 # This macro is AC_REQUIREd in _AM_DEPENDENCIES
651 AC_DEFUN([AM_SET_DEPDIR],
652 [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
653 AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
654 ])
655
656
657 # AM_DEP_TRACK
658 # ------------
659 AC_DEFUN([AM_DEP_TRACK],
660 [AC_ARG_ENABLE(dependency-tracking,
661 [  --disable-dependency-tracking Speeds up one-time builds
662   --enable-dependency-tracking  Do not reject slow dependency extractors])
663 if test "x$enable_dependency_tracking" != xno; then
664   am_depcomp="$ac_aux_dir/depcomp"
665   AMDEPBACKSLASH='\'
666 fi
667 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
668 AC_SUBST([AMDEPBACKSLASH])
669 ])
670
671 # Generate code to set up dependency tracking.   -*- Autoconf -*-
672
673 # Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
674
675 # This program is free software; you can redistribute it and/or modify
676 # it under the terms of the GNU General Public License as published by
677 # the Free Software Foundation; either version 2, or (at your option)
678 # any later version.
679
680 # This program is distributed in the hope that it will be useful,
681 # but WITHOUT ANY WARRANTY; without even the implied warranty of
682 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
683 # GNU General Public License for more details.
684
685 # You should have received a copy of the GNU General Public License
686 # along with this program; if not, write to the Free Software
687 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
688 # 02111-1307, USA.
689
690 #serial 2
691
692 # _AM_OUTPUT_DEPENDENCY_COMMANDS
693 # ------------------------------
694 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
695 [for mf in $CONFIG_FILES; do
696   # Strip MF so we end up with the name of the file.
697   mf=`echo "$mf" | sed -e 's/:.*$//'`
698   # Check whether this is an Automake generated Makefile or not.
699   # We used to match only the files named `Makefile.in', but
700   # some people rename them; so instead we look at the file content.
701   # Grep'ing the first line is not enough: some people post-process
702   # each Makefile.in and add a new line on top of each file to say so.
703   # So let's grep whole file.
704   if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
705     dirpart=`AS_DIRNAME("$mf")`
706   else
707     continue
708   fi
709   grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
710   # Extract the definition of DEP_FILES from the Makefile without
711   # running `make'.
712   DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
713   test -z "$DEPDIR" && continue
714   # When using ansi2knr, U may be empty or an underscore; expand it
715   U=`sed -n -e '/^U = / s///p' < "$mf"`
716   test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
717   # We invoke sed twice because it is the simplest approach to
718   # changing $(DEPDIR) to its actual value in the expansion.
719   for file in `sed -n -e '
720     /^DEP_FILES = .*\\\\$/ {
721       s/^DEP_FILES = //
722       :loop
723         s/\\\\$//
724         p
725         n
726         /\\\\$/ b loop
727       p
728     }
729     /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
730        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
731     # Make sure the directory exists.
732     test -f "$dirpart/$file" && continue
733     fdir=`AS_DIRNAME(["$file"])`
734     AS_MKDIR_P([$dirpart/$fdir])
735     # echo "creating $dirpart/$file"
736     echo '# dummy' > "$dirpart/$file"
737   done
738 done
739 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
740
741
742 # AM_OUTPUT_DEPENDENCY_COMMANDS
743 # -----------------------------
744 # This macro should only be invoked once -- use via AC_REQUIRE.
745 #
746 # This code is only required when automatic dependency tracking
747 # is enabled.  FIXME.  This creates each `.P' file that we will
748 # need in order to bootstrap the dependency handling code.
749 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
750 [AC_CONFIG_COMMANDS([depfiles],
751      [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
752      [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
753 ])
754
755 # Check to see how 'make' treats includes.      -*- Autoconf -*-
756
757 # Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
758
759 # This program is free software; you can redistribute it and/or modify
760 # it under the terms of the GNU General Public License as published by
761 # the Free Software Foundation; either version 2, or (at your option)
762 # any later version.
763
764 # This program is distributed in the hope that it will be useful,
765 # but WITHOUT ANY WARRANTY; without even the implied warranty of
766 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
767 # GNU General Public License for more details.
768
769 # You should have received a copy of the GNU General Public License
770 # along with this program; if not, write to the Free Software
771 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
772 # 02111-1307, USA.
773
774 # serial 2
775
776 # AM_MAKE_INCLUDE()
777 # -----------------
778 # Check to see how make treats includes.
779 AC_DEFUN([AM_MAKE_INCLUDE],
780 [am_make=${MAKE-make}
781 cat > confinc << 'END'
782 am__doit:
783         @echo done
784 .PHONY: am__doit
785 END
786 # If we don't find an include directive, just comment out the code.
787 AC_MSG_CHECKING([for style of include used by $am_make])
788 am__include="#"
789 am__quote=
790 _am_result=none
791 # First try GNU make style include.
792 echo "include confinc" > confmf
793 # We grep out `Entering directory' and `Leaving directory'
794 # messages which can occur if `w' ends up in MAKEFLAGS.
795 # In particular we don't look at `^make:' because GNU make might
796 # be invoked under some other name (usually "gmake"), in which
797 # case it prints its new name instead of `make'.
798 if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
799    am__include=include
800    am__quote=
801    _am_result=GNU
802 fi
803 # Now try BSD make style include.
804 if test "$am__include" = "#"; then
805    echo '.include "confinc"' > confmf
806    if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
807       am__include=.include
808       am__quote="\""
809       _am_result=BSD
810    fi
811 fi
812 AC_SUBST([am__include])
813 AC_SUBST([am__quote])
814 AC_MSG_RESULT([$_am_result])
815 rm -f confinc confmf
816 ])
817
818 # AM_CONDITIONAL                                              -*- Autoconf -*-
819
820 # Copyright 1997, 2000, 2001 Free Software Foundation, Inc.
821
822 # This program is free software; you can redistribute it and/or modify
823 # it under the terms of the GNU General Public License as published by
824 # the Free Software Foundation; either version 2, or (at your option)
825 # any later version.
826
827 # This program is distributed in the hope that it will be useful,
828 # but WITHOUT ANY WARRANTY; without even the implied warranty of
829 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
830 # GNU General Public License for more details.
831
832 # You should have received a copy of the GNU General Public License
833 # along with this program; if not, write to the Free Software
834 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
835 # 02111-1307, USA.
836
837 # serial 5
838
839 AC_PREREQ(2.52)
840
841 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
842 # -------------------------------------
843 # Define a conditional.
844 AC_DEFUN([AM_CONDITIONAL],
845 [ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
846         [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
847 AC_SUBST([$1_TRUE])
848 AC_SUBST([$1_FALSE])
849 if $2; then
850   $1_TRUE=
851   $1_FALSE='#'
852 else
853   $1_TRUE='#'
854   $1_FALSE=
855 fi
856 AC_CONFIG_COMMANDS_PRE(
857 [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
858   AC_MSG_ERROR([conditional "$1" was never defined.
859 Usually this means the macro was only invoked conditionally.])
860 fi])])
861
862 #serial 1
863 # This test replaces the one in autoconf.
864 # Currently this macro should have the same name as the autoconf macro
865 # because gettext's gettext.m4 (distributed in the automake package)
866 # still uses it.  Otherwise, the use in gettext.m4 makes autoheader
867 # give these diagnostics:
868 #   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
869 #   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
870
871 undefine([AC_ISC_POSIX])
872
873 AC_DEFUN([AC_ISC_POSIX],
874   [
875     dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
876     AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
877   ]
878 )
879
880
881 # Copyright 1996, 1997, 1998, 2000, 2001, 2002  Free Software Foundation, Inc.
882
883 # This program is free software; you can redistribute it and/or modify
884 # it under the terms of the GNU General Public License as published by
885 # the Free Software Foundation; either version 2, or (at your option)
886 # any later version.
887
888 # This program is distributed in the hope that it will be useful,
889 # but WITHOUT ANY WARRANTY; without even the implied warranty of
890 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
891 # GNU General Public License for more details.
892
893 # You should have received a copy of the GNU General Public License
894 # along with this program; if not, write to the Free Software
895 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
896 # 02111-1307, USA.
897
898 # serial 2
899
900 AC_DEFUN([AM_C_PROTOTYPES],
901 [AC_REQUIRE([AM_PROG_CC_STDC])
902 AC_REQUIRE([AC_PROG_CPP])
903 AC_MSG_CHECKING([for function prototypes])
904 if test "$am_cv_prog_cc_stdc" != no; then
905   AC_MSG_RESULT(yes)
906   AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
907   U= ANSI2KNR=
908 else
909   AC_MSG_RESULT(no)
910   U=_ ANSI2KNR=./ansi2knr
911 fi
912 # Ensure some checks needed by ansi2knr itself.
913 AC_HEADER_STDC
914 AC_CHECK_HEADERS(string.h)
915 AC_SUBST(U)dnl
916 AC_SUBST(ANSI2KNR)dnl
917 ])
918
919 AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
920
921
922 # Copyright 1996, 1997, 1999, 2000, 2001, 2002  Free Software Foundation, Inc.
923
924 # This program is free software; you can redistribute it and/or modify
925 # it under the terms of the GNU General Public License as published by
926 # the Free Software Foundation; either version 2, or (at your option)
927 # any later version.
928
929 # This program is distributed in the hope that it will be useful,
930 # but WITHOUT ANY WARRANTY; without even the implied warranty of
931 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
932 # GNU General Public License for more details.
933
934 # You should have received a copy of the GNU General Public License
935 # along with this program; if not, write to the Free Software
936 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
937 # 02111-1307, USA.
938
939 # serial 2
940
941 # @defmac AC_PROG_CC_STDC
942 # @maindex PROG_CC_STDC
943 # @ovindex CC
944 # If the C compiler in not in ANSI C mode by default, try to add an option
945 # to output variable @code{CC} to make it so.  This macro tries various
946 # options that select ANSI C on some system or another.  It considers the
947 # compiler to be in ANSI C mode if it handles function prototypes correctly.
948 #
949 # If you use this macro, you should check after calling it whether the C
950 # compiler has been set to accept ANSI C; if not, the shell variable
951 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
952 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
953 # program @code{ansi2knr}, which comes with Ghostscript.
954 # @end defmac
955
956 AC_DEFUN([AM_PROG_CC_STDC],
957 [AC_REQUIRE([AC_PROG_CC])
958 AC_BEFORE([$0], [AC_C_INLINE])
959 AC_BEFORE([$0], [AC_C_CONST])
960 dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
961 dnl a magic option to avoid problems with ANSI preprocessor commands
962 dnl like #elif.
963 dnl FIXME: can't do this because then AC_AIX won't work due to a
964 dnl circular dependency.
965 dnl AC_BEFORE([$0], [AC_PROG_CPP])
966 AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
967 AC_CACHE_VAL(am_cv_prog_cc_stdc,
968 [am_cv_prog_cc_stdc=no
969 ac_save_CC="$CC"
970 # Don't try gcc -ansi; that turns off useful extensions and
971 # breaks some systems' header files.
972 # AIX                   -qlanglvl=ansi
973 # Ultrix and OSF/1      -std1
974 # HP-UX 10.20 and later -Ae
975 # HP-UX older versions  -Aa -D_HPUX_SOURCE
976 # SVR4                  -Xc -D__EXTENSIONS__
977 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
978 do
979   CC="$ac_save_CC $ac_arg"
980   AC_TRY_COMPILE(
981 [#include <stdarg.h>
982 #include <stdio.h>
983 #include <sys/types.h>
984 #include <sys/stat.h>
985 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
986 struct buf { int x; };
987 FILE * (*rcsopen) (struct buf *, struct stat *, int);
988 static char *e (p, i)
989      char **p;
990      int i;
991 {
992   return p[i];
993 }
994 static char *f (char * (*g) (char **, int), char **p, ...)
995 {
996   char *s;
997   va_list v;
998   va_start (v,p);
999   s = g (p, va_arg (v,int));
1000   va_end (v);
1001   return s;
1002 }
1003 int test (int i, double x);
1004 struct s1 {int (*f) (int a);};
1005 struct s2 {int (*f) (double a);};
1006 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
1007 int argc;
1008 char **argv;
1009 ], [
1010 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
1011 ],
1012 [am_cv_prog_cc_stdc="$ac_arg"; break])
1013 done
1014 CC="$ac_save_CC"
1015 ])
1016 if test -z "$am_cv_prog_cc_stdc"; then
1017   AC_MSG_RESULT([none needed])
1018 else
1019   AC_MSG_RESULT([$am_cv_prog_cc_stdc])
1020 fi
1021 case "x$am_cv_prog_cc_stdc" in
1022   x|xno) ;;
1023   *) CC="$CC $am_cv_prog_cc_stdc" ;;
1024 esac
1025 ])
1026
1027 AU_DEFUN([fp_PROG_CC_STDC], [AM_PROG_CC_STDC])
1028
1029 dnl ---------------------------------------------------------------------------
1030 dnl Look for the curses libraries.  Older curses implementations may require
1031 dnl termcap/termlib to be linked as well.
1032 AC_DEFUN([CF_CURSES_LIBS],[
1033 AC_CHECK_FUNC(initscr,,[
1034 case $host_os in #(vi
1035 freebsd*) #(vi
1036         AC_CHECK_LIB(mytinfo,tgoto,[LIBS="-lmytinfo $LIBS"])
1037         ;;
1038 hpux10.*|hpux11.*)
1039         AC_CHECK_LIB(cur_colr,initscr,[
1040                 LIBS="-lcur_colr $LIBS"
1041                 CFLAGS="-I/usr/include/curses_colr $CFLAGS"
1042                 ac_cv_func_initscr=yes
1043                 ],[
1044         AC_CHECK_LIB(Hcurses,initscr,[
1045                 # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
1046                 LIBS="-lHcurses $LIBS"
1047                 CFLAGS="-D__HP_CURSES -D_HP_CURSES $CFLAGS"
1048                 ac_cv_func_initscr=yes
1049                 ])])
1050         ;;
1051 linux*) # Suse Linux does not follow /usr/lib convention
1052         LIBS="$LIBS -L/lib"
1053         ;;
1054 esac
1055
1056 if test ".$With5lib" != ".no" ; then
1057 if test -d /usr/5lib ; then
1058         # SunOS 3.x or 4.x
1059         CPPFLAGS="$CPPFLAGS -I/usr/5include"
1060         LIBS="$LIBS -L/usr/5lib"
1061 fi
1062 fi
1063
1064 if test ".$ac_cv_func_initscr" != .yes ; then
1065         cf_save_LIBS="$LIBS"
1066         cf_term_lib=""
1067         cf_curs_lib=""
1068
1069         # Check for library containing tgoto.  Do this before curses library
1070         # because it may be needed to link the test-case for initscr.
1071         AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
1072                 for cf_term_lib in termcap termlib unknown
1073                 do
1074                         AC_CHECK_LIB($cf_term_lib,tgoto,[break])
1075                 done
1076         ])
1077
1078         # Check for library containing initscr
1079         test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
1080         for cf_curs_lib in cursesX curses ncurses xcurses jcurses unknown
1081         do
1082                 AC_CHECK_LIB($cf_curs_lib,initscr,[break])
1083         done
1084         test $cf_curs_lib = unknown && AC_ERROR(no curses library found)
1085
1086         LIBS="-l$cf_curs_lib $cf_save_LIBS"
1087         if test "$cf_term_lib" = unknown ; then
1088                 AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
1089                 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
1090                         [initscr()],
1091                         [cf_result=yes],
1092                         [cf_result=no])
1093                 AC_MSG_RESULT($cf_result)
1094                 test $cf_result = no && AC_ERROR(Cannot link curses library)
1095         elif test "$cf_term_lib" != predefined ; then
1096                 AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
1097                 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
1098                         [initscr(); tgoto((char *)0, 0, 0);],
1099                         [cf_result=no],
1100                         [
1101                         LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
1102                         AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
1103                                 [initscr()],
1104                                 [cf_result=yes],
1105                                 [cf_result=error])
1106                         ])
1107                 AC_MSG_RESULT($cf_result)
1108         fi
1109 fi
1110
1111 ])])
1112
1113 dnl ---------------------------------------------------------------------------
1114 dnl Check if a function is declared by including a set of include files.
1115 dnl Invoke the corresponding actions according to whether it is found or not.
1116 dnl
1117 dnl Gcc (unlike other compilers) will only warn about the miscast assignment
1118 dnl in the first test, but most compilers will oblige with an error in the
1119 dnl second test.
1120 dnl
1121 dnl CF_CHECK_FUNCDECL(INCLUDES, FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1122 AC_DEFUN([CF_CHECK_FUNCDECL],
1123 [
1124 AC_MSG_CHECKING([for $2 declaration])
1125 AC_CACHE_VAL(ac_cv_func_decl_$2,
1126 [AC_TRY_COMPILE([$1],
1127 [#ifndef ${ac_func}
1128 extern  int     ${ac_func}();
1129 #endif],[
1130 AC_TRY_COMPILE([$1],
1131 [#ifndef ${ac_func}
1132 int     (*p)() = ${ac_func};
1133 #endif],[
1134 eval "ac_cv_func_decl_$2=yes"],[
1135 eval "ac_cv_func_decl_$2=no"])],[
1136 eval "ac_cv_func_decl_$2=yes"])])
1137 if eval "test \"`echo '$ac_cv_func_'decl_$2`\" = yes"; then
1138   AC_MSG_RESULT(yes)
1139   ifelse([$3], , :, [$3])
1140 else
1141   AC_MSG_RESULT(no)
1142 ifelse([$4], , , [$4
1143 ])dnl
1144 fi
1145 ])dnl
1146 dnl ---------------------------------------------------------------------------
1147 dnl Check if functions are declared by including a set of include files.
1148 dnl and define DECL_XXX if not.
1149 dnl
1150 dnl CF_CHECK_FUNCDECLS(INCLUDES, FUNCTION... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1151 AC_DEFUN([CF_CHECK_FUNCDECLS],
1152 [for ac_func in $2
1153 do
1154 CF_CHECK_FUNCDECL([$1], $ac_func,
1155 [
1156   CF_UPPER(ac_tr_func,HAVE_$ac_func)
1157   AC_DEFINE_UNQUOTED($ac_tr_func) $3],
1158 [$4])dnl
1159 dnl [$3],
1160 dnl [
1161 dnl   CF_UPPER(ac_tr_func,DECL_$ac_func)
1162 dnl   AC_DEFINE_UNQUOTED($ac_tr_func) $4])dnl
1163 done
1164 ])dnl
1165 dnl ---------------------------------------------------------------------------
1166 dnl Make an uppercase version of a variable
1167 dnl $1=uppercase($2)
1168 AC_DEFUN([CF_UPPER],
1169 [
1170 changequote(,)dnl
1171 $1=`echo $2 | tr '[a-z]' '[A-Z]'`
1172 changequote([,])dnl
1173 ])dnl
1174 dnl ---------------------------------------------------------------------------
1175
1176 # gssapi.m4: Find GSSAPI libraries in either Heimdal or MIT implementations
1177 # Brendan Cully <brendan@kublai.com> 20010529
1178
1179 dnl MUTT_AM_PATH_GSSAPI(PREFIX)
1180 dnl Search for a GSSAPI implementation in the standard locations plus PREFIX,
1181 dnl if it is set and not "yes".
1182 dnl Defines GSSAPI_CFLAGS and GSSAPI_LIBS if found.
1183 dnl Defines GSSAPI_IMPL to "Heimdal", "MIT", or "OldMIT", or "none" if not found
1184 AC_DEFUN([MUTT_AM_PATH_GSSAPI],
1185 [
1186   GSSAPI_PREFIX=[$]$1
1187   GSSAPI_IMPL="none"
1188   saved_CPPFLAGS="$CPPFLAGS"
1189   saved_LDFLAGS="$LDFLAGS"
1190   saved_LIBS="$LIBS"
1191   dnl First try krb5-config
1192   if test "$GSSAPI_PREFIX" != "yes"
1193   then
1194     krb5_path="$GSSAPI_PREFIX/bin"
1195   else
1196     krb5_path="$PATH"
1197   fi
1198   AC_PATH_PROG(KRB5CFGPATH, krb5-config, none, $krb5_path)
1199   if test "$KRB5CFGPATH" != "none"
1200   then
1201     GSSAPI_CFLAGS="$CPPFLAGS `$KRB5CFGPATH --cflags gssapi`"
1202     GSSAPI_LIBS="$MUTTLIBS `$KRB5CFGPATH --libs gssapi`"
1203     case "`$KRB5CFGPATH --version`" in
1204       "Kerberos 5 "*)   GSSAPI_IMPL="MIT";;
1205       ?eimdal*)         GSSAPI_IMPL="Heimdal";;
1206       *)                GSSAPI_IMPL="Unknown";;
1207    esac
1208   else
1209     dnl No krb5-config, run the old code
1210     if test "$GSSAPI_PREFIX" != "yes"
1211     then
1212       GSSAPI_CFLAGS="-I$GSSAPI_PREFIX/include"
1213       GSSAPI_LDFLAGS="-L$GSSAPI_PREFIX/lib"
1214       CPPFLAGS="$CPPFLAGS $GSSAPI_CFLAGS"
1215       LDFLAGS="$LDFLAGS $GSSAPI_LDFLAGS"
1216     fi
1217
1218     dnl New MIT kerberos V support
1219     AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context, [
1220       GSSAPI_IMPL="MIT",
1221       GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err"
1222       ],, -lkrb5 -lk5crypto -lcom_err)
1223
1224     dnl Heimdal kerberos V support
1225     if test "$GSSAPI_IMPL" = "none"
1226     then
1227       AC_CHECK_LIB(gssapi, gss_init_sec_context, [
1228           GSSAPI_IMPL="Heimdal"
1229           GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi -lkrb5 -ldes -lasn1 -lroken"
1230           GSSAPI_LIBS="$GSSAPI_LIBS -lcrypt -lcom_err"
1231           ],, -lkrb5 -ldes -lasn1 -lroken -lcrypt -lcom_err)
1232     fi
1233
1234     dnl Old MIT Kerberos V
1235     dnl Note: older krb5 distributions use -lcrypto instead of
1236     dnl -lk5crypto, which collides with OpenSSL.  One way of dealing
1237     dnl with that is to extract all objects from krb5's libcrypto
1238     dnl and from openssl's libcrypto into the same directory, then
1239     dnl to create a new libcrypto from these.
1240     if test "$GSSAPI_IMPL" = "none"
1241     then
1242       AC_CHECK_LIB(gssapi_krb5, g_order_init, [
1243         GSSAPI_IMPL="OldMIT",
1244         GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi_krb5 -lkrb5 -lcrypto -lcom_err"
1245         ],, -lkrb5 -lcrypto -lcom_err)
1246     fi
1247   fi
1248
1249   CPPFLAGS="$saved_CPPFLAGS"
1250   LDFLAGS="$saved_LDFLAGS"
1251   LIBS="$saved_LIBS"
1252 ])
1253
1254 # Macro to add for using GNU gettext.
1255 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1256
1257 #
1258 # Slightly modified by Thomas Roessler <roessler@does-not-exist.org>
1259 # Updated to gettext-0.10.38 by Edmund Grimley Evans <edmundo@rano.org>
1260 # Updated to gettext-0.10.40 by Andrew W. Nosenko <awn@bcs.zp.ua>
1261 #
1262
1263 # This file can be copied and used freely without restrictions.  It can
1264 # be used in projects which are not available under the GNU General Public
1265 # License or the GNU Library General Public License but which still want
1266 # to provide support for the GNU gettext functionality.
1267 # Please note that the actual code of the GNU gettext library is covered
1268 # by the GNU Library General Public License, and the rest of the GNU
1269 # gettext package package is covered by the GNU General Public License.
1270 # They are *not* in the public domain.
1271
1272 # serial 10
1273
1274 dnl Usage: MUTT_AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
1275 dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
1276 dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
1277 dnl    depending on --{enable,disable}-{shared,static} and on the presence of
1278 dnl    AM-DISABLE-SHARED). Otherwise, a static library
1279 dnl    $(top_builddir)/intl/libintl.a will be created.
1280 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
1281 dnl    implementations (in libc or libintl) without the ngettext() function
1282 dnl    will be ignored.
1283 dnl LIBDIR is used to find the intl libraries.  If empty,
1284 dnl    the value `$(top_builddir)/intl/' is used.
1285 dnl
1286 dnl The result of the configuration is one of three cases:
1287 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
1288 dnl    and used.
1289 dnl    Catalog format: GNU --> install in $(datadir)
1290 dnl    Catalog extension: .mo after installation, .gmo in source tree
1291 dnl 2) GNU gettext has been found in the system's C library.
1292 dnl    Catalog format: GNU --> install in $(datadir)
1293 dnl    Catalog extension: .mo after installation, .gmo in source tree
1294 dnl 3) No internationalization, always use English msgid.
1295 dnl    Catalog format: none
1296 dnl    Catalog extension: none
1297 dnl The use of .gmo is historical (it was needed to avoid overwriting the
1298 dnl GNU format catalogs when building on a platform with an X/Open gettext),
1299 dnl but we keep it in order not to force irrelevant filename changes on the
1300 dnl maintainers.
1301 dnl
1302 AC_DEFUN([MUTT_AM_WITH_NLS],
1303   [AC_MSG_CHECKING([whether NLS is requested])
1304     dnl Default is enabled NLS
1305     AC_ARG_ENABLE(nls,
1306       [  --disable-nls              Do not use Native Language Support],
1307       USE_NLS=$enableval, USE_NLS=yes)
1308     AC_MSG_RESULT($USE_NLS)
1309     AC_SUBST(USE_NLS)
1310
1311     BUILD_INCLUDED_LIBINTL=no
1312     USE_INCLUDED_LIBINTL=no
1313     INTLLIBS=
1314
1315     dnl If we use NLS figure out what method
1316     if test "$USE_NLS" = "yes"; then
1317       AC_DEFINE(ENABLE_NLS, 1,
1318         [Define to 1 if translation of program messages to the user's native language
1319    is requested.])
1320       AC_MSG_CHECKING([whether included gettext is requested])
1321       AC_ARG_WITH(included-gettext,
1322         [  --with-included-gettext    Use the GNU gettext library included here],
1323         nls_cv_force_use_gnu_gettext=$withval,
1324         nls_cv_force_use_gnu_gettext=no)
1325       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
1326
1327       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
1328       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
1329         dnl User does not insist on using GNU NLS library.  Figure out what
1330         dnl to use.  If GNU gettext is available we use this.  Else we have
1331         dnl to fall back to GNU NLS library.
1332         CATOBJEXT=NONE
1333
1334         dnl Add a version number to the cache macros.
1335         define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
1336         define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
1337
1338         AC_CHECK_HEADER(libintl.h,
1339           [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
1340             [AC_TRY_LINK([#include <libintl.h>
1341 extern int _nl_msg_cat_cntr;],
1342                [bindtextdomain ("", "");
1343 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
1344                gt_cv_func_gnugettext_libc=yes,
1345                gt_cv_func_gnugettext_libc=no)])
1346
1347            if test "$gt_cv_func_gnugettext_libc" != "yes"; then
1348              AC_CACHE_CHECK([for GNU gettext in libintl],
1349                gt_cv_func_gnugettext_libintl,
1350                [gt_save_LIBS="$LIBS"
1351                 LIBS="$LIBS -lintl $LIBICONV"
1352                 AC_TRY_LINK([#include <libintl.h>
1353 extern int _nl_msg_cat_cntr;],
1354                   [bindtextdomain ("", "");
1355 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
1356                   gt_cv_func_gnugettext_libintl=yes,
1357                   gt_cv_func_gnugettext_libintl=no)
1358                 LIBS="$gt_save_LIBS"])
1359            fi
1360
1361            dnl If an already present or preinstalled GNU gettext() is found,
1362            dnl use it.  But if this macro is used in GNU gettext, and GNU
1363            dnl gettext is already preinstalled in libintl, we update this
1364            dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
1365            if test "$gt_cv_func_gnugettext_libc" = "yes" \
1366               || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
1367                    && test "$PACKAGE" != gettext; }; then
1368              AC_DEFINE(HAVE_GETTEXT, 1,
1369                [Define if the GNU gettext() function is already present or preinstalled.])
1370
1371              if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
1372                dnl If iconv() is in a separate libiconv library, then anyone
1373                dnl linking with libintl{.a,.so} also needs to link with
1374                dnl libiconv.
1375                INTLLIBS="-lintl $LIBICONV"
1376              fi
1377
1378              gt_save_LIBS="$LIBS"
1379              LIBS="$LIBS $INTLLIBS"
1380              AC_CHECK_FUNCS(dcgettext)
1381              LIBS="$gt_save_LIBS"
1382
1383              dnl Search for GNU msgfmt in the PATH.
1384              MUTT_AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1385                [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
1386              AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1387
1388              dnl Search for GNU xgettext in the PATH.
1389              MUTT_AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1390                [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
1391
1392              CATOBJEXT=.gmo
1393            fi
1394         ])
1395
1396         if test "$CATOBJEXT" = "NONE"; then
1397           dnl GNU gettext is not found in the C library.
1398           dnl Fall back on GNU gettext library.
1399           nls_cv_use_gnu_gettext=yes
1400         fi
1401       fi
1402
1403       if test "$nls_cv_use_gnu_gettext" = "yes"; then
1404         dnl Mark actions used to generate GNU NLS library.
1405         INTLOBJS="\$(GETTOBJS)"
1406         MUTT_AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1407           [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
1408         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1409         MUTT_AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1410           [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
1411         AC_SUBST(MSGFMT)
1412         BUILD_INCLUDED_LIBINTL=yes
1413         USE_INCLUDED_LIBINTL=yes
1414         CATOBJEXT=.gmo
1415         INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
1416         LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
1417       fi
1418
1419       dnl This could go away some day; the MUTT_PATH_PROG_WITH_TEST already does it.
1420       dnl Test whether we really found GNU msgfmt.
1421       if test "$GMSGFMT" != ":"; then
1422         dnl If it is no GNU msgfmt we define it as : so that the
1423         dnl Makefiles still can work.
1424         if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
1425           : ;
1426         else
1427           AC_MSG_RESULT(
1428             [found msgfmt program is not GNU msgfmt; ignore it])
1429           GMSGFMT=":"
1430         fi
1431       fi
1432
1433       dnl This could go away some day; the MUTT_PATH_PROG_WITH_TEST already does it.
1434       dnl Test whether we really found GNU xgettext.
1435       if test "$XGETTEXT" != ":"; then
1436         dnl If it is no GNU xgettext we define it as : so that the
1437         dnl Makefiles still can work.
1438         if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
1439           : ;
1440         else
1441           AC_MSG_RESULT(
1442             [found xgettext program is not GNU xgettext; ignore it])
1443           XGETTEXT=":"
1444         fi
1445       fi
1446
1447       dnl We need to process the po/ directory.
1448       POSUB=po
1449     fi
1450     AC_OUTPUT_COMMANDS(
1451      [for ac_file in $CONFIG_FILES; do
1452         # Support "outfile[:infile[:infile...]]"
1453         case "$ac_file" in
1454           *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
1455         esac
1456         # PO directories have a Makefile.in generated from Makefile.in.in.
1457         case "$ac_file" in */Makefile.in)
1458           # Adjust a relative srcdir.
1459           ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
1460           ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
1461           ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
1462           # In autoconf-2.13 it is called $ac_given_srcdir.
1463           # In autoconf-2.50 it is called $srcdir.
1464           test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
1465           case "$ac_given_srcdir" in
1466             .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
1467             /*) top_srcdir="$ac_given_srcdir" ;;
1468             *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
1469           esac
1470           if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
1471             rm -f "$ac_dir/POTFILES"
1472             test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
1473             sed -e "/^#/d" -e "/^[      ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
1474             test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
1475             sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
1476           fi
1477           ;;
1478         esac
1479       done])
1480
1481
1482     dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
1483     dnl to 'yes' because some of the testsuite requires it.
1484     if test "$PACKAGE" = gettext; then
1485       BUILD_INCLUDED_LIBINTL=yes
1486     fi
1487
1488     dnl intl/plural.c is generated from intl/plural.y. It requires bison,
1489     dnl because plural.y uses bison specific features. It requires at least
1490     dnl bison-1.26 because earlier versions generate a plural.c that doesn't
1491     dnl compile.
1492     dnl bison is only needed for the maintainer (who touches plural.y). But in
1493     dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
1494     dnl the rule in general Makefile. Now, some people carelessly touch the
1495     dnl files or have a broken "make" program, hence the plural.c rule will
1496     dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
1497     dnl present or too old.
1498     AC_CHECK_PROGS([INTLBISON], [bison])
1499     if test -z "$INTLBISON"; then
1500       ac_verc_fail=yes
1501     else
1502       dnl Found it, now check the version.
1503       AC_MSG_CHECKING([version of bison])
1504 changequote(<<,>>)dnl
1505       ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
1506       case $ac_prog_version in
1507         '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
1508         1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
1509 changequote([,])dnl
1510            ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
1511         *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
1512       esac
1513       AC_MSG_RESULT([$ac_prog_version])
1514     fi
1515     if test $ac_verc_fail = yes; then
1516       INTLBISON=:
1517     fi
1518
1519     dnl These rules are solely for the distribution goal.  While doing this
1520     dnl we only have to keep exactly one list of the available catalogs
1521     dnl in configure.in.
1522     for lang in $ALL_LINGUAS; do
1523       GMOFILES="$GMOFILES $lang.gmo"
1524       POFILES="$POFILES $lang.po"
1525     done
1526
1527     dnl Make all variables we use known to autoconf.
1528     AC_SUBST(BUILD_INCLUDED_LIBINTL)
1529     AC_SUBST(USE_INCLUDED_LIBINTL)
1530     AC_SUBST(CATALOGS)
1531     AC_SUBST(CATOBJEXT)
1532     AC_SUBST(GMOFILES)
1533     AC_SUBST(INTLLIBS)
1534     AC_SUBST(INTLOBJS)
1535     AC_SUBST(POFILES)
1536     AC_SUBST(POSUB)
1537
1538     dnl For backward compatibility. Some configure.ins may be using this.
1539     nls_cv_header_intl=
1540     nls_cv_header_libgt=
1541
1542     dnl For backward compatibility. Some Makefiles may be using this.
1543     DATADIRNAME=share
1544     AC_SUBST(DATADIRNAME)
1545
1546     dnl For backward compatibility. Some Makefiles may be using this.
1547     INSTOBJEXT=.mo
1548     AC_SUBST(INSTOBJEXT)
1549
1550     dnl For backward compatibility. Some Makefiles may be using this.
1551     GENCAT=gencat
1552     AC_SUBST(GENCAT)
1553   ])
1554
1555 dnl Usage: Just like MUTT_AM_WITH_NLS, which see.
1556 AC_DEFUN([MUTT_AM_GNU_GETTEXT],
1557   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1558    AC_REQUIRE([AC_PROG_CC])dnl
1559    AC_REQUIRE([AC_CANONICAL_HOST])dnl
1560    AC_REQUIRE([AC_PROG_RANLIB])dnl
1561    AC_REQUIRE([AC_ISC_POSIX])dnl
1562    AC_REQUIRE([AC_HEADER_STDC])dnl
1563    AC_REQUIRE([AC_C_CONST])dnl
1564    AC_REQUIRE([AC_C_INLINE])dnl
1565    AC_REQUIRE([AC_TYPE_OFF_T])dnl
1566    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1567    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1568    AC_REQUIRE([AC_FUNC_MMAP])dnl
1569    AC_REQUIRE([MUTT_jm_GLIBC21])dnl
1570
1571    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
1572 stdlib.h string.h unistd.h sys/param.h])
1573    AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
1574 getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
1575 strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
1576
1577    MUTT_AM_ICONV
1578    MUTT_AM_LANGINFO_CODESET
1579    MUTT_AM_LC_MESSAGES
1580    MUTT_AM_WITH_NLS([$1],[$2],[$3])
1581
1582    if test "x$CATOBJEXT" != "x"; then
1583      if test "x$ALL_LINGUAS" = "x"; then
1584        LINGUAS=
1585      else
1586        AC_MSG_CHECKING(for catalogs to be installed)
1587        NEW_LINGUAS=
1588        for presentlang in $ALL_LINGUAS; do
1589          useit=no
1590          for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
1591            # Use the presentlang catalog if desiredlang is
1592            #   a. equal to presentlang, or
1593            #   b. a variant of presentlang (because in this case,
1594            #      presentlang can be used as a fallback for messages
1595            #      which are not translated in the desiredlang catalog).
1596            case "$desiredlang" in
1597              "$presentlang"*) useit=yes;;
1598            esac
1599          done
1600          if test $useit = yes; then
1601            NEW_LINGUAS="$NEW_LINGUAS $presentlang"
1602          fi
1603        done
1604        LINGUAS=$NEW_LINGUAS
1605        AC_MSG_RESULT($LINGUAS)
1606      fi
1607
1608      dnl Construct list of names of catalog files to be constructed.
1609      if test -n "$LINGUAS"; then
1610        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
1611      fi
1612    fi
1613
1614    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1615    dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
1616    dnl Try to locate is.
1617    MKINSTALLDIRS=
1618    if test -n "$ac_aux_dir"; then
1619      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
1620    fi
1621    if test -z "$MKINSTALLDIRS"; then
1622      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1623    fi
1624    AC_SUBST(MKINSTALLDIRS)
1625
1626    dnl Enable libtool support if the surrounding package wishes it.
1627    INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
1628    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
1629   ])
1630
1631 # Search path for a program which passes the given test.
1632 # Ulrich Drepper <drepper@cygnus.com>, 1996.
1633 #
1634 # This file can be copied and used freely without restrictions.  It can
1635 # be used in projects which are not available under the GNU General Public
1636 # License or the GNU Library General Public License but which still want
1637 # to provide support for the GNU gettext functionality.
1638 # Please note that the actual code of the GNU gettext library is covered
1639 # by the GNU Library General Public License, and the rest of the GNU
1640 # gettext package package is covered by the GNU General Public License.
1641 # They are *not* in the public domain.
1642
1643 # serial 2
1644
1645 dnl MUTT_AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
1646 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1647 AC_DEFUN([MUTT_AM_PATH_PROG_WITH_TEST],
1648 [# Extract the first word of "$2", so it can be a program name with args.
1649 set dummy $2; ac_word=[$]2
1650 AC_MSG_CHECKING([for $ac_word])
1651 AC_CACHE_VAL(ac_cv_path_$1,
1652 [case "[$]$1" in
1653   /*)
1654   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1655   ;;
1656   *)
1657   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1658   for ac_dir in ifelse([$5], , $PATH, [$5]); do
1659     test -z "$ac_dir" && ac_dir=.
1660     if test -f $ac_dir/$ac_word; then
1661       if [$3]; then
1662         ac_cv_path_$1="$ac_dir/$ac_word"
1663         break
1664       fi
1665     fi
1666   done
1667   IFS="$ac_save_ifs"
1668 dnl If no 4th arg is given, leave the cache variable unset,
1669 dnl so AC_PATH_PROGS will keep looking.
1670 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1671 ])dnl
1672   ;;
1673 esac])dnl
1674 $1="$ac_cv_path_$1"
1675 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
1676   AC_MSG_RESULT([$]$1)
1677 else
1678   AC_MSG_RESULT(no)
1679 fi
1680 AC_SUBST($1)dnl
1681 ])
1682
1683 #serial 2
1684
1685 # Test for the GNU C Library, version 2.1 or newer.
1686 # From Bruno Haible.
1687
1688 AC_DEFUN([MUTT_jm_GLIBC21],
1689   [
1690     AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
1691       ac_cv_gnu_library_2_1,
1692       [AC_EGREP_CPP([Lucky GNU user],
1693         [
1694 #include <features.h>
1695 #ifdef __GNU_LIBRARY__
1696  #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
1697   Lucky GNU user
1698  #endif
1699 #endif
1700         ],
1701         ac_cv_gnu_library_2_1=yes,
1702         ac_cv_gnu_library_2_1=no)
1703       ]
1704     )
1705     AC_SUBST(GLIBC21)
1706     GLIBC21="$ac_cv_gnu_library_2_1"
1707   ]
1708 )
1709
1710 #serial AM2
1711
1712 dnl From Bruno Haible.
1713
1714 AC_DEFUN([MUTT_AM_ICONV],
1715 [
1716   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
1717   dnl those with the standalone portable GNU libiconv installed).
1718
1719   AC_ARG_WITH([libiconv-prefix],
1720 [  --with-libiconv-prefix=DIR Search for libiconv in DIR/include and DIR/lib], [
1721     for dir in `echo "$withval" | tr : ' '`; do
1722       if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
1723       if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
1724     done
1725    ])
1726
1727   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
1728     am_cv_func_iconv="no, consider installing GNU libiconv"
1729     am_cv_lib_iconv=no
1730     AC_TRY_LINK([#include <stdlib.h>
1731 #include <iconv.h>],
1732       [iconv_t cd = iconv_open("","");
1733        iconv(cd,NULL,NULL,NULL,NULL);
1734        iconv_close(cd);],
1735       am_cv_func_iconv=yes)
1736     if test "$am_cv_func_iconv" != yes; then
1737       am_save_LIBS="$LIBS"
1738       LIBS="$LIBS -liconv"
1739       AC_TRY_LINK([#include <stdlib.h>
1740 #include <iconv.h>],
1741         [iconv_t cd = iconv_open("","");
1742          iconv(cd,NULL,NULL,NULL,NULL);
1743          iconv_close(cd);],
1744         am_cv_lib_iconv=yes
1745         am_cv_func_iconv=yes)
1746       LIBS="$am_save_LIBS"
1747     fi
1748   ])
1749   if test "$am_cv_func_iconv" = yes; then
1750     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
1751     AC_MSG_CHECKING([for iconv declaration])
1752     AC_CACHE_VAL(am_cv_proto_iconv, [
1753       AC_TRY_COMPILE([
1754 #include <stdlib.h>
1755 #include <iconv.h>
1756 extern
1757 #ifdef __cplusplus
1758 "C"
1759 #endif
1760 #if defined(__STDC__) || defined(__cplusplus)
1761 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1762 #else
1763 size_t iconv();
1764 #endif
1765 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
1766       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);"])
1767     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
1768     AC_MSG_RESULT([$]{ac_t:-
1769          }[$]am_cv_proto_iconv)
1770     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
1771       [Define as const if the declaration of iconv() needs const.])
1772   fi
1773   LIBICONV=
1774   if test "$am_cv_lib_iconv" = yes; then
1775     LIBICONV="-liconv"
1776   fi
1777   AC_SUBST(LIBICONV)
1778 ])
1779
1780 #serial AM1
1781
1782 dnl From Bruno Haible.
1783
1784 AC_DEFUN([MUTT_AM_LANGINFO_CODESET],
1785 [
1786   AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
1787     [AC_TRY_LINK([#include <langinfo.h>],
1788       [char* cs = nl_langinfo(CODESET);],
1789       am_cv_langinfo_codeset=yes,
1790       am_cv_langinfo_codeset=no)
1791     ])
1792   if test $am_cv_langinfo_codeset = yes; then
1793     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
1794       [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
1795   fi
1796 ])
1797
1798 # Check whether LC_MESSAGES is available in <locale.h>.
1799 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1800 #
1801 # This file can be copied and used freely without restrictions.  It can
1802 # be used in projects which are not available under the GNU General Public
1803 # License or the GNU Library General Public License but which still want
1804 # to provide support for the GNU gettext functionality.
1805 # Please note that the actual code of the GNU gettext library is covered
1806 # by the GNU Library General Public License, and the rest of the GNU
1807 # gettext package package is covered by the GNU General Public License.
1808 # They are *not* in the public domain.
1809
1810 # serial 2
1811
1812 AC_DEFUN([MUTT_AM_LC_MESSAGES],
1813   [if test $ac_cv_header_locale_h = yes; then
1814     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1815       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1816        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1817     if test $am_cv_val_LC_MESSAGES = yes; then
1818       AC_DEFINE(HAVE_LC_MESSAGES, 1,
1819         [Define if your <locale.h> file defines LC_MESSAGES.])
1820     fi
1821   fi])
1822
1823 dnl vim:ft=config:
1824
1825 dnl Search for libesmtp, by Steven Engelhardt <sengelha@yahoo.com>
1826 dnl
1827 dnl libesmtp often requires linking against -lpthread or -lc_r (BSD).
1828 dnl This macro attempts to centralize this code.
1829
1830 AC_DEFUN([MUTT_AM_LIBESMTP],
1831 [
1832   AC_ARG_WITH(
1833     [libesmtp],
1834     [  --with-libesmtp=DIR      Compile in support for libesmtp for the MTA],
1835     [ if test "$with_libesmtp" != "no"
1836       then
1837         mutt_libesmtp_check_path="$PATH"
1838
1839         if test "$with_libesmtp" != "yes"
1840         then
1841           mutt_libesmtp_check_path="$tmp_path:$withval/bin"
1842         fi
1843
1844         dnl 1. Find libesmtp-config
1845         AC_PATH_PROG([mutt_libesmtp_config_path],
1846                      [libesmtp-config],
1847                      [no],
1848                      [$mutt_libesmtp_check_path])
1849
1850         if test "$mutt_libesmtp_config_path" = "no"
1851         then
1852           AC_MSG_ERROR([libesmtp-config binary not found.])
1853         fi
1854
1855         dnl 2. Get CFLAGS and LIBS from libesmtp-config
1856         mutt_libesmtp_cflags=`$mutt_libesmtp_config_path --cflags`
1857         mutt_libesmtp_libs=`$mutt_libesmtp_config_path --libs`
1858
1859         dnl 3. Verify libesmtp.h can be found with these settings
1860         temp_CFLAGS="$CFLAGS"
1861         CFLAGS="$CFLAGS $mutt_libesmtp_cflags"
1862         AC_CHECK_HEADER([libesmtp.h],
1863                         [],
1864                         AC_MSG_ERROR([Could not find libesmtp.h]))
1865         CFLAGS="$temp_CFLAGS"
1866
1867         dnl 4. Verify the libesmtp library can be linked in
1868         temp_CFLAGS="$CFLAGS"
1869         temp_LIBS="$LIBS"
1870         CFLAGS="$CFLAGS $mutt_libesmtp_cflags"
1871         LIBS="$LIBS $mutt_libesmtp_libs"
1872         AC_CHECK_LIB([esmtp],
1873                      [smtp_create_session],
1874                      [],
1875                      AC_MSG_ERROR([Could not find libesmtp]))
1876         CFLAGS="$temp_CFLAGS"
1877         LIBS="$temp_LIBS"
1878
1879         dnl 5. Export use_libesmtp variable so configure.in can
1880         dnl    act accordingly.
1881         use_libesmtp=yes
1882       fi
1883     ]
1884   )
1885 ])
1886