1# aclocal.m4 generated automatically by aclocal 1.6 -*- Autoconf -*-
2
3# Copyright 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
33AC_PREREQ([2.52])
34
35# serial 6
36
37# When config.status generates a header, we must update the stamp-h file.
38# This file resides in the same directory as the config header
39# that is generated.  We must strip everything past the first ":",
40# and everything past the last "/".
41
42# _AM_DIRNAME(PATH)
43# -----------------
44# Like AS_DIRNAME, only do it during macro expansion
45AC_DEFUN([_AM_DIRNAME],
46       [m4_if(regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1,
47	      m4_if(regexp([$1], [^//\([^/]\|$\)]), -1,
48		    m4_if(regexp([$1], [^/.*]), -1,
49			  [.],
50			  patsubst([$1], [^\(/\).*], [\1])),
51		    patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])),
52	      patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl
53])# _AM_DIRNAME
54
55
56# The stamp files are numbered to have different names.
57# We could number them on a directory basis, but that's additional
58# complications, let's have a unique counter.
59m4_define([_AM_STAMP_Count], [0])
60
61
62# _AM_STAMP(HEADER)
63# -----------------
64# The name of the stamp file for HEADER.
65AC_DEFUN([_AM_STAMP],
66[m4_define([_AM_STAMP_Count], m4_incr(_AM_STAMP_Count))dnl
67AS_ESCAPE(_AM_DIRNAME(patsubst([$1],
68                               [:.*])))/stamp-h[]_AM_STAMP_Count])
69
70
71# _AM_CONFIG_HEADER(HEADER[:SOURCES], COMMANDS, INIT-COMMANDS)
72# ------------------------------------------------------------
73# We used to try to get a real timestamp in stamp-h.  But the fear is that
74# that will cause unnecessary cvs conflicts.
75AC_DEFUN([_AM_CONFIG_HEADER],
76[# Add the stamp file to the list of files AC keeps track of,
77# along with our hook.
78AC_CONFIG_HEADERS([$1],
79                  [# update the timestamp
80echo 'timestamp for $1' >"_AM_STAMP([$1])"
81$2],
82                  [$3])
83])# _AM_CONFIG_HEADER
84
85
86# AM_CONFIG_HEADER(HEADER[:SOURCES]..., COMMANDS, INIT-COMMANDS)
87# --------------------------------------------------------------
88AC_DEFUN([AM_CONFIG_HEADER],
89[AC_FOREACH([_AM_File], [$1], [_AM_CONFIG_HEADER(_AM_File, [$2], [$3])])
90])# AM_CONFIG_HEADER
91
92# Do all the work for Automake.                            -*- Autoconf -*-
93
94# This macro actually does too much some checks are only needed if
95# your package does certain things.  But this isn't really a big deal.
96
97# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
98# Free Software Foundation, Inc.
99
100# This program is free software; you can redistribute it and/or modify
101# it under the terms of the GNU General Public License as published by
102# the Free Software Foundation; either version 2, or (at your option)
103# any later version.
104
105# This program is distributed in the hope that it will be useful,
106# but WITHOUT ANY WARRANTY; without even the implied warranty of
107# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
108# GNU General Public License for more details.
109
110# You should have received a copy of the GNU General Public License
111# along with this program; if not, write to the Free Software
112# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
113# 02111-1307, USA.
114
115# serial 8
116
117# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
118# written in clear, in which case automake, when reading aclocal.m4,
119# will think it sees a *use*, and therefore will trigger all it's
120# C support machinery.  Also note that it means that autoscan, seeing
121# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
122
123
124AC_PREREQ([2.52])
125
126# Autoconf 2.50 wants to disallow AM_ names.  We explicitly allow
127# the ones we care about.
128m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
129
130# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
131# AM_INIT_AUTOMAKE([OPTIONS])
132# -----------------------------------------------
133# The call with PACKAGE and VERSION arguments is the old style
134# call (pre autoconf-2.50), which is being phased out.  PACKAGE
135# and VERSION should now be passed to AC_INIT and removed from
136# the call to AM_INIT_AUTOMAKE.
137# We support both call styles for the transition.  After
138# the next Automake release, Autoconf can make the AC_INIT
139# arguments mandatory, and then we can depend on a new Autoconf
140# release and drop the old call support.
141AC_DEFUN([AM_INIT_AUTOMAKE],
142[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
143 AC_REQUIRE([AC_PROG_INSTALL])dnl
144# test to see if srcdir already configured
145if test "`cd $srcdir && pwd`" != "`pwd`" &&
146   test -f $srcdir/config.status; then
147  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
148fi
149
150# Define the identity of the package.
151dnl Distinguish between old-style and new-style calls.
152m4_ifval([$2],
153[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
154 AC_SUBST([PACKAGE], [$1])dnl
155 AC_SUBST([VERSION], [$2])],
156[_AM_SET_OPTIONS([$1])dnl
157 AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])dnl
158 AC_SUBST([VERSION], [AC_PACKAGE_VERSION])])dnl
159
160_AM_IF_OPTION([no-define],,
161[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
162 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
163
164# Some tools Automake needs.
165AC_REQUIRE([AM_SANITY_CHECK])dnl
166AC_REQUIRE([AC_ARG_PROGRAM])dnl
167AM_MISSING_PROG(ACLOCAL, "aclocal-${am__api_version}")
168AM_MISSING_PROG(AUTOCONF, autoconf)
169AM_MISSING_PROG(AUTOMAKE, "automake-${am__api_version}")
170AM_MISSING_PROG(AUTOHEADER, autoheader)
171AM_MISSING_PROG(MAKEINFO, makeinfo)
172AM_MISSING_PROG(AMTAR, tar)
173AM_PROG_INSTALL_SH
174AM_PROG_INSTALL_STRIP
175# We need awk for the "check" target.  The system "awk" is bad on
176# some platforms.
177AC_REQUIRE([AC_PROG_AWK])dnl
178AC_REQUIRE([AC_PROG_MAKE_SET])dnl
179
180_AM_IF_OPTION([no-dependencies],,
181[AC_PROVIDE_IFELSE([AC_PROG_][CC],
182                  [_AM_DEPENDENCIES(CC)],
183                  [define([AC_PROG_][CC],
184                          defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl
185AC_PROVIDE_IFELSE([AC_PROG_][CXX],
186                  [_AM_DEPENDENCIES(CXX)],
187                  [define([AC_PROG_][CXX],
188                          defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl
189])
190])
191
192# Copyright 2002  Free Software Foundation, Inc.
193
194# This program is free software; you can redistribute it and/or modify
195# it under the terms of the GNU General Public License as published by
196# the Free Software Foundation; either version 2, or (at your option)
197# any later version.
198
199# This program is distributed in the hope that it will be useful,
200# but WITHOUT ANY WARRANTY; without even the implied warranty of
201# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
202# GNU General Public License for more details.
203
204# You should have received a copy of the GNU General Public License
205# along with this program; if not, write to the Free Software
206# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
207
208# AM_AUTOMAKE_VERSION(VERSION)
209# ----------------------------
210# Automake X.Y traces this macro to ensure aclocal.m4 has been
211# generated from the m4 files accompanying Automake X.Y.
212AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.6"])
213
214# AM_SET_CURRENT_AUTOMAKE_VERSION
215# -------------------------------
216# Call AM_AUTOMAKE_VERSION so it can be traced.
217# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
218AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
219	 [AM_AUTOMAKE_VERSION([1.6])])
220
221# Helper functions for option handling.                    -*- Autoconf -*-
222
223# Copyright 2001, 2002  Free Software Foundation, Inc.
224
225# This program is free software; you can redistribute it and/or modify
226# it under the terms of the GNU General Public License as published by
227# the Free Software Foundation; either version 2, or (at your option)
228# any later version.
229
230# This program is distributed in the hope that it will be useful,
231# but WITHOUT ANY WARRANTY; without even the implied warranty of
232# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
233# GNU General Public License for more details.
234
235# You should have received a copy of the GNU General Public License
236# along with this program; if not, write to the Free Software
237# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
238# 02111-1307, USA.
239
240# serial 2
241
242# _AM_MANGLE_OPTION(NAME)
243# -----------------------
244AC_DEFUN([_AM_MANGLE_OPTION],
245[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
246
247# _AM_SET_OPTION(NAME)
248# ------------------------------
249# Set option NAME.  Presently that only means defining a flag for this option.
250AC_DEFUN([_AM_SET_OPTION],
251[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
252
253# _AM_SET_OPTIONS(OPTIONS)
254# ----------------------------------
255# OPTIONS is a space-separated list of Automake options.
256AC_DEFUN([_AM_SET_OPTIONS],
257[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
258
259# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
260# -------------------------------------------
261# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
262AC_DEFUN([_AM_IF_OPTION],
263[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
264
265#
266# Check to make sure that the build environment is sane.
267#
268
269# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
270
271# This program is free software; you can redistribute it and/or modify
272# it under the terms of the GNU General Public License as published by
273# the Free Software Foundation; either version 2, or (at your option)
274# any later version.
275
276# This program is distributed in the hope that it will be useful,
277# but WITHOUT ANY WARRANTY; without even the implied warranty of
278# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
279# GNU General Public License for more details.
280
281# You should have received a copy of the GNU General Public License
282# along with this program; if not, write to the Free Software
283# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
284# 02111-1307, USA.
285
286# serial 3
287
288# AM_SANITY_CHECK
289# ---------------
290AC_DEFUN([AM_SANITY_CHECK],
291[AC_MSG_CHECKING([whether build environment is sane])
292# Just in case
293sleep 1
294echo timestamp > conftest.file
295# Do `set' in a subshell so we don't clobber the current shell's
296# arguments.  Must try -L first in case configure is actually a
297# symlink; some systems play weird games with the mod time of symlinks
298# (eg FreeBSD returns the mod time of the symlink's containing
299# directory).
300if (
301   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
302   if test "$[*]" = "X"; then
303      # -L didn't work.
304      set X `ls -t $srcdir/configure conftest.file`
305   fi
306   rm -f conftest.file
307   if test "$[*]" != "X $srcdir/configure conftest.file" \
308      && test "$[*]" != "X conftest.file $srcdir/configure"; then
309
310      # If neither matched, then we have a broken ls.  This can happen
311      # if, for instance, CONFIG_SHELL is bash and it inherits a
312      # broken ls alias from the environment.  This has actually
313      # happened.  Such a system could not be considered "sane".
314      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
315alias in your environment])
316   fi
317
318   test "$[2]" = conftest.file
319   )
320then
321   # Ok.
322   :
323else
324   AC_MSG_ERROR([newly created file is older than distributed files!
325Check your system clock])
326fi
327AC_MSG_RESULT(yes)])
328
329#  -*- Autoconf -*-
330
331
332# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
333
334# This program is free software; you can redistribute it and/or modify
335# it under the terms of the GNU General Public License as published by
336# the Free Software Foundation; either version 2, or (at your option)
337# any later version.
338
339# This program is distributed in the hope that it will be useful,
340# but WITHOUT ANY WARRANTY; without even the implied warranty of
341# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
342# GNU General Public License for more details.
343
344# You should have received a copy of the GNU General Public License
345# along with this program; if not, write to the Free Software
346# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
347# 02111-1307, USA.
348
349# serial 3
350
351# AM_MISSING_PROG(NAME, PROGRAM)
352# ------------------------------
353AC_DEFUN([AM_MISSING_PROG],
354[AC_REQUIRE([AM_MISSING_HAS_RUN])
355$1=${$1-"${am_missing_run}$2"}
356AC_SUBST($1)])
357
358
359# AM_MISSING_HAS_RUN
360# ------------------
361# Define MISSING if not defined so far and test if it supports --run.
362# If it does, set am_missing_run to use it, otherwise, to nothing.
363AC_DEFUN([AM_MISSING_HAS_RUN],
364[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
365test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
366# Use eval to expand $SHELL
367if eval "$MISSING --run true"; then
368  am_missing_run="$MISSING --run "
369else
370  am_missing_run=
371  AC_MSG_WARN([`missing' script is too old or missing])
372fi
373])
374
375# AM_AUX_DIR_EXPAND
376
377# Copyright 2001 Free Software Foundation, Inc.
378
379# This program is free software; you can redistribute it and/or modify
380# it under the terms of the GNU General Public License as published by
381# the Free Software Foundation; either version 2, or (at your option)
382# any later version.
383
384# This program is distributed in the hope that it will be useful,
385# but WITHOUT ANY WARRANTY; without even the implied warranty of
386# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
387# GNU General Public License for more details.
388
389# You should have received a copy of the GNU General Public License
390# along with this program; if not, write to the Free Software
391# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
392# 02111-1307, USA.
393
394# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
395# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
396# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
397#
398# Of course, Automake must honor this variable whenever it calls a
399# tool from the auxiliary directory.  The problem is that $srcdir (and
400# therefore $ac_aux_dir as well) can be either absolute or relative,
401# depending on how configure is run.  This is pretty annoying, since
402# it makes $ac_aux_dir quite unusable in subdirectories: in the top
403# source directory, any form will work fine, but in subdirectories a
404# relative path needs to be adjusted first.
405#
406# $ac_aux_dir/missing
407#    fails when called from a subdirectory if $ac_aux_dir is relative
408# $top_srcdir/$ac_aux_dir/missing
409#    fails if $ac_aux_dir is absolute,
410#    fails when called from a subdirectory in a VPATH build with
411#          a relative $ac_aux_dir
412#
413# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
414# are both prefixed by $srcdir.  In an in-source build this is usually
415# harmless because $srcdir is `.', but things will broke when you
416# start a VPATH build or use an absolute $srcdir.
417#
418# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
419# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
420#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
421# and then we would define $MISSING as
422#   MISSING="\${SHELL} $am_aux_dir/missing"
423# This will work as long as MISSING is not called from configure, because
424# unfortunately $(top_srcdir) has no meaning in configure.
425# However there are other variables, like CC, which are often used in
426# configure, and could therefore not use this "fixed" $ac_aux_dir.
427#
428# Another solution, used here, is to always expand $ac_aux_dir to an
429# absolute PATH.  The drawback is that using absolute paths prevent a
430# configured tree to be moved without reconfiguration.
431
432# Rely on autoconf to set up CDPATH properly.
433AC_PREREQ([2.50])
434
435AC_DEFUN([AM_AUX_DIR_EXPAND], [
436# expand $ac_aux_dir to an absolute path
437am_aux_dir=`cd $ac_aux_dir && pwd`
438])
439
440# AM_PROG_INSTALL_SH
441# ------------------
442# Define $install_sh.
443
444# Copyright 2001 Free Software Foundation, Inc.
445
446# This program is free software; you can redistribute it and/or modify
447# it under the terms of the GNU General Public License as published by
448# the Free Software Foundation; either version 2, or (at your option)
449# any later version.
450
451# This program is distributed in the hope that it will be useful,
452# but WITHOUT ANY WARRANTY; without even the implied warranty of
453# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
454# GNU General Public License for more details.
455
456# You should have received a copy of the GNU General Public License
457# along with this program; if not, write to the Free Software
458# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
459# 02111-1307, USA.
460
461AC_DEFUN([AM_PROG_INSTALL_SH],
462[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
463install_sh=${install_sh-"$am_aux_dir/install-sh"}
464AC_SUBST(install_sh)])
465
466# AM_PROG_INSTALL_STRIP
467
468# Copyright 2001 Free Software Foundation, Inc.
469
470# This program is free software; you can redistribute it and/or modify
471# it under the terms of the GNU General Public License as published by
472# the Free Software Foundation; either version 2, or (at your option)
473# any later version.
474
475# This program is distributed in the hope that it will be useful,
476# but WITHOUT ANY WARRANTY; without even the implied warranty of
477# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
478# GNU General Public License for more details.
479
480# You should have received a copy of the GNU General Public License
481# along with this program; if not, write to the Free Software
482# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
483# 02111-1307, USA.
484
485# One issue with vendor `install' (even GNU) is that you can't
486# specify the program used to strip binaries.  This is especially
487# annoying in cross-compiling environments, where the build's strip
488# is unlikely to handle the host's binaries.
489# Fortunately install-sh will honor a STRIPPROG variable, so we
490# always use install-sh in `make install-strip', and initialize
491# STRIPPROG with the value of the STRIP variable (set by the user).
492AC_DEFUN([AM_PROG_INSTALL_STRIP],
493[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
494# Installed binaries are usually stripped using `strip' when the user
495# run `make install-strip'.  However `strip' might not be the right
496# tool to use in cross-compilation environments, therefore Automake
497# will honor the `STRIP' environment variable to overrule this program.
498dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
499if test "$cross_compiling" != no; then
500  AC_CHECK_TOOL([STRIP], [strip], :)
501fi
502INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
503AC_SUBST([INSTALL_STRIP_PROGRAM])])
504
505# serial 4						-*- Autoconf -*-
506
507# Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
508
509# This program is free software; you can redistribute it and/or modify
510# it under the terms of the GNU General Public License as published by
511# the Free Software Foundation; either version 2, or (at your option)
512# any later version.
513
514# This program is distributed in the hope that it will be useful,
515# but WITHOUT ANY WARRANTY; without even the implied warranty of
516# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
517# GNU General Public License for more details.
518
519# You should have received a copy of the GNU General Public License
520# along with this program; if not, write to the Free Software
521# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
522# 02111-1307, USA.
523
524
525# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
526# written in clear, in which case automake, when reading aclocal.m4,
527# will think it sees a *use*, and therefore will trigger all it's
528# C support machinery.  Also note that it means that autoscan, seeing
529# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
530
531
532
533# _AM_DEPENDENCIES(NAME)
534# ----------------------
535# See how the compiler implements dependency checking.
536# NAME is "CC", "CXX", "GCJ", or "OBJC".
537# We try a few techniques and use that to set a single cache variable.
538#
539# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
540# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
541# dependency, and given that the user is not expected to run this macro,
542# just rely on AC_PROG_CC.
543AC_DEFUN([_AM_DEPENDENCIES],
544[AC_REQUIRE([AM_SET_DEPDIR])dnl
545AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
546AC_REQUIRE([AM_MAKE_INCLUDE])dnl
547AC_REQUIRE([AM_DEP_TRACK])dnl
548
549ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
550       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
551       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc']
552       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
553                   [depcc="$$1"   am_compiler_list=])
554
555AC_CACHE_CHECK([dependency style of $depcc],
556               [am_cv_$1_dependencies_compiler_type],
557[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
558  # We make a subdir and do the tests there.  Otherwise we can end up
559  # making bogus files that we don't know about and never remove.  For
560  # instance it was reported that on HP-UX the gcc test will end up
561  # making a dummy file named `D' -- because `-MD' means `put the output
562  # in D'.
563  mkdir conftest.dir
564  # Copy depcomp to subdir because otherwise we won't find it if we're
565  # using a relative directory.
566  cp "$am_depcomp" conftest.dir
567  cd conftest.dir
568
569  am_cv_$1_dependencies_compiler_type=none
570  if test "$am_compiler_list" = ""; then
571     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
572  fi
573  for depmode in $am_compiler_list; do
574    # We need to recreate these files for each test, as the compiler may
575    # overwrite some of them when testing with obscure command lines.
576    # This happens at least with the AIX C compiler.
577    echo '#include "conftest.h"' > conftest.c
578    echo 'int i;' > conftest.h
579    echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
580
581    case $depmode in
582    nosideeffect)
583      # after this tag, mechanisms are not by side-effect, so they'll
584      # only be used when explicitly requested
585      if test "x$enable_dependency_tracking" = xyes; then
586	continue
587      else
588	break
589      fi
590      ;;
591    none) break ;;
592    esac
593    # We check with `-c' and `-o' for the sake of the "dashmstdout"
594    # mode.  It turns out that the SunPro C++ compiler does not properly
595    # handle `-M -o', and we need to detect this.
596    if depmode=$depmode \
597       source=conftest.c object=conftest.o \
598       depfile=conftest.Po tmpdepfile=conftest.TPo \
599       $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
600       grep conftest.h conftest.Po > /dev/null 2>&1 &&
601       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
602      am_cv_$1_dependencies_compiler_type=$depmode
603      break
604    fi
605  done
606
607  cd ..
608  rm -rf conftest.dir
609else
610  am_cv_$1_dependencies_compiler_type=none
611fi
612])
613AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
614])
615
616
617# AM_SET_DEPDIR
618# -------------
619# Choose a directory name for dependency files.
620# This macro is AC_REQUIREd in _AM_DEPENDENCIES
621AC_DEFUN([AM_SET_DEPDIR],
622[rm -f .deps 2>/dev/null
623mkdir .deps 2>/dev/null
624if test -d .deps; then
625  DEPDIR=.deps
626else
627  # MS-DOS does not allow filenames that begin with a dot.
628  DEPDIR=_deps
629fi
630rmdir .deps 2>/dev/null
631AC_SUBST([DEPDIR])
632])
633
634
635# AM_DEP_TRACK
636# ------------
637AC_DEFUN([AM_DEP_TRACK],
638[AC_ARG_ENABLE(dependency-tracking,
639[  --disable-dependency-tracking Speeds up one-time builds
640  --enable-dependency-tracking  Do not reject slow dependency extractors])
641if test "x$enable_dependency_tracking" != xno; then
642  am_depcomp="$ac_aux_dir/depcomp"
643  AMDEPBACKSLASH='\'
644fi
645AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
646AC_SUBST([AMDEPBACKSLASH])
647])
648
649# Generate code to set up dependency tracking.   -*- Autoconf -*-
650
651# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
652
653# This program is free software; you can redistribute it and/or modify
654# it under the terms of the GNU General Public License as published by
655# the Free Software Foundation; either version 2, or (at your option)
656# any later version.
657
658# This program is distributed in the hope that it will be useful,
659# but WITHOUT ANY WARRANTY; without even the implied warranty of
660# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
661# GNU General Public License for more details.
662
663# You should have received a copy of the GNU General Public License
664# along with this program; if not, write to the Free Software
665# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
666# 02111-1307, USA.
667
668#serial 2
669
670# _AM_OUTPUT_DEPENDENCY_COMMANDS
671# ------------------------------
672AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
673[for mf in $CONFIG_FILES; do
674  # Strip MF so we end up with the name of the file.
675  mf=`echo "$mf" | sed -e 's/:.*$//'`
676  if (sed 1q $mf | fgrep 'generated by automake') > /dev/null 2>&1; then
677    dirpart=`AS_DIRNAME("$mf")`
678  else
679    continue
680  fi
681  grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
682  # Extract the definition of DEP_FILES from the Makefile without
683  # running `make'.
684  DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
685  test -z "$DEPDIR" && continue
686  # When using ansi2knr, U may be empty or an underscore; expand it
687  U=`sed -n -e '/^U = / s///p' < "$mf"`
688  test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
689  # We invoke sed twice because it is the simplest approach to
690  # changing $(DEPDIR) to its actual value in the expansion.
691  for file in `sed -n -e '
692    /^DEP_FILES = .*\\\\$/ {
693      s/^DEP_FILES = //
694      :loop
695	s/\\\\$//
696	p
697	n
698	/\\\\$/ b loop
699      p
700    }
701    /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
702       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
703    # Make sure the directory exists.
704    test -f "$dirpart/$file" && continue
705    fdir=`AS_DIRNAME(["$file"])`
706    AS_MKDIR_P([$dirpart/$fdir])
707    # echo "creating $dirpart/$file"
708    echo '# dummy' > "$dirpart/$file"
709  done
710done
711])# _AM_OUTPUT_DEPENDENCY_COMMANDS
712
713
714# AM_OUTPUT_DEPENDENCY_COMMANDS
715# -----------------------------
716# This macro should only be invoked once -- use via AC_REQUIRE.
717#
718# This code is only required when automatic dependency tracking
719# is enabled.  FIXME.  This creates each `.P' file that we will
720# need in order to bootstrap the dependency handling code.
721AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
722[AC_CONFIG_COMMANDS([depfiles],
723     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
724     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
725])
726
727# Copyright 2001 Free Software Foundation, Inc.             -*- Autoconf -*-
728
729# This program is free software; you can redistribute it and/or modify
730# it under the terms of the GNU General Public License as published by
731# the Free Software Foundation; either version 2, or (at your option)
732# any later version.
733
734# This program is distributed in the hope that it will be useful,
735# but WITHOUT ANY WARRANTY; without even the implied warranty of
736# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
737# GNU General Public License for more details.
738
739# You should have received a copy of the GNU General Public License
740# along with this program; if not, write to the Free Software
741# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
742# 02111-1307, USA.
743
744# serial 2
745
746# AM_MAKE_INCLUDE()
747# -----------------
748# Check to see how make treats includes.
749AC_DEFUN([AM_MAKE_INCLUDE],
750[am_make=${MAKE-make}
751cat > confinc << 'END'
752doit:
753	@echo done
754END
755# If we don't find an include directive, just comment out the code.
756AC_MSG_CHECKING([for style of include used by $am_make])
757am__include="#"
758am__quote=
759_am_result=none
760# First try GNU make style include.
761echo "include confinc" > confmf
762# We grep out `Entering directory' and `Leaving directory'
763# messages which can occur if `w' ends up in MAKEFLAGS.
764# In particular we don't look at `^make:' because GNU make might
765# be invoked under some other name (usually "gmake"), in which
766# case it prints its new name instead of `make'.
767if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then
768   am__include=include
769   am__quote=
770   _am_result=GNU
771fi
772# Now try BSD make style include.
773if test "$am__include" = "#"; then
774   echo '.include "confinc"' > confmf
775   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
776      am__include=.include
777      am__quote="\""
778      _am_result=BSD
779   fi
780fi
781AC_SUBST(am__include)
782AC_SUBST(am__quote)
783AC_MSG_RESULT($_am_result)
784rm -f confinc confmf
785])
786
787# AM_CONDITIONAL                                              -*- Autoconf -*-
788
789# Copyright 1997, 2000, 2001 Free Software Foundation, Inc.
790
791# This program is free software; you can redistribute it and/or modify
792# it under the terms of the GNU General Public License as published by
793# the Free Software Foundation; either version 2, or (at your option)
794# any later version.
795
796# This program is distributed in the hope that it will be useful,
797# but WITHOUT ANY WARRANTY; without even the implied warranty of
798# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
799# GNU General Public License for more details.
800
801# You should have received a copy of the GNU General Public License
802# along with this program; if not, write to the Free Software
803# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
804# 02111-1307, USA.
805
806# serial 5
807
808AC_PREREQ(2.52)
809
810# AM_CONDITIONAL(NAME, SHELL-CONDITION)
811# -------------------------------------
812# Define a conditional.
813AC_DEFUN([AM_CONDITIONAL],
814[ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
815        [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
816AC_SUBST([$1_TRUE])
817AC_SUBST([$1_FALSE])
818if $2; then
819  $1_TRUE=
820  $1_FALSE='#'
821else
822  $1_TRUE='#'
823  $1_FALSE=
824fi
825AC_CONFIG_COMMANDS_PRE(
826[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
827  AC_MSG_ERROR([conditional \"$1\" was never defined.
828Usually this means the macro was only invoked conditionally.])
829fi])])
830
831# isc-posix.m4 serial 1 (gettext-0.10.40)
832dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
833dnl This file is free software, distributed under the terms of the GNU
834dnl General Public License.  As a special exception to the GNU General
835dnl Public License, this file may be distributed as part of a program
836dnl that contains a configuration script generated by Autoconf, under
837dnl the same distribution terms as the rest of that program.
838
839# This test replaces the one in autoconf.
840# Currently this macro should have the same name as the autoconf macro
841# because gettext's gettext.m4 (distributed in the automake package)
842# still uses it.  Otherwise, the use in gettext.m4 makes autoheader
843# give these diagnostics:
844#   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
845#   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
846
847undefine([AC_ISC_POSIX])
848
849AC_DEFUN([AC_ISC_POSIX],
850  [
851    dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
852    AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
853  ]
854)
855
856
857# Copyright 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
858
859# This program is free software; you can redistribute it and/or modify
860# it under the terms of the GNU General Public License as published by
861# the Free Software Foundation; either version 2, or (at your option)
862# any later version.
863
864# This program is distributed in the hope that it will be useful,
865# but WITHOUT ANY WARRANTY; without even the implied warranty of
866# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
867# GNU General Public License for more details.
868
869# You should have received a copy of the GNU General Public License
870# along with this program; if not, write to the Free Software
871# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
872# 02111-1307, USA.
873
874# serial 1
875
876# @defmac AC_PROG_CC_STDC
877# @maindex PROG_CC_STDC
878# @ovindex CC
879# If the C compiler in not in ANSI C mode by default, try to add an option
880# to output variable @code{CC} to make it so.  This macro tries various
881# options that select ANSI C on some system or another.  It considers the
882# compiler to be in ANSI C mode if it handles function prototypes correctly.
883#
884# If you use this macro, you should check after calling it whether the C
885# compiler has been set to accept ANSI C; if not, the shell variable
886# @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
887# code in ANSI C, you can make an un-ANSIfied copy of it by using the
888# program @code{ansi2knr}, which comes with Ghostscript.
889# @end defmac
890
891AC_DEFUN([AM_PROG_CC_STDC],
892[AC_REQUIRE([AC_PROG_CC])
893AC_BEFORE([$0], [AC_C_INLINE])
894AC_BEFORE([$0], [AC_C_CONST])
895dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
896dnl a magic option to avoid problems with ANSI preprocessor commands
897dnl like #elif.
898dnl FIXME: can't do this because then AC_AIX won't work due to a
899dnl circular dependency.
900dnl AC_BEFORE([$0], [AC_PROG_CPP])
901AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
902AC_CACHE_VAL(am_cv_prog_cc_stdc,
903[am_cv_prog_cc_stdc=no
904ac_save_CC="$CC"
905# Don't try gcc -ansi; that turns off useful extensions and
906# breaks some systems' header files.
907# AIX			-qlanglvl=ansi
908# Ultrix and OSF/1	-std1
909# HP-UX 10.20 and later	-Ae
910# HP-UX older versions	-Aa -D_HPUX_SOURCE
911# SVR4			-Xc -D__EXTENSIONS__
912for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
913do
914  CC="$ac_save_CC $ac_arg"
915  AC_TRY_COMPILE(
916[#include <stdarg.h>
917#include <stdio.h>
918#include <sys/types.h>
919#include <sys/stat.h>
920/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
921struct buf { int x; };
922FILE * (*rcsopen) (struct buf *, struct stat *, int);
923static char *e (p, i)
924     char **p;
925     int i;
926{
927  return p[i];
928}
929static char *f (char * (*g) (char **, int), char **p, ...)
930{
931  char *s;
932  va_list v;
933  va_start (v,p);
934  s = g (p, va_arg (v,int));
935  va_end (v);
936  return s;
937}
938int test (int i, double x);
939struct s1 {int (*f) (int a);};
940struct s2 {int (*f) (double a);};
941int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
942int argc;
943char **argv;
944], [
945return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
946],
947[am_cv_prog_cc_stdc="$ac_arg"; break])
948done
949CC="$ac_save_CC"
950])
951if test -z "$am_cv_prog_cc_stdc"; then
952  AC_MSG_RESULT([none needed])
953else
954  AC_MSG_RESULT([$am_cv_prog_cc_stdc])
955fi
956case "x$am_cv_prog_cc_stdc" in
957  x|xno) ;;
958  *) CC="$CC $am_cv_prog_cc_stdc" ;;
959esac
960])
961
962#serial 3
963# Make sure _GNU_SOURCE is defined where necessary: as early as possible
964# for configure-time tests, as well as for every source file that includes
965# config.h.
966
967# From Jim Meyering.
968
969AC_DEFUN([AC__GNU_SOURCE],
970[
971  # Make sure that _GNU_SOURCE is defined for all subsequent
972  # configure-time compile tests.
973  # This definition must be emitted (into confdefs.h) before any
974  # test that involves compilation.
975  cat >>confdefs.h <<\EOF
976#ifndef _GNU_SOURCE
977# define _GNU_SOURCE
978#endif
979EOF
980
981  # Emit this code into config.h.in.
982  # The ifndef is to avoid redefinition warnings.
983  AH_VERBATIM([_GNU_SOURCE], [#ifndef _GNU_SOURCE
984# define _GNU_SOURCE
985#endif])
986])
987
988# Check for variable-length arrays.
989
990#serial 1
991
992# From Paul Eggert
993
994# Copyright (C) 2001 Free Software Foundation, Inc.
995
996# This program is free software; you can redistribute it and/or modify
997# it under the terms of the GNU General Public License as published by
998# the Free Software Foundation; either version 2, or (at your option)
999# any later version.
1000
1001# This program is distributed in the hope that it will be useful,
1002# but WITHOUT ANY WARRANTY; without even the implied warranty of
1003# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1004# GNU General Public License for more details.
1005
1006# You should have received a copy of the GNU General Public License
1007# along with this program; if not, write to the Free Software
1008# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1009# 02111-1307, USA.
1010
1011AC_DEFUN([AC_C_VARARRAYS],
1012[
1013  AC_CACHE_CHECK([for variable-length arrays],
1014    ac_cv_c_vararrays,
1015    [AC_TRY_COMPILE(
1016       [],
1017       [static int x; char a[++x]; a[sizeof a - 1] = 0; return a[0];],
1018       ac_cv_c_vararrays=yes,
1019       ac_cv_c_vararrays=no)])
1020  if test $ac_cv_c_vararrays = yes; then
1021    AC_DEFINE(HAVE_C_VARARRAYS, 1,
1022      [Define to 1 if C supports variable-length arrays.])
1023  fi
1024])
1025
1026# Check for stdbool.h that conforms to C99.
1027
1028# Copyright (C) 2002 Free Software Foundation, Inc.
1029
1030# This program is free software; you can redistribute it and/or modify
1031# it under the terms of the GNU General Public License as published by
1032# the Free Software Foundation; either version 2, or (at your option)
1033# any later version.
1034
1035# This program is distributed in the hope that it will be useful,
1036# but WITHOUT ANY WARRANTY; without even the implied warranty of
1037# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1038# GNU General Public License for more details.
1039
1040# You should have received a copy of the GNU General Public License
1041# along with this program; if not, write to the Free Software
1042# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1043# 02111-1307, USA.
1044
1045AC_DEFUN([AC_HEADER_STDBOOL],
1046  [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
1047     [ac_cv_header_stdbool_h],
1048     [AC_TRY_COMPILE(
1049	[
1050	  #include <stdbool.h>
1051	  #ifndef bool
1052	   "error: bool is not defined"
1053	  #endif
1054	  #ifndef false
1055	   "error: false is not defined"
1056	  #endif
1057	  #ifndef true
1058	   "error: false is not defined"
1059	  #endif
1060	  #ifndef __bool_true_false_are_defined
1061	   "error: __bool_true_false_are_defined is not defined"
1062	  #endif
1063
1064	  struct s { _Bool s: 1; _Bool t; } s;
1065
1066	  char a[true == 1 ? 1 : -1];
1067	  char b[false == 0 ? 1 : -1];
1068	  char c[__bool_true_false_are_defined == 1 ? 1 : -1];
1069	  char d[(bool) -0.5 == true ? 1 : -1];
1070	  char e[(bool) &s == true ? 1 : -1];
1071	  char f[(_Bool) -0.0 == false ? 1 : -1];
1072	  char g[true];
1073	  char h[sizeof (_Bool)];
1074	  char i[sizeof s.t];
1075	],
1076	[ return !a + !b + !c + !d + !e + !f + !g + !h + !i; ],
1077	[ac_cv_header_stdbool_h=yes],
1078	[ac_cv_header_stdbool_h=no])])
1079   if test $ac_cv_header_stdbool_h = yes; then
1080     AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.])
1081   fi])
1082
1083#serial 6
1084
1085dnl From Paul Eggert.
1086
1087AC_PREREQ(2.52)
1088
1089# Define intmax_t to long or long long if <inttypes.h> doesn't define.
1090
1091AC_DEFUN([jm_AC_TYPE_INTMAX_T],
1092[
1093  AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
1094  AC_CHECK_TYPE(intmax_t, ,
1095    [test $ac_cv_type_long_long = yes \
1096       && ac_type='long long' \
1097       || ac_type='long'
1098     AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
1099       [Define to widest signed type if <inttypes.h> doesn't define.])])
1100])
1101
1102# Define uintmax_t to unsigned long or unsigned long long
1103# if <inttypes.h> doesn't define.
1104
1105AC_DEFUN([jm_AC_TYPE_UINTMAX_T],
1106[
1107  AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
1108  AC_CHECK_TYPE(uintmax_t, ,
1109    [test $ac_cv_type_unsigned_long_long = yes \
1110       && ac_type='unsigned long long' \
1111       || ac_type='unsigned long'
1112     AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
1113       [Define to widest unsigned type if <inttypes.h> doesn't define.])])
1114])
1115
1116#serial 2
1117
1118dnl From Paul Eggert.
1119
1120# Define HAVE_LONG_LONG if 'long long' works.
1121
1122AC_DEFUN([jm_AC_TYPE_LONG_LONG],
1123[
1124  AC_CACHE_CHECK([for long long], ac_cv_type_long_long,
1125  [AC_TRY_LINK([long long ll = 1; int i = 63;],
1126    [long long llmax = (long long) -1;
1127     return ll << i | ll >> i | llmax / ll | llmax % ll;],
1128    ac_cv_type_long_long=yes,
1129    ac_cv_type_long_long=no)])
1130  if test $ac_cv_type_long_long = yes; then
1131    AC_DEFINE(HAVE_LONG_LONG, 1,
1132      [Define if you have the long long type.])
1133  fi
1134])
1135
1136# Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works.
1137
1138AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
1139[
1140  AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
1141  [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
1142    [unsigned long long ullmax = (unsigned long long) -1;
1143     return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
1144    ac_cv_type_unsigned_long_long=yes,
1145    ac_cv_type_unsigned_long_long=no)])
1146  if test $ac_cv_type_unsigned_long_long = yes; then
1147    AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
1148      [Define if you have the unsigned long long type.])
1149  fi
1150])
1151
1152# gettext.m4 serial 13 (gettext-0.11.1)
1153dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
1154dnl This file is free software, distributed under the terms of the GNU
1155dnl General Public License.  As a special exception to the GNU General
1156dnl Public License, this file may be distributed as part of a program
1157dnl that contains a configuration script generated by Autoconf, under
1158dnl the same distribution terms as the rest of that program.
1159dnl
1160dnl This file can can be used in projects which are not available under
1161dnl the GNU General Public License or the GNU Library General Public
1162dnl License but which still want to provide support for the GNU gettext
1163dnl functionality.
1164dnl Please note that the actual code of the GNU gettext library is covered
1165dnl by the GNU Library General Public License, and the rest of the GNU
1166dnl gettext package package is covered by the GNU General Public License.
1167dnl They are *not* in the public domain.
1168
1169dnl Authors:
1170dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
1171dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2002.
1172
1173dnl Macro to add for using GNU gettext.
1174
1175dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
1176dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
1177dnl    default (if it is not specified or empty) is 'no-libtool'.
1178dnl    INTLSYMBOL should be 'external' for packages with no intl directory,
1179dnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
1180dnl    If INTLSYMBOL is 'use-libtool', then a libtool library
1181dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
1182dnl    depending on --{enable,disable}-{shared,static} and on the presence of
1183dnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
1184dnl    $(top_builddir)/intl/libintl.a will be created.
1185dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
1186dnl    implementations (in libc or libintl) without the ngettext() function
1187dnl    will be ignored.
1188dnl INTLDIR is used to find the intl libraries.  If empty,
1189dnl    the value `$(top_builddir)/intl/' is used.
1190dnl
1191dnl The result of the configuration is one of three cases:
1192dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
1193dnl    and used.
1194dnl    Catalog format: GNU --> install in $(datadir)
1195dnl    Catalog extension: .mo after installation, .gmo in source tree
1196dnl 2) GNU gettext has been found in the system's C library.
1197dnl    Catalog format: GNU --> install in $(datadir)
1198dnl    Catalog extension: .mo after installation, .gmo in source tree
1199dnl 3) No internationalization, always use English msgid.
1200dnl    Catalog format: none
1201dnl    Catalog extension: none
1202dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
1203dnl The use of .gmo is historical (it was needed to avoid overwriting the
1204dnl GNU format catalogs when building on a platform with an X/Open gettext),
1205dnl but we keep it in order not to force irrelevant filename changes on the
1206dnl maintainers.
1207dnl
1208AC_DEFUN([AM_GNU_GETTEXT],
1209[
1210  dnl Argument checking.
1211  ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
1212    [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
1213])])])])])
1214  ifelse([$2], [], , [ifelse([$2], [need-ngettext], ,
1215    [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
1216])])])
1217  define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
1218  define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
1219
1220  AC_REQUIRE([AM_PO_SUBDIRS])dnl
1221  ifelse(gt_included_intl, yes, [
1222    AC_REQUIRE([AM_INTL_SUBDIR])dnl
1223  ])
1224
1225  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
1226  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1227  AC_REQUIRE([AC_LIB_RPATH])
1228
1229  AC_MSG_CHECKING([whether NLS is requested])
1230  dnl Default is enabled NLS
1231  AC_ARG_ENABLE(nls,
1232    [  --disable-nls           do not use Native Language Support],
1233    USE_NLS=$enableval, USE_NLS=yes)
1234  AC_MSG_RESULT($USE_NLS)
1235  AC_SUBST(USE_NLS)
1236
1237  ifelse(gt_included_intl, yes, [
1238    BUILD_INCLUDED_LIBINTL=no
1239    USE_INCLUDED_LIBINTL=no
1240  ])
1241  LIBINTL=
1242  LTLIBINTL=
1243  POSUB=
1244
1245  dnl If we use NLS figure out what method
1246  if test "$USE_NLS" = "yes"; then
1247    gt_use_preinstalled_gnugettext=no
1248    ifelse(gt_included_intl, yes, [
1249      AC_MSG_CHECKING([whether included gettext is requested])
1250      AC_ARG_WITH(included-gettext,
1251        [  --with-included-gettext use the GNU gettext library included here],
1252        nls_cv_force_use_gnu_gettext=$withval,
1253        nls_cv_force_use_gnu_gettext=no)
1254      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
1255
1256      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
1257      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
1258    ])
1259        dnl User does not insist on using GNU NLS library.  Figure out what
1260        dnl to use.  If GNU gettext is available we use this.  Else we have
1261        dnl to fall back to GNU NLS library.
1262
1263        dnl Add a version number to the cache macros.
1264        define([gt_api_version], ifelse([$2], [need-ngettext], 2, 1))
1265        define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
1266        define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
1267
1268        AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
1269         [AC_TRY_LINK([#include <libintl.h>
1270extern int _nl_msg_cat_cntr;
1271extern int *_nl_domain_bindings;],
1272            [bindtextdomain ("", "");
1273return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
1274            gt_cv_func_gnugettext_libc=yes,
1275            gt_cv_func_gnugettext_libc=no)])
1276
1277        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
1278          dnl Sometimes libintl requires libiconv, so first search for libiconv.
1279          ifelse(gt_included_intl, yes, , [
1280            AM_ICONV_LINK
1281          ])
1282          dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
1283          dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
1284          dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
1285          dnl even if libiconv doesn't exist.
1286          AC_LIB_LINKFLAGS_BODY([intl])
1287          AC_CACHE_CHECK([for GNU gettext in libintl],
1288            gt_cv_func_gnugettext_libintl,
1289           [gt_save_CPPFLAGS="$CPPFLAGS"
1290            CPPFLAGS="$CPPFLAGS $INCINTL"
1291            gt_save_LIBS="$LIBS"
1292            LIBS="$LIBS $LIBINTL"
1293            dnl Now see whether libintl exists and does not depend on libiconv.
1294            AC_TRY_LINK([#include <libintl.h>
1295extern int _nl_msg_cat_cntr;
1296extern int *_nl_domain_bindings;
1297extern
1298#ifdef __cplusplus
1299"C"
1300#endif
1301const char *_nl_expand_alias ();],
1302              [bindtextdomain ("", "");
1303return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings + *_nl_expand_alias (0)],
1304              gt_cv_func_gnugettext_libintl=yes,
1305              gt_cv_func_gnugettext_libintl=no)
1306            dnl Now see whether libintl exists and depends on libiconv.
1307            if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
1308              LIBS="$LIBS $LIBICONV"
1309              AC_TRY_LINK([#include <libintl.h>
1310extern int _nl_msg_cat_cntr;
1311extern int *_nl_domain_bindings;
1312extern
1313#ifdef __cplusplus
1314"C"
1315#endif
1316const char *_nl_expand_alias ();],
1317                [bindtextdomain ("", "");
1318return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings + *_nl_expand_alias (0)],
1319               [LIBINTL="$LIBINTL $LIBICONV"
1320                LTLIBINTL="$LTLIBINTL $LTLIBICONV"
1321                gt_cv_func_gnugettext_libintl=yes
1322               ])
1323            fi
1324            CPPFLAGS="$gt_save_CPPFLAGS"
1325            LIBS="$gt_save_LIBS"])
1326        fi
1327
1328        dnl If an already present or preinstalled GNU gettext() is found,
1329        dnl use it.  But if this macro is used in GNU gettext, and GNU
1330        dnl gettext is already preinstalled in libintl, we update this
1331        dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
1332        if test "$gt_cv_func_gnugettext_libc" = "yes" \
1333           || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
1334                && test "$PACKAGE" != gettext; }; then
1335          gt_use_preinstalled_gnugettext=yes
1336        else
1337          dnl Reset the values set by searching for libintl.
1338          LIBINTL=
1339          LTLIBINTL=
1340          INCINTL=
1341        fi
1342
1343    ifelse(gt_included_intl, yes, [
1344        if test "$gt_use_preinstalled_gnugettext" != "yes"; then
1345          dnl GNU gettext is not found in the C library.
1346          dnl Fall back on included GNU gettext library.
1347          nls_cv_use_gnu_gettext=yes
1348        fi
1349      fi
1350
1351      if test "$nls_cv_use_gnu_gettext" = "yes"; then
1352        dnl Mark actions used to generate GNU NLS library.
1353        INTLOBJS="\$(GETTOBJS)"
1354        BUILD_INCLUDED_LIBINTL=yes
1355        USE_INCLUDED_LIBINTL=yes
1356        LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
1357        LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
1358        LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
1359      fi
1360
1361      if test "$gt_use_preinstalled_gnugettext" = "yes" \
1362         || test "$nls_cv_use_gnu_gettext" = "yes"; then
1363        dnl Mark actions to use GNU gettext tools.
1364        CATOBJEXT=.gmo
1365      fi
1366    ])
1367
1368    if test "$gt_use_preinstalled_gnugettext" = "yes" \
1369       || test "$nls_cv_use_gnu_gettext" = "yes"; then
1370      AC_DEFINE(ENABLE_NLS, 1,
1371        [Define to 1 if translation of program messages to the user's native language
1372   is requested.])
1373    else
1374      USE_NLS=no
1375    fi
1376  fi
1377
1378  if test "$USE_NLS" = "yes"; then
1379
1380    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
1381      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
1382        AC_MSG_CHECKING([how to link with libintl])
1383        AC_MSG_RESULT([$LIBINTL])
1384        AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
1385      fi
1386
1387      dnl For backward compatibility. Some packages may be using this.
1388      AC_DEFINE(HAVE_GETTEXT, 1,
1389       [Define if the GNU gettext() function is already present or preinstalled.])
1390      AC_DEFINE(HAVE_DCGETTEXT, 1,
1391       [Define if the GNU dcgettext() function is already present or preinstalled.])
1392    fi
1393
1394    dnl We need to process the po/ directory.
1395    POSUB=po
1396  fi
1397
1398  ifelse(gt_included_intl, yes, [
1399    dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
1400    dnl to 'yes' because some of the testsuite requires it.
1401    if test "$PACKAGE" = gettext; then
1402      BUILD_INCLUDED_LIBINTL=yes
1403    fi
1404
1405    dnl Make all variables we use known to autoconf.
1406    AC_SUBST(BUILD_INCLUDED_LIBINTL)
1407    AC_SUBST(USE_INCLUDED_LIBINTL)
1408    AC_SUBST(CATOBJEXT)
1409    AC_SUBST(INTLOBJS)
1410
1411    dnl For backward compatibility. Some configure.ins may be using this.
1412    nls_cv_header_intl=
1413    nls_cv_header_libgt=
1414
1415    dnl For backward compatibility. Some Makefiles may be using this.
1416    DATADIRNAME=share
1417    AC_SUBST(DATADIRNAME)
1418
1419    dnl For backward compatibility. Some Makefiles may be using this.
1420    INSTOBJEXT=.mo
1421    AC_SUBST(INSTOBJEXT)
1422
1423    dnl For backward compatibility. Some Makefiles may be using this.
1424    GENCAT=gencat
1425    AC_SUBST(GENCAT)
1426
1427    dnl Enable libtool support if the surrounding package wishes it.
1428    INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
1429    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
1430  ])
1431
1432  dnl For backward compatibility. Some Makefiles may be using this.
1433  INTLLIBS="$LIBINTL"
1434  AC_SUBST(INTLLIBS)
1435
1436  dnl Make all documented variables known to autoconf.
1437  AC_SUBST(LIBINTL)
1438  AC_SUBST(LTLIBINTL)
1439  AC_SUBST(POSUB)
1440])
1441
1442
1443dnl Checks for all prerequisites of the po subdirectory,
1444dnl except for USE_NLS.
1445AC_DEFUN([AM_PO_SUBDIRS],
1446[
1447  AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1448  AC_REQUIRE([AC_PROG_INSTALL])dnl
1449  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
1450
1451  dnl Perform the following tests also if --disable-nls has been given,
1452  dnl because they are needed for "make dist" to work.
1453
1454  dnl Search for GNU msgfmt in the PATH.
1455  dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
1456  dnl The second test excludes FreeBSD msgfmt.
1457  AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1458    [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
1459     (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
1460    :)
1461  AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1462
1463  dnl Search for GNU xgettext 0.11 or newer in the PATH.
1464  dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
1465  dnl The second test excludes FreeBSD xgettext.
1466  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1467    [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
1468     (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
1469    :)
1470  dnl Remove leftover from FreeBSD xgettext call.
1471  rm -f messages.po
1472
1473  dnl Search for GNU msgmerge 0.11 or newer in the PATH.
1474  AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
1475    [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
1476
1477  dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1478  dnl Test whether we really found GNU msgfmt.
1479  if test "$GMSGFMT" != ":"; then
1480    dnl If it is no GNU msgfmt we define it as : so that the
1481    dnl Makefiles still can work.
1482    if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
1483       (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
1484      : ;
1485    else
1486      GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
1487      AC_MSG_RESULT(
1488        [found $GMSGFMT program is not GNU msgfmt; ignore it])
1489      GMSGFMT=":"
1490    fi
1491  fi
1492
1493  dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1494  dnl Test whether we really found GNU xgettext.
1495  if test "$XGETTEXT" != ":"; then
1496    dnl If it is no GNU xgettext we define it as : so that the
1497    dnl Makefiles still can work.
1498    if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
1499       (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
1500      : ;
1501    else
1502      AC_MSG_RESULT(
1503        [found xgettext program is not GNU xgettext; ignore it])
1504      XGETTEXT=":"
1505    fi
1506    dnl Remove leftover from FreeBSD xgettext call.
1507    rm -f messages.po
1508  fi
1509
1510  AC_OUTPUT_COMMANDS([
1511    for ac_file in $CONFIG_FILES; do
1512      # Support "outfile[:infile[:infile...]]"
1513      case "$ac_file" in
1514        *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
1515      esac
1516      # PO directories have a Makefile.in generated from Makefile.in.in.
1517      case "$ac_file" in */Makefile.in)
1518        # Adjust a relative srcdir.
1519        ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
1520        ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
1521        ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
1522        # In autoconf-2.13 it is called $ac_given_srcdir.
1523        # In autoconf-2.50 it is called $srcdir.
1524        test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
1525        case "$ac_given_srcdir" in
1526          .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
1527          /*) top_srcdir="$ac_given_srcdir" ;;
1528          *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
1529        esac
1530        if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
1531          rm -f "$ac_dir/POTFILES"
1532          test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
1533          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ 	]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
1534          # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
1535          # on $ac_dir but don't depend on user-specified configuration
1536          # parameters.
1537          if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
1538            # The LINGUAS file contains the set of available languages.
1539            if test -n "$ALL_LINGUAS"; then
1540              test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
1541            fi
1542            ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
1543            # Hide the ALL_LINGUAS assigment from automake.
1544            eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
1545          fi
1546          case "$ac_given_srcdir" in
1547            .) srcdirpre= ;;
1548            *) srcdirpre='$(srcdir)/' ;;
1549          esac
1550          POFILES=
1551          GMOFILES=
1552          UPDATEPOFILES=
1553          DUMMYPOFILES=
1554          for lang in $ALL_LINGUAS; do
1555            POFILES="$POFILES $srcdirpre$lang.po"
1556            GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
1557            UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
1558            DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
1559          done
1560          # CATALOGS depends on both $ac_dir and the user's LINGUAS
1561          # environment variable.
1562          INST_LINGUAS=
1563          if test -n "$ALL_LINGUAS"; then
1564            for presentlang in $ALL_LINGUAS; do
1565              useit=no
1566              if test "%UNSET%" != "$LINGUAS"; then
1567                desiredlanguages="$LINGUAS"
1568              else
1569                desiredlanguages="$ALL_LINGUAS"
1570              fi
1571              for desiredlang in $desiredlanguages; do
1572                # Use the presentlang catalog if desiredlang is
1573                #   a. equal to presentlang, or
1574                #   b. a variant of presentlang (because in this case,
1575                #      presentlang can be used as a fallback for messages
1576                #      which are not translated in the desiredlang catalog).
1577                case "$desiredlang" in
1578                  "$presentlang"*) useit=yes;;
1579                esac
1580              done
1581              if test $useit = yes; then
1582                INST_LINGUAS="$INST_LINGUAS $presentlang"
1583              fi
1584            done
1585          fi
1586          CATALOGS=
1587          if test -n "$INST_LINGUAS"; then
1588            for lang in $INST_LINGUAS; do
1589              CATALOGS="$CATALOGS $lang.gmo"
1590            done
1591          fi
1592          test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
1593          sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
1594          for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
1595            if test -f "$f"; then
1596              case "$f" in
1597                *.orig | *.bak | *~) ;;
1598                *) cat "$f" >> "$ac_dir/Makefile" ;;
1599              esac
1600            fi
1601          done
1602        fi
1603        ;;
1604      esac
1605    done],
1606   [# Capture the value of obsolete $ALL_LINGUAS because we need it to compute
1607    # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
1608    # from automake.
1609    eval 'ALL_LINGUAS''="$ALL_LINGUAS"'
1610    # Capture the value of LINGUAS because we need it to compute CATALOGS.
1611    LINGUAS="${LINGUAS-%UNSET%}"
1612   ])
1613])
1614
1615
1616dnl Checks for all prerequisites of the intl subdirectory,
1617dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
1618dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
1619AC_DEFUN([AM_INTL_SUBDIR],
1620[
1621  AC_REQUIRE([AC_PROG_INSTALL])dnl
1622  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
1623  AC_REQUIRE([AC_PROG_CC])dnl
1624  AC_REQUIRE([AC_CANONICAL_HOST])dnl
1625  AC_REQUIRE([AC_PROG_RANLIB])dnl
1626  AC_REQUIRE([AC_ISC_POSIX])dnl
1627  AC_REQUIRE([AC_HEADER_STDC])dnl
1628  AC_REQUIRE([AC_C_CONST])dnl
1629  AC_REQUIRE([AC_C_INLINE])dnl
1630  AC_REQUIRE([AC_TYPE_OFF_T])dnl
1631  AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1632  AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1633  AC_REQUIRE([AC_FUNC_MMAP])dnl
1634  AC_REQUIRE([jm_GLIBC21])dnl
1635
1636  AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
1637stdlib.h string.h unistd.h sys/param.h])
1638  AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
1639geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \
1640strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
1641
1642  AM_ICONV
1643  AM_LANGINFO_CODESET
1644  AM_LC_MESSAGES
1645
1646  dnl intl/plural.c is generated from intl/plural.y. It requires bison,
1647  dnl because plural.y uses bison specific features. It requires at least
1648  dnl bison-1.26 because earlier versions generate a plural.c that doesn't
1649  dnl compile.
1650  dnl bison is only needed for the maintainer (who touches plural.y). But in
1651  dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
1652  dnl the rule in general Makefile. Now, some people carelessly touch the
1653  dnl files or have a broken "make" program, hence the plural.c rule will
1654  dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
1655  dnl present or too old.
1656  AC_CHECK_PROGS([INTLBISON], [bison])
1657  if test -z "$INTLBISON"; then
1658    ac_verc_fail=yes
1659  else
1660    dnl Found it, now check the version.
1661    AC_MSG_CHECKING([version of bison])
1662changequote(<<,>>)dnl
1663    ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
1664    case $ac_prog_version in
1665      '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
1666      1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
1667changequote([,])dnl
1668         ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
1669      *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
1670    esac
1671    AC_MSG_RESULT([$ac_prog_version])
1672  fi
1673  if test $ac_verc_fail = yes; then
1674    INTLBISON=:
1675  fi
1676])
1677
1678
1679AC_DEFUN([AM_MKINSTALLDIRS],
1680[
1681  dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1682  dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
1683  dnl Try to locate is.
1684  MKINSTALLDIRS=
1685  if test -n "$ac_aux_dir"; then
1686    MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
1687  fi
1688  if test -z "$MKINSTALLDIRS"; then
1689    MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1690  fi
1691  AC_SUBST(MKINSTALLDIRS)
1692])
1693
1694# lib-prefix.m4 serial 1 (gettext-0.11)
1695dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
1696dnl This file is free software, distributed under the terms of the GNU
1697dnl General Public License.  As a special exception to the GNU General
1698dnl Public License, this file may be distributed as part of a program
1699dnl that contains a configuration script generated by Autoconf, under
1700dnl the same distribution terms as the rest of that program.
1701
1702dnl From Bruno Haible.
1703
1704dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
1705dnl to access previously installed libraries. The basic assumption is that
1706dnl a user will want packages to use other packages he previously installed
1707dnl with the same --prefix option.
1708dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
1709dnl libraries, but is otherwise very convenient.
1710AC_DEFUN([AC_LIB_PREFIX],
1711[
1712  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
1713  AC_REQUIRE([AC_PROG_CC])
1714  AC_REQUIRE([AC_CANONICAL_HOST])
1715  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1716  dnl By default, look in $includedir and $libdir.
1717  use_additional=yes
1718  AC_LIB_WITH_FINAL_PREFIX([
1719    eval additional_includedir=\"$includedir\"
1720    eval additional_libdir=\"$libdir\"
1721  ])
1722  AC_ARG_WITH([lib-prefix],
1723[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
1724  --without-lib-prefix    don't search for libraries in includedir and libdir],
1725[
1726    if test "X$withval" = "Xno"; then
1727      use_additional=no
1728    else
1729      if test "X$withval" = "X"; then
1730        AC_LIB_WITH_FINAL_PREFIX([
1731          eval additional_includedir=\"$includedir\"
1732          eval additional_libdir=\"$libdir\"
1733        ])
1734      else
1735        additional_includedir="$withval/include"
1736        additional_libdir="$withval/lib"
1737      fi
1738    fi
1739])
1740  if test $use_additional = yes; then
1741    dnl Potentially add $additional_includedir to $CPPFLAGS.
1742    dnl But don't add it
1743    dnl   1. if it's the standard /usr/include,
1744    dnl   2. if it's already present in $CPPFLAGS,
1745    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
1746    dnl   4. if it doesn't exist as a directory.
1747    if test "X$additional_includedir" != "X/usr/include"; then
1748      haveit=
1749      for x in $CPPFLAGS; do
1750        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1751        if test "X$x" = "X-I$additional_includedir"; then
1752          haveit=yes
1753          break
1754        fi
1755      done
1756      if test -z "$haveit"; then
1757        if test "X$additional_includedir" = "X/usr/local/include"; then
1758          if test -n "$GCC"; then
1759            case $host_os in
1760              linux*) haveit=yes;;
1761            esac
1762          fi
1763        fi
1764        if test -z "$haveit"; then
1765          if test -d "$additional_includedir"; then
1766            dnl Really add $additional_includedir to $CPPFLAGS.
1767            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
1768          fi
1769        fi
1770      fi
1771    fi
1772    dnl Potentially add $additional_libdir to $LDFLAGS.
1773    dnl But don't add it
1774    dnl   1. if it's the standard /usr/lib,
1775    dnl   2. if it's already present in $LDFLAGS,
1776    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
1777    dnl   4. if it doesn't exist as a directory.
1778    if test "X$additional_libdir" != "X/usr/lib"; then
1779      haveit=
1780      for x in $LDFLAGS; do
1781        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1782        if test "X$x" = "X-L$additional_libdir"; then
1783          haveit=yes
1784          break
1785        fi
1786      done
1787      if test -z "$haveit"; then
1788        if test "X$additional_libdir" = "X/usr/local/lib"; then
1789          if test -n "$GCC"; then
1790            case $host_os in
1791              linux*) haveit=yes;;
1792            esac
1793          fi
1794        fi
1795        if test -z "$haveit"; then
1796          if test -d "$additional_libdir"; then
1797            dnl Really add $additional_libdir to $LDFLAGS.
1798            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
1799          fi
1800        fi
1801      fi
1802    fi
1803  fi
1804])
1805
1806dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
1807dnl acl_final_exec_prefix, containing the values to which $prefix and
1808dnl $exec_prefix will expand at the end of the configure script.
1809AC_DEFUN([AC_LIB_PREPARE_PREFIX],
1810[
1811  dnl Unfortunately, prefix and exec_prefix get only finally determined
1812  dnl at the end of configure.
1813  if test "X$prefix" = "XNONE"; then
1814    acl_final_prefix="$ac_default_prefix"
1815  else
1816    acl_final_prefix="$prefix"
1817  fi
1818  if test "X$exec_prefix" = "XNONE"; then
1819    acl_final_exec_prefix='${prefix}'
1820  else
1821    acl_final_exec_prefix="$exec_prefix"
1822  fi
1823  acl_save_prefix="$prefix"
1824  prefix="$acl_final_prefix"
1825  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
1826  prefix="$acl_save_prefix"
1827])
1828
1829dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
1830dnl variables prefix and exec_prefix bound to the values they will have
1831dnl at the end of the configure script.
1832AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
1833[
1834  acl_save_prefix="$prefix"
1835  prefix="$acl_final_prefix"
1836  acl_save_exec_prefix="$exec_prefix"
1837  exec_prefix="$acl_final_exec_prefix"
1838  $1
1839  exec_prefix="$acl_save_exec_prefix"
1840  prefix="$acl_save_prefix"
1841])
1842
1843# lib-link.m4 serial 1 (gettext-0.11)
1844dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
1845dnl This file is free software, distributed under the terms of the GNU
1846dnl General Public License.  As a special exception to the GNU General
1847dnl Public License, this file may be distributed as part of a program
1848dnl that contains a configuration script generated by Autoconf, under
1849dnl the same distribution terms as the rest of that program.
1850
1851dnl From Bruno Haible.
1852
1853dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
1854dnl the libraries corresponding to explicit and implicit dependencies.
1855dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
1856dnl augments the CPPFLAGS variable.
1857AC_DEFUN([AC_LIB_LINKFLAGS],
1858[
1859  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1860  AC_REQUIRE([AC_LIB_RPATH])
1861  define([Name],[translit([$1],[./-], [___])])
1862  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1863                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1864  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
1865    AC_LIB_LINKFLAGS_BODY([$1], [$2])
1866    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
1867    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
1868    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
1869  ])
1870  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
1871  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
1872  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
1873  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1874  AC_SUBST([LIB]NAME)
1875  AC_SUBST([LTLIB]NAME)
1876  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
1877  dnl results of this search when this library appears as a dependency.
1878  HAVE_LIB[]NAME=yes
1879  undefine([Name])
1880  undefine([NAME])
1881])
1882
1883dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
1884dnl searches for libname and the libraries corresponding to explicit and
1885dnl implicit dependencies, together with the specified include files and
1886dnl the ability to compile and link the specified testcode. If found, it
1887dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
1888dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
1889dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
1890dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
1891AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
1892[
1893  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1894  AC_REQUIRE([AC_LIB_RPATH])
1895  define([Name],[translit([$1],[./-], [___])])
1896  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1897                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1898
1899  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
1900  dnl accordingly.
1901  AC_LIB_LINKFLAGS_BODY([$1], [$2])
1902
1903  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
1904  dnl because if the user has installed lib[]Name and not disabled its use
1905  dnl via --without-lib[]Name-prefix, he wants to use it.
1906  ac_save_CPPFLAGS="$CPPFLAGS"
1907  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1908
1909  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
1910    ac_save_LIBS="$LIBS"
1911    LIBS="$LIBS $LIB[]NAME"
1912    AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
1913    LIBS="$ac_save_LIBS"
1914  ])
1915  if test "$ac_cv_lib[]Name" = yes; then
1916    HAVE_LIB[]NAME=yes
1917    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
1918    AC_MSG_CHECKING([how to link with lib[]$1])
1919    AC_MSG_RESULT([$LIB[]NAME])
1920  else
1921    HAVE_LIB[]NAME=no
1922    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
1923    dnl $INC[]NAME either.
1924    CPPFLAGS="$ac_save_CPPFLAGS"
1925    LIB[]NAME=
1926    LTLIB[]NAME=
1927  fi
1928  AC_SUBST([HAVE_LIB]NAME)
1929  AC_SUBST([LIB]NAME)
1930  AC_SUBST([LTLIB]NAME)
1931  undefine([Name])
1932  undefine([NAME])
1933])
1934
1935dnl Determine the platform dependent parameters needed to use rpath:
1936dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
1937dnl hardcode_direct, hardcode_minus_L,
1938dnl sys_lib_search_path_spec, sys_lib_dlsearch_path_spec.
1939AC_DEFUN([AC_LIB_RPATH],
1940[
1941  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
1942  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
1943  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
1944  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
1945  AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
1946    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
1947    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
1948    . ./conftest.sh
1949    rm -f ./conftest.sh
1950    acl_cv_rpath=done
1951  ])
1952  wl="$acl_cv_wl"
1953  libext="$acl_cv_libext"
1954  shlibext="$acl_cv_shlibext"
1955  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
1956  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
1957  hardcode_direct="$acl_cv_hardcode_direct"
1958  hardcode_minus_L="$acl_cv_hardcode_minus_L"
1959  sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec"
1960  sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec"
1961])
1962
1963dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
1964dnl the libraries corresponding to explicit and implicit dependencies.
1965dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
1966AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
1967[
1968  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1969                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1970  dnl By default, look in $includedir and $libdir.
1971  use_additional=yes
1972  AC_LIB_WITH_FINAL_PREFIX([
1973    eval additional_includedir=\"$includedir\"
1974    eval additional_libdir=\"$libdir\"
1975  ])
1976  AC_ARG_WITH([lib$1-prefix],
1977[  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
1978  --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
1979[
1980    if test "X$withval" = "Xno"; then
1981      use_additional=no
1982    else
1983      if test "X$withval" = "X"; then
1984        AC_LIB_WITH_FINAL_PREFIX([
1985          eval additional_includedir=\"$includedir\"
1986          eval additional_libdir=\"$libdir\"
1987        ])
1988      else
1989        additional_includedir="$withval/include"
1990        additional_libdir="$withval/lib"
1991      fi
1992    fi
1993])
1994  dnl Search the library and its dependencies in $additional_libdir and
1995  dnl $LDFLAGS. Using breadth-first-seach.
1996  LIB[]NAME=
1997  LTLIB[]NAME=
1998  INC[]NAME=
1999  rpathdirs=
2000  ltrpathdirs=
2001  names_already_handled=
2002  names_next_round='$1 $2'
2003  while test -n "$names_next_round"; do
2004    names_this_round="$names_next_round"
2005    names_next_round=
2006    for name in $names_this_round; do
2007      already_handled=
2008      for n in $names_already_handled; do
2009        if test "$n" = "$name"; then
2010          already_handled=yes
2011          break
2012        fi
2013      done
2014      if test -z "$already_handled"; then
2015        names_already_handled="$names_already_handled $name"
2016        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
2017        dnl or AC_LIB_HAVE_LINKFLAGS call.
2018        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
2019        eval value=\"\$HAVE_LIB$uppername\"
2020        if test -n "$value"; then
2021          if test "$value" = yes; then
2022            eval value=\"\$LIB$uppername\"
2023            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
2024            eval value=\"\$LTLIB$uppername\"
2025            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
2026          else
2027            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
2028            dnl that this library doesn't exist. So just drop it.
2029            :
2030          fi
2031        else
2032          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
2033          dnl and the already constructed $LIBNAME/$LTLIBNAME.
2034          found_dir=
2035          found_la=
2036          found_so=
2037          found_a=
2038          if test $use_additional = yes; then
2039            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
2040              found_dir="$additional_libdir"
2041              found_so="$additional_libdir/lib$name.$shlibext"
2042              if test -f "$additional_libdir/lib$name.la"; then
2043                found_la="$additional_libdir/lib$name.la"
2044              fi
2045            else
2046              if test -f "$additional_libdir/lib$name.$libext"; then
2047                found_dir="$additional_libdir"
2048                found_a="$additional_libdir/lib$name.$libext"
2049                if test -f "$additional_libdir/lib$name.la"; then
2050                  found_la="$additional_libdir/lib$name.la"
2051                fi
2052              fi
2053            fi
2054          fi
2055          if test "X$found_dir" = "X"; then
2056            for x in $LDFLAGS $LTLIB[]NAME; do
2057              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2058              case "$x" in
2059                -L*)
2060                  dir=`echo "X$x" | sed -e 's/^X-L//'`
2061                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
2062                    found_dir="$dir"
2063                    found_so="$dir/lib$name.$shlibext"
2064                    if test -f "$dir/lib$name.la"; then
2065                      found_la="$dir/lib$name.la"
2066                    fi
2067                  else
2068                    if test -f "$dir/lib$name.$libext"; then
2069                      found_dir="$dir"
2070                      found_a="$dir/lib$name.$libext"
2071                      if test -f "$dir/lib$name.la"; then
2072                        found_la="$dir/lib$name.la"
2073                      fi
2074                    fi
2075                  fi
2076                  ;;
2077              esac
2078              if test "X$found_dir" != "X"; then
2079                break
2080              fi
2081            done
2082          fi
2083          if test "X$found_dir" != "X"; then
2084            dnl Found the library.
2085            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
2086            if test "X$found_so" != "X"; then
2087              dnl Linking with a shared library. We attempt to hardcode its
2088              dnl directory into the executable's runpath, unless it's the
2089              dnl standard /usr/lib.
2090              if test "X$found_dir" = "X/usr/lib"; then
2091                dnl No hardcoding is needed.
2092                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
2093              else
2094                dnl Use an explicit option to hardcode DIR into the resulting
2095                dnl binary.
2096                dnl Potentially add DIR to ltrpathdirs.
2097                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
2098                haveit=
2099                for x in $ltrpathdirs; do
2100                  if test "X$x" = "X$found_dir"; then
2101                    haveit=yes
2102                    break
2103                  fi
2104                done
2105                if test -z "$haveit"; then
2106                  ltrpathdirs="$ltrpathdirs $found_dir"
2107                fi
2108                dnl The hardcoding into $LIBNAME is system dependent.
2109                if test "$hardcode_direct" = yes; then
2110                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
2111                  dnl resulting binary.
2112                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
2113                else
2114                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
2115                    dnl Use an explicit option to hardcode DIR into the resulting
2116                    dnl binary.
2117                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
2118                    dnl Potentially add DIR to rpathdirs.
2119                    dnl The rpathdirs will be appended to $LIBNAME at the end.
2120                    haveit=
2121                    for x in $rpathdirs; do
2122                      if test "X$x" = "X$found_dir"; then
2123                        haveit=yes
2124                        break
2125                      fi
2126                    done
2127                    if test -z "$haveit"; then
2128                      rpathdirs="$rpathdirs $found_dir"
2129                    fi
2130                  else
2131                    dnl Rely on "-L$found_dir".
2132                    dnl But don't add it if it's already contained in the LDFLAGS
2133                    dnl or the already constructed $LIBNAME
2134                    haveit=
2135                    for x in $LDFLAGS $LIB[]NAME; do
2136                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2137                      if test "X$x" = "X-L$found_dir"; then
2138                        haveit=yes
2139                        break
2140                      fi
2141                    done
2142                    if test -z "$haveit"; then
2143                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
2144                    fi
2145                    if test "$hardcode_minus_L" != no; then
2146                      dnl FIXME: Not sure whether we should use
2147                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
2148                      dnl here.
2149                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
2150                    else
2151                      dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
2152                      dnl here, because this doesn't fit in flags passed to the
2153                      dnl compiler. So give up. No hardcoding. This affects only
2154                      dnl very old systems.
2155                      dnl FIXME: Not sure whether we should use
2156                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
2157                      dnl here.
2158                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
2159                    fi
2160                  fi
2161                fi
2162              fi
2163            else
2164              if test "X$found_a" != "X"; then
2165                dnl Linking with a static library.
2166                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
2167              else
2168                dnl We shouldn't come here, but anyway it's good to have a
2169                dnl fallback.
2170                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
2171              fi
2172            fi
2173            dnl Assume the include files are nearby.
2174            additional_includedir=
2175            case "$found_dir" in
2176              */lib | */lib/)
2177                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
2178                additional_includedir="$basedir/include"
2179                ;;
2180            esac
2181            if test "X$additional_includedir" != "X"; then
2182              dnl Potentially add $additional_includedir to $INCNAME.
2183              dnl But don't add it
2184              dnl   1. if it's the standard /usr/include,
2185              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
2186              dnl   3. if it's already present in $CPPFLAGS or the already
2187              dnl      constructed $INCNAME,
2188              dnl   4. if it doesn't exist as a directory.
2189              if test "X$additional_includedir" != "X/usr/include"; then
2190                haveit=
2191                if test "X$additional_includedir" = "X/usr/local/include"; then
2192                  if test -n "$GCC"; then
2193                    case $host_os in
2194                      linux*) haveit=yes;;
2195                    esac
2196                  fi
2197                fi
2198                if test -z "$haveit"; then
2199                  for x in $CPPFLAGS $INC[]NAME; do
2200                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2201                    if test "X$x" = "X-I$additional_includedir"; then
2202                      haveit=yes
2203                      break
2204                    fi
2205                  done
2206                  if test -z "$haveit"; then
2207                    if test -d "$additional_includedir"; then
2208                      dnl Really add $additional_includedir to $INCNAME.
2209                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
2210                    fi
2211                  fi
2212                fi
2213              fi
2214            fi
2215            dnl Look for dependencies.
2216            if test -n "$found_la"; then
2217              dnl Read the .la file. It defines the variables
2218              dnl dlname, library_names, old_library, dependency_libs, current,
2219              dnl age, revision, installed, dlopen, dlpreopen, libdir.
2220              save_libdir="$libdir"
2221              case "$found_la" in
2222                */* | *\\*) . "$found_la" ;;
2223                *) . "./$found_la" ;;
2224              esac
2225              libdir="$save_libdir"
2226              dnl We use only dependency_libs.
2227              for dep in $dependency_libs; do
2228                case "$dep" in
2229                  -L*)
2230                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
2231                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
2232                    dnl But don't add it
2233                    dnl   1. if it's the standard /usr/lib,
2234                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
2235                    dnl   3. if it's already present in $LDFLAGS or the already
2236                    dnl      constructed $LIBNAME,
2237                    dnl   4. if it doesn't exist as a directory.
2238                    if test "X$additional_libdir" != "X/usr/lib"; then
2239                      haveit=
2240                      if test "X$additional_libdir" = "X/usr/local/lib"; then
2241                        if test -n "$GCC"; then
2242                          case $host_os in
2243                            linux*) haveit=yes;;
2244                          esac
2245                        fi
2246                      fi
2247                      if test -z "$haveit"; then
2248                        haveit=
2249                        for x in $LDFLAGS $LIB[]NAME; do
2250                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2251                          if test "X$x" = "X-L$additional_libdir"; then
2252                            haveit=yes
2253                            break
2254                          fi
2255                        done
2256                        if test -z "$haveit"; then
2257                          if test -d "$additional_libdir"; then
2258                            dnl Really add $additional_libdir to $LIBNAME.
2259                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
2260                          fi
2261                        fi
2262                        haveit=
2263                        for x in $LDFLAGS $LTLIB[]NAME; do
2264                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2265                          if test "X$x" = "X-L$additional_libdir"; then
2266                            haveit=yes
2267                            break
2268                          fi
2269                        done
2270                        if test -z "$haveit"; then
2271                          if test -d "$additional_libdir"; then
2272                            dnl Really add $additional_libdir to $LTLIBNAME.
2273                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
2274                          fi
2275                        fi
2276                      fi
2277                    fi
2278                    ;;
2279                  -l*)
2280                    dnl Handle this in the next round.
2281                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
2282                    ;;
2283                  *.la)
2284                    dnl Handle this in the next round. Throw away the .la's
2285                    dnl directory; it is already contained in a preceding -L
2286                    dnl option.
2287                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
2288                    ;;
2289                  *)
2290                    dnl Most likely an immediate library name.
2291                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
2292                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
2293                    ;;
2294                esac
2295              done
2296            fi
2297          else
2298            dnl Didn't find the library; assume it is in the system directories
2299            dnl known to the linker and runtime loader. (All the system
2300            dnl directories known to the linker should also be known to the
2301            dnl runtime loader, otherwise the system is severely misconfigured.)
2302            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
2303            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
2304          fi
2305        fi
2306      fi
2307    done
2308  done
2309  if test "X$rpathdirs" != "X"; then
2310    if test -n "$hardcode_libdir_separator"; then
2311      dnl Weird platform: only the last -rpath option counts, the user must
2312      dnl pass all path elements in one option. We can arrange that for a
2313      dnl single library, but not when more than one $LIBNAMEs are used.
2314      alldirs=
2315      for found_dir in $rpathdirs; do
2316        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
2317      done
2318      dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
2319      acl_save_libdir="$libdir"
2320      libdir="$alldirs"
2321      eval flag=\"$hardcode_libdir_flag_spec\"
2322      libdir="$acl_save_libdir"
2323      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
2324    else
2325      dnl The -rpath options are cumulative.
2326      for found_dir in $rpathdirs; do
2327        acl_save_libdir="$libdir"
2328        libdir="$found_dir"
2329        eval flag=\"$hardcode_libdir_flag_spec\"
2330        libdir="$acl_save_libdir"
2331        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
2332      done
2333    fi
2334  fi
2335  if test "X$ltrpathdirs" != "X"; then
2336    dnl When using libtool, the option that works for both libraries and
2337    dnl executables is -R. The -R options are cumulative.
2338    for found_dir in $ltrpathdirs; do
2339      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
2340    done
2341  fi
2342])
2343
2344dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
2345dnl unless already present in VAR.
2346dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
2347dnl contains two or three consecutive elements that belong together.
2348AC_DEFUN([AC_LIB_APPENDTOVAR],
2349[
2350  for element in [$2]; do
2351    haveit=
2352    for x in $[$1]; do
2353      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2354      if test "X$x" = "X$element"; then
2355        haveit=yes
2356        break
2357      fi
2358    done
2359    if test -z "$haveit"; then
2360      [$1]="${[$1]}${[$1]:+ }$element"
2361    fi
2362  done
2363])
2364
2365# lib-ld.m4 serial 1 (gettext-0.11)
2366dnl Copyright (C) 1996-2002 Free Software Foundation, Inc.
2367dnl This file is free software, distributed under the terms of the GNU
2368dnl General Public License.  As a special exception to the GNU General
2369dnl Public License, this file may be distributed as part of a program
2370dnl that contains a configuration script generated by Autoconf, under
2371dnl the same distribution terms as the rest of that program.
2372
2373dnl Subroutines of libtool.m4,
2374dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
2375dnl with libtool.m4.
2376
2377dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
2378AC_DEFUN([AC_LIB_PROG_LD_GNU],
2379[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
2380[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
2381if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
2382  acl_cv_prog_gnu_ld=yes
2383else
2384  acl_cv_prog_gnu_ld=no
2385fi])
2386with_gnu_ld=$acl_cv_prog_gnu_ld
2387])
2388
2389dnl From libtool-1.4. Sets the variable LD.
2390AC_DEFUN([AC_LIB_PROG_LD],
2391[AC_ARG_WITH(gnu-ld,
2392[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
2393test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
2394AC_REQUIRE([AC_PROG_CC])dnl
2395AC_REQUIRE([AC_CANONICAL_HOST])dnl
2396ac_prog=ld
2397if test "$GCC" = yes; then
2398  # Check if gcc -print-prog-name=ld gives a path.
2399  AC_MSG_CHECKING([for ld used by GCC])
2400  case $host in
2401  *-*-mingw*)
2402    # gcc leaves a trailing carriage return which upsets mingw
2403    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
2404  *)
2405    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
2406  esac
2407  case $ac_prog in
2408    # Accept absolute paths.
2409    [[\\/]* | [A-Za-z]:[\\/]*)]
2410      [re_direlt='/[^/][^/]*/\.\./']
2411      # Canonicalize the path of ld
2412      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
2413      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
2414	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
2415      done
2416      test -z "$LD" && LD="$ac_prog"
2417      ;;
2418  "")
2419    # If it fails, then pretend we aren't using GCC.
2420    ac_prog=ld
2421    ;;
2422  *)
2423    # If it is relative, then search for the first ld in PATH.
2424    with_gnu_ld=unknown
2425    ;;
2426  esac
2427elif test "$with_gnu_ld" = yes; then
2428  AC_MSG_CHECKING([for GNU ld])
2429else
2430  AC_MSG_CHECKING([for non-GNU ld])
2431fi
2432AC_CACHE_VAL(acl_cv_path_LD,
2433[if test -z "$LD"; then
2434  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
2435  for ac_dir in $PATH; do
2436    test -z "$ac_dir" && ac_dir=.
2437    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
2438      acl_cv_path_LD="$ac_dir/$ac_prog"
2439      # Check to see if the program is GNU ld.  I'd rather use --version,
2440      # but apparently some GNU ld's only accept -v.
2441      # Break only if it was the GNU/non-GNU ld that we prefer.
2442      if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
2443	test "$with_gnu_ld" != no && break
2444      else
2445	test "$with_gnu_ld" != yes && break
2446      fi
2447    fi
2448  done
2449  IFS="$ac_save_ifs"
2450else
2451  acl_cv_path_LD="$LD" # Let the user override the test with a path.
2452fi])
2453LD="$acl_cv_path_LD"
2454if test -n "$LD"; then
2455  AC_MSG_RESULT($LD)
2456else
2457  AC_MSG_RESULT(no)
2458fi
2459test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
2460AC_LIB_PROG_LD_GNU
2461])
2462
2463# iconv.m4 serial AM3 (gettext-0.11)
2464dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
2465dnl This file is free software, distributed under the terms of the GNU
2466dnl General Public License.  As a special exception to the GNU General
2467dnl Public License, this file may be distributed as part of a program
2468dnl that contains a configuration script generated by Autoconf, under
2469dnl the same distribution terms as the rest of that program.
2470
2471dnl From Bruno Haible.
2472
2473AC_DEFUN([AM_ICONV_LINK],
2474[
2475  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
2476  dnl those with the standalone portable GNU libiconv installed).
2477
2478  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
2479  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2480  AC_REQUIRE([AC_LIB_RPATH])
2481
2482  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
2483  dnl accordingly.
2484  AC_LIB_LINKFLAGS_BODY([iconv])
2485
2486  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
2487  dnl because if the user has installed libiconv and not disabled its use
2488  dnl via --without-libiconv-prefix, he wants to use it. The first
2489  dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
2490  am_save_CPPFLAGS="$CPPFLAGS"
2491  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
2492
2493  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
2494    am_cv_func_iconv="no, consider installing GNU libiconv"
2495    am_cv_lib_iconv=no
2496    AC_TRY_LINK([#include <stdlib.h>
2497#include <iconv.h>],
2498      [iconv_t cd = iconv_open("","");
2499       iconv(cd,NULL,NULL,NULL,NULL);
2500       iconv_close(cd);],
2501      am_cv_func_iconv=yes)
2502    if test "$am_cv_func_iconv" != yes; then
2503      am_save_LIBS="$LIBS"
2504      LIBS="$LIBS $LIBICONV"
2505      AC_TRY_LINK([#include <stdlib.h>
2506#include <iconv.h>],
2507        [iconv_t cd = iconv_open("","");
2508         iconv(cd,NULL,NULL,NULL,NULL);
2509         iconv_close(cd);],
2510        am_cv_lib_iconv=yes
2511        am_cv_func_iconv=yes)
2512      LIBS="$am_save_LIBS"
2513    fi
2514  ])
2515  if test "$am_cv_func_iconv" = yes; then
2516    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
2517  fi
2518  if test "$am_cv_lib_iconv" = yes; then
2519    AC_MSG_CHECKING([how to link with libiconv])
2520    AC_MSG_RESULT([$LIBICONV])
2521  else
2522    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
2523    dnl either.
2524    CPPFLAGS="$am_save_CPPFLAGS"
2525    LIBICONV=
2526    LTLIBICONV=
2527  fi
2528  AC_SUBST(LIBICONV)
2529  AC_SUBST(LTLIBICONV)
2530])
2531
2532AC_DEFUN([AM_ICONV],
2533[
2534  AC_REQUIRE([AM_ICONV_LINK])
2535  if test "$am_cv_func_iconv" = yes; then
2536    AC_MSG_CHECKING([for iconv declaration])
2537    AC_CACHE_VAL(am_cv_proto_iconv, [
2538      AC_TRY_COMPILE([
2539#include <stdlib.h>
2540#include <iconv.h>
2541extern
2542#ifdef __cplusplus
2543"C"
2544#endif
2545#if defined(__STDC__) || defined(__cplusplus)
2546size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
2547#else
2548size_t iconv();
2549#endif
2550], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
2551      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);"])
2552    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
2553    AC_MSG_RESULT([$]{ac_t:-
2554         }[$]am_cv_proto_iconv)
2555    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
2556      [Define as const if the declaration of iconv() needs const.])
2557  fi
2558])
2559
2560# progtest.m4 serial 2 (gettext-0.10.40)
2561dnl Copyright (C) 1996-2002 Free Software Foundation, Inc.
2562dnl This file is free software, distributed under the terms of the GNU
2563dnl General Public License.  As a special exception to the GNU General
2564dnl Public License, this file may be distributed as part of a program
2565dnl that contains a configuration script generated by Autoconf, under
2566dnl the same distribution terms as the rest of that program.
2567dnl
2568dnl This file can can be used in projects which are not available under
2569dnl the GNU General Public License or the GNU Library General Public
2570dnl License but which still want to provide support for the GNU gettext
2571dnl functionality.
2572dnl Please note that the actual code of the GNU gettext library is covered
2573dnl by the GNU Library General Public License, and the rest of the GNU
2574dnl gettext package package is covered by the GNU General Public License.
2575dnl They are *not* in the public domain.
2576
2577dnl Authors:
2578dnl   Ulrich Drepper <drepper@cygnus.com>, 1996.
2579
2580# Search path for a program which passes the given test.
2581
2582dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
2583dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
2584AC_DEFUN([AM_PATH_PROG_WITH_TEST],
2585[# Extract the first word of "$2", so it can be a program name with args.
2586set dummy $2; ac_word=[$]2
2587AC_MSG_CHECKING([for $ac_word])
2588AC_CACHE_VAL(ac_cv_path_$1,
2589[case "[$]$1" in
2590  /*)
2591  ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
2592  ;;
2593  *)
2594  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
2595  for ac_dir in ifelse([$5], , $PATH, [$5]); do
2596    test -z "$ac_dir" && ac_dir=.
2597    if test -f $ac_dir/$ac_word; then
2598      if [$3]; then
2599	ac_cv_path_$1="$ac_dir/$ac_word"
2600	break
2601      fi
2602    fi
2603  done
2604  IFS="$ac_save_ifs"
2605dnl If no 4th arg is given, leave the cache variable unset,
2606dnl so AC_PATH_PROGS will keep looking.
2607ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
2608])dnl
2609  ;;
2610esac])dnl
2611$1="$ac_cv_path_$1"
2612if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
2613  AC_MSG_RESULT([$]$1)
2614else
2615  AC_MSG_RESULT(no)
2616fi
2617AC_SUBST($1)dnl
2618])
2619
2620# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
2621dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
2622dnl This file is free software, distributed under the terms of the GNU
2623dnl General Public License.  As a special exception to the GNU General
2624dnl Public License, this file may be distributed as part of a program
2625dnl that contains a configuration script generated by Autoconf, under
2626dnl the same distribution terms as the rest of that program.
2627
2628# Test for the GNU C Library, version 2.1 or newer.
2629# From Bruno Haible.
2630
2631AC_DEFUN([jm_GLIBC21],
2632  [
2633    AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
2634      ac_cv_gnu_library_2_1,
2635      [AC_EGREP_CPP([Lucky GNU user],
2636	[
2637#include <features.h>
2638#ifdef __GNU_LIBRARY__
2639 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
2640  Lucky GNU user
2641 #endif
2642#endif
2643	],
2644	ac_cv_gnu_library_2_1=yes,
2645	ac_cv_gnu_library_2_1=no)
2646      ]
2647    )
2648    AC_SUBST(GLIBC21)
2649    GLIBC21="$ac_cv_gnu_library_2_1"
2650  ]
2651)
2652
2653# codeset.m4 serial AM1 (gettext-0.10.40)
2654dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
2655dnl This file is free software, distributed under the terms of the GNU
2656dnl General Public License.  As a special exception to the GNU General
2657dnl Public License, this file may be distributed as part of a program
2658dnl that contains a configuration script generated by Autoconf, under
2659dnl the same distribution terms as the rest of that program.
2660
2661dnl From Bruno Haible.
2662
2663AC_DEFUN([AM_LANGINFO_CODESET],
2664[
2665  AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
2666    [AC_TRY_LINK([#include <langinfo.h>],
2667      [char* cs = nl_langinfo(CODESET);],
2668      am_cv_langinfo_codeset=yes,
2669      am_cv_langinfo_codeset=no)
2670    ])
2671  if test $am_cv_langinfo_codeset = yes; then
2672    AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
2673      [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
2674  fi
2675])
2676
2677# lcmessage.m4 serial 2 (gettext-0.10.40)
2678dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
2679dnl This file is free software, distributed under the terms of the GNU
2680dnl General Public License.  As a special exception to the GNU General
2681dnl Public License, this file may be distributed as part of a program
2682dnl that contains a configuration script generated by Autoconf, under
2683dnl the same distribution terms as the rest of that program.
2684dnl
2685dnl This file can can be used in projects which are not available under
2686dnl the GNU General Public License or the GNU Library General Public
2687dnl License but which still want to provide support for the GNU gettext
2688dnl functionality.
2689dnl Please note that the actual code of the GNU gettext library is covered
2690dnl by the GNU Library General Public License, and the rest of the GNU
2691dnl gettext package package is covered by the GNU General Public License.
2692dnl They are *not* in the public domain.
2693
2694dnl Authors:
2695dnl   Ulrich Drepper <drepper@cygnus.com>, 1995.
2696
2697# Check whether LC_MESSAGES is available in <locale.h>.
2698
2699AC_DEFUN([AM_LC_MESSAGES],
2700  [if test $ac_cv_header_locale_h = yes; then
2701    AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
2702      [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2703       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
2704    if test $am_cv_val_LC_MESSAGES = yes; then
2705      AC_DEFINE(HAVE_LC_MESSAGES, 1,
2706        [Define if your <locale.h> file defines LC_MESSAGES.])
2707    fi
2708  fi])
2709
2710#serial 5
2711
2712dnl From Paul Eggert.
2713
2714# Define ST_MTIM_NSEC to be the nanoseconds member of struct stat's st_mtim,
2715# if it exists.
2716
2717AC_DEFUN([AC_STRUCT_ST_MTIM_NSEC],
2718 [AC_CACHE_CHECK([for nanoseconds member of struct stat.st_mtim],
2719   ac_cv_struct_st_mtim_nsec,
2720   [ac_save_CPPFLAGS="$CPPFLAGS"
2721    ac_cv_struct_st_mtim_nsec=no
2722    # tv_nsec -- the usual case
2723    # _tv_nsec -- Solaris 2.6, if
2724    #	(defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1
2725    #	 && !defined __EXTENSIONS__)
2726    # st__tim.tv_nsec -- UnixWare 2.1.2
2727    for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do
2728      CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val"
2729      AC_TRY_COMPILE([#include <sys/types.h>
2730#include <sys/stat.h>], [struct stat s; s.st_mtim.ST_MTIM_NSEC;],
2731        [ac_cv_struct_st_mtim_nsec=$ac_val; break])
2732    done
2733    CPPFLAGS="$ac_save_CPPFLAGS"])
2734
2735  if test $ac_cv_struct_st_mtim_nsec != no; then
2736    AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec,
2737      [Define to be the nanoseconds member of struct stat's st_mtim,
2738   if it exists.])
2739  fi
2740 ]
2741)
2742
2743#serial 7 -*- autoconf -*-
2744
2745dnl From Jim Meyering.
2746dnl
2747dnl See if the glibc *_unlocked I/O macros are available.
2748dnl Use only those *_unlocked macros that are declared.
2749dnl
2750
2751AC_DEFUN([jm_FUNC_GLIBC_UNLOCKED_IO],
2752  [AC_CHECK_DECLS(
2753     [clearerr_unlocked, feof_unlocked, ferror_unlocked,
2754      fflush_unlocked, fgets_unlocked, fputc_unlocked, fputs_unlocked,
2755      fread_unlocked, fwrite_unlocked, getc_unlocked,
2756      getchar_unlocked, putc_unlocked, putchar_unlocked])])
2757
2758#serial 17
2759
2760dnl This macro is intended to be used solely in this file.
2761dnl These are the prerequisite macros for GNU's strftime.c replacement.
2762AC_DEFUN([_jm_STRFTIME_PREREQS],
2763[
2764 dnl strftime.c uses localtime_r and the underyling system strftime
2765 dnl if they exist.
2766 AC_CHECK_FUNCS(localtime_r strftime)
2767
2768 AC_CHECK_HEADERS(limits.h)
2769 AC_CHECK_FUNCS(bcopy tzset mempcpy memcpy memset)
2770
2771 # This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE.
2772 AC_STRUCT_TIMEZONE
2773
2774 AC_CHECK_FUNCS(mblen mbrlen)
2775
2776 AC_CHECK_MEMBER([struct tm.tm_gmtoff],
2777                 [AC_DEFINE(HAVE_TM_GMTOFF, 1,
2778                            [Define if struct tm has the tm_gmtoff member.])],
2779                 ,
2780                 [#include <time.h>])
2781])
2782
2783dnl From Jim Meyering.
2784dnl
2785AC_DEFUN([jm_FUNC_GNU_STRFTIME],
2786[AC_REQUIRE([AC_HEADER_TIME])dnl
2787
2788 _jm_STRFTIME_PREREQS
2789
2790 AC_REQUIRE([AC_C_CONST])dnl
2791 AC_REQUIRE([AC_HEADER_STDC])dnl
2792 AC_CHECK_HEADERS(sys/time.h)
2793 AC_DEFINE([my_strftime], [nstrftime],
2794   [Define to the name of the strftime replacement function.])
2795])
2796
2797AC_DEFUN([jm_FUNC_STRFTIME],
2798[
2799  _jm_STRFTIME_PREREQS
2800])
2801
2802#serial 5
2803
2804dnl From Jim Meyering.
2805dnl Determine whether malloc accepts 0 as its argument.
2806dnl If it doesn't, arrange to use the replacement function.
2807dnl
2808
2809AC_DEFUN([jm_FUNC_MALLOC],
2810[
2811 dnl xmalloc.c requires that this symbol be defined so it doesn't
2812 dnl mistakenly use a broken malloc -- as it might if this test were omitted.
2813 AC_DEFINE(HAVE_DONE_WORKING_MALLOC_CHECK, 1,
2814           [Define if the malloc check has been performed. ])
2815
2816 AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc,
2817  [AC_TRY_RUN([
2818    char *malloc ();
2819    int
2820    main ()
2821    {
2822      exit (malloc (0) ? 0 : 1);
2823    }
2824	  ],
2825	 jm_cv_func_working_malloc=yes,
2826	 jm_cv_func_working_malloc=no,
2827	 dnl When crosscompiling, assume malloc is broken.
2828	 jm_cv_func_working_malloc=no)
2829  ])
2830  if test $jm_cv_func_working_malloc = no; then
2831    AC_LIBOBJ(malloc)
2832    AC_DEFINE(malloc, rpl_malloc,
2833      [Define to rpl_malloc if the replacement function should be used.])
2834  fi
2835])
2836
2837#serial 5
2838
2839dnl From Jim Meyering.
2840dnl Determine whether realloc works when both arguments are 0.
2841dnl If it doesn't, arrange to use the replacement function.
2842dnl
2843
2844AC_DEFUN([jm_FUNC_REALLOC],
2845[
2846 dnl xmalloc.c requires that this symbol be defined so it doesn't
2847 dnl mistakenly use a broken realloc -- as it might if this test were omitted.
2848 AC_DEFINE(HAVE_DONE_WORKING_REALLOC_CHECK, 1,
2849           [Define if the realloc check has been performed. ])
2850
2851 AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc,
2852  [AC_TRY_RUN([
2853    char *realloc ();
2854    int
2855    main ()
2856    {
2857      exit (realloc (0, 0) ? 0 : 1);
2858    }
2859	  ],
2860	 jm_cv_func_working_realloc=yes,
2861	 jm_cv_func_working_realloc=no,
2862	 dnl When crosscompiling, assume realloc is broken.
2863	 jm_cv_func_working_realloc=no)
2864  ])
2865  if test $jm_cv_func_working_realloc = no; then
2866    AC_LIBOBJ(realloc)
2867    AC_DEFINE(realloc, rpl_realloc,
2868      [Define to rpl_realloc if the replacement function should be used.])
2869  fi
2870])
2871
2872# Check prerequisites for compiling lib/c-stack.c.
2873
2874# Copyright (C) 2002 Free Software Foundation, Inc.
2875
2876# This program is free software; you can redistribute it and/or modify
2877# it under the terms of the GNU General Public License as published by
2878# the Free Software Foundation; either version 2, or (at your option)
2879# any later version.
2880
2881# This program is distributed in the hope that it will be useful,
2882# but WITHOUT ANY WARRANTY; without even the implied warranty of
2883# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2884# GNU General Public License for more details.
2885
2886# You should have received a copy of the GNU General Public License
2887# along with this program; if not, write to the Free Software
2888# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2889# 02111-1307, USA.
2890
2891AC_DEFUN([AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC],
2892  [# for STACK_DIRECTION
2893   AC_REQUIRE([AC_FUNC_ALLOCA])
2894
2895   AC_CACHE_CHECK([for working C stack overflow detection],
2896     ac_cv_sys_xsi_stack_overflow_heuristic,
2897     [AC_TRY_RUN(
2898	[
2899	 #include <signal.h>
2900	 #include <ucontext.h>
2901
2902	 static union
2903	 {
2904	   char buffer[SIGSTKSZ];
2905	   long double ld;
2906	   uintmax_t u;
2907	   void *p;
2908	 } alternate_signal_stack;
2909
2910	 #if STACK_DIRECTION
2911	 # define find_stack_direction(ptr) STACK_DIRECTION
2912	 #else
2913	 static int
2914	 find_stack_direction (char const *addr)
2915	 {
2916	   char dummy;
2917	   return (! addr ? find_stack_direction (&dummy)
2918		   : addr < &dummy ? 1 : -1);
2919	 }
2920	 #endif
2921
2922	 static void
2923	 segv_handler (int signo, siginfo_t *info, void *context)
2924	 {
2925	   if (0 < info->si_code)
2926	     {
2927	       ucontext_t const *user_context = context;
2928	       char const *stack_min = user_context->uc_stack.ss_sp;
2929	       size_t stack_size = user_context->uc_stack.ss_size;
2930	       char const *faulting_address = info->si_addr;
2931	       size_t s = faulting_address - stack_min;
2932	       size_t page_size = sysconf (_SC_PAGESIZE);
2933	       if (find_stack_direction (0) < 0)
2934		 s += page_size;
2935	       if (s < stack_size + page_size)
2936		 _exit (0);
2937	     }
2938
2939	   _exit (1);
2940	 }
2941
2942	 static int
2943	 c_stack_action (void)
2944	 {
2945	   stack_t st;
2946	   struct sigaction act;
2947	   int r;
2948
2949	   st.ss_flags = 0;
2950	   st.ss_sp = alternate_signal_stack.buffer;
2951	   st.ss_size = sizeof alternate_signal_stack.buffer;
2952	   r = sigaltstack (&st, 0);
2953	   if (r != 0)
2954	     return r;
2955
2956	   sigemptyset (&act.sa_mask);
2957	   act.sa_flags = SA_NODEFER | SA_ONSTACK | SA_RESETHAND | SA_SIGINFO;
2958	   act.sa_sigaction = segv_handler;
2959	   return sigaction (SIGSEGV, &act, 0);
2960	 }
2961
2962	 static int
2963	 recurse (char *p)
2964	 {
2965	   char array[500];
2966	   array[0] = 1;
2967	   return *p + recurse (array);
2968	 }
2969
2970	 int
2971	 main (void)
2972	 {
2973	   c_stack_action ();
2974	   return recurse ("\1");
2975	 }
2976	],
2977	[ac_cv_sys_xsi_stack_overflow_heuristic=yes],
2978	[ac_cv_sys_xsi_stack_overflow_heuristic=no],
2979	[ac_cv_sys_xsi_stack_overflow_heuristic=cross-compiling])])
2980
2981   if test $ac_cv_sys_xsi_stack_overflow_heuristic = yes; then
2982     AC_DEFINE(HAVE_XSI_STACK_OVERFLOW_HEURISTIC, 1,
2983       [Define to 1 if extending the stack slightly past the limit causes
2984	a SIGSEGV, and an alternate stack can be established with sigaltstack,
2985	and the signal handler is passed a context that specifies the
2986	run time stack.  This behavior is defined by POSIX 1003.1-2001
2987        with the X/Open System Interface (XSI) option
2988	and is a standardized way to implement a SEGV-based stack
2989        overflow detection heuristic.])
2990   fi])
2991
2992
2993AC_DEFUN([jm_PREREQ_C_STACK],
2994  [AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
2995   AC_REQUIRE([AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC])
2996
2997   # for STACK_DIRECTION
2998   AC_REQUIRE([AC_FUNC_ALLOCA])
2999
3000   AC_CHECK_HEADERS(unistd.h)
3001
3002   AC_CHECK_TYPES([siginfo_t, stack_t], , , [#include <signal.h>])])
3003
3004#serial 4
3005
3006dnl FIXME: put these prerequisite-only *.m4 files in a separate
3007dnl directory -- otherwise, they'll conflict with existing files.
3008
3009dnl These are the prerequisite macros for GNU's error.c file.
3010AC_DEFUN([jm_PREREQ_ERROR],
3011[
3012  AC_CHECK_FUNCS(strerror vprintf doprnt)
3013  AC_CHECK_DECLS([strerror])
3014  AC_FUNC_STRERROR_R
3015  AC_HEADER_STDC
3016])
3017
3018#serial 22
3019
3020dnl These are the prerequisite macros for files in the lib/
3021dnl directories of the fileutils, sh-utils, and textutils packages.
3022
3023AC_DEFUN([jm_PREREQ],
3024[
3025  jm_PREREQ_ADDEXT
3026  jm_PREREQ_CANON_HOST
3027  jm_PREREQ_DIRNAME
3028  jm_PREREQ_ERROR
3029  jm_PREREQ_EXCLUDE
3030  jm_PREREQ_GETPAGESIZE
3031  jm_PREREQ_HARD_LOCALE
3032  jm_PREREQ_HASH
3033  jm_PREREQ_HUMAN
3034  jm_PREREQ_MBSWIDTH
3035  jm_PREREQ_MEMCHR
3036  jm_PREREQ_PHYSMEM
3037  jm_PREREQ_POSIXVER
3038  jm_PREREQ_QUOTEARG
3039  jm_PREREQ_READUTMP
3040  jm_PREREQ_REGEX
3041  jm_PREREQ_TEMPNAME # called by mkstemp
3042  jm_PREREQ_XGETCWD
3043  jm_PREREQ_XREADLINK
3044])
3045
3046AC_DEFUN([jm_PREREQ_ADDEXT],
3047[
3048  dnl For addext.c.
3049  AC_SYS_LONG_FILE_NAMES
3050  AC_CHECK_FUNCS(pathconf)
3051  AC_CHECK_HEADERS(limits.h string.h unistd.h)
3052])
3053
3054AC_DEFUN([jm_PREREQ_CANON_HOST],
3055[
3056  dnl Add any libraries as early as possible.
3057  dnl In particular, inet_ntoa needs -lnsl at least on Solaris5.5.1,
3058  dnl so we have to add -lnsl to LIBS before checking for that function.
3059  AC_SEARCH_LIBS(gethostbyname, [inet nsl])
3060
3061  dnl These come from -lnsl on Solaris5.5.1.
3062  AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
3063
3064  AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
3065  AC_CHECK_HEADERS(unistd.h string.h netdb.h sys/socket.h \
3066                   netinet/in.h arpa/inet.h)
3067])
3068
3069AC_DEFUN([jm_PREREQ_DIRNAME],
3070[
3071  AC_HEADER_STDC
3072  AC_CHECK_HEADERS(string.h)
3073])
3074
3075AC_DEFUN([jm_PREREQ_EXCLUDE],
3076[
3077  jm_FUNC_FNMATCH
3078  AC_HEADER_STDBOOL
3079])
3080
3081AC_DEFUN([jm_PREREQ_GETPAGESIZE],
3082[
3083  AC_CHECK_FUNCS(getpagesize)
3084  AC_CHECK_HEADERS(OS.h unistd.h)
3085])
3086
3087AC_DEFUN([jm_PREREQ_HARD_LOCALE],
3088[ 
3089  AC_C_PROTOTYPES
3090  AC_CHECK_FUNCS(setlocale)
3091  AC_CHECK_HEADERS(locale.h stdlib.h string.h)
3092])
3093
3094AC_DEFUN([jm_PREREQ_HASH],
3095[
3096  AC_CHECK_HEADERS(stdlib.h)
3097  AC_HEADER_STDBOOL
3098  AC_REQUIRE([jm_CHECK_DECLS])
3099])
3100
3101# If you use human.c, you need the following files:
3102# inttypes.m4 ulonglong.m4
3103AC_DEFUN([jm_PREREQ_HUMAN],
3104[
3105  AC_CHECK_HEADERS(limits.h stdlib.h string.h)
3106  AC_CHECK_DECLS([getenv])
3107  AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
3108])
3109
3110AC_DEFUN([jm_PREREQ_MEMCHR],
3111[
3112  AC_CHECK_HEADERS(limits.h stdlib.h bp-sym.h)
3113])
3114
3115AC_DEFUN([jm_PREREQ_PHYSMEM],
3116[
3117  AC_CHECK_HEADERS(sys/pstat.h unistd.h)
3118  AC_CHECK_FUNCS(pstat_getstatic pstat_getdynamic)
3119])
3120
3121AC_DEFUN([jm_PREREQ_POSIXVER],
3122[
3123  AC_CHECK_HEADERS(unistd.h)
3124  AC_CHECK_DECLS([getenv])
3125])
3126
3127AC_DEFUN([jm_PREREQ_QUOTEARG],
3128[
3129  AC_CHECK_FUNCS(isascii iswprint)
3130  jm_FUNC_MBRTOWC
3131  AC_CHECK_HEADERS(limits.h stddef.h stdlib.h string.h wchar.h wctype.h)
3132  AC_HEADER_STDC
3133  AC_C_BACKSLASH_A
3134  AC_MBSTATE_T
3135  AM_C_PROTOTYPES
3136])
3137
3138AC_DEFUN([jm_PREREQ_REGEX],
3139[
3140  dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it.
3141  dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary
3142  dnl to get them.
3143  AC_CHECK_FUNCS(bzero bcopy isascii btowc)
3144  AC_CHECK_HEADERS(alloca.h libintl.h wctype.h wchar.h)
3145  AC_HEADER_STDC
3146  AC_FUNC_ALLOCA
3147])
3148
3149AC_DEFUN([jm_PREREQ_TEMPNAME],
3150[
3151  AC_HEADER_STDC
3152  AC_HEADER_STAT
3153  AC_CHECK_HEADERS(fcntl.h sys/time.h stdint.h unistd.h)
3154  AC_CHECK_FUNCS(__secure_getenv gettimeofday)
3155  AC_CHECK_DECLS([getenv])
3156])
3157
3158AC_DEFUN([jm_PREREQ_XGETCWD],
3159[
3160  AC_C_PROTOTYPES
3161  AC_CHECK_HEADERS(limits.h stdlib.h sys/param.h unistd.h)
3162  AC_CHECK_FUNCS(getcwd)
3163  AC_FUNC_GETCWD_NULL
3164])
3165
3166AC_DEFUN([jm_PREREQ_XREADLINK],
3167[
3168  AC_C_PROTOTYPES
3169  AC_CHECK_HEADERS(limits.h stdlib.h sys/types.h unistd.h)
3170])
3171
3172#serial 18
3173
3174dnl This is just a wrapper function to encapsulate this kludge.
3175dnl Putting it in a separate file like this helps share it between
3176dnl different packages.
3177AC_DEFUN([jm_CHECK_DECLS],
3178[
3179  AC_REQUIRE([_jm_DECL_HEADERS])
3180  AC_REQUIRE([AC_HEADER_TIME])
3181  headers='
3182#include <stdio.h>
3183#if HAVE_STRING_H
3184# if !STDC_HEADERS && HAVE_MEMORY_H
3185#  include <memory.h>
3186# endif
3187# include <string.h>
3188#else
3189# if HAVE_STRINGS_H
3190#  include <strings.h>
3191# endif
3192#endif
3193#if HAVE_STDLIB_H
3194# include <stdlib.h>
3195#endif
3196#if HAVE_UNISTD_H
3197# include <unistd.h>
3198#endif
3199
3200#include <sys/types.h>
3201#if TIME_WITH_SYS_TIME
3202# include <sys/time.h>
3203# include <time.h>
3204#else
3205# if HAVE_SYS_TIME_H
3206#  include <sys/time.h>
3207# else
3208#  include <time.h>
3209# endif
3210#endif
3211
3212#if HAVE_UTMP_H
3213# include <utmp.h>
3214#endif
3215
3216#if HAVE_GRP_H
3217# include <grp.h>
3218#endif
3219
3220#if HAVE_PWD_H
3221# include <pwd.h>
3222#endif
3223'
3224
3225  AC_CHECK_DECLS([
3226    free,
3227    getenv,
3228    geteuid,
3229    getgrgid,
3230    getlogin,
3231    getpwuid,
3232    getuid,
3233    getutent,
3234    lseek,
3235    malloc,
3236    memchr,
3237    memrchr,
3238    nanosleep,
3239    realloc,
3240    stpcpy,
3241    strndup,
3242    strnlen,
3243    strstr,
3244    strtoul,
3245    strtoull,
3246    ttyname], , , $headers)
3247])
3248
3249dnl FIXME: when autoconf has support for it.
3250dnl This is a little helper so we can require these header checks.
3251AC_DEFUN([_jm_DECL_HEADERS],
3252[
3253  AC_REQUIRE([AC_HEADER_STDC])
3254  AC_CHECK_HEADERS(grp.h memory.h pwd.h string.h strings.h stdlib.h \
3255                   unistd.h sys/time.h utmp.h utmpx.h)
3256])
3257
3258#serial 4
3259
3260dnl From Paul Eggert
3261
3262AC_DEFUN([jm_FUNC_MBRTOWC],
3263[
3264  AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
3265    jm_cv_func_mbrtowc,
3266    [AC_TRY_LINK(
3267       [#include <wchar.h>],
3268       [mbstate_t state; return ! (sizeof state && mbrtowc);],
3269       jm_cv_func_mbrtowc=yes,
3270       jm_cv_func_mbrtowc=no)])
3271  if test $jm_cv_func_mbrtowc = yes; then
3272    AC_DEFINE(HAVE_MBRTOWC, 1,
3273      [Define to 1 if mbrtowc and mbstate_t are properly declared.])
3274  fi
3275])
3276
3277#serial 4
3278
3279dnl From Paul Eggert.
3280
3281AC_DEFUN([AC_C_BACKSLASH_A],
3282[
3283  AC_CACHE_CHECK([whether backslash-a works in strings], ac_cv_c_backslash_a,
3284   [AC_TRY_COMPILE([],
3285     [
3286#if '\a' == 'a'
3287      syntax error;
3288#endif
3289      char buf['\a' == 'a' ? -1 : 1];
3290      buf[0] = '\a';
3291      return buf[0] != "\a"[0];
3292     ],
3293     ac_cv_c_backslash_a=yes,
3294     ac_cv_c_backslash_a=no)])
3295  if test $ac_cv_c_backslash_a = yes; then
3296    AC_DEFINE(HAVE_C_BACKSLASH_A, 1,
3297      [Define if backslash-a works in C strings.])
3298  fi
3299])
3300
3301# serial 9
3302
3303# From Paul Eggert.
3304
3305# BeOS 5 has <wchar.h> but does not define mbstate_t,
3306# so you can't declare an object of that type.
3307# Check for this incompatibility with Standard C.
3308
3309# Include stdlib.h first, because otherwise this test would fail on Linux
3310# (at least glibc-2.1.3) because the "_XOPEN_SOURCE 500" definition elicits
3311# a syntax error in wchar.h due to the use of undefined __int32_t.
3312
3313AC_DEFUN([AC_MBSTATE_T],
3314  [
3315   AC_CHECK_HEADERS(stdlib.h)
3316
3317   AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t,
3318    [AC_TRY_COMPILE([
3319#if HAVE_STDLIB_H
3320# include <stdlib.h>
3321#endif
3322#include <wchar.h>],
3323      [mbstate_t x; return sizeof x;],
3324      ac_cv_type_mbstate_t=yes,
3325      ac_cv_type_mbstate_t=no)])
3326   if test $ac_cv_type_mbstate_t = no; then
3327     AC_DEFINE(mbstate_t, int,
3328	       [Define to a type if <wchar.h> does not define.])
3329   fi])
3330
3331
3332# Copyright 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
3333
3334# This program is free software; you can redistribute it and/or modify
3335# it under the terms of the GNU General Public License as published by
3336# the Free Software Foundation; either version 2, or (at your option)
3337# any later version.
3338
3339# This program is distributed in the hope that it will be useful,
3340# but WITHOUT ANY WARRANTY; without even the implied warranty of
3341# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3342# GNU General Public License for more details.
3343
3344# You should have received a copy of the GNU General Public License
3345# along with this program; if not, write to the Free Software
3346# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
3347# 02111-1307, USA.
3348
3349# serial 1
3350
3351AC_DEFUN([AM_C_PROTOTYPES],
3352[AC_REQUIRE([AM_PROG_CC_STDC])
3353AC_REQUIRE([AC_PROG_CPP])
3354AC_MSG_CHECKING([for function prototypes])
3355if test "$am_cv_prog_cc_stdc" != no; then
3356  AC_MSG_RESULT(yes)
3357  AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
3358  U= ANSI2KNR=
3359else
3360  AC_MSG_RESULT(no)
3361  U=_ ANSI2KNR=./ansi2knr
3362fi
3363# Ensure some checks needed by ansi2knr itself.
3364AC_HEADER_STDC
3365AC_CHECK_HEADERS(string.h)
3366AC_SUBST(U)dnl
3367AC_SUBST(ANSI2KNR)dnl
3368])
3369
3370#serial 4
3371
3372# autoconf tests required for use of xstrtoumax.c
3373
3374AC_DEFUN([jm_AC_PREREQ_XSTRTOUMAX],
3375[
3376  AC_REQUIRE([jm_AC_TYPE_INTMAX_T])
3377  AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
3378  AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
3379  AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
3380  AC_CHECK_DECLS([strtol, strtoul, strtoull, strtoimax, strtoumax])
3381  AC_CHECK_HEADERS(limits.h stdlib.h inttypes.h)
3382
3383  AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro],
3384    jm_cv_func_strtoumax_macro,
3385    AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include <inttypes.h>
3386#ifdef strtoumax
3387 inttypes_h_defines_strtoumax
3388#endif],
3389      jm_cv_func_strtoumax_macro=yes,
3390      jm_cv_func_strtoumax_macro=no))
3391
3392  if test "$jm_cv_func_strtoumax_macro" != yes; then
3393    AC_REPLACE_FUNCS(strtoumax)
3394  fi
3395
3396  dnl Only the replacement strtoumax invokes strtoul and strtoull,
3397  dnl so we need the replacements only if strtoumax does not exist.
3398  case "$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in
3399    no,no)
3400      AC_REPLACE_FUNCS(strtoul)
3401
3402      dnl We don't need (and can't compile) the replacement strtoull
3403      dnl unless the type `unsigned long long' exists.
3404      if test "$ac_cv_type_unsigned_long_long" = yes; then
3405	AC_REPLACE_FUNCS(strtoull)
3406      fi
3407      ;;
3408  esac
3409])
3410
3411# Check for fnmatch.
3412
3413# This is a modified version of autoconf's AC_FUNC_FNMATCH;
3414# it also checks for FNM_CASEFOLD or FNM_IGNORECASE.
3415
3416# Copyright (C) 2000, 2001 Free Software Foundation, Inc.
3417
3418# This program is free software; you can redistribute it and/or modify
3419# it under the terms of the GNU General Public License as published by
3420# the Free Software Foundation; either version 2, or (at your option)
3421# any later version.
3422
3423# This program is distributed in the hope that it will be useful,
3424# but WITHOUT ANY WARRANTY; without even the implied warranty of
3425# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3426# GNU General Public License for more details.
3427
3428# You should have received a copy of the GNU General Public License
3429# along with this program; if not, write to the Free Software
3430# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
3431# 02111-1307, USA.
3432
3433# AC_FUNC_FNMATCH
3434# ---------------
3435# We look for fnmatch.h to avoid that the test fails in C++.
3436AC_DEFUN([AC_FUNC_FNMATCH],
3437[AC_CACHE_CHECK([for working GNU-style fnmatch],
3438                [ac_cv_func_fnmatch_works],
3439# Some versions of Solaris, SCO, and the GNU C Library
3440# have a broken or incompatible fnmatch.
3441# So we run a test program.  If we are cross-compiling, take no chance.
3442# Thanks to John Oleynick, Franc,ois Pinard, and Paul Eggert for this test.
3443[AC_RUN_IFELSE([AC_LANG_PROGRAM([@%:@include <fnmatch.h>],
3444 [exit (fnmatch ("a*", "abc", 0) != 0
3445	|| fnmatch ("xxXX", "xXxX", FNM_CASEFOLD) != 0
3446	|| fnmatch ("d*/*1", "d/s/1", FNM_FILE_NAME) != FNM_NOMATCH
3447	|| fnmatch ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR) != 0
3448	|| fnmatch ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR) != 0
3449	|| fnmatch ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR) != 0);])],
3450               [ac_cv_func_fnmatch_works=yes],
3451               [ac_cv_func_fnmatch_works=no],
3452               [ac_cv_func_fnmatch_works=no])])
3453if test $ac_cv_func_fnmatch_works = yes; then
3454  AC_DEFINE(HAVE_FNMATCH, 1,
3455            [Define to 1 if your system has a working `fnmatch' function.])
3456fi
3457])# AC_FUNC_FNMATCH
3458
3459#serial 12
3460
3461dnl Initially derived from code in GNU grep.
3462dnl Mostly written by Jim Meyering.
3463
3464dnl Usage: jm_INCLUDED_REGEX([lib/regex.c])
3465dnl
3466AC_DEFUN([jm_INCLUDED_REGEX],
3467  [
3468    dnl Even packages that don't use regex.c can use this macro.
3469    dnl Of course, for them it doesn't do anything.
3470
3471    # Assume we'll default to using the included regex.c.
3472    ac_use_included_regex=yes
3473
3474    # However, if the system regex support is good enough that it passes the
3475    # the following run test, then default to *not* using the included regex.c.
3476    # If cross compiling, assume the test would fail and use the included
3477    # regex.c.  The first failing regular expression is from `Spencer ere
3478    # test #75' in grep-2.3.
3479    AC_CACHE_CHECK([for working re_compile_pattern],
3480		   jm_cv_func_working_re_compile_pattern,
3481      AC_TRY_RUN(
3482[#include <stdio.h>
3483#include <regex.h>
3484	  int
3485	  main ()
3486	  {
3487	    static struct re_pattern_buffer regex;
3488	    const char *s;
3489	    struct re_registers regs;
3490	    re_set_syntax (RE_SYNTAX_POSIX_EGREP);
3491	    [s = re_compile_pattern ("a[[:@:>@:]]b\n", 9, &regex);]
3492	    /* This should fail with _Invalid character class name_ error.  */
3493	    if (!s)
3494	      exit (1);
3495
3496	    /* This should succeed, but doesn't for e.g. glibc-2.1.3.  */
3497	    s = re_compile_pattern ("{1", 2, &regex);
3498
3499	    if (s)
3500	      exit (1);
3501
3502	    /* The following example is derived from a problem report
3503               against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>.  */
3504	    s = re_compile_pattern ("[[an�]]*n", 7, &regex);
3505	    if (s)
3506	      exit (1);
3507
3508	    /* This should match, but doesn't for e.g. glibc-2.2.1.  */
3509	    if (re_match (&regex, "an", 2, 0, &regs) != 2)
3510	      exit (1);
3511
3512	    exit (0);
3513	  }
3514	],
3515	       jm_cv_func_working_re_compile_pattern=yes,
3516	       jm_cv_func_working_re_compile_pattern=no,
3517	       dnl When crosscompiling, assume it's broken.
3518	       jm_cv_func_working_re_compile_pattern=no))
3519    if test $jm_cv_func_working_re_compile_pattern = yes; then
3520      ac_use_included_regex=no
3521    fi
3522
3523    test -n "$1" || AC_MSG_ERROR([missing argument])
3524    m4_syscmd([test -f $1])
3525    ifelse(m4_sysval, 0,
3526      [
3527	AC_ARG_WITH(included-regex,
3528	[  --without-included-regex don't compile regex; this is the default on
3529                          systems with version 2 of the GNU C library
3530                          (use with caution on other system)],
3531		    jm_with_regex=$withval,
3532		    jm_with_regex=$ac_use_included_regex)
3533	if test "$jm_with_regex" = yes; then
3534	  AC_LIBOBJ(regex)
3535	fi
3536      ],
3537    )
3538  ]
3539)
3540
3541#serial 5
3542
3543# Define some macros required for proper operation of code in lib/*.c
3544# on MSDOS/Windows systems.
3545
3546# From Jim Meyering.
3547
3548AC_DEFUN([jm_AC_DOS],
3549  [
3550    AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos],
3551      [
3552        AC_TRY_COMPILE([],
3553        [#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__
3554neither MSDOS nor Windows
3555#endif],
3556        [ac_cv_win_or_dos=yes],
3557        [ac_cv_win_or_dos=no])
3558      ])
3559
3560    if test x"$ac_cv_win_or_dos" = xyes; then
3561      ac_fs_accepts_drive_letter_prefix=1
3562      ac_fs_backslash_is_file_name_separator=1
3563    else
3564      ac_fs_accepts_drive_letter_prefix=0
3565      ac_fs_backslash_is_file_name_separator=0
3566    fi
3567
3568    AH_VERBATIM(FILESYSTEM_PREFIX_LEN,
3569    [#if FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
3570# define FILESYSTEM_PREFIX_LEN(Filename) \
3571  ((Filename)[0] && (Filename)[1] == ':' ? 2 : 0)
3572#else
3573# define FILESYSTEM_PREFIX_LEN(Filename) 0
3574#endif])
3575
3576    AC_DEFINE_UNQUOTED([FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
3577      $ac_fs_accepts_drive_letter_prefix,
3578      [Define on systems for which file names may have a so-called
3579       `drive letter' prefix, define this to compute the length of that
3580       prefix, including the colon.])
3581
3582    AH_VERBATIM(ISSLASH,
3583    [#if FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
3584# define ISSLASH(C) ((C) == '/' || (C) == '\\')
3585#else
3586# define ISSLASH(C) ((C) == '/')
3587#endif])
3588
3589    AC_DEFINE_UNQUOTED([FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR],
3590      $ac_fs_backslash_is_file_name_separator,
3591      [Define if the backslash character may also serve as a file name
3592       component separator.])
3593  ])
3594
3595# Check for setmode, DOS style.
3596
3597# Copyright (C) 2001, 2002 Free Software Foundation, Inc.
3598
3599# This program is free software; you can redistribute it and/or modify
3600# it under the terms of the GNU General Public License as published by
3601# the Free Software Foundation; either version 2, or (at your option)
3602# any later version.
3603
3604# This program is distributed in the hope that it will be useful,
3605# but WITHOUT ANY WARRANTY; without even the implied warranty of
3606# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3607# GNU General Public License for more details.
3608
3609# You should have received a copy of the GNU General Public License
3610# along with this program; if not, write to the Free Software
3611# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
3612# 02111-1307, USA.
3613
3614AC_DEFUN([AC_FUNC_SETMODE_DOS],
3615  [AC_CHECK_HEADERS(fcntl.h unistd.h)
3616   AC_CACHE_CHECK([for DOS-style setmode],
3617     [ac_cv_func_setmode_dos],
3618     [AC_TRY_LINK(
3619	[#include <io.h>
3620	 #if HAVE_FCNTL_H
3621	 # include <fcntl.h>
3622	 #endif
3623	 #if HAVE_UNISTD_H
3624	 # include <unistd.h>
3625	 #endif],
3626	[int ret = setmode && setmode (1, O_BINARY);],
3627	[ac_cv_func_setmode_dos=yes],
3628	[ac_cv_func_setmode_dos=no])])
3629   if test $ac_cv_func_setmode_dos = yes; then
3630     AC_DEFINE(HAVE_SETMODE_DOS, 1,
3631       [Define to 1 if you have the DOS-style `setmode' function.])
3632   fi])
3633
3634