.
[platform/upstream/coreutils.git] / aclocal.m4
1 # generated automatically by aclocal 1.7.6 -*- Autoconf -*-
2
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
4 # Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 # Do all the work for Automake.                            -*- Autoconf -*-
15
16 # This macro actually does too much some checks are only needed if
17 # your package does certain things.  But this isn't really a big deal.
18
19 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
20 # Free Software Foundation, Inc.
21
22 # This program is free software; you can redistribute it and/or modify
23 # it under the terms of the GNU General Public License as published by
24 # the Free Software Foundation; either version 2, or (at your option)
25 # any later version.
26
27 # This program is distributed in the hope that it will be useful,
28 # but WITHOUT ANY WARRANTY; without even the implied warranty of
29 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30 # GNU General Public License for more details.
31
32 # You should have received a copy of the GNU General Public License
33 # along with this program; if not, write to the Free Software
34 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
35 # 02111-1307, USA.
36
37 # serial 10
38
39 AC_PREREQ([2.54])
40
41 # Autoconf 2.50 wants to disallow AM_ names.  We explicitly allow
42 # the ones we care about.
43 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
44
45 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
46 # AM_INIT_AUTOMAKE([OPTIONS])
47 # -----------------------------------------------
48 # The call with PACKAGE and VERSION arguments is the old style
49 # call (pre autoconf-2.50), which is being phased out.  PACKAGE
50 # and VERSION should now be passed to AC_INIT and removed from
51 # the call to AM_INIT_AUTOMAKE.
52 # We support both call styles for the transition.  After
53 # the next Automake release, Autoconf can make the AC_INIT
54 # arguments mandatory, and then we can depend on a new Autoconf
55 # release and drop the old call support.
56 AC_DEFUN([AM_INIT_AUTOMAKE],
57 [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
58  AC_REQUIRE([AC_PROG_INSTALL])dnl
59 # test to see if srcdir already configured
60 if test "`cd $srcdir && pwd`" != "`pwd`" &&
61    test -f $srcdir/config.status; then
62   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
63 fi
64
65 # test whether we have cygpath
66 if test -z "$CYGPATH_W"; then
67   if (cygpath --version) >/dev/null 2>/dev/null; then
68     CYGPATH_W='cygpath -w'
69   else
70     CYGPATH_W=echo
71   fi
72 fi
73 AC_SUBST([CYGPATH_W])
74
75 # Define the identity of the package.
76 dnl Distinguish between old-style and new-style calls.
77 m4_ifval([$2],
78 [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
79  AC_SUBST([PACKAGE], [$1])dnl
80  AC_SUBST([VERSION], [$2])],
81 [_AM_SET_OPTIONS([$1])dnl
82  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
83  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
84
85 _AM_IF_OPTION([no-define],,
86 [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
87  AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
88
89 # Some tools Automake needs.
90 AC_REQUIRE([AM_SANITY_CHECK])dnl
91 AC_REQUIRE([AC_ARG_PROGRAM])dnl
92 AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
93 AM_MISSING_PROG(AUTOCONF, autoconf)
94 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
95 AM_MISSING_PROG(AUTOHEADER, autoheader)
96 AM_MISSING_PROG(MAKEINFO, makeinfo)
97 AM_MISSING_PROG(AMTAR, tar)
98 AM_PROG_INSTALL_SH
99 AM_PROG_INSTALL_STRIP
100 # We need awk for the "check" target.  The system "awk" is bad on
101 # some platforms.
102 AC_REQUIRE([AC_PROG_AWK])dnl
103 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
104 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
105
106 _AM_IF_OPTION([no-dependencies],,
107 [AC_PROVIDE_IFELSE([AC_PROG_CC],
108                   [_AM_DEPENDENCIES(CC)],
109                   [define([AC_PROG_CC],
110                           defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
111 AC_PROVIDE_IFELSE([AC_PROG_CXX],
112                   [_AM_DEPENDENCIES(CXX)],
113                   [define([AC_PROG_CXX],
114                           defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
115 ])
116 ])
117
118
119 # When config.status generates a header, we must update the stamp-h file.
120 # This file resides in the same directory as the config header
121 # that is generated.  The stamp files are numbered to have different names.
122
123 # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
124 # loop where config.status creates the headers, so we can generate
125 # our stamp files there.
126 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
127 [# Compute $1's index in $config_headers.
128 _am_stamp_count=1
129 for _am_header in $config_headers :; do
130   case $_am_header in
131     $1 | $1:* )
132       break ;;
133     * )
134       _am_stamp_count=`expr $_am_stamp_count + 1` ;;
135   esac
136 done
137 echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
138
139 # Copyright 2002  Free Software Foundation, Inc.
140
141 # This program is free software; you can redistribute it and/or modify
142 # it under the terms of the GNU General Public License as published by
143 # the Free Software Foundation; either version 2, or (at your option)
144 # any later version.
145
146 # This program is distributed in the hope that it will be useful,
147 # but WITHOUT ANY WARRANTY; without even the implied warranty of
148 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
149 # GNU General Public License for more details.
150
151 # You should have received a copy of the GNU General Public License
152 # along with this program; if not, write to the Free Software
153 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
154
155 # AM_AUTOMAKE_VERSION(VERSION)
156 # ----------------------------
157 # Automake X.Y traces this macro to ensure aclocal.m4 has been
158 # generated from the m4 files accompanying Automake X.Y.
159 AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"])
160
161 # AM_SET_CURRENT_AUTOMAKE_VERSION
162 # -------------------------------
163 # Call AM_AUTOMAKE_VERSION so it can be traced.
164 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
165 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
166          [AM_AUTOMAKE_VERSION([1.7.6])])
167
168 # Helper functions for option handling.                    -*- Autoconf -*-
169
170 # Copyright 2001, 2002  Free Software Foundation, Inc.
171
172 # This program is free software; you can redistribute it and/or modify
173 # it under the terms of the GNU General Public License as published by
174 # the Free Software Foundation; either version 2, or (at your option)
175 # any later version.
176
177 # This program is distributed in the hope that it will be useful,
178 # but WITHOUT ANY WARRANTY; without even the implied warranty of
179 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
180 # GNU General Public License for more details.
181
182 # You should have received a copy of the GNU General Public License
183 # along with this program; if not, write to the Free Software
184 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
185 # 02111-1307, USA.
186
187 # serial 2
188
189 # _AM_MANGLE_OPTION(NAME)
190 # -----------------------
191 AC_DEFUN([_AM_MANGLE_OPTION],
192 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
193
194 # _AM_SET_OPTION(NAME)
195 # ------------------------------
196 # Set option NAME.  Presently that only means defining a flag for this option.
197 AC_DEFUN([_AM_SET_OPTION],
198 [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
199
200 # _AM_SET_OPTIONS(OPTIONS)
201 # ----------------------------------
202 # OPTIONS is a space-separated list of Automake options.
203 AC_DEFUN([_AM_SET_OPTIONS],
204 [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
205
206 # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
207 # -------------------------------------------
208 # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
209 AC_DEFUN([_AM_IF_OPTION],
210 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
211
212 #
213 # Check to make sure that the build environment is sane.
214 #
215
216 # Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
217
218 # This program is free software; you can redistribute it and/or modify
219 # it under the terms of the GNU General Public License as published by
220 # the Free Software Foundation; either version 2, or (at your option)
221 # any later version.
222
223 # This program is distributed in the hope that it will be useful,
224 # but WITHOUT ANY WARRANTY; without even the implied warranty of
225 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
226 # GNU General Public License for more details.
227
228 # You should have received a copy of the GNU General Public License
229 # along with this program; if not, write to the Free Software
230 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
231 # 02111-1307, USA.
232
233 # serial 3
234
235 # AM_SANITY_CHECK
236 # ---------------
237 AC_DEFUN([AM_SANITY_CHECK],
238 [AC_MSG_CHECKING([whether build environment is sane])
239 # Just in case
240 sleep 1
241 echo timestamp > conftest.file
242 # Do `set' in a subshell so we don't clobber the current shell's
243 # arguments.  Must try -L first in case configure is actually a
244 # symlink; some systems play weird games with the mod time of symlinks
245 # (eg FreeBSD returns the mod time of the symlink's containing
246 # directory).
247 if (
248    set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
249    if test "$[*]" = "X"; then
250       # -L didn't work.
251       set X `ls -t $srcdir/configure conftest.file`
252    fi
253    rm -f conftest.file
254    if test "$[*]" != "X $srcdir/configure conftest.file" \
255       && test "$[*]" != "X conftest.file $srcdir/configure"; then
256
257       # If neither matched, then we have a broken ls.  This can happen
258       # if, for instance, CONFIG_SHELL is bash and it inherits a
259       # broken ls alias from the environment.  This has actually
260       # happened.  Such a system could not be considered "sane".
261       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
262 alias in your environment])
263    fi
264
265    test "$[2]" = conftest.file
266    )
267 then
268    # Ok.
269    :
270 else
271    AC_MSG_ERROR([newly created file is older than distributed files!
272 Check your system clock])
273 fi
274 AC_MSG_RESULT(yes)])
275
276 #  -*- Autoconf -*-
277
278
279 # Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
280
281 # This program is free software; you can redistribute it and/or modify
282 # it under the terms of the GNU General Public License as published by
283 # the Free Software Foundation; either version 2, or (at your option)
284 # any later version.
285
286 # This program is distributed in the hope that it will be useful,
287 # but WITHOUT ANY WARRANTY; without even the implied warranty of
288 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
289 # GNU General Public License for more details.
290
291 # You should have received a copy of the GNU General Public License
292 # along with this program; if not, write to the Free Software
293 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
294 # 02111-1307, USA.
295
296 # serial 3
297
298 # AM_MISSING_PROG(NAME, PROGRAM)
299 # ------------------------------
300 AC_DEFUN([AM_MISSING_PROG],
301 [AC_REQUIRE([AM_MISSING_HAS_RUN])
302 $1=${$1-"${am_missing_run}$2"}
303 AC_SUBST($1)])
304
305
306 # AM_MISSING_HAS_RUN
307 # ------------------
308 # Define MISSING if not defined so far and test if it supports --run.
309 # If it does, set am_missing_run to use it, otherwise, to nothing.
310 AC_DEFUN([AM_MISSING_HAS_RUN],
311 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
312 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
313 # Use eval to expand $SHELL
314 if eval "$MISSING --run true"; then
315   am_missing_run="$MISSING --run "
316 else
317   am_missing_run=
318   AC_MSG_WARN([`missing' script is too old or missing])
319 fi
320 ])
321
322 # AM_AUX_DIR_EXPAND
323
324 # Copyright 2001 Free Software Foundation, Inc.
325
326 # This program is free software; you can redistribute it and/or modify
327 # it under the terms of the GNU General Public License as published by
328 # the Free Software Foundation; either version 2, or (at your option)
329 # any later version.
330
331 # This program is distributed in the hope that it will be useful,
332 # but WITHOUT ANY WARRANTY; without even the implied warranty of
333 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
334 # GNU General Public License for more details.
335
336 # You should have received a copy of the GNU General Public License
337 # along with this program; if not, write to the Free Software
338 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
339 # 02111-1307, USA.
340
341 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
342 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
343 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
344 #
345 # Of course, Automake must honor this variable whenever it calls a
346 # tool from the auxiliary directory.  The problem is that $srcdir (and
347 # therefore $ac_aux_dir as well) can be either absolute or relative,
348 # depending on how configure is run.  This is pretty annoying, since
349 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
350 # source directory, any form will work fine, but in subdirectories a
351 # relative path needs to be adjusted first.
352 #
353 # $ac_aux_dir/missing
354 #    fails when called from a subdirectory if $ac_aux_dir is relative
355 # $top_srcdir/$ac_aux_dir/missing
356 #    fails if $ac_aux_dir is absolute,
357 #    fails when called from a subdirectory in a VPATH build with
358 #          a relative $ac_aux_dir
359 #
360 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
361 # are both prefixed by $srcdir.  In an in-source build this is usually
362 # harmless because $srcdir is `.', but things will broke when you
363 # start a VPATH build or use an absolute $srcdir.
364 #
365 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
366 # iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
367 #   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
368 # and then we would define $MISSING as
369 #   MISSING="\${SHELL} $am_aux_dir/missing"
370 # This will work as long as MISSING is not called from configure, because
371 # unfortunately $(top_srcdir) has no meaning in configure.
372 # However there are other variables, like CC, which are often used in
373 # configure, and could therefore not use this "fixed" $ac_aux_dir.
374 #
375 # Another solution, used here, is to always expand $ac_aux_dir to an
376 # absolute PATH.  The drawback is that using absolute paths prevent a
377 # configured tree to be moved without reconfiguration.
378
379 # Rely on autoconf to set up CDPATH properly.
380 AC_PREREQ([2.50])
381
382 AC_DEFUN([AM_AUX_DIR_EXPAND], [
383 # expand $ac_aux_dir to an absolute path
384 am_aux_dir=`cd $ac_aux_dir && pwd`
385 ])
386
387 # AM_PROG_INSTALL_SH
388 # ------------------
389 # Define $install_sh.
390
391 # Copyright 2001 Free Software Foundation, Inc.
392
393 # This program is free software; you can redistribute it and/or modify
394 # it under the terms of the GNU General Public License as published by
395 # the Free Software Foundation; either version 2, or (at your option)
396 # any later version.
397
398 # This program is distributed in the hope that it will be useful,
399 # but WITHOUT ANY WARRANTY; without even the implied warranty of
400 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
401 # GNU General Public License for more details.
402
403 # You should have received a copy of the GNU General Public License
404 # along with this program; if not, write to the Free Software
405 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
406 # 02111-1307, USA.
407
408 AC_DEFUN([AM_PROG_INSTALL_SH],
409 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
410 install_sh=${install_sh-"$am_aux_dir/install-sh"}
411 AC_SUBST(install_sh)])
412
413 # AM_PROG_INSTALL_STRIP
414
415 # Copyright 2001 Free Software Foundation, Inc.
416
417 # This program is free software; you can redistribute it and/or modify
418 # it under the terms of the GNU General Public License as published by
419 # the Free Software Foundation; either version 2, or (at your option)
420 # any later version.
421
422 # This program is distributed in the hope that it will be useful,
423 # but WITHOUT ANY WARRANTY; without even the implied warranty of
424 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
425 # GNU General Public License for more details.
426
427 # You should have received a copy of the GNU General Public License
428 # along with this program; if not, write to the Free Software
429 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
430 # 02111-1307, USA.
431
432 # One issue with vendor `install' (even GNU) is that you can't
433 # specify the program used to strip binaries.  This is especially
434 # annoying in cross-compiling environments, where the build's strip
435 # is unlikely to handle the host's binaries.
436 # Fortunately install-sh will honor a STRIPPROG variable, so we
437 # always use install-sh in `make install-strip', and initialize
438 # STRIPPROG with the value of the STRIP variable (set by the user).
439 AC_DEFUN([AM_PROG_INSTALL_STRIP],
440 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
441 # Installed binaries are usually stripped using `strip' when the user
442 # run `make install-strip'.  However `strip' might not be the right
443 # tool to use in cross-compilation environments, therefore Automake
444 # will honor the `STRIP' environment variable to overrule this program.
445 dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
446 if test "$cross_compiling" != no; then
447   AC_CHECK_TOOL([STRIP], [strip], :)
448 fi
449 INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
450 AC_SUBST([INSTALL_STRIP_PROGRAM])])
451
452 #                                                          -*- Autoconf -*-
453 # Copyright (C) 2003  Free Software Foundation, Inc.
454
455 # This program is free software; you can redistribute it and/or modify
456 # it under the terms of the GNU General Public License as published by
457 # the Free Software Foundation; either version 2, or (at your option)
458 # any later version.
459
460 # This program is distributed in the hope that it will be useful,
461 # but WITHOUT ANY WARRANTY; without even the implied warranty of
462 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
463 # GNU General Public License for more details.
464
465 # You should have received a copy of the GNU General Public License
466 # along with this program; if not, write to the Free Software
467 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
468 # 02111-1307, USA.
469
470 # serial 1
471
472 # Check whether the underlying file-system supports filenames
473 # with a leading dot.  For instance MS-DOS doesn't.
474 AC_DEFUN([AM_SET_LEADING_DOT],
475 [rm -rf .tst 2>/dev/null
476 mkdir .tst 2>/dev/null
477 if test -d .tst; then
478   am__leading_dot=.
479 else
480   am__leading_dot=_
481 fi
482 rmdir .tst 2>/dev/null
483 AC_SUBST([am__leading_dot])])
484
485 # serial 5                                              -*- Autoconf -*-
486
487 # Copyright (C) 1999, 2000, 2001, 2002, 2003  Free Software Foundation, Inc.
488
489 # This program is free software; you can redistribute it and/or modify
490 # it under the terms of the GNU General Public License as published by
491 # the Free Software Foundation; either version 2, or (at your option)
492 # any later version.
493
494 # This program is distributed in the hope that it will be useful,
495 # but WITHOUT ANY WARRANTY; without even the implied warranty of
496 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
497 # GNU General Public License for more details.
498
499 # You should have received a copy of the GNU General Public License
500 # along with this program; if not, write to the Free Software
501 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
502 # 02111-1307, USA.
503
504
505 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
506 # written in clear, in which case automake, when reading aclocal.m4,
507 # will think it sees a *use*, and therefore will trigger all it's
508 # C support machinery.  Also note that it means that autoscan, seeing
509 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
510
511
512
513 # _AM_DEPENDENCIES(NAME)
514 # ----------------------
515 # See how the compiler implements dependency checking.
516 # NAME is "CC", "CXX", "GCJ", or "OBJC".
517 # We try a few techniques and use that to set a single cache variable.
518 #
519 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
520 # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
521 # dependency, and given that the user is not expected to run this macro,
522 # just rely on AC_PROG_CC.
523 AC_DEFUN([_AM_DEPENDENCIES],
524 [AC_REQUIRE([AM_SET_DEPDIR])dnl
525 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
526 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
527 AC_REQUIRE([AM_DEP_TRACK])dnl
528
529 ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
530        [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
531        [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
532        [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
533                    [depcc="$$1"   am_compiler_list=])
534
535 AC_CACHE_CHECK([dependency style of $depcc],
536                [am_cv_$1_dependencies_compiler_type],
537 [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
538   # We make a subdir and do the tests there.  Otherwise we can end up
539   # making bogus files that we don't know about and never remove.  For
540   # instance it was reported that on HP-UX the gcc test will end up
541   # making a dummy file named `D' -- because `-MD' means `put the output
542   # in D'.
543   mkdir conftest.dir
544   # Copy depcomp to subdir because otherwise we won't find it if we're
545   # using a relative directory.
546   cp "$am_depcomp" conftest.dir
547   cd conftest.dir
548   # We will build objects and dependencies in a subdirectory because
549   # it helps to detect inapplicable dependency modes.  For instance
550   # both Tru64's cc and ICC support -MD to output dependencies as a
551   # side effect of compilation, but ICC will put the dependencies in
552   # the current directory while Tru64 will put them in the object
553   # directory.
554   mkdir sub
555
556   am_cv_$1_dependencies_compiler_type=none
557   if test "$am_compiler_list" = ""; then
558      am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
559   fi
560   for depmode in $am_compiler_list; do
561     # Setup a source with many dependencies, because some compilers
562     # like to wrap large dependency lists on column 80 (with \), and
563     # we should not choose a depcomp mode which is confused by this.
564     #
565     # We need to recreate these files for each test, as the compiler may
566     # overwrite some of them when testing with obscure command lines.
567     # This happens at least with the AIX C compiler.
568     : > sub/conftest.c
569     for i in 1 2 3 4 5 6; do
570       echo '#include "conftst'$i'.h"' >> sub/conftest.c
571       : > sub/conftst$i.h
572     done
573     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
574
575     case $depmode in
576     nosideeffect)
577       # after this tag, mechanisms are not by side-effect, so they'll
578       # only be used when explicitly requested
579       if test "x$enable_dependency_tracking" = xyes; then
580         continue
581       else
582         break
583       fi
584       ;;
585     none) break ;;
586     esac
587     # We check with `-c' and `-o' for the sake of the "dashmstdout"
588     # mode.  It turns out that the SunPro C++ compiler does not properly
589     # handle `-M -o', and we need to detect this.
590     if depmode=$depmode \
591        source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
592        depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
593        $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
594          >/dev/null 2>conftest.err &&
595        grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
596        grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
597        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
598       # icc doesn't choke on unknown options, it will just issue warnings
599       # (even with -Werror).  So we grep stderr for any message
600       # that says an option was ignored.
601       if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
602         am_cv_$1_dependencies_compiler_type=$depmode
603         break
604       fi
605     fi
606   done
607
608   cd ..
609   rm -rf conftest.dir
610 else
611   am_cv_$1_dependencies_compiler_type=none
612 fi
613 ])
614 AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
615 AM_CONDITIONAL([am__fastdep$1], [
616   test "x$enable_dependency_tracking" != xno \
617   && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
618 ])
619
620
621 # AM_SET_DEPDIR
622 # -------------
623 # Choose a directory name for dependency files.
624 # This macro is AC_REQUIREd in _AM_DEPENDENCIES
625 AC_DEFUN([AM_SET_DEPDIR],
626 [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
627 AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
628 ])
629
630
631 # AM_DEP_TRACK
632 # ------------
633 AC_DEFUN([AM_DEP_TRACK],
634 [AC_ARG_ENABLE(dependency-tracking,
635 [  --disable-dependency-tracking Speeds up one-time builds
636   --enable-dependency-tracking  Do not reject slow dependency extractors])
637 if test "x$enable_dependency_tracking" != xno; then
638   am_depcomp="$ac_aux_dir/depcomp"
639   AMDEPBACKSLASH='\'
640 fi
641 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
642 AC_SUBST([AMDEPBACKSLASH])
643 ])
644
645 # Generate code to set up dependency tracking.   -*- Autoconf -*-
646
647 # Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
648
649 # This program is free software; you can redistribute it and/or modify
650 # it under the terms of the GNU General Public License as published by
651 # the Free Software Foundation; either version 2, or (at your option)
652 # any later version.
653
654 # This program is distributed in the hope that it will be useful,
655 # but WITHOUT ANY WARRANTY; without even the implied warranty of
656 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
657 # GNU General Public License for more details.
658
659 # You should have received a copy of the GNU General Public License
660 # along with this program; if not, write to the Free Software
661 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
662 # 02111-1307, USA.
663
664 #serial 2
665
666 # _AM_OUTPUT_DEPENDENCY_COMMANDS
667 # ------------------------------
668 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
669 [for mf in $CONFIG_FILES; do
670   # Strip MF so we end up with the name of the file.
671   mf=`echo "$mf" | sed -e 's/:.*$//'`
672   # Check whether this is an Automake generated Makefile or not.
673   # We used to match only the files named `Makefile.in', but
674   # some people rename them; so instead we look at the file content.
675   # Grep'ing the first line is not enough: some people post-process
676   # each Makefile.in and add a new line on top of each file to say so.
677   # So let's grep whole file.
678   if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
679     dirpart=`AS_DIRNAME("$mf")`
680   else
681     continue
682   fi
683   grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
684   # Extract the definition of DEP_FILES from the Makefile without
685   # running `make'.
686   DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
687   test -z "$DEPDIR" && continue
688   # When using ansi2knr, U may be empty or an underscore; expand it
689   U=`sed -n -e '/^U = / s///p' < "$mf"`
690   test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
691   # We invoke sed twice because it is the simplest approach to
692   # changing $(DEPDIR) to its actual value in the expansion.
693   for file in `sed -n -e '
694     /^DEP_FILES = .*\\\\$/ {
695       s/^DEP_FILES = //
696       :loop
697         s/\\\\$//
698         p
699         n
700         /\\\\$/ b loop
701       p
702     }
703     /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
704        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
705     # Make sure the directory exists.
706     test -f "$dirpart/$file" && continue
707     fdir=`AS_DIRNAME(["$file"])`
708     AS_MKDIR_P([$dirpart/$fdir])
709     # echo "creating $dirpart/$file"
710     echo '# dummy' > "$dirpart/$file"
711   done
712 done
713 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
714
715
716 # AM_OUTPUT_DEPENDENCY_COMMANDS
717 # -----------------------------
718 # This macro should only be invoked once -- use via AC_REQUIRE.
719 #
720 # This code is only required when automatic dependency tracking
721 # is enabled.  FIXME.  This creates each `.P' file that we will
722 # need in order to bootstrap the dependency handling code.
723 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
724 [AC_CONFIG_COMMANDS([depfiles],
725      [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
726      [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
727 ])
728
729 # Check to see how 'make' treats includes.      -*- Autoconf -*-
730
731 # Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
732
733 # This program is free software; you can redistribute it and/or modify
734 # it under the terms of the GNU General Public License as published by
735 # the Free Software Foundation; either version 2, or (at your option)
736 # any later version.
737
738 # This program is distributed in the hope that it will be useful,
739 # but WITHOUT ANY WARRANTY; without even the implied warranty of
740 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
741 # GNU General Public License for more details.
742
743 # You should have received a copy of the GNU General Public License
744 # along with this program; if not, write to the Free Software
745 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
746 # 02111-1307, USA.
747
748 # serial 2
749
750 # AM_MAKE_INCLUDE()
751 # -----------------
752 # Check to see how make treats includes.
753 AC_DEFUN([AM_MAKE_INCLUDE],
754 [am_make=${MAKE-make}
755 cat > confinc << 'END'
756 am__doit:
757         @echo done
758 .PHONY: am__doit
759 END
760 # If we don't find an include directive, just comment out the code.
761 AC_MSG_CHECKING([for style of include used by $am_make])
762 am__include="#"
763 am__quote=
764 _am_result=none
765 # First try GNU make style include.
766 echo "include confinc" > confmf
767 # We grep out `Entering directory' and `Leaving directory'
768 # messages which can occur if `w' ends up in MAKEFLAGS.
769 # In particular we don't look at `^make:' because GNU make might
770 # be invoked under some other name (usually "gmake"), in which
771 # case it prints its new name instead of `make'.
772 if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
773    am__include=include
774    am__quote=
775    _am_result=GNU
776 fi
777 # Now try BSD make style include.
778 if test "$am__include" = "#"; then
779    echo '.include "confinc"' > confmf
780    if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
781       am__include=.include
782       am__quote="\""
783       _am_result=BSD
784    fi
785 fi
786 AC_SUBST([am__include])
787 AC_SUBST([am__quote])
788 AC_MSG_RESULT([$_am_result])
789 rm -f confinc confmf
790 ])
791
792 # AM_CONDITIONAL                                              -*- Autoconf -*-
793
794 # Copyright 1997, 2000, 2001 Free Software Foundation, Inc.
795
796 # This program is free software; you can redistribute it and/or modify
797 # it under the terms of the GNU General Public License as published by
798 # the Free Software Foundation; either version 2, or (at your option)
799 # any later version.
800
801 # This program is distributed in the hope that it will be useful,
802 # but WITHOUT ANY WARRANTY; without even the implied warranty of
803 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
804 # GNU General Public License for more details.
805
806 # You should have received a copy of the GNU General Public License
807 # along with this program; if not, write to the Free Software
808 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
809 # 02111-1307, USA.
810
811 # serial 5
812
813 AC_PREREQ(2.52)
814
815 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
816 # -------------------------------------
817 # Define a conditional.
818 AC_DEFUN([AM_CONDITIONAL],
819 [ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
820         [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
821 AC_SUBST([$1_TRUE])
822 AC_SUBST([$1_FALSE])
823 if $2; then
824   $1_TRUE=
825   $1_FALSE='#'
826 else
827   $1_TRUE='#'
828   $1_FALSE=
829 fi
830 AC_CONFIG_COMMANDS_PRE(
831 [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
832   AC_MSG_ERROR([conditional "$1" was never defined.
833 Usually this means the macro was only invoked conditionally.])
834 fi])])
835
836 # gl_USE_SYSTEM_EXTENSIONS
837 # ------------------------
838 # Enable extensions on systems that normally disable them,
839 # typically due to standards-conformance issues.
840 AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], [
841   AC_REQUIRE([AC_GNU_SOURCE])
842   AH_VERBATIM([__EXTENSIONS__],
843 [/* Enable extensions on Solaris.  */
844 #ifndef __EXTENSIONS__
845 # undef __EXTENSIONS__
846 #endif])
847   AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
848   AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
849   AC_DEFINE([__EXTENSIONS__])
850 ])
851
852 #serial 5
853
854 dnl From Jim Meyering.
855 dnl Find a new-enough version of Perl.
856 dnl
857
858 AC_DEFUN([jm_PERL],
859 [
860   dnl FIXME: don't hard-code 5.003
861   dnl FIXME: should we cache the result?
862   AC_MSG_CHECKING([for perl5.003 or newer])
863   if test "${PERL+set}" = set; then
864     # `PERL' is set in the user's environment.
865     candidate_perl_names="$PERL"
866     perl_specified=yes
867   else
868     candidate_perl_names='perl perl5'
869     perl_specified=no
870   fi
871
872   found=no
873   AC_SUBST(PERL)
874   PERL="$am_missing_run perl"
875   for perl in $candidate_perl_names; do
876     # Run test in a subshell; some versions of sh will print an error if
877     # an executable is not found, even if stderr is redirected.
878     if ( $perl -e 'require 5.003; use File::Compare' ) > /dev/null 2>&1; then
879       PERL=$perl
880       found=yes
881       break
882     fi
883   done
884
885   AC_MSG_RESULT($found)
886   test $found = no && AC_MSG_WARN([
887 WARNING: You don't seem to have perl5.003 or newer installed, or you lack
888          a usable version of the Perl File::Compare module.  As a result,
889          you may be unable to run a few tests or to regenerate certain
890          files if you modify the sources from which they are derived.
891 ] )
892 ])
893
894 #serial 68   -*- autoconf -*-
895
896 m4_undefine([AC_LANG_SOURCE(C)])
897 dnl The following is identical to the definition in c.m4
898 dnl from the autoconf cvs repository on 2003-03-07.
899 dnl FIXME: remove this code once we upgrade to autoconf-2.58.
900
901 # We can't use '#line $LINENO "configure"' here, since
902 # Sun c89 (Sun WorkShop 6 update 2 C 5.3 Patch 111679-08 2002/05/09)
903 # rejects $LINENO greater than 32767, and some configure scripts
904 # are longer than 32767 lines.
905 m4_define([AC_LANG_SOURCE(C)],
906 [/* confdefs.h.  */
907 _ACEOF
908 cat confdefs.h >>conftest.$ac_ext
909 cat >>conftest.$ac_ext <<_ACEOF
910 /* end confdefs.h.  */
911 $1])
912
913
914 dnl Misc type-related macros for fileutils, sh-utils, textutils.
915
916 AC_DEFUN([jm_MACROS],
917 [
918   AC_PREREQ(2.57)
919
920   GNU_PACKAGE="GNU $PACKAGE"
921   AC_DEFINE_UNQUOTED(GNU_PACKAGE, "$GNU_PACKAGE",
922     [The concatenation of the strings `GNU ', and PACKAGE.])
923   AC_SUBST(GNU_PACKAGE)
924
925   AM_MISSING_PROG(HELP2MAN, help2man)
926   AC_SUBST(OPTIONAL_BIN_PROGS)
927   AC_SUBST(MAN)
928   AC_SUBST(DF_PROG)
929
930   dnl This macro actually runs replacement code.  See isc-posix.m4.
931   AC_REQUIRE([AC_ISC_POSIX])dnl
932
933   jm_CHECK_ALL_TYPES
934
935   AC_REQUIRE([UTILS_HOST_OS])
936   AC_REQUIRE([jm_ASSERT])
937   AC_REQUIRE([jm_CHECK_TYPE_STRUCT_UTIMBUF])
938   AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE])
939   AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_INO])
940   AC_REQUIRE([jm_CHECK_DECLS])
941
942   AC_REQUIRE([jm_PREREQ])
943
944   AC_REQUIRE([UTILS_FUNC_DIRFD])
945   AC_REQUIRE([AC_FUNC_ACL])
946   AC_REQUIRE([AC_FUNC_FTW])
947   AC_REQUIRE([jm_FUNC_LCHOWN])
948   AC_REQUIRE([fetish_FUNC_RMDIR_NOTEMPTY])
949   AC_REQUIRE([jm_FUNC_CHOWN])
950   AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
951   AC_REQUIRE([AC_FUNC_STRERROR_R])
952   AC_REQUIRE([jm_FUNC_GROUP_MEMBER])
953   AC_REQUIRE([jm_AFS])
954   AC_REQUIRE([jm_AC_FUNC_LINK_FOLLOWS_SYMLINK])
955   AC_REQUIRE([jm_FUNC_FPENDING])
956
957   # This is for od and stat, and any other program that
958   # uses the PRI.MAX macros from inttypes.h.
959   AC_REQUIRE([gt_INTTYPES_PRI])
960
961   AC_REQUIRE([jm_FUNC_GETGROUPS])
962
963   AC_REQUIRE([AC_FUNC_FSEEKO])
964   AC_REQUIRE([AC_FUNC_ALLOCA])
965
966   AC_CONFIG_LIBOBJ_DIR([lib])
967   AC_FUNC_GETLOADAVG([lib])
968
969   AC_REQUIRE([jm_SYS_PROC_UPTIME])
970   AC_REQUIRE([jm_FUNC_FTRUNCATE])
971
972   # raise is used by at least sort and ls.
973   AC_REPLACE_FUNCS(raise)
974
975   # By default, argmatch should fail calling usage (1).
976   AC_DEFINE(ARGMATCH_DIE, [usage (1)],
977             [Define to the function xargmatch calls on failures.])
978   AC_DEFINE(ARGMATCH_DIE_DECL, [extern void usage ()],
979             [Define to the declaration of the xargmatch failure function.])
980
981   dnl Used to define SETVBUF in sys2.h.
982   dnl This evokes the following warning from autoconf:
983   dnl ...: warning: AC_TRY_RUN called without default to allow cross compiling
984   AC_FUNC_SETVBUF_REVERSED
985
986   # used by sleep and shred
987   AC_REQUIRE([gl_CLOCK_TIME])
988   AC_CHECK_FUNCS(gettimeofday)
989   AC_FUNC_GETTIMEOFDAY_CLOBBER
990
991   AC_REQUIRE([AC_FUNC_CLOSEDIR_VOID])
992
993   AC_CHECK_FUNCS( \
994     endgrent \
995     endpwent \
996     fdatasync \
997     ftruncate \
998     gethrtime \
999     hasmntopt \
1000     isascii \
1001     iswspace \
1002     lchown \
1003     listmntent \
1004     localeconv \
1005     memcpy \
1006     mempcpy \
1007     mkfifo \
1008     realpath \
1009     sethostname \
1010     strchr \
1011     strerror \
1012     strrchr \
1013     sysctl \
1014     sysinfo \
1015     wcrtomb \
1016     tzset \
1017   )
1018
1019   # for test.c
1020   AC_CHECK_FUNCS(setreuid setregid)
1021
1022   AC_FUNC_STRTOD
1023   AC_REQUIRE([UTILS_SYS_OPEN_MAX])
1024   AC_REQUIRE([GL_FUNC_GETCWD_PATH_MAX])
1025   AC_REQUIRE([GL_FUNC_READDIR])
1026
1027   # See if linking `seq' requires -lm.
1028   # It does on nearly every system.  The single exception (so far) is
1029   # BeOS which has all the math functions in the normal runtime library
1030   # and doesn't have a separate math library.
1031
1032   AC_SUBST(SEQ_LIBM)
1033   ac_seq_body='
1034      static double x, y;
1035      x = floor (x);
1036      x = rint (x);
1037      x = modf (x, &y);'
1038   AC_TRY_LINK([#include <math.h>], $ac_seq_body, ,
1039     [ac_seq_save_LIBS="$LIBS"
1040      LIBS="$LIBS -lm"
1041      AC_TRY_LINK([#include <math.h>], $ac_seq_body, SEQ_LIBM=-lm)
1042      LIBS="$ac_seq_save_LIBS"
1043     ])
1044
1045   AM_LANGINFO_CODESET
1046   jm_GLIBC21
1047   AM_ICONV
1048   jm_FUNC_UNLINK_BUSY_TEXT
1049
1050   # These tests are for df.
1051   AC_REQUIRE([gl_FSUSAGE])
1052   AC_REQUIRE([gl_MOUNTLIST])
1053   if test $gl_cv_list_mounted_fs = yes && test $gl_cv_fs_space = yes; then
1054     DF_PROG='df$(EXEEXT)'
1055   fi
1056   AC_REQUIRE([jm_AC_DOS])
1057   AC_REQUIRE([AC_FUNC_CANONICALIZE_FILE_NAME])
1058
1059   # If any of these functions don't exist (e.g. DJGPP 2.03),
1060   # use the corresponding stub.
1061   AC_CHECK_FUNC([fchdir], , [AC_LIBOBJ(fchdir-stub)])
1062   AC_CHECK_FUNC([fchown], , [AC_LIBOBJ(fchown-stub)])
1063 ])
1064
1065 # These tests must be run before any use of AC_CHECK_TYPE,
1066 # because that macro compiles code that tests e.g., HAVE_UNISTD_H.
1067 # See the definition of ac_includes_default in `configure'.
1068 AC_DEFUN([jm_CHECK_ALL_HEADERS],
1069 [
1070   AC_CHECK_HEADERS( \
1071     errno.h  \
1072     fcntl.h \
1073     float.h \
1074     hurd.h \
1075     limits.h \
1076     memory.h \
1077     mntent.h \
1078     mnttab.h \
1079     netdb.h \
1080     paths.h \
1081     stdlib.h \
1082     stddef.h \
1083     stdint.h \
1084     string.h \
1085     sys/filsys.h \
1086     sys/fs/s5param.h \
1087     sys/fs_types.h \
1088     sys/fstyp.h \
1089     sys/ioctl.h \
1090     sys/mntent.h \
1091     sys/mount.h \
1092     sys/param.h \
1093     sys/resource.h \
1094     sys/socket.h \
1095     sys/statfs.h \
1096     sys/statvfs.h \
1097     sys/sysctl.h \
1098     sys/systeminfo.h \
1099     sys/time.h \
1100     sys/timeb.h \
1101     sys/vfs.h \
1102     sys/wait.h \
1103     syslog.h \
1104     termios.h \
1105     unistd.h \
1106     utime.h \
1107     values.h \
1108   )
1109 ])
1110
1111 # This macro must be invoked before any tests that run the compiler.
1112 AC_DEFUN([jm_CHECK_ALL_TYPES],
1113 [
1114   dnl This test must come as early as possible after the compiler configuration
1115   dnl tests, because the choice of the file model can (in principle) affect
1116   dnl whether functions and headers are available, whether they work, etc.
1117   AC_REQUIRE([AC_SYS_LARGEFILE])
1118
1119   dnl This test must precede tests of compiler characteristics like
1120   dnl that for the inline keyword, since it may change the degree to
1121   dnl which the compiler supports such features.
1122   AC_REQUIRE([AM_C_PROTOTYPES])
1123
1124   dnl Checks for typedefs, structures, and compiler characteristics.
1125   AC_REQUIRE([AC_C_BIGENDIAN])
1126   AC_REQUIRE([AC_C_CONST])
1127   AC_REQUIRE([AC_C_VOLATILE])
1128   AC_REQUIRE([AC_C_INLINE])
1129   AC_REQUIRE([AC_C_LONG_DOUBLE])
1130
1131   AC_REQUIRE([jm_CHECK_ALL_HEADERS])
1132   AC_REQUIRE([AC_HEADER_DIRENT])
1133   AC_REQUIRE([AC_HEADER_STDC])
1134   AC_CHECK_MEMBERS(
1135     [struct stat.st_author,
1136      struct stat.st_blksize],,,
1137     [$ac_includes_default
1138 #include <sys/stat.h>
1139   ])
1140   AC_REQUIRE([AC_STRUCT_ST_BLOCKS])
1141
1142   AC_REQUIRE([AC_HEADER_STAT])
1143   AC_REQUIRE([AC_STRUCT_ST_MTIM_NSEC])
1144   AC_REQUIRE([AC_STRUCT_ST_DM_MODE])
1145
1146   AC_REQUIRE([AC_TYPE_GETGROUPS])
1147   AC_REQUIRE([AC_TYPE_MODE_T])
1148   AC_REQUIRE([AC_TYPE_OFF_T])
1149   AC_REQUIRE([AC_TYPE_PID_T])
1150   AC_REQUIRE([AC_TYPE_SIGNAL])
1151   AC_REQUIRE([AC_TYPE_SIZE_T])
1152   AC_REQUIRE([AC_TYPE_UID_T])
1153   AC_CHECK_TYPE(ino_t, unsigned long)
1154
1155   gt_TYPE_SSIZE_T
1156
1157   dnl This relies on the fact that autoconf 2.14a's implementation of
1158   dnl AC_CHECK_TYPE checks includes unistd.h.
1159   AC_CHECK_TYPE(major_t, unsigned int)
1160   AC_CHECK_TYPE(minor_t, unsigned int)
1161
1162   AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
1163   AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
1164
1165   AC_REQUIRE([AC_HEADER_MAJOR])
1166   AC_REQUIRE([AC_HEADER_DIRENT])
1167
1168 ])
1169
1170 # isc-posix.m4 serial 2 (gettext-0.11.2)
1171 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
1172 dnl This file is free software, distributed under the terms of the GNU
1173 dnl General Public License.  As a special exception to the GNU General
1174 dnl Public License, this file may be distributed as part of a program
1175 dnl that contains a configuration script generated by Autoconf, under
1176 dnl the same distribution terms as the rest of that program.
1177
1178 # This file is not needed with autoconf-2.53 and newer.  Remove it in 2005.
1179
1180 # This test replaces the one in autoconf.
1181 # Currently this macro should have the same name as the autoconf macro
1182 # because gettext's gettext.m4 (distributed in the automake package)
1183 # still uses it.  Otherwise, the use in gettext.m4 makes autoheader
1184 # give these diagnostics:
1185 #   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
1186 #   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
1187
1188 undefine([AC_ISC_POSIX])
1189
1190 AC_DEFUN([AC_ISC_POSIX],
1191   [
1192     dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
1193     AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
1194   ]
1195 )
1196
1197 #serial 3
1198
1199 dnl From Paul Eggert.
1200
1201 # Define HOST_OPERATING_SYSTEM to a name for the host operating system.
1202 AC_DEFUN([UTILS_HOST_OS],
1203 [
1204   AC_CACHE_CHECK([host operating system],
1205     utils_cv_host_operating_system,
1206
1207     [[case $host_os in
1208
1209        # These operating system names do not use the default heuristic below.
1210        # They are in reverse order, so that more-specific prefixes come first.
1211        winnt*)          os='Windows NT';;
1212        vos*)            os='VOS';;
1213        sysv*)           os='Unix System V';;
1214        superux*)        os='SUPER-UX';;
1215        sunos*)          os='SunOS';;
1216        stop*)           os='STOP';;
1217        sco*)            os='SCO Unix';;
1218        riscos*)         os='RISC OS';;
1219        riscix*)         os='RISCiX';;
1220        qnx*)            os='QNX';;
1221        pw32*)           os='PW32';;
1222        ptx*)            os='ptx';;
1223        plan9*)          os='Plan 9';;
1224        osf*)            os='Tru64';;
1225        os2*)            os='OS/2';;
1226        openbsd*)        os='OpenBSD';;
1227        nsk*)            os='NonStop Kernel';;
1228        nonstopux*)      os='NonStop-UX';;
1229        netbsd*-gnu*)    os='GNU/NetBSD';;
1230        netbsd*)         os='NetBSD';;
1231        msdosdjgpp*)     os='DJGPP';;
1232        mpeix*)          os='MPE/iX';;
1233        mint*)           os='MiNT';;
1234        mingw*)          os='MinGW';;
1235        lynxos*)         os='LynxOS';;
1236        linux*)          os='GNU/Linux';;
1237        hpux*)           os='HP-UX';;
1238        hiux*)           os='HI-UX';;
1239        gnu*)            os='GNU';;
1240        freebsd*-gnu*)   os='GNU/FreeBSD';;
1241        freebsd*)        os='FreeBSD';;
1242        dgux*)           os='DG/UX';;
1243        bsdi*)           os='BSD/OS';;
1244        bsd*)            os='BSD';;
1245        beos*)           os='BeOS';;
1246        aux*)            os='A/UX';;
1247        atheos*)         os='AtheOS';;
1248        amigaos*)        os='Amiga OS';;
1249        aix*)            os='AIX';;
1250
1251        # The default heuristic takes the initial alphabetic string
1252        # from $host_os, but capitalizes its first letter.
1253        [A-Za-z]*)
1254          os=`
1255            expr "X$host_os" : 'X\([A-Za-z]\)' | tr '[a-z]' '[A-Z]'
1256          ``
1257            expr "X$host_os" : 'X.\([A-Za-z]*\)'
1258          `
1259          ;;
1260
1261        # If $host_os does not start with an alphabetic string, use it unchanged.
1262        *)
1263          os=$host_os;;
1264      esac
1265      utils_cv_host_operating_system=$os]])
1266   AC_DEFINE_UNQUOTED(HOST_OPERATING_SYSTEM,
1267     "$utils_cv_host_operating_system",
1268     [The host operating system.])
1269 ])
1270
1271 #serial 3
1272 dnl based on code from Eleftherios Gkioulekas
1273
1274 AC_DEFUN([jm_ASSERT],
1275 [
1276   AC_MSG_CHECKING(whether to enable assertions)
1277   AC_ARG_ENABLE(assert,
1278         [  --disable-assert        turn off assertions],
1279         [ AC_MSG_RESULT(no)
1280           AC_DEFINE(NDEBUG,1,[Define to 1 if assertions should be disabled.]) ],
1281         [ AC_MSG_RESULT(yes) ]
1282                )
1283 ])
1284
1285 #serial 5
1286
1287 dnl From Jim Meyering
1288
1289 dnl Define HAVE_STRUCT_UTIMBUF if `struct utimbuf' is declared --
1290 dnl usually in <utime.h>.
1291 dnl Some systems have utime.h but don't declare the struct anywhere.
1292
1293 AC_DEFUN([jm_CHECK_TYPE_STRUCT_UTIMBUF],
1294 [
1295   AC_CHECK_HEADERS_ONCE(sys/time.h utime.h)
1296   AC_REQUIRE([AC_HEADER_TIME])
1297   AC_CACHE_CHECK([for struct utimbuf], fu_cv_sys_struct_utimbuf,
1298     [AC_TRY_COMPILE(
1299       [
1300 #ifdef TIME_WITH_SYS_TIME
1301 # include <sys/time.h>
1302 # include <time.h>
1303 #else
1304 # ifdef HAVE_SYS_TIME_H
1305 #  include <sys/time.h>
1306 # else
1307 #  include <time.h>
1308 # endif
1309 #endif
1310 #ifdef HAVE_UTIME_H
1311 # include <utime.h>
1312 #endif
1313       ],
1314       [static struct utimbuf x; x.actime = x.modtime;],
1315       fu_cv_sys_struct_utimbuf=yes,
1316       fu_cv_sys_struct_utimbuf=no)
1317     ])
1318
1319   if test $fu_cv_sys_struct_utimbuf = yes; then
1320     AC_DEFINE(HAVE_STRUCT_UTIMBUF, 1,
1321       [Define if struct utimbuf is declared -- usually in <utime.h>.
1322        Some systems have utime.h but don't declare the struct anywhere. ])
1323   fi
1324 ])
1325
1326 # onceonly_2_57.m4 serial 3
1327 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
1328 dnl This file is free software, distributed under the terms of the GNU
1329 dnl General Public License.  As a special exception to the GNU General
1330 dnl Public License, this file may be distributed as part of a program
1331 dnl that contains a configuration script generated by Autoconf, under
1332 dnl the same distribution terms as the rest of that program.
1333
1334 dnl This file defines some "once only" variants of standard autoconf macros.
1335 dnl   AC_CHECK_HEADERS_ONCE         like  AC_CHECK_HEADERS
1336 dnl   AC_CHECK_FUNCS_ONCE           like  AC_CHECK_FUNCS
1337 dnl   AC_CHECK_DECLS_ONCE           like  AC_CHECK_DECLS
1338 dnl   AC_REQUIRE([AC_HEADER_STDC])  like  AC_HEADER_STDC
1339 dnl The advantage is that the check for each of the headers/functions/decls
1340 dnl will be put only once into the 'configure' file. It keeps the size of
1341 dnl the 'configure' file down, and avoids redundant output when 'configure'
1342 dnl is run.
1343 dnl The drawback is that the checks cannot be conditionalized. If you write
1344 dnl   if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi
1345 dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to
1346 dnl empty, and the check will be inserted before the body of the AC_DEFUNed
1347 dnl function.
1348
1349 dnl This is like onceonly.m4, except that it uses diversions to named sections
1350 dnl DEFAULTS and INIT_PREPARE in order to check all requested headers at once,
1351 dnl thus reducing the size of 'configure'. Works with autoconf-2.57. The
1352 dnl size reduction is ca. 9%.
1353
1354 dnl Autoconf version 2.57 or newer is recommended.
1355 AC_PREREQ(2.54)
1356
1357 # AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
1358 # AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
1359 AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
1360   :
1361   AC_FOREACH([gl_HEADER_NAME], [$1], [
1362     AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
1363                                                  [./-], [___])), [
1364       m4_divert_text([INIT_PREPARE],
1365         [gl_header_list="$gl_header_list gl_HEADER_NAME"])
1366       gl_HEADERS_EXPANSION
1367       AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])),
1368         [Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.])
1369     ])
1370     AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
1371                                                    [./-], [___])))
1372   ])
1373 ])
1374 m4_define([gl_HEADERS_EXPANSION], [
1375   m4_divert_text([DEFAULTS], [gl_header_list=])
1376   AC_CHECK_HEADERS([$gl_header_list])
1377   m4_define([gl_HEADERS_EXPANSION], [])
1378 ])
1379
1380 # AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of
1381 # AC_CHECK_FUNCS(FUNC1 FUNC2 ...).
1382 AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
1383   :
1384   AC_FOREACH([gl_FUNC_NAME], [$1], [
1385     AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [
1386       m4_divert_text([INIT_PREPARE],
1387         [gl_func_list="$gl_func_list gl_FUNC_NAME"])
1388       gl_FUNCS_EXPANSION
1389       AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])),
1390         [Define to 1 if you have the `]m4_defn([gl_FUNC_NAME])[' function.])
1391     ])
1392     AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]))
1393   ])
1394 ])
1395 m4_define([gl_FUNCS_EXPANSION], [
1396   m4_divert_text([DEFAULTS], [gl_func_list=])
1397   AC_CHECK_FUNCS([$gl_func_list])
1398   m4_define([gl_FUNCS_EXPANSION], [])
1399 ])
1400
1401 # AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of
1402 # AC_CHECK_DECLS(DECL1, DECL2, ...).
1403 AC_DEFUN([AC_CHECK_DECLS_ONCE], [
1404   :
1405   AC_FOREACH([gl_DECL_NAME], [$1], [
1406     AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [
1407       AC_CHECK_DECLS(m4_defn([gl_DECL_NAME]))
1408     ])
1409     AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]))
1410   ])
1411 ])
1412
1413 #serial 6
1414
1415 dnl From Jim Meyering.
1416 dnl
1417 dnl Check whether struct dirent has a member named d_type.
1418 dnl
1419
1420 AC_DEFUN([jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE],
1421   [AC_REQUIRE([AC_HEADER_DIRENT])dnl
1422    AC_CACHE_CHECK([for d_type member in directory struct],
1423                   jm_cv_struct_dirent_d_type,
1424      [AC_TRY_LINK(dnl
1425        [
1426 #include <sys/types.h>
1427 #ifdef HAVE_DIRENT_H
1428 # include <dirent.h>
1429 #else /* not HAVE_DIRENT_H */
1430 # define dirent direct
1431 # ifdef HAVE_SYS_NDIR_H
1432 #  include <sys/ndir.h>
1433 # endif /* HAVE_SYS_NDIR_H */
1434 # ifdef HAVE_SYS_DIR_H
1435 #  include <sys/dir.h>
1436 # endif /* HAVE_SYS_DIR_H */
1437 # ifdef HAVE_NDIR_H
1438 #  include <ndir.h>
1439 # endif /* HAVE_NDIR_H */
1440 #endif /* HAVE_DIRENT_H */
1441        ],
1442        [struct dirent dp; dp.d_type = 0;],
1443
1444        jm_cv_struct_dirent_d_type=yes,
1445        jm_cv_struct_dirent_d_type=no)
1446      ]
1447    )
1448    if test $jm_cv_struct_dirent_d_type = yes; then
1449      AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE, 1,
1450        [Define if there is a member named d_type in the struct describing
1451         directory headers.])
1452    fi
1453   ]
1454 )
1455
1456 #serial 5
1457
1458 dnl From Jim Meyering.
1459 dnl
1460 dnl Check whether struct dirent has a member named d_ino.
1461 dnl
1462
1463 AC_DEFUN([jm_CHECK_TYPE_STRUCT_DIRENT_D_INO],
1464   [AC_REQUIRE([AC_HEADER_DIRENT])dnl
1465    AC_CACHE_CHECK([for d_ino member in directory struct],
1466                   jm_cv_struct_dirent_d_ino,
1467      [AC_TRY_LINK(dnl
1468        [
1469 #include <sys/types.h>
1470 #ifdef HAVE_DIRENT_H
1471 # include <dirent.h>
1472 #else /* not HAVE_DIRENT_H */
1473 # define dirent direct
1474 # ifdef HAVE_SYS_NDIR_H
1475 #  include <sys/ndir.h>
1476 # endif /* HAVE_SYS_NDIR_H */
1477 # ifdef HAVE_SYS_DIR_H
1478 #  include <sys/dir.h>
1479 # endif /* HAVE_SYS_DIR_H */
1480 # ifdef HAVE_NDIR_H
1481 #  include <ndir.h>
1482 # endif /* HAVE_NDIR_H */
1483 #endif /* HAVE_DIRENT_H */
1484        ],
1485        [struct dirent dp; dp.d_ino = 0;],
1486
1487        jm_cv_struct_dirent_d_ino=yes,
1488        jm_cv_struct_dirent_d_ino=no)
1489      ]
1490    )
1491    if test $jm_cv_struct_dirent_d_ino = yes; then
1492      AC_DEFINE(D_INO_IN_DIRENT, 1,
1493        [Define if there is a member named d_ino in the struct describing
1494         directory headers.])
1495    fi
1496   ]
1497 )
1498
1499 #serial 18
1500
1501 dnl This is just a wrapper function to encapsulate this kludge.
1502 dnl Putting it in a separate file like this helps share it between
1503 dnl different packages.
1504 AC_DEFUN([jm_CHECK_DECLS],
1505 [
1506   AC_REQUIRE([_jm_DECL_HEADERS])
1507   AC_REQUIRE([AC_HEADER_TIME])
1508   headers='
1509 #include <stdio.h>
1510 #if HAVE_STRING_H
1511 # if !STDC_HEADERS && HAVE_MEMORY_H
1512 #  include <memory.h>
1513 # endif
1514 # include <string.h>
1515 #else
1516 # if HAVE_STRINGS_H
1517 #  include <strings.h>
1518 # endif
1519 #endif
1520 #if HAVE_STDLIB_H
1521 # include <stdlib.h>
1522 #endif
1523 #if HAVE_UNISTD_H
1524 # include <unistd.h>
1525 #endif
1526
1527 #include <sys/types.h>
1528 #if TIME_WITH_SYS_TIME
1529 # include <sys/time.h>
1530 # include <time.h>
1531 #else
1532 # if HAVE_SYS_TIME_H
1533 #  include <sys/time.h>
1534 # else
1535 #  include <time.h>
1536 # endif
1537 #endif
1538
1539 #if HAVE_UTMP_H
1540 # include <utmp.h>
1541 #endif
1542
1543 #if HAVE_GRP_H
1544 # include <grp.h>
1545 #endif
1546
1547 #if HAVE_PWD_H
1548 # include <pwd.h>
1549 #endif
1550 '
1551
1552   AC_CHECK_DECLS([
1553     free,
1554     getenv,
1555     geteuid,
1556     getgrgid,
1557     getlogin,
1558     getpwuid,
1559     getuid,
1560     getutent,
1561     lseek,
1562     malloc,
1563     memchr,
1564     memrchr,
1565     nanosleep,
1566     realloc,
1567     stpcpy,
1568     strndup,
1569     strnlen,
1570     strstr,
1571     strtoul,
1572     strtoull,
1573     ttyname], , , $headers)
1574 ])
1575
1576 dnl FIXME: when autoconf has support for it.
1577 dnl This is a little helper so we can require these header checks.
1578 AC_DEFUN([_jm_DECL_HEADERS],
1579 [
1580   AC_REQUIRE([AC_HEADER_STDC])
1581   AC_CHECK_HEADERS(grp.h memory.h pwd.h string.h strings.h stdlib.h \
1582                    unistd.h sys/time.h utmp.h utmpx.h)
1583 ])
1584
1585 #serial 35
1586
1587 dnl We use jm_ for non Autoconf macros.
1588 m4_pattern_forbid([^jm_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
1589 m4_pattern_forbid([^gl_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
1590
1591 # These are the prerequisite macros for files in the lib/
1592 # directory of the coreutils package.
1593
1594 AC_DEFUN([jm_PREREQ],
1595 [
1596   # We don't yet use c-stack.c.
1597   # AC_REQUIRE([gl_C_STACK])
1598
1599   AC_REQUIRE([AM_FUNC_GETLINE])
1600   AC_REQUIRE([AM_STDBOOL_H])
1601   AC_REQUIRE([UTILS_FUNC_MKDIR_TRAILING_SLASH])
1602   AC_REQUIRE([UTILS_FUNC_MKSTEMP])
1603   AC_REQUIRE([gl_BACKUPFILE])
1604   AC_REQUIRE([gl_CANON_HOST])
1605   AC_REQUIRE([gl_CLOSEOUT])
1606   AC_REQUIRE([gl_DIRNAME])
1607   AC_REQUIRE([gl_ERROR])
1608   AC_REQUIRE([gl_EXCLUDE])
1609   AC_REQUIRE([gl_EXITFAIL])
1610   AC_REQUIRE([gl_FILEBLOCKS])
1611   AC_REQUIRE([gl_FILEMODE])
1612   AC_REQUIRE([gl_FILE_TYPE])
1613   AC_REQUIRE([gl_FSUSAGE])
1614   AC_REQUIRE([gl_FUNC_ALLOCA])
1615   AC_REQUIRE([gl_FUNC_ATEXIT])
1616   AC_REQUIRE([gl_FUNC_DUP2])
1617   AC_REQUIRE([gl_FUNC_EUIDACCESS])
1618   AC_REQUIRE([gl_FUNC_FNMATCH_GNU])
1619   AC_REQUIRE([gl_FUNC_GETHOSTNAME])
1620   AC_REQUIRE([gl_FUNC_GETLOADAVG])
1621   AC_REQUIRE([gl_FUNC_GETPASS])
1622   AC_REQUIRE([gl_FUNC_GETUSERSHELL])
1623   AC_REQUIRE([gl_FUNC_MEMCHR])
1624   AC_REQUIRE([gl_FUNC_MEMCPY])
1625   AC_REQUIRE([gl_FUNC_MEMMOVE])
1626   AC_REQUIRE([gl_FUNC_MEMRCHR])
1627   AC_REQUIRE([gl_FUNC_MEMSET])
1628   AC_REQUIRE([gl_FUNC_MKTIME])
1629   AC_REQUIRE([gl_FUNC_READLINK])
1630   AC_REQUIRE([gl_FUNC_RMDIR])
1631   AC_REQUIRE([gl_FUNC_RPMATCH])
1632   AC_REQUIRE([gl_FUNC_SIG2STR])
1633   AC_REQUIRE([gl_FUNC_STPCPY])
1634   AC_REQUIRE([gl_FUNC_STRCSPN])
1635   AC_REQUIRE([gl_FUNC_STRDUP])
1636   AC_REQUIRE([gl_FUNC_STRNDUP])
1637   AC_REQUIRE([gl_FUNC_STRNLEN])
1638   AC_REQUIRE([gl_FUNC_STRPBRK])
1639   AC_REQUIRE([gl_FUNC_STRSTR])
1640   AC_REQUIRE([gl_FUNC_STRTOD])
1641   AC_REQUIRE([gl_FUNC_STRTOIMAX])
1642   AC_REQUIRE([gl_FUNC_STRTOLL])
1643   AC_REQUIRE([gl_FUNC_STRTOL])
1644   AC_REQUIRE([gl_FUNC_STRTOULL])
1645   AC_REQUIRE([gl_FUNC_STRTOUL])
1646   AC_REQUIRE([gl_FUNC_STRTOUMAX])
1647   AC_REQUIRE([gl_FUNC_STRVERSCMP])
1648   AC_REQUIRE([gl_FUNC_VASNPRINTF])
1649   AC_REQUIRE([gl_FUNC_VASPRINTF])
1650   AC_REQUIRE([gl_GETDATE])
1651   AC_REQUIRE([gl_GETNDELIM2])
1652   AC_REQUIRE([gl_GETOPT])
1653   AC_REQUIRE([gl_GETPAGESIZE])
1654   AC_REQUIRE([gl_HARD_LOCALE])
1655   AC_REQUIRE([gl_HASH])
1656   AC_REQUIRE([gl_HUMAN])
1657   AC_REQUIRE([gl_MBSWIDTH])
1658   AC_REQUIRE([gl_MEMCOLL])
1659   AC_REQUIRE([gl_MODECHANGE])
1660   AC_REQUIRE([gl_MOUNTLIST])
1661   AC_REQUIRE([gl_OBSTACK])
1662   AC_REQUIRE([gl_PATHMAX])
1663   AC_REQUIRE([gl_PATH_CONCAT])
1664   AC_REQUIRE([gl_PHYSMEM])
1665   AC_REQUIRE([gl_POSIXTM])
1666   AC_REQUIRE([gl_POSIXVER])
1667   AC_REQUIRE([gl_QUOTEARG])
1668   AC_REQUIRE([gl_QUOTE])
1669   AC_REQUIRE([gl_READUTMP])
1670   AC_REQUIRE([gl_REGEX])
1671   AC_REQUIRE([gl_SAFE_READ])
1672   AC_REQUIRE([gl_SAFE_WRITE])
1673   AC_REQUIRE([gl_SAME])
1674   AC_REQUIRE([gl_SAVEDIR])
1675   AC_REQUIRE([gl_SAVE_CWD])
1676   AC_REQUIRE([gl_SETTIME])
1677   AC_REQUIRE([gl_SHA])
1678   AC_REQUIRE([gl_STDIO_SAFER])
1679   AC_REQUIRE([gl_STRCASE])
1680   AC_REQUIRE([gl_TIMESPEC])
1681   AC_REQUIRE([gl_UNICODEIO])
1682   AC_REQUIRE([gl_UNISTD_SAFER])
1683   AC_REQUIRE([gl_USERSPEC])
1684   AC_REQUIRE([gl_UTIMENS])
1685   AC_REQUIRE([gl_XALLOC])
1686   AC_REQUIRE([gl_XGETCWD])
1687   AC_REQUIRE([gl_XREADLINK])
1688   AC_REQUIRE([gl_XSTRTOD])
1689   AC_REQUIRE([gl_XSTRTOL])
1690   AC_REQUIRE([gl_YESNO])
1691   AC_REQUIRE([jm_FUNC_GLIBC_UNLOCKED_IO])
1692   AC_REQUIRE([jm_FUNC_GNU_STRFTIME])
1693   AC_REQUIRE([jm_FUNC_LSTAT])
1694   AC_REQUIRE([jm_FUNC_MALLOC])
1695   AC_REQUIRE([jm_FUNC_MEMCMP])
1696   AC_REQUIRE([jm_FUNC_NANOSLEEP])
1697   AC_REQUIRE([jm_FUNC_PUTENV])
1698   AC_REQUIRE([jm_FUNC_REALLOC])
1699   AC_REQUIRE([jm_FUNC_STAT])
1700   AC_REQUIRE([jm_FUNC_UTIME])
1701   AC_REQUIRE([jm_PREREQ_ADDEXT])
1702   AC_REQUIRE([jm_PREREQ_STAT])
1703   AC_REQUIRE([jm_XSTRTOIMAX])
1704   AC_REQUIRE([jm_XSTRTOUMAX])
1705   AC_REQUIRE([vb_FUNC_RENAME])
1706 ])
1707
1708 AC_DEFUN([jm_PREREQ_ADDEXT],
1709 [
1710   dnl For addext.c.
1711   AC_REQUIRE([AC_SYS_LONG_FILE_NAMES])
1712   AC_CHECK_FUNCS(pathconf)
1713   AC_CHECK_HEADERS(limits.h string.h unistd.h)
1714 ])
1715
1716 AC_DEFUN([jm_PREREQ_STAT],
1717 [
1718   AC_CHECK_HEADERS(sys/sysmacros.h sys/statvfs.h sys/vfs.h inttypes.h)
1719   AC_CHECK_HEADERS(sys/param.h sys/mount.h)
1720   AC_CHECK_FUNCS(statvfs)
1721
1722   # For `struct statfs' on Ultrix 4.4.
1723   AC_CHECK_HEADERS([netinet/in.h nfs/nfs_clnt.h nfs/vfs.h],,,
1724     [AC_INCLUDES_DEFAULT])
1725
1726   AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
1727
1728   statxfs_includes="\
1729 $ac_includes_default
1730 #if HAVE_SYS_STATVFS_H
1731 # include <sys/statvfs.h>
1732 #endif
1733 #if HAVE_SYS_VFS_H
1734 # include <sys/vfs.h>
1735 #endif
1736 #if !HAVE_SYS_STATVFS_H && !HAVE_SYS_VFS_H
1737 # if HAVE_SYS_MOUNT_H && HAVE_SYS_PARAM_H
1738 /* NetBSD 1.5.2 needs these, for the declaration of struct statfs. */
1739 #  include <sys/param.h>
1740 #  include <sys/mount.h>
1741 # elif HAVE_NETINET_IN_H && HAVE_NFS_NFS_CLNT_H && HAVE_NFS_VFS_H
1742 /* Ultrix 4.4 needs these for the declaration of struct statfs.  */
1743 #  include <netinet/in.h>
1744 #  include <nfs/nfs_clnt.h>
1745 #  include <nfs/vfs.h>
1746 # endif
1747 #endif
1748 "
1749   AC_CHECK_MEMBERS([struct statfs.f_basetype],,,[$statxfs_includes])
1750   AC_CHECK_MEMBERS([struct statvfs.f_basetype],,,[$statxfs_includes])
1751   AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$statxfs_includes])
1752   AC_CHECK_MEMBERS([struct statfs.f_type],,,[$statxfs_includes])
1753   AC_CHECK_MEMBERS([struct statvfs.f_type],,,[$statxfs_includes])
1754   AC_CHECK_MEMBERS([struct statfs.f_fsid.__val],,,[$statxfs_includes])
1755   AC_CHECK_MEMBERS([struct statvfs.f_fsid.__val],,,[$statxfs_includes])
1756   AC_CHECK_MEMBERS([struct statfs.f_namemax],,,[$statxfs_includes])
1757   AC_CHECK_MEMBERS([struct statvfs.f_namemax],,,[$statxfs_includes])
1758   AC_CHECK_MEMBERS([struct statfs.f_namelen],,,[$statxfs_includes])
1759   AC_CHECK_MEMBERS([struct statvfs.f_namelen],,,[$statxfs_includes])
1760 ])
1761
1762 # getline.m4 serial 9
1763
1764 dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software
1765 dnl Foundation, Inc.
1766
1767 dnl This file is free software, distributed under the terms of the GNU
1768 dnl General Public License.  As a special exception to the GNU General
1769 dnl Public License, this file may be distributed as part of a program
1770 dnl that contains a configuration script generated by Autoconf, under
1771 dnl the same distribution terms as the rest of that program.
1772
1773 AC_PREREQ(2.52)
1774
1775 dnl See if there's a working, system-supplied version of the getline function.
1776 dnl We can't just do AC_REPLACE_FUNCS(getline) because some systems
1777 dnl have a function by that name in -linet that doesn't have anything
1778 dnl to do with the function we need.
1779 AC_DEFUN([AM_FUNC_GETLINE],
1780 [
1781   dnl Persuade glibc <stdio.h> to declare getline() and getdelim().
1782   AC_REQUIRE([AC_GNU_SOURCE])
1783
1784   am_getline_needs_run_time_check=no
1785   AC_CHECK_FUNC(getline,
1786                 dnl Found it in some library.  Verify that it works.
1787                 am_getline_needs_run_time_check=yes,
1788                 am_cv_func_working_getline=no)
1789   if test $am_getline_needs_run_time_check = yes; then
1790     AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline,
1791     [echo fooN |tr -d '\012'|tr N '\012' > conftest.data
1792     AC_TRY_RUN([
1793 #    include <stdio.h>
1794 #    include <stdlib.h>
1795 #    include <string.h>
1796     int main ()
1797     { /* Based on a test program from Karl Heuer.  */
1798       char *line = NULL;
1799       size_t siz = 0;
1800       int len;
1801       FILE *in = fopen ("./conftest.data", "r");
1802       if (!in)
1803         return 1;
1804       len = getline (&line, &siz, in);
1805       exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1);
1806     }
1807     ], am_cv_func_working_getline=yes dnl The library version works.
1808     , am_cv_func_working_getline=no dnl The library version does NOT work.
1809     , am_cv_func_working_getline=no dnl We're cross compiling.
1810     )])
1811   fi
1812
1813   if test $am_cv_func_working_getline = no; then
1814     dnl We must choose a different name for our function, since on ELF systems
1815     dnl a broken getline() in libc.so would override our getline() in
1816     dnl libgettextlib.so.
1817     AC_DEFINE([getline], [gnu_getline],
1818       [Define to a replacement function name for getline().])
1819     AC_LIBOBJ(getline)
1820     AC_LIBOBJ(getndelim2)
1821     gl_PREREQ_GETLINE
1822     gl_PREREQ_GETNDELIM2
1823   fi
1824 ])
1825
1826 # Prerequisites of lib/getline.c.
1827 AC_DEFUN([gl_PREREQ_GETLINE],
1828 [
1829   AC_CHECK_FUNCS(getdelim)
1830 ])
1831
1832 # getndelim2.m4 serial 1
1833 dnl Copyright (C) 2003 Free Software Foundation, Inc.
1834 dnl This file is free software, distributed under the terms of the GNU
1835 dnl General Public License.  As a special exception to the GNU General
1836 dnl Public License, this file may be distributed as part of a program
1837 dnl that contains a configuration script generated by Autoconf, under
1838 dnl the same distribution terms as the rest of that program.
1839
1840 AC_DEFUN([gl_GETNDELIM2],
1841 [
1842   AC_LIBOBJ(getndelim2)
1843   gl_PREREQ_GETNDELIM2
1844 ])
1845
1846 # Prerequisites of lib/getndelim2.h and lib/getndelim2.c.
1847 AC_DEFUN([gl_PREREQ_GETNDELIM2],
1848 [
1849   dnl Prerequisites of lib/getndelim2.h.
1850   AC_REQUIRE([gt_TYPE_SSIZE_T])
1851   dnl Prerequisites of lib/getndelim2.c.
1852   AC_REQUIRE([AC_HEADER_STDC])
1853 ])
1854
1855 # ssize_t.m4 serial 3 (gettext-0.12.2)
1856 dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
1857 dnl This file is free software, distributed under the terms of the GNU
1858 dnl General Public License.  As a special exception to the GNU General
1859 dnl Public License, this file may be distributed as part of a program
1860 dnl that contains a configuration script generated by Autoconf, under
1861 dnl the same distribution terms as the rest of that program.
1862
1863 dnl From Bruno Haible.
1864 dnl Test whether ssize_t is defined.
1865
1866 AC_DEFUN([gt_TYPE_SSIZE_T],
1867 [
1868   AC_CACHE_CHECK([for ssize_t], gt_cv_ssize_t,
1869     [AC_TRY_COMPILE([#include <sys/types.h>],
1870        [int x = sizeof (ssize_t *) + sizeof (ssize_t);],
1871        gt_cv_ssize_t=yes, gt_cv_ssize_t=no)])
1872   if test $gt_cv_ssize_t = no; then
1873     AC_DEFINE(ssize_t, int,
1874               [Define as a signed type of the same size as size_t.])
1875   fi
1876 ])
1877
1878 # Check for stdbool.h that conforms to C99.
1879
1880 # Copyright (C) 2002-2003 Free Software Foundation, Inc.
1881
1882 # This program is free software; you can redistribute it and/or modify
1883 # it under the terms of the GNU General Public License as published by
1884 # the Free Software Foundation; either version 2, or (at your option)
1885 # any later version.
1886
1887 # This program is distributed in the hope that it will be useful,
1888 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1889 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1890 # GNU General Public License for more details.
1891
1892 # You should have received a copy of the GNU General Public License
1893 # along with this program; if not, write to the Free Software
1894 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1895 # 02111-1307, USA.
1896
1897 # Prepare for substituting <stdbool.h> if it is not supported.
1898
1899 AC_DEFUN([AM_STDBOOL_H],
1900 [
1901   AC_REQUIRE([AC_HEADER_STDBOOL])
1902
1903   # Define two additional variables used in the Makefile substitution.
1904
1905   if test "$ac_cv_header_stdbool_h" = yes; then
1906     STDBOOL_H=''
1907   else
1908     STDBOOL_H='stdbool.h'
1909   fi
1910   AC_SUBST([STDBOOL_H])
1911
1912   if test "$ac_cv_type__Bool" = yes; then
1913     HAVE__BOOL=1
1914   else
1915     HAVE__BOOL=0
1916   fi
1917   AC_SUBST([HAVE__BOOL])
1918 ])
1919
1920 # This macro is only needed in autoconf <= 2.54.  Newer versions of autoconf
1921 # have this macro built-in.
1922
1923 AC_DEFUN([AC_HEADER_STDBOOL],
1924   [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
1925      [ac_cv_header_stdbool_h],
1926      [AC_TRY_COMPILE(
1927         [
1928           #include <stdbool.h>
1929           #ifndef bool
1930            "error: bool is not defined"
1931           #endif
1932           #ifndef false
1933            "error: false is not defined"
1934           #endif
1935           #if false
1936            "error: false is not 0"
1937           #endif
1938           #ifndef true
1939            "error: false is not defined"
1940           #endif
1941           #if true != 1
1942            "error: true is not 1"
1943           #endif
1944           #ifndef __bool_true_false_are_defined
1945            "error: __bool_true_false_are_defined is not defined"
1946           #endif
1947
1948           struct s { _Bool s: 1; _Bool t; } s;
1949
1950           char a[true == 1 ? 1 : -1];
1951           char b[false == 0 ? 1 : -1];
1952           char c[__bool_true_false_are_defined == 1 ? 1 : -1];
1953           char d[(bool) -0.5 == true ? 1 : -1];
1954           bool e = &s;
1955           char f[(_Bool) -0.0 == false ? 1 : -1];
1956           char g[true];
1957           char h[sizeof (_Bool)];
1958           char i[sizeof s.t];
1959         ],
1960         [ return !a + !b + !c + !d + !e + !f + !g + !h + !i; ],
1961         [ac_cv_header_stdbool_h=yes],
1962         [ac_cv_header_stdbool_h=no])])
1963    AC_CHECK_TYPES([_Bool])
1964    if test $ac_cv_header_stdbool_h = yes; then
1965      AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.])
1966    fi])
1967
1968 #serial 2
1969
1970 # On some systems, mkdir ("foo/", 0700) fails because of the trailing slash.
1971 # On such systems, arrange to use a wrapper function that removes any
1972 # trailing slashes.
1973 AC_DEFUN([UTILS_FUNC_MKDIR_TRAILING_SLASH],
1974 [dnl
1975   AC_CACHE_CHECK([whether mkdir fails due to a trailing slash],
1976     utils_cv_func_mkdir_trailing_slash_bug,
1977     [
1978       # Arrange for deletion of the temporary directory this test might create.
1979       ac_clean_files="$ac_clean_files confdir-slash"
1980       AC_TRY_RUN([
1981 #       include <sys/types.h>
1982 #       include <sys/stat.h>
1983 #       include <stdlib.h>
1984         int main ()
1985         {
1986           rmdir ("confdir-slash");
1987           exit (mkdir ("confdir-slash/", 0700));
1988         }
1989         ],
1990       utils_cv_func_mkdir_trailing_slash_bug=no,
1991       utils_cv_func_mkdir_trailing_slash_bug=yes,
1992       utils_cv_func_mkdir_trailing_slash_bug=yes
1993       )
1994     ]
1995   )
1996
1997   if test $utils_cv_func_mkdir_trailing_slash_bug = yes; then
1998     AC_LIBOBJ(mkdir)
1999     AC_DEFINE(mkdir, rpl_mkdir,
2000       [Define to rpl_mkdir if the replacement function should be used.])
2001     gl_PREREQ_MKDIR
2002   fi
2003 ])
2004
2005 # Prerequisites of lib/mkdir.c.
2006 AC_DEFUN([gl_PREREQ_MKDIR],
2007 [
2008   AC_CHECK_HEADERS_ONCE(stdlib.h string.h)
2009   AC_CHECK_DECLS_ONCE(free)
2010 ])
2011
2012 #serial 4
2013
2014 # On some hosts (e.g., HP-UX 10.20, SunOS 4.1.4, Solaris 2.5.1), mkstemp has a
2015 # silly limit that it can create no more than 26 files from a given template.
2016 # Other systems lack mkstemp altogether.
2017 # On OSF1/Tru64 V4.0F, the system-provided mkstemp function can create
2018 # only 32 files per process.
2019 # On systems like the above, arrange to use the replacement function.
2020 AC_DEFUN([UTILS_FUNC_MKSTEMP],
2021 [dnl
2022   AC_REPLACE_FUNCS(mkstemp)
2023   if test $ac_cv_func_mkstemp = no; then
2024     utils_cv_func_mkstemp_limitations=yes
2025   else
2026     AC_CACHE_CHECK([for mkstemp limitations],
2027       utils_cv_func_mkstemp_limitations,
2028       [
2029         AC_TRY_RUN([
2030 #         include <stdlib.h>
2031           int main ()
2032           {
2033             int i;
2034             for (i = 0; i < 70; i++)
2035               {
2036                 char template[] = "conftestXXXXXX";
2037                 int fd = mkstemp (template);
2038                 if (fd == -1)
2039                   exit (1);
2040                 close (fd);
2041               }
2042             exit (0);
2043           }
2044           ],
2045         utils_cv_func_mkstemp_limitations=no,
2046         utils_cv_func_mkstemp_limitations=yes,
2047         utils_cv_func_mkstemp_limitations=yes
2048         )
2049       ]
2050     )
2051   fi
2052
2053   if test $utils_cv_func_mkstemp_limitations = yes; then
2054     AC_LIBOBJ(mkstemp)
2055     AC_LIBOBJ(tempname)
2056     AC_DEFINE(mkstemp, rpl_mkstemp,
2057       [Define to rpl_mkstemp if the replacement function should be used.])
2058     gl_PREREQ_MKSTEMP
2059     jm_PREREQ_TEMPNAME
2060   fi
2061 ])
2062
2063 # Prerequisites of lib/mkstemp.c.
2064 AC_DEFUN([gl_PREREQ_MKSTEMP],
2065 [
2066 ])
2067
2068 # Prerequisites of lib/tempname.c.
2069 AC_DEFUN([jm_PREREQ_TEMPNAME],
2070 [
2071   AC_REQUIRE([AC_HEADER_STDC])
2072   AC_REQUIRE([AC_HEADER_STAT])
2073   AC_CHECK_HEADERS_ONCE(fcntl.h sys/time.h unistd.h)
2074   AC_CHECK_HEADERS(stdint.h)
2075   AC_CHECK_FUNCS(__secure_getenv gettimeofday)
2076   AC_CHECK_DECLS_ONCE(getenv)
2077   AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
2078 ])
2079
2080 # uintmax_t.m4 serial 7 (gettext-0.12)
2081 dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
2082 dnl This file is free software, distributed under the terms of the GNU
2083 dnl General Public License.  As a special exception to the GNU General
2084 dnl Public License, this file may be distributed as part of a program
2085 dnl that contains a configuration script generated by Autoconf, under
2086 dnl the same distribution terms as the rest of that program.
2087
2088 dnl From Paul Eggert.
2089
2090 AC_PREREQ(2.13)
2091
2092 # Define uintmax_t to 'unsigned long' or 'unsigned long long'
2093 # if it is not already defined in <stdint.h> or <inttypes.h>.
2094
2095 AC_DEFUN([jm_AC_TYPE_UINTMAX_T],
2096 [
2097   AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
2098   AC_REQUIRE([jm_AC_HEADER_STDINT_H])
2099   if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then
2100     AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
2101     test $ac_cv_type_unsigned_long_long = yes \
2102       && ac_type='unsigned long long' \
2103       || ac_type='unsigned long'
2104     AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
2105       [Define to unsigned long or unsigned long long
2106        if <stdint.h> and <inttypes.h> don't define.])
2107   else
2108     AC_DEFINE(HAVE_UINTMAX_T, 1,
2109       [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
2110   fi
2111 ])
2112
2113 # inttypes_h.m4 serial 5 (gettext-0.12)
2114 dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
2115 dnl This file is free software, distributed under the terms of the GNU
2116 dnl General Public License.  As a special exception to the GNU General
2117 dnl Public License, this file may be distributed as part of a program
2118 dnl that contains a configuration script generated by Autoconf, under
2119 dnl the same distribution terms as the rest of that program.
2120
2121 dnl From Paul Eggert.
2122
2123 # Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
2124 # doesn't clash with <sys/types.h>, and declares uintmax_t.
2125
2126 AC_DEFUN([jm_AC_HEADER_INTTYPES_H],
2127 [
2128   AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
2129   [AC_TRY_COMPILE(
2130     [#include <sys/types.h>
2131 #include <inttypes.h>],
2132     [uintmax_t i = (uintmax_t) -1;],
2133     jm_ac_cv_header_inttypes_h=yes,
2134     jm_ac_cv_header_inttypes_h=no)])
2135   if test $jm_ac_cv_header_inttypes_h = yes; then
2136     AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
2137       [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
2138        and declares uintmax_t. ])
2139   fi
2140 ])
2141
2142 # stdint_h.m4 serial 3 (gettext-0.12)
2143 dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
2144 dnl This file is free software, distributed under the terms of the GNU
2145 dnl General Public License.  As a special exception to the GNU General
2146 dnl Public License, this file may be distributed as part of a program
2147 dnl that contains a configuration script generated by Autoconf, under
2148 dnl the same distribution terms as the rest of that program.
2149
2150 dnl From Paul Eggert.
2151
2152 # Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
2153 # doesn't clash with <sys/types.h>, and declares uintmax_t.
2154
2155 AC_DEFUN([jm_AC_HEADER_STDINT_H],
2156 [
2157   AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h,
2158   [AC_TRY_COMPILE(
2159     [#include <sys/types.h>
2160 #include <stdint.h>],
2161     [uintmax_t i = (uintmax_t) -1;],
2162     jm_ac_cv_header_stdint_h=yes,
2163     jm_ac_cv_header_stdint_h=no)])
2164   if test $jm_ac_cv_header_stdint_h = yes; then
2165     AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
2166       [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
2167        and declares uintmax_t. ])
2168   fi
2169 ])
2170
2171 # ulonglong.m4 serial 3
2172 dnl Copyright (C) 1999-2003 Free Software Foundation, Inc.
2173 dnl This file is free software, distributed under the terms of the GNU
2174 dnl General Public License.  As a special exception to the GNU General
2175 dnl Public License, this file may be distributed as part of a program
2176 dnl that contains a configuration script generated by Autoconf, under
2177 dnl the same distribution terms as the rest of that program.
2178
2179 dnl From Paul Eggert.
2180
2181 # Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works.
2182
2183 AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
2184 [
2185   AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
2186   [AC_TRY_LINK([unsigned long long ull = 1ULL; int i = 63;],
2187     [unsigned long long ullmax = (unsigned long long) -1;
2188      return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
2189     ac_cv_type_unsigned_long_long=yes,
2190     ac_cv_type_unsigned_long_long=no)])
2191   if test $ac_cv_type_unsigned_long_long = yes; then
2192     AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
2193       [Define if you have the 'unsigned long long' type.])
2194   fi
2195 ])
2196
2197 # backupfile.m4 serial 2
2198 dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
2199 dnl This file is free software, distributed under the terms of the GNU
2200 dnl General Public License.  As a special exception to the GNU General
2201 dnl Public License, this file may be distributed as part of a program
2202 dnl that contains a configuration script generated by Autoconf, under
2203 dnl the same distribution terms as the rest of that program.
2204
2205 AC_DEFUN([gl_BACKUPFILE],
2206 [
2207   dnl Prerequisites of lib/backupfile.c.
2208   AC_REQUIRE([AC_HEADER_DIRENT])
2209   AC_REQUIRE([AC_FUNC_CLOSEDIR_VOID])
2210   AC_CHECK_HEADERS_ONCE(stdlib.h string.h)
2211   AC_CHECK_DECLS_ONCE(getenv malloc)
2212   jm_CHECK_TYPE_STRUCT_DIRENT_D_INO
2213
2214   dnl Prerequisites of lib/addext.c.
2215   AC_REQUIRE([jm_AC_DOS])
2216   AC_SYS_LONG_FILE_NAMES
2217   AC_CHECK_HEADERS_ONCE(string.h unistd.h)
2218   AC_CHECK_FUNCS(pathconf)
2219 ])
2220
2221 #serial 5
2222
2223 # Define some macros required for proper operation of code in lib/*.c
2224 # on MSDOS/Windows systems.
2225
2226 # From Jim Meyering.
2227
2228 AC_DEFUN([jm_AC_DOS],
2229   [
2230     AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos],
2231       [
2232         AC_TRY_COMPILE([],
2233         [#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__
2234 neither MSDOS nor Windows
2235 #endif],
2236         [ac_cv_win_or_dos=yes],
2237         [ac_cv_win_or_dos=no])
2238       ])
2239
2240     if test x"$ac_cv_win_or_dos" = xyes; then
2241       ac_fs_accepts_drive_letter_prefix=1
2242       ac_fs_backslash_is_file_name_separator=1
2243     else
2244       ac_fs_accepts_drive_letter_prefix=0
2245       ac_fs_backslash_is_file_name_separator=0
2246     fi
2247
2248     AH_VERBATIM(FILESYSTEM_PREFIX_LEN,
2249     [#if FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
2250 # define FILESYSTEM_PREFIX_LEN(Filename) \
2251   ((Filename)[0] && (Filename)[1] == ':' ? 2 : 0)
2252 #else
2253 # define FILESYSTEM_PREFIX_LEN(Filename) 0
2254 #endif])
2255
2256     AC_DEFINE_UNQUOTED([FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
2257       $ac_fs_accepts_drive_letter_prefix,
2258       [Define on systems for which file names may have a so-called
2259        `drive letter' prefix, define this to compute the length of that
2260        prefix, including the colon.])
2261
2262     AH_VERBATIM(ISSLASH,
2263     [#if FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
2264 # define ISSLASH(C) ((C) == '/' || (C) == '\\')
2265 #else
2266 # define ISSLASH(C) ((C) == '/')
2267 #endif])
2268
2269     AC_DEFINE_UNQUOTED([FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR],
2270       $ac_fs_backslash_is_file_name_separator,
2271       [Define if the backslash character may also serve as a file name
2272        component separator.])
2273   ])
2274
2275 # canon-host.m4 serial 2
2276 dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
2277 dnl This file is free software, distributed under the terms of the GNU
2278 dnl General Public License.  As a special exception to the GNU General
2279 dnl Public License, this file may be distributed as part of a program
2280 dnl that contains a configuration script generated by Autoconf, under
2281 dnl the same distribution terms as the rest of that program.
2282
2283 AC_DEFUN([gl_CANON_HOST],
2284 [
2285   dnl Prerequisites of lib/canon-host.c.
2286   AC_CHECK_HEADERS_ONCE(stdlib.h string.h unistd.h)
2287   AC_CHECK_HEADERS(netdb.h sys/socket.h netinet/in.h arpa/inet.h)
2288
2289   dnl Add any libraries as early as possible.
2290   dnl In particular, inet_ntoa needs -lnsl at least on Solaris 2.5.1,
2291   dnl so we have to add -lnsl to LIBS before checking for that function.
2292   AC_SEARCH_LIBS(gethostbyname, [inet nsl])
2293
2294   dnl These come from -lnsl on Solaris 2.5.1.
2295   AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
2296 ])
2297
2298 #serial 5
2299
2300 dnl A replacement for autoconf's macro by the same name.  This version
2301 dnl uses `ac_lib' rather than `i' for the loop variable, but more importantly
2302 dnl moves the ACTION-IF-FOUND ([$]3) into the inner `if'-block so that it is
2303 dnl run only if one of the listed libraries ends up being used (and not in
2304 dnl the `none required' case.
2305 dnl I hope it's only temporary while we wait for that version to be fixed.
2306 undefine([AC_SEARCH_LIBS])
2307
2308 # AC_SEARCH_LIBS(FUNCTION, SEARCH-LIBS,
2309 #                [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
2310 #                [OTHER-LIBRARIES])
2311 # --------------------------------------------------------
2312 # Search for a library defining FUNC, if it's not already available.
2313 AC_DEFUN([AC_SEARCH_LIBS],
2314 [
2315   AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1],
2316   [
2317     ac_func_search_save_LIBS=$LIBS
2318     ac_cv_search_$1=no
2319     AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1='none required'])
2320     if test "$ac_cv_search_$1" = no; then
2321       for ac_lib in $2; do
2322         LIBS="-l$ac_lib $5 $ac_func_search_save_LIBS"
2323         AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="-l$ac_lib"; break])
2324       done
2325     fi
2326     LIBS=$ac_func_search_save_LIBS
2327   ])
2328
2329   if test "$ac_cv_search_$1" = no; then :
2330     $4
2331   else
2332     if test "$ac_cv_search_$1" = 'none required'; then :
2333       $4
2334     else
2335       LIBS="$ac_cv_search_$1 $LIBS"
2336       $3
2337     fi
2338   fi
2339 ])
2340
2341 # closeout.m4 serial 1
2342 dnl Copyright (C) 2002 Free Software Foundation, Inc.
2343 dnl This file is free software, distributed under the terms of the GNU
2344 dnl General Public License.  As a special exception to the GNU General
2345 dnl Public License, this file may be distributed as part of a program
2346 dnl that contains a configuration script generated by Autoconf, under
2347 dnl the same distribution terms as the rest of that program.
2348
2349 AC_DEFUN([gl_CLOSEOUT],
2350 [
2351   dnl Prerequisites of lib/closeout.c.
2352   AC_CHECK_HEADERS_ONCE(stdlib.h)
2353 ])
2354
2355 # dirname.m4 serial 1
2356 dnl Copyright (C) 2002 Free Software Foundation, Inc.
2357 dnl This file is free software, distributed under the terms of the GNU
2358 dnl General Public License.  As a special exception to the GNU General
2359 dnl Public License, this file may be distributed as part of a program
2360 dnl that contains a configuration script generated by Autoconf, under
2361 dnl the same distribution terms as the rest of that program.
2362
2363 AC_DEFUN([gl_DIRNAME],
2364 [
2365   dnl Prerequisites of lib/dirname.h.
2366   AC_REQUIRE([jm_AC_DOS])
2367
2368   dnl Prerequisites of lib/dirname.c.
2369   AC_REQUIRE([AC_HEADER_STDC])
2370   AC_CHECK_HEADERS_ONCE(string.h)
2371
2372   dnl Prerequisites of lib/basename.c.
2373   AC_REQUIRE([AC_HEADER_STDC])
2374   AC_CHECK_HEADERS_ONCE(string.h)
2375
2376   dnl Prerequisites of lib/stripslash.c.
2377   AC_REQUIRE([AC_HEADER_STDC])
2378   AC_CHECK_HEADERS_ONCE(string.h)
2379 ])
2380
2381 #serial 7
2382
2383 AC_DEFUN([gl_ERROR],
2384 [
2385   AC_FUNC_ERROR_AT_LINE
2386   dnl Note: AC_FUNC_ERROR_AT_LINE does AC_LIBSOURCES([error.h, error.c]).
2387   jm_PREREQ_ERROR
2388 ])
2389
2390 # Prerequisites of lib/error.c.
2391 AC_DEFUN([jm_PREREQ_ERROR],
2392 [
2393   AC_REQUIRE([AC_HEADER_STDC])
2394   AC_REQUIRE([AC_FUNC_VPRINTF])
2395   AC_CHECK_FUNCS(strerror)
2396   AC_CHECK_DECLS([strerror])
2397   AC_FUNC_STRERROR_R
2398 ])
2399
2400 # exclude.m4 serial 2
2401 dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
2402 dnl This file is free software, distributed under the terms of the GNU
2403 dnl General Public License.  As a special exception to the GNU General
2404 dnl Public License, this file may be distributed as part of a program
2405 dnl that contains a configuration script generated by Autoconf, under
2406 dnl the same distribution terms as the rest of that program.
2407
2408 AC_DEFUN([gl_EXCLUDE],
2409 [
2410   dnl Prerequisites of lib/exclude.c.
2411   AC_REQUIRE([AC_C_INLINE])
2412   AC_REQUIRE([AC_HEADER_STDC])
2413   AC_CHECK_HEADERS_ONCE(stdlib.h string.h strings.h)
2414   AC_CHECK_FUNCS_ONCE(isascii)
2415 ])
2416
2417 # exitfail.m4 serial 1
2418 dnl Copyright (C) 2002 Free Software Foundation, Inc.
2419 dnl This file is free software, distributed under the terms of the GNU
2420 dnl General Public License.  As a special exception to the GNU General
2421 dnl Public License, this file may be distributed as part of a program
2422 dnl that contains a configuration script generated by Autoconf, under
2423 dnl the same distribution terms as the rest of that program.
2424
2425 AC_DEFUN([gl_EXITFAIL],
2426 [
2427   dnl Prerequisites of lib/exitfail.c.
2428   AC_CHECK_HEADERS_ONCE(stdlib.h)
2429 ])
2430
2431 # fileblocks.m4 serial 1
2432 dnl Copyright (C) 2002 Free Software Foundation, Inc.
2433 dnl This file is free software, distributed under the terms of the GNU
2434 dnl General Public License.  As a special exception to the GNU General
2435 dnl Public License, this file may be distributed as part of a program
2436 dnl that contains a configuration script generated by Autoconf, under
2437 dnl the same distribution terms as the rest of that program.
2438
2439 AC_DEFUN([gl_FILEBLOCKS],
2440 [
2441   AC_STRUCT_ST_BLOCKS
2442   dnl Note: AC_STRUCT_ST_BLOCKS does AC_LIBOBJ(fileblocks).
2443   if test $ac_cv_member_struct_stat_st_blocks = no; then
2444     gl_PREREQ_FILEBLOCKS
2445   fi
2446 ])
2447
2448 # Prerequisites of lib/fileblocks.c.
2449 AC_DEFUN([gl_PREREQ_FILEBLOCKS], [
2450   AC_CHECK_HEADERS_ONCE(sys/param.h unistd.h)
2451 ])
2452
2453 # filemode.m4 serial 1
2454 dnl Copyright (C) 2002 Free Software Foundation, Inc.
2455 dnl This file is free software, distributed under the terms of the GNU
2456 dnl General Public License.  As a special exception to the GNU General
2457 dnl Public License, this file may be distributed as part of a program
2458 dnl that contains a configuration script generated by Autoconf, under
2459 dnl the same distribution terms as the rest of that program.
2460
2461 AC_DEFUN([gl_FILEMODE],
2462 [
2463   dnl Prerequisites of lib/filemode.c.
2464   AC_REQUIRE([AC_HEADER_STAT])
2465 ])
2466
2467 # file-type.m4 serial 1
2468 dnl Copyright (C) 2002 Free Software Foundation, Inc.
2469 dnl This file is free software, distributed under the terms of the GNU
2470 dnl General Public License.  As a special exception to the GNU General
2471 dnl Public License, this file may be distributed as part of a program
2472 dnl that contains a configuration script generated by Autoconf, under
2473 dnl the same distribution terms as the rest of that program.
2474
2475 AC_DEFUN([gl_FILE_TYPE],
2476 [
2477   dnl Prerequisites of lib/file-type.h.
2478   AC_REQUIRE([AC_HEADER_STAT])
2479 ])
2480
2481 #serial 11
2482
2483 # From fileutils/configure.in
2484
2485 AC_DEFUN([gl_FSUSAGE],
2486 [
2487   AC_CHECK_HEADERS_ONCE(sys/param.h)
2488   AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs_types.h)
2489   jm_FILE_SYSTEM_USAGE([gl_cv_fs_space=yes], [gl_cv_fs_space=no])
2490   if test $gl_cv_fs_space = yes; then
2491     AC_LIBOBJ(fsusage)
2492     gl_PREREQ_FSUSAGE_EXTRA
2493   fi
2494 ])
2495
2496 # Try to determine how a program can obtain filesystem usage information.
2497 # If successful, define the appropriate symbol (see fsusage.c) and
2498 # execute ACTION-IF-FOUND.  Otherwise, execute ACTION-IF-NOT-FOUND.
2499 #
2500 # jm_FILE_SYSTEM_USAGE([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
2501
2502 AC_DEFUN([jm_FILE_SYSTEM_USAGE],
2503 [
2504
2505 echo "checking how to get filesystem space usage..."
2506 ac_fsusage_space=no
2507
2508 # Perform only the link test since it seems there are no variants of the
2509 # statvfs function.  This check is more than just AC_CHECK_FUNCS(statvfs)
2510 # because that got a false positive on SCO OSR5.  Adding the declaration
2511 # of a `struct statvfs' causes this test to fail (as it should) on such
2512 # systems.  That system is reported to work fine with STAT_STATFS4 which
2513 # is what it gets when this test fails.
2514 if test $ac_fsusage_space = no; then
2515   # SVR4
2516   AC_CACHE_CHECK([for statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
2517                  [AC_TRY_LINK([#include <sys/types.h>
2518 #ifdef __GLIBC__
2519 Do not use statvfs on systems with GNU libc, because that function stats
2520 all preceding entries in /proc/mounts, and that makes df hang if even
2521 one of the corresponding file systems is hard-mounted, but not available.
2522 #endif
2523 #include <sys/statvfs.h>],
2524                               [struct statvfs fsd; statvfs (0, &fsd);],
2525                               fu_cv_sys_stat_statvfs=yes,
2526                               fu_cv_sys_stat_statvfs=no)])
2527   if test $fu_cv_sys_stat_statvfs = yes; then
2528     ac_fsusage_space=yes
2529     AC_DEFINE(STAT_STATVFS, 1,
2530               [  Define if there is a function named statvfs.  (SVR4)])
2531   fi
2532 fi
2533
2534 if test $ac_fsusage_space = no; then
2535   # DEC Alpha running OSF/1
2536   AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
2537   AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
2538   [AC_TRY_RUN([
2539 #include <sys/param.h>
2540 #include <sys/types.h>
2541 #include <sys/mount.h>
2542   main ()
2543   {
2544     struct statfs fsd;
2545     fsd.f_fsize = 0;
2546     exit (statfs (".", &fsd, sizeof (struct statfs)));
2547   }],
2548   fu_cv_sys_stat_statfs3_osf1=yes,
2549   fu_cv_sys_stat_statfs3_osf1=no,
2550   fu_cv_sys_stat_statfs3_osf1=no)])
2551   AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
2552   if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
2553     ac_fsusage_space=yes
2554     AC_DEFINE(STAT_STATFS3_OSF1, 1,
2555               [   Define if  statfs takes 3 args.  (DEC Alpha running OSF/1)])
2556   fi
2557 fi
2558
2559 if test $ac_fsusage_space = no; then
2560 # AIX
2561   AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
2562 member (AIX, 4.3BSD)])
2563   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
2564   [AC_TRY_RUN([
2565 #ifdef HAVE_SYS_PARAM_H
2566 #include <sys/param.h>
2567 #endif
2568 #ifdef HAVE_SYS_MOUNT_H
2569 #include <sys/mount.h>
2570 #endif
2571 #ifdef HAVE_SYS_VFS_H
2572 #include <sys/vfs.h>
2573 #endif
2574   main ()
2575   {
2576   struct statfs fsd;
2577   fsd.f_bsize = 0;
2578   exit (statfs (".", &fsd));
2579   }],
2580   fu_cv_sys_stat_statfs2_bsize=yes,
2581   fu_cv_sys_stat_statfs2_bsize=no,
2582   fu_cv_sys_stat_statfs2_bsize=no)])
2583   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
2584   if test $fu_cv_sys_stat_statfs2_bsize = yes; then
2585     ac_fsusage_space=yes
2586     AC_DEFINE(STAT_STATFS2_BSIZE, 1,
2587 [  Define if statfs takes 2 args and struct statfs has a field named f_bsize.
2588    (4.3BSD, SunOS 4, HP-UX, AIX PS/2)])
2589   fi
2590 fi
2591
2592 if test $ac_fsusage_space = no; then
2593 # SVR3
2594   AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
2595   AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
2596   [AC_TRY_RUN([#include <sys/types.h>
2597 #include <sys/statfs.h>
2598   main ()
2599   {
2600   struct statfs fsd;
2601   exit (statfs (".", &fsd, sizeof fsd, 0));
2602   }],
2603     fu_cv_sys_stat_statfs4=yes,
2604     fu_cv_sys_stat_statfs4=no,
2605     fu_cv_sys_stat_statfs4=no)])
2606   AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
2607   if test $fu_cv_sys_stat_statfs4 = yes; then
2608     ac_fsusage_space=yes
2609     AC_DEFINE(STAT_STATFS4, 1,
2610               [  Define if statfs takes 4 args.  (SVR3, Dynix, Irix, Dolphin)])
2611   fi
2612 fi
2613
2614 if test $ac_fsusage_space = no; then
2615 # 4.4BSD and NetBSD
2616   AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
2617 member (4.4BSD and NetBSD)])
2618   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
2619   [AC_TRY_RUN([#include <sys/types.h>
2620 #ifdef HAVE_SYS_PARAM_H
2621 #include <sys/param.h>
2622 #endif
2623 #ifdef HAVE_SYS_MOUNT_H
2624 #include <sys/mount.h>
2625 #endif
2626   main ()
2627   {
2628   struct statfs fsd;
2629   fsd.f_fsize = 0;
2630   exit (statfs (".", &fsd));
2631   }],
2632   fu_cv_sys_stat_statfs2_fsize=yes,
2633   fu_cv_sys_stat_statfs2_fsize=no,
2634   fu_cv_sys_stat_statfs2_fsize=no)])
2635   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
2636   if test $fu_cv_sys_stat_statfs2_fsize = yes; then
2637     ac_fsusage_space=yes
2638     AC_DEFINE(STAT_STATFS2_FSIZE, 1,
2639 [  Define if statfs takes 2 args and struct statfs has a field named f_fsize.
2640    (4.4BSD, NetBSD)])
2641   fi
2642 fi
2643
2644 if test $ac_fsusage_space = no; then
2645   # Ultrix
2646   AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
2647   AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
2648   [AC_TRY_RUN([#include <sys/types.h>
2649 #ifdef HAVE_SYS_PARAM_H
2650 #include <sys/param.h>
2651 #endif
2652 #ifdef HAVE_SYS_MOUNT_H
2653 #include <sys/mount.h>
2654 #endif
2655 #ifdef HAVE_SYS_FS_TYPES_H
2656 #include <sys/fs_types.h>
2657 #endif
2658   main ()
2659   {
2660   struct fs_data fsd;
2661   /* Ultrix's statfs returns 1 for success,
2662      0 for not mounted, -1 for failure.  */
2663   exit (statfs (".", &fsd) != 1);
2664   }],
2665   fu_cv_sys_stat_fs_data=yes,
2666   fu_cv_sys_stat_fs_data=no,
2667   fu_cv_sys_stat_fs_data=no)])
2668   AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
2669   if test $fu_cv_sys_stat_fs_data = yes; then
2670     ac_fsusage_space=yes
2671     AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
2672 [  Define if statfs takes 2 args and the second argument has
2673    type struct fs_data.  (Ultrix)])
2674   fi
2675 fi
2676
2677 if test $ac_fsusage_space = no; then
2678   # SVR2
2679   AC_TRY_CPP([#include <sys/filsys.h>
2680     ],
2681     AC_DEFINE(STAT_READ_FILSYS, 1,
2682       [Define if there is no specific function for reading filesystems usage
2683        information and you have the <sys/filsys.h> header file.  (SVR2)])
2684     ac_fsusage_space=yes)
2685 fi
2686
2687 AS_IF([test $ac_fsusage_space = yes], [$1], [$2])
2688
2689 ])
2690
2691
2692 # Check for SunOS statfs brokenness wrt partitions 2GB and larger.
2693 # If <sys/vfs.h> exists and struct statfs has a member named f_spare,
2694 # enable the work-around code in fsusage.c.
2695 AC_DEFUN([jm_STATFS_TRUNCATES],
2696 [
2697   AC_MSG_CHECKING([for statfs that truncates block counts])
2698   AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
2699   [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2700 #if !defined(sun) && !defined(__sun)
2701 choke -- this is a workaround for a Sun-specific problem
2702 #endif
2703 #include <sys/types.h>
2704 #include <sys/vfs.h>]],
2705     [[struct statfs t; long c = *(t.f_spare);]])],
2706     [fu_cv_sys_truncating_statfs=yes],
2707     [fu_cv_sys_truncating_statfs=no])])
2708   if test $fu_cv_sys_truncating_statfs = yes; then
2709     AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS, 1,
2710       [Define if the block counts reported by statfs may be truncated to 2GB
2711        and the correct values may be stored in the f_spare array.
2712        (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem.
2713        SunOS 4.1.1 seems not to be affected.)])
2714   fi
2715   AC_MSG_RESULT($fu_cv_sys_truncating_statfs)
2716 ])
2717
2718
2719 # Prerequisites of lib/fsusage.c not done by jm_FILE_SYSTEM_USAGE.
2720 AC_DEFUN([gl_PREREQ_FSUSAGE_EXTRA],
2721 [
2722   AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
2723   AC_CHECK_HEADERS_ONCE(fcntl.h)
2724   AC_CHECK_HEADERS(dustat.h sys/fs/s5param.h sys/filsys.h sys/statfs.h sys/statvfs.h)
2725   jm_STATFS_TRUNCATES
2726 ])
2727
2728 # alloca.m4 serial 2 (gettext-0.12)
2729 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
2730 dnl This file is free software, distributed under the terms of the GNU
2731 dnl General Public License.  As a special exception to the GNU General
2732 dnl Public License, this file may be distributed as part of a program
2733 dnl that contains a configuration script generated by Autoconf, under
2734 dnl the same distribution terms as the rest of that program.
2735
2736 AC_DEFUN([gl_FUNC_ALLOCA],
2737 [
2738   dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
2739   AC_REQUIRE([AC_PROG_CPP])
2740   AC_REQUIRE([AC_PROG_EGREP])
2741
2742   AC_REQUIRE([AC_FUNC_ALLOCA])
2743   if test $ac_cv_func_alloca_works = no; then
2744     gl_PREREQ_ALLOCA
2745   fi
2746
2747   # Define an additional variable used in the Makefile substitution.
2748
2749   AC_EGREP_CPP([Need own alloca], [
2750 #if defined __GNUC__ || defined _MSC_VER || !HAVE_ALLOCA_H
2751   Need own alloca
2752 #endif
2753     ],
2754     ALLOCA_H=alloca.h,
2755     ALLOCA_H=)
2756   AC_SUBST([ALLOCA_H])
2757 ])
2758
2759 # Prerequisites of lib/alloca.c.
2760 # STACK_DIRECTION is already handled by AC_FUNC_ALLOCA.
2761 AC_DEFUN([gl_PREREQ_ALLOCA], [
2762   AC_CHECK_HEADERS_ONCE(stdlib.h string.h)
2763 ])
2764
2765 # atexit.m4 serial 1
2766 dnl Copyright (C) 2002 Free Software Foundation, Inc.
2767 dnl This file is free software, distributed under the terms of the GNU
2768 dnl General Public License.  As a special exception to the GNU General
2769 dnl Public License, this file may be distributed as part of a program
2770 dnl that contains a configuration script generated by Autoconf, under
2771 dnl the same distribution terms as the rest of that program.
2772
2773 AC_DEFUN([gl_FUNC_ATEXIT],
2774 [
2775   AC_REPLACE_FUNCS(atexit)
2776   if test $ac_cv_func_atexit = no; then
2777     gl_PREREQ_ATEXIT
2778   fi
2779 ])
2780
2781 # Prerequisites of lib/atexit.c.
2782 AC_DEFUN([gl_PREREQ_ATEXIT], [
2783   :
2784 ])
2785
2786 # dup2.m4 serial 1
2787 dnl Copyright (C) 2002 Free Software Foundation, Inc.
2788 dnl This file is free software, distributed under the terms of the GNU
2789 dnl General Public License.  As a special exception to the GNU General
2790 dnl Public License, this file may be distributed as part of a program
2791 dnl that contains a configuration script generated by Autoconf, under
2792 dnl the same distribution terms as the rest of that program.
2793
2794 AC_DEFUN([gl_FUNC_DUP2],
2795 [
2796   AC_REPLACE_FUNCS(dup2)
2797   if test $ac_cv_func_dup2 = no; then
2798     gl_PREREQ_DUP2
2799   fi
2800 ])
2801
2802 # Prerequisites of lib/dup2.c.
2803 AC_DEFUN([gl_PREREQ_DUP2], [
2804   AC_CHECK_HEADERS_ONCE(fcntl.h unistd.h)
2805 ])
2806
2807
2808 # euidaccess.m4 serial 2
2809 dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
2810 dnl This file is free software, distributed under the terms of the GNU
2811 dnl General Public License.  As a special exception to the GNU General
2812 dnl Public License, this file may be distributed as part of a program
2813 dnl that contains a configuration script generated by Autoconf, under
2814 dnl the same distribution terms as the rest of that program.
2815
2816 AC_DEFUN([gl_FUNC_EUIDACCESS],
2817 [
2818   dnl Persuade glibc <unistd.h> to declare euidaccess().
2819   AC_REQUIRE([AC_GNU_SOURCE])
2820
2821   AC_CHECK_DECLS([euidaccess])
2822   AC_REPLACE_FUNCS(euidaccess)
2823   if test $ac_cv_func_euidaccess = no; then
2824     gl_PREREQ_EUIDACCESS
2825   fi
2826 ])
2827
2828 # Prerequisites of lib/euidaccess.c.
2829 AC_DEFUN([gl_PREREQ_EUIDACCESS], [
2830   AC_CHECK_HEADERS_ONCE(unistd.h)
2831   AC_REQUIRE([AC_FUNC_GETGROUPS])
2832 ])
2833
2834
2835 # Check for fnmatch.
2836
2837 # This is a modified version of autoconf's AC_FUNC_FNMATCH.
2838 # This file should be simplified after Autoconf 2.57 is required.
2839
2840 # Copyright (C) 2000-2003 Free Software Foundation, Inc.
2841
2842 # This program is free software; you can redistribute it and/or modify
2843 # it under the terms of the GNU General Public License as published by
2844 # the Free Software Foundation; either version 2, or (at your option)
2845 # any later version.
2846
2847 # This program is distributed in the hope that it will be useful,
2848 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2849 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2850 # GNU General Public License for more details.
2851
2852 # You should have received a copy of the GNU General Public License
2853 # along with this program; if not, write to the Free Software
2854 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2855 # 02111-1307, USA.
2856
2857 # _AC_FUNC_FNMATCH_IF(STANDARD = GNU | POSIX, CACHE_VAR, IF-TRUE, IF-FALSE)
2858 # -------------------------------------------------------------------------
2859 # If a STANDARD compliant fnmatch is found, run IF-TRUE, otherwise
2860 # IF-FALSE.  Use CACHE_VAR.
2861 AC_DEFUN([_AC_FUNC_FNMATCH_IF],
2862 [AC_CACHE_CHECK(
2863    [for working $1 fnmatch],
2864    [$2],
2865   [# Some versions of Solaris, SCO, and the GNU C Library
2866    # have a broken or incompatible fnmatch.
2867    # So we run a test program.  If we are cross-compiling, take no chance.
2868    # Thanks to John Oleynick, Franc,ois Pinard, and Paul Eggert for this test.
2869    AC_RUN_IFELSE(
2870       [AC_LANG_PROGRAM(
2871          [
2872 #          include <stdlib.h>
2873 #          include <fnmatch.h>
2874 #          define y(a, b, c) (fnmatch (a, b, c) == 0)
2875 #          define n(a, b, c) (fnmatch (a, b, c) == FNM_NOMATCH)
2876          ],
2877          [exit
2878            (!(y ("a*", "abc", 0)
2879               && n ("d*/*1", "d/s/1", FNM_PATHNAME)
2880               && y ("a\\\\bc", "abc", 0)
2881               && n ("a\\\\bc", "abc", FNM_NOESCAPE)
2882               && y ("*x", ".x", 0)
2883               && n ("*x", ".x", FNM_PERIOD)
2884               && m4_if([$1], [GNU],
2885                    [y ("xxXX", "xXxX", FNM_CASEFOLD)
2886                     && y ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH)
2887                     && n ("d*/*1", "d/s/1", FNM_FILE_NAME)
2888                     && y ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR)
2889                     && y ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR)
2890                     && y ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR)],
2891                    1)));])],
2892       [$2=yes],
2893       [$2=no],
2894       [$2=cross])])
2895 AS_IF([test $$2 = yes], [$3], [$4])
2896 ])# _AC_FUNC_FNMATCH_IF
2897
2898
2899 # _AC_LIBOBJ_FNMATCH
2900 # ------------------
2901 # Prepare the replacement of fnmatch.
2902 AC_DEFUN([_AC_LIBOBJ_FNMATCH],
2903 [AC_REQUIRE([AC_C_CONST])dnl
2904 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
2905 AC_REQUIRE([AC_TYPE_MBSTATE_T])dnl
2906 AC_CHECK_DECLS([getenv])
2907 AC_CHECK_FUNCS([btowc mbsrtowcs mempcpy wmempcpy])
2908 AC_CHECK_HEADERS([wchar.h wctype.h])
2909 AC_LIBOBJ([fnmatch])
2910 FNMATCH_H=fnmatch.h
2911 AC_DEFINE(fnmatch, rpl_fnmatch,
2912           [Define to rpl_fnmatch if the replacement function should be used.])
2913 ])# _AC_LIBOBJ_FNMATCH
2914
2915
2916 # Additional prerequisites of lib/fnmatch.c, not part of _AC_LIBOBJ_FNMATCH.
2917 AC_DEFUN([gl_PREREQ_FNMATCH_EXTRA],
2918 [
2919   AC_REQUIRE([AC_HEADER_STDC])
2920   AC_CHECK_HEADERS_ONCE(string.h strings.h)
2921 ])
2922
2923
2924 AC_DEFUN([gl_FUNC_FNMATCH_POSIX],
2925 [
2926   FNMATCH_H=
2927   _AC_FUNC_FNMATCH_IF([POSIX], [ac_cv_func_fnmatch_posix],
2928                       [rm -f lib/fnmatch.h],
2929                       [_AC_LIBOBJ_FNMATCH])
2930   if test $ac_cv_func_fnmatch_posix != yes; then
2931     gl_PREREQ_FNMATCH_EXTRA
2932     dnl We must choose a different name for our function, since on ELF systems
2933     dnl a broken fnmatch() in libc.so would override our fnmatch() if it is
2934     dnl compiled into a shared library.
2935     AC_DEFINE([fnmatch], [posix_fnmatch],
2936       [Define to a replacement function name for fnmatch().])
2937   fi
2938   AC_SUBST([FNMATCH_H])
2939 ])
2940
2941
2942 AC_DEFUN([gl_FUNC_FNMATCH_GNU],
2943 [
2944   dnl Persuade glibc <fnmatch.h> to declare FNM_CASEFOLD etc.
2945   AC_REQUIRE([AC_GNU_SOURCE])
2946
2947   FNMATCH_H=
2948   _AC_FUNC_FNMATCH_IF([GNU], [ac_cv_func_fnmatch_gnu],
2949                       [rm -f lib/fnmatch.h],
2950                       [_AC_LIBOBJ_FNMATCH])
2951   if test $ac_cv_func_fnmatch_gnu != yes; then
2952     gl_PREREQ_FNMATCH_EXTRA
2953     dnl We must choose a different name for our function, since on ELF systems
2954     dnl a broken fnmatch() in libc.so would override our fnmatch() if it is
2955     dnl compiled into a shared library.
2956     AC_DEFINE([fnmatch], [gnu_fnmatch],
2957       [Define to a replacement function name for fnmatch().])
2958   fi
2959   AC_SUBST([FNMATCH_H])
2960 ])
2961
2962 # gethostname.m4 serial 1
2963 dnl Copyright (C) 2002 Free Software Foundation, Inc.
2964 dnl This file is free software, distributed under the terms of the GNU
2965 dnl General Public License.  As a special exception to the GNU General
2966 dnl Public License, this file may be distributed as part of a program
2967 dnl that contains a configuration script generated by Autoconf, under
2968 dnl the same distribution terms as the rest of that program.
2969
2970 AC_DEFUN([gl_FUNC_GETHOSTNAME],
2971 [
2972   AC_REPLACE_FUNCS(gethostname)
2973   if test $ac_cv_func_gethostname = no; then
2974     gl_PREREQ_GETHOSTNAME
2975   fi
2976 ])
2977
2978 # Prerequisites of lib/gethostname.c.
2979 AC_DEFUN([gl_PREREQ_GETHOSTNAME], [
2980   AC_CHECK_FUNCS(uname)
2981 ])
2982
2983
2984 #serial 11
2985
2986 # A replacement for autoconf's macro by the same name.  This version
2987 # accepts an optional argument specifying the name of the $srcdir-relative
2988 # directory in which the file getloadavg.c may be found.  It is unusual
2989 # (but justified, imho) that this file is required at ./configure time.
2990
2991 undefine([AC_FUNC_GETLOADAVG])
2992
2993 # AC_FUNC_GETLOADAVG
2994 # ------------------
2995 AC_DEFUN([AC_FUNC_GETLOADAVG],
2996 [ac_have_func=no # yes means we've found a way to get the load average.
2997
2998 AC_CHECK_HEADERS_ONCE(fcntl.h locale.h unistd.h)
2999 AC_CHECK_HEADERS(mach/mach.h)
3000 AC_CHECK_FUNCS(setlocale)
3001
3002 # By default, expect to find getloadavg.c in $srcdir/.
3003 ac_lib_dir_getloadavg=$srcdir
3004 # But if there's an argument, DIR, expect to find getloadavg.c in $srcdir/DIR.
3005 m4_ifval([$1], [ac_lib_dir_getloadavg=$srcdir/$1])
3006 # Make sure getloadavg.c is where it belongs, at ./configure-time.
3007 test -f $ac_lib_dir_getloadavg/getloadavg.c \
3008   || AC_MSG_ERROR([getloadavg.c is not in $ac_lib_dir_getloadavg])
3009 # FIXME: Add an autoconf-time test, too?
3010
3011 ac_save_LIBS=$LIBS
3012
3013 # Check for getloadavg, but be sure not to touch the cache variable.
3014 (AC_CHECK_FUNC(getloadavg, exit 0, exit 1)) && ac_have_func=yes
3015
3016 # On HPUX9, an unprivileged user can get load averages through this function.
3017 AC_CHECK_FUNCS(pstat_getdynamic)
3018
3019 # Solaris has libkstat which does not require root.
3020 AC_CHECK_LIB(kstat, kstat_open)
3021 test $ac_cv_lib_kstat_kstat_open = yes && ac_have_func=yes
3022
3023 # Some systems with -lutil have (and need) -lkvm as well, some do not.
3024 # On Solaris, -lkvm requires nlist from -lelf, so check that first
3025 # to get the right answer into the cache.
3026 # For kstat on solaris, we need libelf to force the definition of SVR4 below.
3027 if test $ac_have_func = no; then
3028   AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS")
3029 fi
3030 if test $ac_have_func = no; then
3031   AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS")
3032   # Check for the 4.4BSD definition of getloadavg.
3033   AC_CHECK_LIB(util, getloadavg,
3034     [LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes])
3035 fi
3036
3037 if test $ac_have_func = no; then
3038   # There is a commonly available library for RS/6000 AIX.
3039   # Since it is not a standard part of AIX, it might be installed locally.
3040   ac_getloadavg_LIBS=$LIBS
3041   LIBS="-L/usr/local/lib $LIBS"
3042   AC_CHECK_LIB(getloadavg, getloadavg,
3043                [LIBS="-lgetloadavg $LIBS"], [LIBS=$ac_getloadavg_LIBS])
3044 fi
3045
3046 # Make sure it is really in the library, if we think we found it,
3047 # otherwise set up the replacement function.
3048 AC_CHECK_FUNCS(getloadavg, [],
3049                [_AC_LIBOBJ_GETLOADAVG])
3050
3051 # Some definitions of getloadavg require that the program be installed setgid.
3052 AC_CACHE_CHECK(whether getloadavg requires setgid,
3053                ac_cv_func_getloadavg_setgid,
3054 [AC_EGREP_CPP([Yowza Am I SETGID yet],
3055 [#include "$ac_lib_dir_getloadavg/getloadavg.c"
3056 #ifdef LDAV_PRIVILEGED
3057 Yowza Am I SETGID yet
3058 @%:@endif],
3059               ac_cv_func_getloadavg_setgid=yes,
3060               ac_cv_func_getloadavg_setgid=no)])
3061 if test $ac_cv_func_getloadavg_setgid = yes; then
3062   NEED_SETGID=true
3063   AC_DEFINE(GETLOADAVG_PRIVILEGED, 1,
3064             [Define if the `getloadavg' function needs to be run setuid
3065              or setgid.])
3066 else
3067   NEED_SETGID=false
3068 fi
3069 AC_SUBST(NEED_SETGID)dnl
3070
3071 if test $ac_cv_func_getloadavg_setgid = yes; then
3072   AC_CACHE_CHECK(group of /dev/kmem, ac_cv_group_kmem,
3073 [ # On Solaris, /dev/kmem is a symlink.  Get info on the real file.
3074   ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
3075   # If we got an error (system does not support symlinks), try without -L.
3076   test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
3077   ac_cv_group_kmem=`echo $ac_ls_output \
3078     | sed -ne ['s/[      ][      ]*/ /g;
3079                s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\)  *.*/\1/;
3080                / /s/.* //;p;']`
3081 ])
3082   AC_SUBST(KMEM_GROUP, $ac_cv_group_kmem)dnl
3083 fi
3084 if test "x$ac_save_LIBS" = x; then
3085   GETLOADAVG_LIBS=$LIBS
3086 else
3087   GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$ac_save_LIBS!!"`
3088 fi
3089 LIBS=$ac_save_LIBS
3090
3091 AC_SUBST(GETLOADAVG_LIBS)dnl
3092 ])# AC_FUNC_GETLOADAVG
3093
3094
3095 AC_DEFUN([gl_FUNC_GETLOADAVG],
3096 [
3097   AC_FUNC_GETLOADAVG([lib])
3098   dnl Note AC_FUNC_GETLOADAVG does AC_LIBOBJ(getloadavg).
3099   if test $ac_cv_func_getloadavg = no; then
3100     gl_PREREQ_GETLOADAVG
3101   fi
3102 ])
3103
3104 # Prerequisites of lib/getloadavg.c not done by autoconf's AC_FUNC_GETLOADAVG.
3105 AC_DEFUN([gl_PREREQ_GETLOADAVG],
3106 [
3107   AC_CHECK_HEADERS_ONCE(fcntl.h unistd.h)
3108 ])
3109
3110 # getpass.m4 serial 2
3111 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
3112 dnl This file is free software, distributed under the terms of the GNU
3113 dnl General Public License.  As a special exception to the GNU General
3114 dnl Public License, this file may be distributed as part of a program
3115 dnl that contains a configuration script generated by Autoconf, under
3116 dnl the same distribution terms as the rest of that program.
3117
3118 # Provide a getpass() function if the system doesn't have it.
3119 AC_DEFUN([gl_FUNC_GETPASS],
3120 [
3121   AC_REPLACE_FUNCS(getpass)
3122   if test $ac_cv_func_getpass = no; then
3123     gl_PREREQ_GETPASS
3124   fi
3125 ])
3126
3127 # Provide the GNU getpass() implementation. It supports passwords of
3128 # arbitrary length (not just 8 bytes as on HP-UX).
3129 AC_DEFUN([gl_FUNC_GETPASS_GNU],
3130 [
3131   dnl TODO: Detect when GNU getpass() is already found in glibc.
3132   AC_LIBOBJ(getpass)
3133   gl_PREREQ_GETPASS
3134   dnl We must choose a different name for our function, since on ELF systems
3135   dnl an unusable getpass() in libc.so would override our getpass() if it is
3136   dnl compiled into a shared library.
3137   AC_DEFINE([getpass], [gnu_getpass],
3138     [Define to a replacement function name for getpass().])
3139 ])
3140
3141 # Prerequisites of lib/getpass.c.
3142 AC_DEFUN([gl_PREREQ_GETPASS], [
3143   :
3144 ])
3145
3146
3147 # getusershell.m4 serial 1
3148 dnl Copyright (C) 2002 Free Software Foundation, Inc.
3149 dnl This file is free software, distributed under the terms of the GNU
3150 dnl General Public License.  As a special exception to the GNU General
3151 dnl Public License, this file may be distributed as part of a program
3152 dnl that contains a configuration script generated by Autoconf, under
3153 dnl the same distribution terms as the rest of that program.
3154
3155 AC_DEFUN([gl_FUNC_GETUSERSHELL],
3156 [
3157   AC_REPLACE_FUNCS(getusershell)
3158   if test $ac_cv_func_getusershell = no; then
3159     gl_PREREQ_GETUSERSHELL
3160   fi
3161 ])
3162
3163 # Prerequisites of lib/getusershell.c.
3164 AC_DEFUN([gl_PREREQ_GETUSERSHELL], [
3165   AC_REQUIRE([AC_HEADER_STDC])
3166   AC_CHECK_HEADERS_ONCE(stdlib.h)
3167   AC_CHECK_FUNCS_ONCE(isascii)
3168 ])
3169
3170
3171 # memchr.m4 serial 1
3172 dnl Copyright (C) 2002 Free Software Foundation, Inc.
3173 dnl This file is free software, distributed under the terms of the GNU
3174 dnl General Public License.  As a special exception to the GNU General
3175 dnl Public License, this file may be distributed as part of a program
3176 dnl that contains a configuration script generated by Autoconf, under
3177 dnl the same distribution terms as the rest of that program.
3178
3179 AC_DEFUN([gl_FUNC_MEMCHR],
3180 [
3181   AC_REPLACE_FUNCS(memchr)
3182   if test $ac_cv_func_memchr = no; then
3183     jm_PREREQ_MEMCHR
3184   fi
3185 ])
3186
3187 # Prerequisites of lib/memchr.c.
3188 AC_DEFUN([jm_PREREQ_MEMCHR], [
3189   AC_CHECK_HEADERS_ONCE(limits.h stdlib.h)
3190   AC_CHECK_HEADERS(bp-sym.h)
3191 ])
3192
3193 # memcpy.m4 serial 1
3194 dnl Copyright (C) 2002 Free Software Foundation, Inc.
3195 dnl This file is free software, distributed under the terms of the GNU
3196 dnl General Public License.  As a special exception to the GNU General
3197 dnl Public License, this file may be distributed as part of a program
3198 dnl that contains a configuration script generated by Autoconf, under
3199 dnl the same distribution terms as the rest of that program.
3200
3201 AC_DEFUN([gl_FUNC_MEMCPY],
3202 [
3203   AC_REPLACE_FUNCS(memcpy)
3204   if test $ac_cv_func_memcpy = no; then
3205     gl_PREREQ_MEMCPY
3206   fi
3207 ])
3208
3209 # Prerequisites of lib/memcpy.c.
3210 AC_DEFUN([gl_PREREQ_MEMCPY], [
3211   :
3212 ])
3213
3214 # memmove.m4 serial 1
3215 dnl Copyright (C) 2002 Free Software Foundation, Inc.
3216 dnl This file is free software, distributed under the terms of the GNU
3217 dnl General Public License.  As a special exception to the GNU General
3218 dnl Public License, this file may be distributed as part of a program
3219 dnl that contains a configuration script generated by Autoconf, under
3220 dnl the same distribution terms as the rest of that program.
3221
3222 AC_DEFUN([gl_FUNC_MEMMOVE],
3223 [
3224   AC_REPLACE_FUNCS(memmove)
3225   if test $ac_cv_func_memmove = no; then
3226     gl_PREREQ_MEMMOVE
3227   fi
3228 ])
3229
3230 # Prerequisites of lib/memmove.c.
3231 AC_DEFUN([gl_PREREQ_MEMMOVE], [
3232   :
3233 ])
3234
3235 # memrchr.m4 serial 1
3236 dnl Copyright (C) 2002 Free Software Foundation, Inc.
3237 dnl This file is free software, distributed under the terms of the GNU
3238 dnl General Public License.  As a special exception to the GNU General
3239 dnl Public License, this file may be distributed as part of a program
3240 dnl that contains a configuration script generated by Autoconf, under
3241 dnl the same distribution terms as the rest of that program.
3242
3243 AC_DEFUN([gl_FUNC_MEMRCHR],
3244 [
3245   dnl Persuade glibc <string.h> to declare memrchr().
3246   AC_REQUIRE([AC_GNU_SOURCE])
3247
3248   AC_REPLACE_FUNCS(memrchr)
3249   if test $ac_cv_func_memrchr = no; then
3250     gl_PREREQ_MEMRCHR
3251   fi
3252 ])
3253
3254 # Prerequisites of lib/memrchr.c.
3255 AC_DEFUN([gl_PREREQ_MEMRCHR], [
3256   AC_CHECK_HEADERS_ONCE(limits.h)
3257 ])
3258
3259 # memset.m4 serial 1
3260 dnl Copyright (C) 2002 Free Software Foundation, Inc.
3261 dnl This file is free software, distributed under the terms of the GNU
3262 dnl General Public License.  As a special exception to the GNU General
3263 dnl Public License, this file may be distributed as part of a program
3264 dnl that contains a configuration script generated by Autoconf, under
3265 dnl the same distribution terms as the rest of that program.
3266
3267 AC_DEFUN([gl_FUNC_MEMSET],
3268 [
3269   AC_REPLACE_FUNCS(memset)
3270   if test $ac_cv_func_memset = no; then
3271     gl_PREREQ_MEMSET
3272   fi
3273 ])
3274
3275 # Prerequisites of lib/memset.c.
3276 AC_DEFUN([gl_PREREQ_MEMSET], [
3277   :
3278 ])
3279
3280 # mktime.m4 serial 2
3281 dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
3282 dnl This file is free software, distributed under the terms of the GNU
3283 dnl General Public License.  As a special exception to the GNU General
3284 dnl Public License, this file may be distributed as part of a program
3285 dnl that contains a configuration script generated by Autoconf, under
3286 dnl the same distribution terms as the rest of that program.
3287
3288 dnl From Jim Meyering.
3289
3290 # Redefine AC_FUNC_MKTIME, to fix a bug in Autoconf 2.57 and earlier.
3291 # This redefinition can be removed once a new version of Autoconf comes out.
3292 # The redefinition is taken from
3293 # <http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/autoconf/autoconf/lib/autoconf/functions.m4?rev=1.78>.
3294 # AC_FUNC_MKTIME
3295 # --------------
3296 AC_DEFUN([AC_FUNC_MKTIME],
3297 [AC_REQUIRE([AC_HEADER_TIME])dnl
3298 AC_CHECK_HEADERS(stdlib.h sys/time.h unistd.h)
3299 AC_CHECK_FUNCS(alarm)
3300 AC_CACHE_CHECK([for working mktime], ac_cv_func_working_mktime,
3301 [AC_RUN_IFELSE([AC_LANG_SOURCE(
3302 [[/* Test program from Paul Eggert and Tony Leneis.  */
3303 #if TIME_WITH_SYS_TIME
3304 # include <sys/time.h>
3305 # include <time.h>
3306 #else
3307 # if HAVE_SYS_TIME_H
3308 #  include <sys/time.h>
3309 # else
3310 #  include <time.h>
3311 # endif
3312 #endif
3313
3314 #if HAVE_STDLIB_H
3315 # include <stdlib.h>
3316 #endif
3317
3318 #if HAVE_UNISTD_H
3319 # include <unistd.h>
3320 #endif
3321
3322 #if !HAVE_ALARM
3323 # define alarm(X) /* empty */
3324 #endif
3325
3326 /* Work around redefinition to rpl_putenv by other config tests.  */
3327 #undef putenv
3328
3329 static time_t time_t_max;
3330 static time_t time_t_min;
3331
3332 /* Values we'll use to set the TZ environment variable.  */
3333 static char *tz_strings[] = {
3334   (char *) 0, "TZ=GMT0", "TZ=JST-9",
3335   "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
3336 };
3337 #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
3338
3339 /* Fail if mktime fails to convert a date in the spring-forward gap.
3340    Based on a problem report from Andreas Jaeger.  */
3341 static void
3342 spring_forward_gap ()
3343 {
3344   /* glibc (up to about 1998-10-07) failed this test. */
3345   struct tm tm;
3346
3347   /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
3348      instead of "TZ=America/Vancouver" in order to detect the bug even
3349      on systems that don't support the Olson extension, or don't have the
3350      full zoneinfo tables installed.  */
3351   putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
3352
3353   tm.tm_year = 98;
3354   tm.tm_mon = 3;
3355   tm.tm_mday = 5;
3356   tm.tm_hour = 2;
3357   tm.tm_min = 0;
3358   tm.tm_sec = 0;
3359   tm.tm_isdst = -1;
3360   if (mktime (&tm) == (time_t)-1)
3361     exit (1);
3362 }
3363
3364 static void
3365 mktime_test1 (now)
3366      time_t now;
3367 {
3368   struct tm *lt;
3369   if ((lt = localtime (&now)) && mktime (lt) != now)
3370     exit (1);
3371 }
3372
3373 static void
3374 mktime_test (now)
3375      time_t now;
3376 {
3377   mktime_test1 (now);
3378   mktime_test1 ((time_t) (time_t_max - now));
3379   mktime_test1 ((time_t) (time_t_min + now));
3380 }
3381
3382 static void
3383 irix_6_4_bug ()
3384 {
3385   /* Based on code from Ariel Faigon.  */
3386   struct tm tm;
3387   tm.tm_year = 96;
3388   tm.tm_mon = 3;
3389   tm.tm_mday = 0;
3390   tm.tm_hour = 0;
3391   tm.tm_min = 0;
3392   tm.tm_sec = 0;
3393   tm.tm_isdst = -1;
3394   mktime (&tm);
3395   if (tm.tm_mon != 2 || tm.tm_mday != 31)
3396     exit (1);
3397 }
3398
3399 static void
3400 bigtime_test (j)
3401      int j;
3402 {
3403   struct tm tm;
3404   time_t now;
3405   tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
3406   now = mktime (&tm);
3407   if (now != (time_t) -1)
3408     {
3409       struct tm *lt = localtime (&now);
3410       if (! (lt
3411              && lt->tm_year == tm.tm_year
3412              && lt->tm_mon == tm.tm_mon
3413              && lt->tm_mday == tm.tm_mday
3414              && lt->tm_hour == tm.tm_hour
3415              && lt->tm_min == tm.tm_min
3416              && lt->tm_sec == tm.tm_sec
3417              && lt->tm_yday == tm.tm_yday
3418              && lt->tm_wday == tm.tm_wday
3419              && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
3420                   == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
3421         exit (1);
3422     }
3423 }
3424
3425 int
3426 main ()
3427 {
3428   time_t t, delta;
3429   int i, j;
3430
3431   /* This test makes some buggy mktime implementations loop.
3432      Give up after 60 seconds; a mktime slower than that
3433      isn't worth using anyway.  */
3434   alarm (60);
3435
3436   for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
3437     continue;
3438   time_t_max--;
3439   if ((time_t) -1 < 0)
3440     for (time_t_min = -1; (time_t) (time_t_min * 2) < 0; time_t_min *= 2)
3441       continue;
3442   delta = time_t_max / 997; /* a suitable prime number */
3443   for (i = 0; i < N_STRINGS; i++)
3444     {
3445       if (tz_strings[i])
3446         putenv (tz_strings[i]);
3447
3448       for (t = 0; t <= time_t_max - delta; t += delta)
3449         mktime_test (t);
3450       mktime_test ((time_t) 1);
3451       mktime_test ((time_t) (60 * 60));
3452       mktime_test ((time_t) (60 * 60 * 24));
3453
3454       for (j = 1; 0 < j; j *= 2)
3455         bigtime_test (j);
3456       bigtime_test (j - 1);
3457     }
3458   irix_6_4_bug ();
3459   spring_forward_gap ();
3460   exit (0);
3461 }]])],
3462                [ac_cv_func_working_mktime=yes],
3463                [ac_cv_func_working_mktime=no],
3464                [ac_cv_func_working_mktime=no])])
3465 if test $ac_cv_func_working_mktime = no; then
3466   AC_LIBOBJ([mktime])
3467 fi
3468 ])# AC_FUNC_MKTIME
3469
3470 AC_DEFUN([gl_FUNC_MKTIME],
3471 [
3472   AC_REQUIRE([AC_FUNC_MKTIME])
3473   if test $ac_cv_func_working_mktime = no; then
3474     AC_DEFINE(mktime, rpl_mktime,
3475       [Define to rpl_mktime if the replacement function should be used.])
3476     gl_PREREQ_MKTIME
3477   fi
3478 ])
3479
3480 # Prerequisites of lib/mktime.c.
3481 AC_DEFUN([gl_PREREQ_MKTIME], [
3482   AC_REQUIRE([AC_HEADER_STDC])
3483   AC_CHECK_HEADERS_ONCE(limits.h)
3484 ])
3485
3486 # readlink.m4 serial 2
3487 dnl Copyright (C) 2003 Free Software Foundation, Inc.
3488 dnl This file is free software, distributed under the terms of the GNU
3489 dnl General Public License.  As a special exception to the GNU General
3490 dnl Public License, this file may be distributed as part of a program
3491 dnl that contains a configuration script generated by Autoconf, under
3492 dnl the same distribution terms as the rest of that program.
3493
3494 AC_DEFUN([gl_FUNC_READLINK],
3495 [
3496   AC_CHECK_FUNCS(readlink)
3497   if test $ac_cv_func_readlink = no; then
3498     AC_LIBOBJ(readlink)
3499     gl_PREREQ_READLINK
3500   fi
3501 ])
3502
3503 # Prerequisites of lib/readlink.c.
3504 AC_DEFUN([gl_PREREQ_READLINK],
3505 [
3506   :
3507 ])
3508
3509 # rmdir.m4 serial 1
3510 dnl Copyright (C) 2002 Free Software Foundation, Inc.
3511 dnl This file is free software, distributed under the terms of the GNU
3512 dnl General Public License.  As a special exception to the GNU General
3513 dnl Public License, this file may be distributed as part of a program
3514 dnl that contains a configuration script generated by Autoconf, under
3515 dnl the same distribution terms as the rest of that program.
3516
3517 AC_DEFUN([gl_FUNC_RMDIR],
3518 [
3519   AC_REPLACE_FUNCS(rmdir)
3520   if test $ac_cv_func_rmdir = no; then
3521     gl_PREREQ_RMDIR
3522   fi
3523 ])
3524
3525 # Prerequisites of lib/rmdir.c.
3526 AC_DEFUN([gl_PREREQ_RMDIR], [
3527   AC_REQUIRE([AC_HEADER_STAT])
3528   :
3529 ])
3530
3531
3532 # rpmatch.m4 serial 3
3533 dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
3534 dnl This file is free software, distributed under the terms of the GNU
3535 dnl General Public License.  As a special exception to the GNU General
3536 dnl Public License, this file may be distributed as part of a program
3537 dnl that contains a configuration script generated by Autoconf, under
3538 dnl the same distribution terms as the rest of that program.
3539
3540 AC_DEFUN([gl_FUNC_RPMATCH],
3541 [
3542   AC_REPLACE_FUNCS(rpmatch)
3543   if test $ac_cv_func_rpmatch = no; then
3544     gl_PREREQ_RPMATCH
3545   fi
3546 ])
3547
3548 # Prerequisites of lib/rpmatch.c.
3549 AC_DEFUN([gl_PREREQ_RPMATCH], [
3550   AC_REQUIRE([AC_HEADER_STDC])
3551   :
3552 ])
3553
3554
3555 # sig2str.m4 serial 1
3556 dnl Copyright (C) 2002 Free Software Foundation, Inc.
3557 dnl This file is free software, distributed under the terms of the GNU
3558 dnl General Public License.  As a special exception to the GNU General
3559 dnl Public License, this file may be distributed as part of a program
3560 dnl that contains a configuration script generated by Autoconf, under
3561 dnl the same distribution terms as the rest of that program.
3562
3563 AC_DEFUN([gl_FUNC_SIG2STR],
3564 [
3565   AC_REPLACE_FUNCS(sig2str)
3566   if test $ac_cv_func_sig2str = no; then
3567     gl_PREREQ_SIG2STR
3568   fi
3569 ])
3570
3571 # Prerequisites of lib/sig2str.c.
3572 AC_DEFUN([gl_PREREQ_SIG2STR], [
3573   :
3574 ])
3575
3576
3577 # stpcpy.m4 serial 1
3578 dnl Copyright (C) 2002 Free Software Foundation, Inc.
3579 dnl This file is free software, distributed under the terms of the GNU
3580 dnl General Public License.  As a special exception to the GNU General
3581 dnl Public License, this file may be distributed as part of a program
3582 dnl that contains a configuration script generated by Autoconf, under
3583 dnl the same distribution terms as the rest of that program.
3584
3585 AC_DEFUN([gl_FUNC_STPCPY],
3586 [
3587   dnl Persuade glibc <string.h> to declare stpcpy().
3588   AC_REQUIRE([AC_GNU_SOURCE])
3589
3590   AC_REPLACE_FUNCS(stpcpy)
3591   if test $ac_cv_func_stpcpy = no; then
3592     gl_PREREQ_STPCPY
3593   fi
3594 ])
3595
3596 # Prerequisites of lib/stpcpy.c.
3597 AC_DEFUN([gl_PREREQ_STPCPY], [
3598   :
3599 ])
3600
3601
3602 # strcspn.m4 serial 1
3603 dnl Copyright (C) 2002 Free Software Foundation, Inc.
3604 dnl This file is free software, distributed under the terms of the GNU
3605 dnl General Public License.  As a special exception to the GNU General
3606 dnl Public License, this file may be distributed as part of a program
3607 dnl that contains a configuration script generated by Autoconf, under
3608 dnl the same distribution terms as the rest of that program.
3609
3610 AC_DEFUN([gl_FUNC_STRCSPN],
3611 [
3612   AC_REPLACE_FUNCS(strcspn)
3613   if test $ac_cv_func_strcspn = no; then
3614     gl_PREREQ_STRCSPN
3615   fi
3616 ])
3617
3618 # Prerequisites of lib/strcspn.c.
3619 AC_DEFUN([gl_PREREQ_STRCSPN], [
3620   AC_CHECK_HEADERS_ONCE(string.h)
3621 ])
3622
3623 # strdup.m4 serial 1
3624 dnl Copyright (C) 2002 Free Software Foundation, Inc.
3625 dnl This file is free software, distributed under the terms of the GNU
3626 dnl General Public License.  As a special exception to the GNU General
3627 dnl Public License, this file may be distributed as part of a program
3628 dnl that contains a configuration script generated by Autoconf, under
3629 dnl the same distribution terms as the rest of that program.
3630
3631 AC_DEFUN([gl_FUNC_STRDUP],
3632 [
3633   AC_REPLACE_FUNCS(strdup)
3634   if test $ac_cv_func_strdup = no; then
3635     gl_PREREQ_STRDUP
3636   fi
3637 ])
3638
3639 # Prerequisites of lib/strdup.c.
3640 AC_DEFUN([gl_PREREQ_STRDUP], [
3641   AC_REQUIRE([AC_HEADER_STDC])
3642   :
3643 ])
3644
3645
3646 # strndup.m4 serial 1
3647 dnl Copyright (C) 2002 Free Software Foundation, Inc.
3648 dnl This file is free software, distributed under the terms of the GNU
3649 dnl General Public License.  As a special exception to the GNU General
3650 dnl Public License, this file may be distributed as part of a program
3651 dnl that contains a configuration script generated by Autoconf, under
3652 dnl the same distribution terms as the rest of that program.
3653
3654 AC_DEFUN([gl_FUNC_STRNDUP],
3655 [
3656   dnl Persuade glibc <string.h> to declare strndup().
3657   AC_REQUIRE([AC_GNU_SOURCE])
3658
3659   AC_REPLACE_FUNCS(strndup)
3660   if test $ac_cv_func_strndup = no; then
3661     gl_PREREQ_STRNDUP
3662   fi
3663 ])
3664
3665 # Prerequisites of lib/strndup.c.
3666 AC_DEFUN([gl_PREREQ_STRNDUP], [
3667   AC_REQUIRE([AC_HEADER_STDC])
3668   AC_CHECK_DECLS(strnlen)
3669 ])
3670
3671
3672 # strnlen.m4 serial 2
3673 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
3674 dnl This file is free software, distributed under the terms of the GNU
3675 dnl General Public License.  As a special exception to the GNU General
3676 dnl Public License, this file may be distributed as part of a program
3677 dnl that contains a configuration script generated by Autoconf, under
3678 dnl the same distribution terms as the rest of that program.
3679
3680 AC_DEFUN([gl_FUNC_STRNLEN],
3681 [
3682   dnl Persuade glibc <string.h> to declare strnlen().
3683   AC_REQUIRE([AC_GNU_SOURCE])
3684
3685   AC_FUNC_STRNLEN
3686   if test $ac_cv_func_strnlen_working = no; then
3687     # This is necessary because automake-1.6.1 doens't understand
3688     # that the above use of AC_FUNC_STRNLEN means we may have to use
3689     # lib/strnlen.c.
3690     #AC_LIBOBJ(strnlen)
3691     AC_DEFINE(strnlen, rpl_strnlen,
3692       [Define to rpl_strnlen if the replacement function should be used.])
3693     gl_PREREQ_STRNLEN
3694   fi
3695 ])
3696
3697 # Prerequisites of lib/strnlen.c.
3698 AC_DEFUN([gl_PREREQ_STRNLEN], [
3699   AC_REQUIRE([AC_HEADER_STDC])
3700   AC_CHECK_HEADERS_ONCE(memory.h string.h)
3701   AC_CHECK_DECLS(memchr)
3702 ])
3703
3704
3705 # strpbrk.m4 serial 1
3706 dnl Copyright (C) 2002 Free Software Foundation, Inc.
3707 dnl This file is free software, distributed under the terms of the GNU
3708 dnl General Public License.  As a special exception to the GNU General
3709 dnl Public License, this file may be distributed as part of a program
3710 dnl that contains a configuration script generated by Autoconf, under
3711 dnl the same distribution terms as the rest of that program.
3712
3713 AC_DEFUN([gl_FUNC_STRPBRK],
3714 [
3715   AC_REPLACE_FUNCS(strpbrk)
3716   if test $ac_cv_func_strpbrk = no; then
3717     gl_PREREQ_STRPBRK
3718   fi
3719 ])
3720
3721 # Prerequisites of lib/strpbrk.c.
3722 AC_DEFUN([gl_PREREQ_STRPBRK], [
3723   AC_CHECK_HEADERS_ONCE(string.h)
3724 ])
3725
3726 # strstr.m4 serial 1
3727 dnl Copyright (C) 2002 Free Software Foundation, Inc.
3728 dnl This file is free software, distributed under the terms of the GNU
3729 dnl General Public License.  As a special exception to the GNU General
3730 dnl Public License, this file may be distributed as part of a program
3731 dnl that contains a configuration script generated by Autoconf, under
3732 dnl the same distribution terms as the rest of that program.
3733
3734 AC_DEFUN([gl_FUNC_STRSTR],
3735 [
3736   AC_REPLACE_FUNCS(strstr)
3737   if test $ac_cv_func_strstr = no; then
3738     gl_PREREQ_STRSTR
3739   fi
3740 ])
3741
3742 # Prerequisites of lib/strstr.c.
3743 AC_DEFUN([gl_PREREQ_STRSTR], [
3744   AC_CHECK_HEADERS_ONCE(string.h)
3745 ])
3746
3747 # strtod.m4 serial 2
3748 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
3749 dnl This file is free software, distributed under the terms of the GNU
3750 dnl General Public License.  As a special exception to the GNU General
3751 dnl Public License, this file may be distributed as part of a program
3752 dnl that contains a configuration script generated by Autoconf, under
3753 dnl the same distribution terms as the rest of that program.
3754
3755 AC_DEFUN([gl_FUNC_STRTOD],
3756 [
3757   AC_REQUIRE([AC_FUNC_STRTOD])
3758   if test $ac_cv_func_strtod = no; then
3759     AC_DEFINE(strtod, rpl_strtod,
3760       [Define to rpl_strtod if the replacement function should be used.])
3761     gl_PREREQ_STRTOD
3762   fi
3763 ])
3764
3765 # Prerequisites of lib/strtod.c.
3766 # The need for pow() is already handled by AC_FUNC_STRTOD.
3767 AC_DEFUN([gl_PREREQ_STRTOD], [
3768   AC_REQUIRE([AC_HEADER_STDC])
3769   AC_CHECK_HEADERS(float.h)
3770   AC_CHECK_FUNCS_ONCE(isascii)
3771 ])
3772
3773 # strtoimax.m4 serial 2
3774 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
3775 dnl This file is free software, distributed under the terms of the GNU
3776 dnl General Public License.  As a special exception to the GNU General
3777 dnl Public License, this file may be distributed as part of a program
3778 dnl that contains a configuration script generated by Autoconf, under
3779 dnl the same distribution terms as the rest of that program.
3780
3781 AC_DEFUN([gl_FUNC_STRTOIMAX],
3782 [
3783   dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
3784   AC_REQUIRE([AC_PROG_CPP])
3785   AC_REQUIRE([AC_PROG_EGREP])
3786
3787   AC_CACHE_CHECK([whether <inttypes.h> defines strtoimax as a macro],
3788     jm_cv_func_strtoimax_macro,
3789     [AC_EGREP_CPP([inttypes_h_defines_strtoimax], [#include <inttypes.h>
3790 #ifdef strtoimax
3791  inttypes_h_defines_strtoimax
3792 #endif],
3793        jm_cv_func_strtoimax_macro=yes,
3794        jm_cv_func_strtoimax_macro=no)])
3795
3796   if test "$jm_cv_func_strtoimax_macro" != yes; then
3797     AC_REPLACE_FUNCS(strtoimax)
3798     if test $ac_cv_func_strtoimax = no; then
3799       gl_PREREQ_STRTOIMAX
3800     fi
3801   fi
3802 ])
3803
3804 # Prerequisites of lib/strtoimax.c.
3805 AC_DEFUN([gl_PREREQ_STRTOIMAX], [
3806   jm_AC_TYPE_INTMAX_T
3807   AC_CHECK_HEADERS_ONCE(stdlib.h)
3808   AC_CHECK_DECLS_ONCE(strtol)
3809   AC_CHECK_DECLS(strtoll)
3810   AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
3811 ])
3812
3813 # intmax_t.m4 serial 2
3814 dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
3815 dnl This file is free software, distributed under the terms of the GNU
3816 dnl General Public License.  As a special exception to the GNU General
3817 dnl Public License, this file may be distributed as part of a program
3818 dnl that contains a configuration script generated by Autoconf, under
3819 dnl the same distribution terms as the rest of that program.
3820
3821 dnl From Paul Eggert.
3822
3823 AC_PREREQ(2.13)
3824
3825 # Define intmax_t to 'long' or 'long long'
3826 # if it is not already defined in <stdint.h> or <inttypes.h>.
3827
3828 AC_DEFUN([jm_AC_TYPE_INTMAX_T],
3829 [
3830   dnl For simplicity, we assume that a header file defines 'intmax_t' if and
3831   dnl only if it defines 'uintmax_t'.
3832   AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
3833   AC_REQUIRE([jm_AC_HEADER_STDINT_H])
3834   if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then
3835     AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
3836     test $ac_cv_type_long_long = yes \
3837       && ac_type='long long' \
3838       || ac_type='long'
3839     AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
3840      [Define to long or long long if <inttypes.h> and <stdint.h> don't define.])
3841   else
3842     AC_DEFINE(HAVE_INTMAX_T, 1,
3843       [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
3844   fi
3845 ])
3846
3847 dnl An alternative would be to explicitly test for 'intmax_t'.
3848
3849 AC_DEFUN([gt_AC_TYPE_INTMAX_T],
3850 [
3851   AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
3852   AC_REQUIRE([jm_AC_HEADER_STDINT_H])
3853   AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t,
3854     [AC_TRY_COMPILE([
3855 #include <stddef.h>
3856 #include <stdlib.h>
3857 #if HAVE_STDINT_H_WITH_UINTMAX
3858 #include <stdint.h>
3859 #endif
3860 #if HAVE_INTTYPES_H_WITH_UINTMAX
3861 #include <inttypes.h>
3862 #endif
3863 ], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
3864   if test $gt_cv_c_intmax_t = yes; then
3865     AC_DEFINE(HAVE_INTMAX_T, 1,
3866       [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
3867   else
3868     AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
3869     test $ac_cv_type_long_long = yes \
3870       && ac_type='long long' \
3871       || ac_type='long'
3872     AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
3873      [Define to long or long long if <stdint.h> and <inttypes.h> don't define.])
3874   fi
3875 ])
3876
3877 # longlong.m4 serial 4
3878 dnl Copyright (C) 1999-2003 Free Software Foundation, Inc.
3879 dnl This file is free software, distributed under the terms of the GNU
3880 dnl General Public License.  As a special exception to the GNU General
3881 dnl Public License, this file may be distributed as part of a program
3882 dnl that contains a configuration script generated by Autoconf, under
3883 dnl the same distribution terms as the rest of that program.
3884
3885 dnl From Paul Eggert.
3886
3887 # Define HAVE_LONG_LONG if 'long long' works.
3888
3889 AC_DEFUN([jm_AC_TYPE_LONG_LONG],
3890 [
3891   AC_CACHE_CHECK([for long long], ac_cv_type_long_long,
3892   [AC_TRY_LINK([long long ll = 1LL; int i = 63;],
3893     [long long llmax = (long long) -1;
3894      return ll << i | ll >> i | llmax / ll | llmax % ll;],
3895     ac_cv_type_long_long=yes,
3896     ac_cv_type_long_long=no)])
3897   if test $ac_cv_type_long_long = yes; then
3898     AC_DEFINE(HAVE_LONG_LONG, 1,
3899       [Define if you have the 'long long' type.])
3900   fi
3901 ])
3902
3903 # strtoll.m4 serial 1
3904 dnl Copyright (C) 2002 Free Software Foundation, Inc.
3905 dnl This file is free software, distributed under the terms of the GNU
3906 dnl General Public License.  As a special exception to the GNU General
3907 dnl Public License, this file may be distributed as part of a program
3908 dnl that contains a configuration script generated by Autoconf, under
3909 dnl the same distribution terms as the rest of that program.
3910
3911 AC_DEFUN([gl_FUNC_STRTOLL],
3912 [
3913   dnl We don't need (and can't compile) the replacement strtoll
3914   dnl unless the type 'long long' exists.
3915   AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
3916   if test "$ac_cv_type_long_long" = yes; then
3917     AC_REPLACE_FUNCS(strtoll)
3918     if test $ac_cv_func_strtoll = no; then
3919       gl_PREREQ_STRTOLL
3920     fi
3921   fi
3922 ])
3923
3924 # Prerequisites of lib/strtoll.c.
3925 AC_DEFUN([gl_PREREQ_STRTOLL], [
3926   :
3927 ])
3928
3929
3930 # strtol.m4 serial 1
3931 dnl Copyright (C) 2002 Free Software Foundation, Inc.
3932 dnl This file is free software, distributed under the terms of the GNU
3933 dnl General Public License.  As a special exception to the GNU General
3934 dnl Public License, this file may be distributed as part of a program
3935 dnl that contains a configuration script generated by Autoconf, under
3936 dnl the same distribution terms as the rest of that program.
3937
3938 AC_DEFUN([gl_FUNC_STRTOL],
3939 [
3940   AC_REPLACE_FUNCS(strtol)
3941   if test $ac_cv_func_strtol = no; then
3942     gl_PREREQ_STRTOL
3943   fi
3944 ])
3945
3946 # Prerequisites of lib/strtol.c.
3947 AC_DEFUN([gl_PREREQ_STRTOL], [
3948   AC_REQUIRE([AC_HEADER_STDC])
3949   AC_CHECK_HEADERS_ONCE(limits.h)
3950   AC_CHECK_FUNCS_ONCE(isascii)
3951 ])
3952
3953 # strtoull.m4 serial 1
3954 dnl Copyright (C) 2002 Free Software Foundation, Inc.
3955 dnl This file is free software, distributed under the terms of the GNU
3956 dnl General Public License.  As a special exception to the GNU General
3957 dnl Public License, this file may be distributed as part of a program
3958 dnl that contains a configuration script generated by Autoconf, under
3959 dnl the same distribution terms as the rest of that program.
3960
3961 AC_DEFUN([gl_FUNC_STRTOULL],
3962 [
3963   dnl We don't need (and can't compile) the replacement strtoull
3964   dnl unless the type 'unsigned long long' exists.
3965   AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
3966   if test "$ac_cv_type_unsigned_long_long" = yes; then
3967     AC_REPLACE_FUNCS(strtoull)
3968     if test $ac_cv_func_strtoull = no; then
3969       gl_PREREQ_STRTOULL
3970     fi
3971   fi
3972 ])
3973
3974 # Prerequisites of lib/strtoull.c.
3975 AC_DEFUN([gl_PREREQ_STRTOULL], [
3976   :
3977 ])
3978
3979
3980 # strtoul.m4 serial 1
3981 dnl Copyright (C) 2002 Free Software Foundation, Inc.
3982 dnl This file is free software, distributed under the terms of the GNU
3983 dnl General Public License.  As a special exception to the GNU General
3984 dnl Public License, this file may be distributed as part of a program
3985 dnl that contains a configuration script generated by Autoconf, under
3986 dnl the same distribution terms as the rest of that program.
3987
3988 AC_DEFUN([gl_FUNC_STRTOUL],
3989 [
3990   AC_REPLACE_FUNCS(strtoul)
3991   if test $ac_cv_func_strtoul = no; then
3992     gl_PREREQ_STRTOUL
3993   fi
3994 ])
3995
3996 # Prerequisites of lib/strtoul.c.
3997 AC_DEFUN([gl_PREREQ_STRTOUL], [
3998   gl_PREREQ_STRTOL
3999 ])
4000
4001 # strtoumax.m4 serial 2
4002 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
4003 dnl This file is free software, distributed under the terms of the GNU
4004 dnl General Public License.  As a special exception to the GNU General
4005 dnl Public License, this file may be distributed as part of a program
4006 dnl that contains a configuration script generated by Autoconf, under
4007 dnl the same distribution terms as the rest of that program.
4008
4009 AC_DEFUN([gl_FUNC_STRTOUMAX],
4010 [
4011   dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
4012   AC_REQUIRE([AC_PROG_CPP])
4013   AC_REQUIRE([AC_PROG_EGREP])
4014
4015   AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro],
4016     jm_cv_func_strtoumax_macro,
4017     [AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include <inttypes.h>
4018 #ifdef strtoumax
4019  inttypes_h_defines_strtoumax
4020 #endif],
4021        jm_cv_func_strtoumax_macro=yes,
4022        jm_cv_func_strtoumax_macro=no)])
4023
4024   if test "$jm_cv_func_strtoumax_macro" != yes; then
4025     AC_REPLACE_FUNCS(strtoumax)
4026     if test $ac_cv_func_strtoumax = no; then
4027       gl_PREREQ_STRTOUMAX
4028     fi
4029   fi
4030 ])
4031
4032 # Prerequisites of lib/strtoumax.c.
4033 AC_DEFUN([gl_PREREQ_STRTOUMAX], [
4034   jm_AC_TYPE_UINTMAX_T
4035   AC_CHECK_HEADERS_ONCE(stdlib.h)
4036   AC_CHECK_DECLS_ONCE(strtoul)
4037   AC_CHECK_DECLS(strtoull)
4038   AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
4039 ])
4040
4041 # strverscmp.m4 serial 1
4042 dnl Copyright (C) 2002 Free Software Foundation, Inc.
4043 dnl This file is free software, distributed under the terms of the GNU
4044 dnl General Public License.  As a special exception to the GNU General
4045 dnl Public License, this file may be distributed as part of a program
4046 dnl that contains a configuration script generated by Autoconf, under
4047 dnl the same distribution terms as the rest of that program.
4048
4049 AC_DEFUN([gl_FUNC_STRVERSCMP],
4050 [
4051   dnl Persuade glibc <string.h> to declare strverscmp().
4052   AC_REQUIRE([AC_GNU_SOURCE])
4053
4054   AC_REPLACE_FUNCS(strverscmp)
4055   if test $ac_cv_func_strverscmp = no; then
4056     gl_PREREQ_STRVERSCMP
4057   fi
4058 ])
4059
4060 # Prerequisites of lib/strverscmp.c.
4061 AC_DEFUN([gl_PREREQ_STRVERSCMP], [
4062   :
4063 ])
4064
4065
4066 # vasnprintf.m4 serial 2
4067 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
4068 dnl This file is free software, distributed under the terms of the GNU
4069 dnl General Public License.  As a special exception to the GNU General
4070 dnl Public License, this file may be distributed as part of a program
4071 dnl that contains a configuration script generated by Autoconf, under
4072 dnl the same distribution terms as the rest of that program.
4073
4074 AC_DEFUN([gl_FUNC_VASNPRINTF],
4075 [
4076   AC_REPLACE_FUNCS(vasnprintf)
4077   if test $ac_cv_func_vasnprintf = no; then
4078     AC_LIBOBJ(printf-args)
4079     AC_LIBOBJ(printf-parse)
4080     AC_LIBOBJ(asnprintf)
4081     gl_PREREQ_PRINTF_ARGS
4082     gl_PREREQ_PRINTF_PARSE
4083     gl_PREREQ_VASNPRINTF
4084     gl_PREREQ_ASNPRINTF
4085   fi
4086 ])
4087
4088 # Prequisites of lib/printf-args.h, lib/printf-args.c.
4089 AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
4090 [
4091   AC_REQUIRE([bh_C_SIGNED])
4092   AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
4093   AC_REQUIRE([gt_TYPE_LONGDOUBLE])
4094   AC_REQUIRE([gt_TYPE_WCHAR_T])
4095   AC_REQUIRE([gt_TYPE_WINT_T])
4096 ])
4097
4098 # Prequisites of lib/printf-parse.h, lib/printf-parse.c.
4099 AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
4100 [
4101   AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
4102   AC_REQUIRE([gt_TYPE_LONGDOUBLE])
4103   AC_REQUIRE([gt_TYPE_WCHAR_T])
4104   AC_REQUIRE([gt_TYPE_WINT_T])
4105   AC_REQUIRE([AC_TYPE_SIZE_T])
4106   AC_CHECK_TYPES(ptrdiff_t)
4107   AC_REQUIRE([gt_AC_TYPE_INTMAX_T])
4108 ])
4109
4110 # Prerequisites of lib/vasnprintf.c.
4111 AC_DEFUN([gl_PREREQ_VASNPRINTF],
4112 [
4113   AC_REQUIRE([AC_FUNC_ALLOCA])
4114   AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
4115   AC_REQUIRE([gt_TYPE_LONGDOUBLE])
4116   AC_REQUIRE([gt_TYPE_WCHAR_T])
4117   AC_REQUIRE([gt_TYPE_WINT_T])
4118   AC_CHECK_FUNCS(snprintf wcslen)
4119 ])
4120
4121 # Prerequisites of lib/asnprintf.c.
4122 AC_DEFUN([gl_PREREQ_ASNPRINTF],
4123 [
4124 ])
4125
4126 # signed.m4 serial 1 (gettext-0.10.40)
4127 dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
4128 dnl This file is free software, distributed under the terms of the GNU
4129 dnl General Public License.  As a special exception to the GNU General
4130 dnl Public License, this file may be distributed as part of a program
4131 dnl that contains a configuration script generated by Autoconf, under
4132 dnl the same distribution terms as the rest of that program.
4133
4134 dnl From Bruno Haible.
4135
4136 AC_DEFUN([bh_C_SIGNED],
4137 [
4138   AC_CACHE_CHECK([for signed], bh_cv_c_signed,
4139    [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)])
4140   if test $bh_cv_c_signed = no; then
4141     AC_DEFINE(signed, ,
4142               [Define to empty if the C compiler doesn't support this keyword.])
4143   fi
4144 ])
4145
4146 # longdouble.m4 serial 1 (gettext-0.12)
4147 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
4148 dnl This file is free software, distributed under the terms of the GNU
4149 dnl General Public License.  As a special exception to the GNU General
4150 dnl Public License, this file may be distributed as part of a program
4151 dnl that contains a configuration script generated by Autoconf, under
4152 dnl the same distribution terms as the rest of that program.
4153
4154 dnl From Bruno Haible.
4155 dnl Test whether the compiler supports the 'long double' type.
4156 dnl Prerequisite: AC_PROG_CC
4157
4158 AC_DEFUN([gt_TYPE_LONGDOUBLE],
4159 [
4160   AC_CACHE_CHECK([for long double], gt_cv_c_long_double,
4161     [if test "$GCC" = yes; then
4162        gt_cv_c_long_double=yes
4163      else
4164        AC_TRY_COMPILE([
4165          /* The Stardent Vistra knows sizeof(long double), but does not support it.  */
4166          long double foo = 0.0;
4167          /* On Ultrix 4.3 cc, long double is 4 and double is 8.  */
4168          int array [2*(sizeof(long double) >= sizeof(double)) - 1];
4169          ], ,
4170          gt_cv_c_long_double=yes, gt_cv_c_long_double=no)
4171      fi])
4172   if test $gt_cv_c_long_double = yes; then
4173     AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.])
4174   fi
4175 ])
4176
4177 # wchar_t.m4 serial 1 (gettext-0.12)
4178 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
4179 dnl This file is free software, distributed under the terms of the GNU
4180 dnl General Public License.  As a special exception to the GNU General
4181 dnl Public License, this file may be distributed as part of a program
4182 dnl that contains a configuration script generated by Autoconf, under
4183 dnl the same distribution terms as the rest of that program.
4184
4185 dnl From Bruno Haible.
4186 dnl Test whether <stddef.h> has the 'wchar_t' type.
4187 dnl Prerequisite: AC_PROG_CC
4188
4189 AC_DEFUN([gt_TYPE_WCHAR_T],
4190 [
4191   AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t,
4192     [AC_TRY_COMPILE([#include <stddef.h>
4193        wchar_t foo = (wchar_t)'\0';], ,
4194        gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)])
4195   if test $gt_cv_c_wchar_t = yes; then
4196     AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.])
4197   fi
4198 ])
4199
4200 # wint_t.m4 serial 1 (gettext-0.12)
4201 dnl Copyright (C) 2003 Free Software Foundation, Inc.
4202 dnl This file is free software, distributed under the terms of the GNU
4203 dnl General Public License.  As a special exception to the GNU General
4204 dnl Public License, this file may be distributed as part of a program
4205 dnl that contains a configuration script generated by Autoconf, under
4206 dnl the same distribution terms as the rest of that program.
4207
4208 dnl From Bruno Haible.
4209 dnl Test whether <wchar.h> has the 'wint_t' type.
4210 dnl Prerequisite: AC_PROG_CC
4211
4212 AC_DEFUN([gt_TYPE_WINT_T],
4213 [
4214   AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t,
4215     [AC_TRY_COMPILE([#include <wchar.h>
4216        wint_t foo = (wchar_t)'\0';], ,
4217        gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)])
4218   if test $gt_cv_c_wint_t = yes; then
4219     AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.])
4220   fi
4221 ])
4222
4223 # vasprintf.m4 serial 1
4224 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
4225 dnl This file is free software, distributed under the terms of the GNU
4226 dnl General Public License.  As a special exception to the GNU General
4227 dnl Public License, this file may be distributed as part of a program
4228 dnl that contains a configuration script generated by Autoconf, under
4229 dnl the same distribution terms as the rest of that program.
4230
4231 AC_DEFUN([gl_FUNC_VASPRINTF],
4232 [
4233   AC_REPLACE_FUNCS(vasprintf)
4234   if test $ac_cv_func_vasprintf = no; then
4235     AC_LIBOBJ(asprintf)
4236     gl_PREREQ_VASPRINTF
4237     gl_PREREQ_ASPRINTF
4238   fi
4239 ])
4240
4241 # Prerequisites of lib/vasprintf.c.
4242 AC_DEFUN([gl_PREREQ_VASPRINTF],
4243 [
4244 ])
4245
4246 # Prerequisites of lib/asprintf.c.
4247 AC_DEFUN([gl_PREREQ_ASPRINTF],
4248 [
4249 ])
4250
4251 # getdate.m4 serial 1
4252 dnl Copyright (C) 2002 Free Software Foundation, Inc.
4253 dnl This file is free software, distributed under the terms of the GNU
4254 dnl General Public License.  As a special exception to the GNU General
4255 dnl Public License, this file may be distributed as part of a program
4256 dnl that contains a configuration script generated by Autoconf, under
4257 dnl the same distribution terms as the rest of that program.
4258
4259 AC_DEFUN([gl_GETDATE],
4260 [
4261   dnl Prerequisites of lib/getdate.h.
4262   AC_HEADER_TIME
4263   AC_CHECK_HEADERS_ONCE(sys/time.h)
4264
4265   dnl Prerequisites of lib/getdate.y.
4266   AC_REQUIRE([jm_BISON])
4267   AC_REQUIRE([AC_FUNC_ALLOCA])
4268   AC_REQUIRE([AC_HEADER_STDC])
4269   AC_CHECK_HEADERS_ONCE(stdlib.h string.h)
4270   AC_CHECK_FUNCS_ONCE(isascii)
4271   AC_STRUCT_TIMEZONE
4272   AC_REQUIRE([gl_TM_GMTOFF])
4273 ])
4274
4275 #serial 2
4276
4277 AC_DEFUN([jm_BISON],
4278 [
4279   # getdate.y works with bison only.
4280   : ${YACC='bison -y'}
4281   AC_SUBST(YACC)
4282 ])
4283
4284 # tm_gmtoff.m4 serial 1
4285 dnl Copyright (C) 2002 Free Software Foundation, Inc.
4286 dnl This file is free software, distributed under the terms of the GNU
4287 dnl General Public License.  As a special exception to the GNU General
4288 dnl Public License, this file may be distributed as part of a program
4289 dnl that contains a configuration script generated by Autoconf, under
4290 dnl the same distribution terms as the rest of that program.
4291
4292 AC_DEFUN([gl_TM_GMTOFF],
4293 [
4294  AC_CHECK_MEMBER([struct tm.tm_gmtoff],
4295                  [AC_DEFINE(HAVE_TM_GMTOFF, 1,
4296                             [Define if struct tm has the tm_gmtoff member.])],
4297                  ,
4298                  [#include <time.h>])
4299 ])
4300
4301 # getopt.m4 serial 1
4302 dnl Copyright (C) 2002 Free Software Foundation, Inc.
4303 dnl This file is free software, distributed under the terms of the GNU
4304 dnl General Public License.  As a special exception to the GNU General
4305 dnl Public License, this file may be distributed as part of a program
4306 dnl that contains a configuration script generated by Autoconf, under
4307 dnl the same distribution terms as the rest of that program.
4308
4309 AC_DEFUN([gl_GETOPT],
4310 [
4311   dnl Prerequisites of lib/getopt.c.
4312   AC_CHECK_HEADERS_ONCE(string.h)
4313 ])
4314
4315 # getpagesize.m4 serial 1
4316 dnl Copyright (C) 2002 Free Software Foundation, Inc.
4317 dnl This file is free software, distributed under the terms of the GNU
4318 dnl General Public License.  As a special exception to the GNU General
4319 dnl Public License, this file may be distributed as part of a program
4320 dnl that contains a configuration script generated by Autoconf, under
4321 dnl the same distribution terms as the rest of that program.
4322
4323 AC_DEFUN([gl_GETPAGESIZE],
4324 [
4325   dnl Prerequisites of lib/getpagesize.h.
4326   AC_CHECK_HEADERS_ONCE(unistd.h)
4327   AC_CHECK_HEADERS(OS.h)
4328   AC_CHECK_FUNCS(getpagesize)
4329 ])
4330
4331 # hard-locale.m4 serial 1
4332 dnl Copyright (C) 2002 Free Software Foundation, Inc.
4333 dnl This file is free software, distributed under the terms of the GNU
4334 dnl General Public License.  As a special exception to the GNU General
4335 dnl Public License, this file may be distributed as part of a program
4336 dnl that contains a configuration script generated by Autoconf, under
4337 dnl the same distribution terms as the rest of that program.
4338
4339 AC_DEFUN([gl_HARD_LOCALE],
4340 [
4341   dnl Prerequisites of lib/hard-locale.c.
4342   AC_CHECK_HEADERS_ONCE(locale.h stdlib.h string.h)
4343   AC_CHECK_FUNCS_ONCE(setlocale)
4344 ])
4345
4346 # hash.m4 serial 2
4347 dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
4348 dnl This file is free software, distributed under the terms of the GNU
4349 dnl General Public License.  As a special exception to the GNU General
4350 dnl Public License, this file may be distributed as part of a program
4351 dnl that contains a configuration script generated by Autoconf, under
4352 dnl the same distribution terms as the rest of that program.
4353
4354 AC_DEFUN([gl_HASH],
4355 [
4356   dnl Prerequisites of lib/hash.c.
4357   AC_REQUIRE([AM_STDBOOL_H])
4358   AC_CHECK_HEADERS_ONCE(stdlib.h)
4359   AC_CHECK_DECLS_ONCE(free malloc)
4360 ])
4361
4362 # human.m4 serial 3
4363 dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
4364 dnl This file is free software, distributed under the terms of the GNU
4365 dnl General Public License.  As a special exception to the GNU General
4366 dnl Public License, this file may be distributed as part of a program
4367 dnl that contains a configuration script generated by Autoconf, under
4368 dnl the same distribution terms as the rest of that program.
4369
4370 AC_DEFUN([gl_HUMAN],
4371 [
4372   dnl Prerequisites of lib/human.h.
4373   AC_REQUIRE([AM_STDBOOL_H])
4374   AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
4375
4376   dnl Prerequisites of lib/human.c.
4377   AC_CHECK_HEADERS_ONCE(locale.h stdlib.h string.h)
4378   AC_CHECK_DECLS_ONCE(getenv)
4379   AC_CHECK_FUNCS_ONCE(localeconv)
4380 ])
4381
4382 #serial 9
4383
4384 dnl autoconf tests required for use of mbswidth.c
4385 dnl From Bruno Haible.
4386
4387 AC_DEFUN([gl_MBSWIDTH],
4388 [
4389   AC_CHECK_HEADERS_ONCE(wchar.h wctype.h)
4390   AC_CHECK_FUNCS_ONCE(isascii iswprint mbsinit)
4391   AC_CHECK_FUNCS(iswcntrl wcwidth)
4392   jm_FUNC_MBRTOWC
4393
4394   AC_CACHE_CHECK([whether wcwidth is declared], ac_cv_have_decl_wcwidth,
4395     [AC_TRY_COMPILE([
4396 /* AIX 3.2.5 declares wcwidth in <string.h>. */
4397 #if HAVE_STRING_H
4398 # include <string.h>
4399 #endif
4400 #if HAVE_WCHAR_H
4401 # include <wchar.h>
4402 #endif
4403 ], [
4404 #ifndef wcwidth
4405   char *p = (char *) wcwidth;
4406 #endif
4407 ], ac_cv_have_decl_wcwidth=yes, ac_cv_have_decl_wcwidth=no)])
4408   if test $ac_cv_have_decl_wcwidth = yes; then
4409     ac_val=1
4410   else
4411     ac_val=0
4412   fi
4413   AC_DEFINE_UNQUOTED(HAVE_DECL_WCWIDTH, $ac_val,
4414     [Define to 1 if you have the declaration of wcwidth(), and to 0 otherwise.])
4415
4416   AC_TYPE_MBSTATE_T
4417 ])
4418
4419 # mbrtowc.m4 serial 5
4420 dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
4421 dnl This file is free software, distributed under the terms of the GNU
4422 dnl General Public License.  As a special exception to the GNU General
4423 dnl Public License, this file may be distributed as part of a program
4424 dnl that contains a configuration script generated by Autoconf, under
4425 dnl the same distribution terms as the rest of that program.
4426
4427 dnl From Paul Eggert
4428
4429 dnl This file can be removed, and jm_FUNC_MBRTOWC replaced with
4430 dnl AC_FUNC_MBRTOWC, when autoconf 2.57 can be assumed everywhere.
4431
4432 AC_DEFUN([jm_FUNC_MBRTOWC],
4433 [
4434   AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
4435     jm_cv_func_mbrtowc,
4436     [AC_TRY_LINK(
4437        [#include <wchar.h>],
4438        [mbstate_t state; return ! (sizeof state && mbrtowc);],
4439        jm_cv_func_mbrtowc=yes,
4440        jm_cv_func_mbrtowc=no)])
4441   if test $jm_cv_func_mbrtowc = yes; then
4442     AC_DEFINE(HAVE_MBRTOWC, 1,
4443       [Define to 1 if mbrtowc and mbstate_t are properly declared.])
4444   fi
4445 ])
4446
4447 # memcoll.m4 serial 2
4448 dnl Copyright (C) 2002 Free Software Foundation, Inc.
4449 dnl This file is free software, distributed under the terms of the GNU
4450 dnl General Public License.  As a special exception to the GNU General
4451 dnl Public License, this file may be distributed as part of a program
4452 dnl that contains a configuration script generated by Autoconf, under
4453 dnl the same distribution terms as the rest of that program.
4454
4455 AC_DEFUN([gl_MEMCOLL],
4456 [
4457   dnl Prerequisites of lib/memcoll.c.
4458   AC_REQUIRE([AC_FUNC_MEMCMP])
4459   AC_CHECK_HEADERS_ONCE(string.h)
4460   AC_FUNC_STRCOLL
4461 ])
4462
4463 # modechange.m4 serial 1
4464 dnl Copyright (C) 2002 Free Software Foundation, Inc.
4465 dnl This file is free software, distributed under the terms of the GNU
4466 dnl General Public License.  As a special exception to the GNU General
4467 dnl Public License, this file may be distributed as part of a program
4468 dnl that contains a configuration script generated by Autoconf, under
4469 dnl the same distribution terms as the rest of that program.
4470
4471 AC_DEFUN([gl_MODECHANGE],
4472 [
4473   AC_REQUIRE([AC_HEADER_STDC])
4474   AC_REQUIRE([AC_HEADER_STAT])
4475 ])
4476
4477 # mountlist.m4 serial 1
4478 dnl Copyright (C) 2002 Free Software Foundation, Inc.
4479 dnl This file is free software, distributed under the terms of the GNU
4480 dnl General Public License.  As a special exception to the GNU General
4481 dnl Public License, this file may be distributed as part of a program
4482 dnl that contains a configuration script generated by Autoconf, under
4483 dnl the same distribution terms as the rest of that program.
4484
4485 AC_DEFUN([gl_MOUNTLIST],
4486 [
4487   jm_LIST_MOUNTED_FILESYSTEMS([gl_cv_list_mounted_fs=yes],
4488                               [gl_cv_list_mounted_fs=no])
4489   if test $gl_cv_list_mounted_fs = yes; then
4490     AC_LIBOBJ(mountlist)
4491     gl_PREREQ_MOUNTLIST_EXTRA
4492   fi
4493 ])
4494
4495 # Prerequisites of lib/mountlist.c not done by jm_LIST_MOUNTED_FILESYSTEMS.
4496 AC_DEFUN([gl_PREREQ_MOUNTLIST_EXTRA],
4497 [
4498   AC_REQUIRE([AC_HEADER_STDC])
4499   dnl Note jm_LIST_MOUNTED_FILESYSTEMS checks for mntent.h, not sys/mntent.h.
4500   AC_CHECK_HEADERS_ONCE(fcntl.h string.h unistd.h)
4501   AC_CHECK_HEADERS(sys/mntent.h)
4502   jm_FSTYPENAME
4503 ])
4504
4505 #serial 13
4506
4507 dnl From Jim Meyering.
4508 dnl
4509 dnl This is not pretty.  I've just taken the autoconf code and wrapped
4510 dnl it in an AC_DEFUN.
4511 dnl
4512
4513 # jm_LIST_MOUNTED_FILESYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
4514 AC_DEFUN([jm_LIST_MOUNTED_FILESYSTEMS],
4515   [
4516 AC_CHECK_FUNCS(listmntent getmntinfo)
4517 AC_CHECK_HEADERS_ONCE(sys/param.h)
4518 AC_CHECK_HEADERS(mntent.h sys/ucred.h sys/mount.h sys/fs_types.h)
4519     getfsstat_includes="\
4520 $ac_includes_default
4521 #if HAVE_SYS_PARAM_H
4522 # include <sys/param.h> /* needed by powerpc-apple-darwin1.3.7 */
4523 #endif
4524 #if HAVE_SYS_UCRED_H
4525 # include <sys/ucred.h> /* needed by powerpc-apple-darwin1.3.7 */
4526 #endif
4527 #if HAVE_SYS_MOUNT_H
4528 # include <sys/mount.h>
4529 #endif
4530 #if HAVE_SYS_FS_TYPES_H
4531 # include <sys/fs_types.h> /* needed by powerpc-apple-darwin1.3.7 */
4532 #endif
4533 "
4534 AC_CHECK_MEMBERS([struct fsstat.f_fstypename],,,[$getfsstat_includes])
4535
4536 # Determine how to get the list of mounted filesystems.
4537 ac_list_mounted_fs=
4538
4539 # If the getmntent function is available but not in the standard library,
4540 # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
4541 AC_FUNC_GETMNTENT
4542
4543 # This test must precede the ones for getmntent because Unicos-9 is
4544 # reported to have the getmntent function, but its support is incompatible
4545 # with other getmntent implementations.
4546
4547 # NOTE: Normally, I wouldn't use a check for system type as I've done for
4548 # `CRAY' below since that goes against the whole autoconf philosophy.  But
4549 # I think there is too great a chance that some non-Cray system has a
4550 # function named listmntent to risk the false positive.
4551
4552 if test -z "$ac_list_mounted_fs"; then
4553   # Cray UNICOS 9
4554   AC_MSG_CHECKING([for listmntent of Cray/Unicos-9])
4555   AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent,
4556     [fu_cv_sys_mounted_cray_listmntent=no
4557       AC_EGREP_CPP(yes,
4558         [#ifdef _CRAY
4559 yes
4560 #endif
4561         ], [test $ac_cv_func_listmntent = yes \
4562             && fu_cv_sys_mounted_cray_listmntent=yes]
4563       )
4564     ]
4565   )
4566   AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent)
4567   if test $fu_cv_sys_mounted_cray_listmntent = yes; then
4568     ac_list_mounted_fs=found
4569     AC_DEFINE(MOUNTED_LISTMNTENT, 1,
4570       [Define if there is a function named listmntent that can be used to
4571        list all mounted filesystems. (UNICOS)])
4572   fi
4573 fi
4574
4575 if test -z "$ac_list_mounted_fs"; then
4576   # AIX.
4577   AC_MSG_CHECKING([for mntctl function and struct vmount])
4578   AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
4579   [AC_TRY_CPP([#include <fshelp.h>],
4580     fu_cv_sys_mounted_vmount=yes,
4581     fu_cv_sys_mounted_vmount=no)])
4582   AC_MSG_RESULT($fu_cv_sys_mounted_vmount)
4583   if test $fu_cv_sys_mounted_vmount = yes; then
4584     ac_list_mounted_fs=found
4585     AC_DEFINE(MOUNTED_VMOUNT, 1,
4586         [Define if there is a function named mntctl that can be used to read
4587          the list of mounted filesystems, and there is a system header file
4588          that declares `struct vmount.'  (AIX)])
4589   fi
4590 fi
4591
4592 if test $ac_cv_func_getmntent = yes; then
4593
4594   # This system has the getmntent function.
4595   # Determine whether it's the one-argument variant or the two-argument one.
4596
4597   if test -z "$ac_list_mounted_fs"; then
4598     # 4.3BSD, SunOS, HP-UX, Dynix, Irix
4599     AC_MSG_CHECKING([for one-argument getmntent function])
4600     AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
4601                  [AC_TRY_COMPILE([
4602 /* SunOS 4.1.x /usr/include/mntent.h needs this for FILE */
4603 #include <stdio.h>
4604
4605 #include <mntent.h>
4606 #if !defined MOUNTED
4607 # if defined _PATH_MOUNTED      /* GNU libc  */
4608 #  define MOUNTED _PATH_MOUNTED
4609 # endif
4610 # if defined MNT_MNTTAB /* HP-UX.  */
4611 #  define MOUNTED MNT_MNTTAB
4612 # endif
4613 # if defined MNTTABNAME /* Dynix.  */
4614 #  define MOUNTED MNTTABNAME
4615 # endif
4616 #endif
4617 ],
4618                     [ struct mntent *mnt = 0; char *table = MOUNTED; ],
4619                     fu_cv_sys_mounted_getmntent1=yes,
4620                     fu_cv_sys_mounted_getmntent1=no)])
4621     AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
4622     if test $fu_cv_sys_mounted_getmntent1 = yes; then
4623       ac_list_mounted_fs=found
4624       AC_DEFINE(MOUNTED_GETMNTENT1, 1,
4625         [Define if there is a function named getmntent for reading the list
4626          of mounted filesystems, and that function takes a single argument.
4627          (4.3BSD, SunOS, HP-UX, Dynix, Irix)])
4628     fi
4629   fi
4630
4631   if test -z "$ac_list_mounted_fs"; then
4632     # SVR4
4633     AC_MSG_CHECKING([for two-argument getmntent function])
4634     AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
4635     [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
4636       fu_cv_sys_mounted_getmntent2=yes,
4637       fu_cv_sys_mounted_getmntent2=no)])
4638     AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2)
4639     if test $fu_cv_sys_mounted_getmntent2 = yes; then
4640       ac_list_mounted_fs=found
4641       AC_DEFINE(MOUNTED_GETMNTENT2, 1,
4642         [Define if there is a function named getmntent for reading the list of
4643          mounted filesystems, and that function takes two arguments.  (SVR4)])
4644     fi
4645   fi
4646
4647 fi
4648
4649 if test -z "$ac_list_mounted_fs"; then
4650   # DEC Alpha running OSF/1, and Apple Darwin 1.3.
4651   # powerpc-apple-darwin1.3.7 needs sys/param.h sys/ucred.h sys/fs_types.h
4652
4653   AC_MSG_CHECKING([for getfsstat function])
4654   AC_CACHE_VAL(fu_cv_sys_mounted_getfsstat,
4655   [AC_TRY_LINK([
4656 #include <sys/types.h>
4657 #if HAVE_STRUCT_FSSTAT_F_FSTYPENAME
4658 # define FS_TYPE(Ent) ((Ent).f_fstypename)
4659 #else
4660 # define FS_TYPE(Ent) mnt_names[(Ent).f_type]
4661 #endif
4662 ]$getfsstat_includes
4663 ,
4664   [struct statfs *stats;
4665    int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT);
4666    char *t = FS_TYPE (*stats); ],
4667     fu_cv_sys_mounted_getfsstat=yes,
4668     fu_cv_sys_mounted_getfsstat=no)])
4669   AC_MSG_RESULT($fu_cv_sys_mounted_getfsstat)
4670   if test $fu_cv_sys_mounted_getfsstat = yes; then
4671     ac_list_mounted_fs=found
4672     AC_DEFINE(MOUNTED_GETFSSTAT, 1,
4673               [Define if there is a function named getfsstat for reading the
4674                list of mounted filesystems.  (DEC Alpha running OSF/1)])
4675   fi
4676 fi
4677
4678 if test -z "$ac_list_mounted_fs"; then
4679   # SVR3
4680   AC_MSG_CHECKING([for FIXME existence of three headers])
4681   AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
4682     [AC_TRY_CPP([
4683 #include <sys/statfs.h>
4684 #include <sys/fstyp.h>
4685 #include <mnttab.h>],
4686                 fu_cv_sys_mounted_fread_fstyp=yes,
4687                 fu_cv_sys_mounted_fread_fstyp=no)])
4688   AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp)
4689   if test $fu_cv_sys_mounted_fread_fstyp = yes; then
4690     ac_list_mounted_fs=found
4691     AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
4692       [Define if (like SVR2) there is no specific function for reading the
4693        list of mounted filesystems, and your system has these header files:
4694        <sys/fstyp.h> and <sys/statfs.h>.  (SVR3)])
4695   fi
4696 fi
4697
4698 if test -z "$ac_list_mounted_fs"; then
4699   # 4.4BSD and DEC OSF/1.
4700   AC_MSG_CHECKING([for getmntinfo function])
4701   AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
4702     [
4703       test "$ac_cv_func_getmntinfo" = yes \
4704           && fu_cv_sys_mounted_getmntinfo=yes \
4705           || fu_cv_sys_mounted_getmntinfo=no
4706     ])
4707   AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
4708   if test $fu_cv_sys_mounted_getmntinfo = yes; then
4709     ac_list_mounted_fs=found
4710     AC_DEFINE(MOUNTED_GETMNTINFO, 1,
4711               [Define if there is a function named getmntinfo for reading the
4712                list of mounted filesystems.  (4.4BSD, Darwin)])
4713   fi
4714 fi
4715
4716 if test -z "$ac_list_mounted_fs"; then
4717   # Ultrix
4718   AC_MSG_CHECKING([for getmnt function])
4719   AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
4720     [AC_TRY_CPP([
4721 #include <sys/fs_types.h>
4722 #include <sys/mount.h>],
4723                 fu_cv_sys_mounted_getmnt=yes,
4724                 fu_cv_sys_mounted_getmnt=no)])
4725   AC_MSG_RESULT($fu_cv_sys_mounted_getmnt)
4726   if test $fu_cv_sys_mounted_getmnt = yes; then
4727     ac_list_mounted_fs=found
4728     AC_DEFINE(MOUNTED_GETMNT, 1,
4729       [Define if there is a function named getmnt for reading the list of
4730        mounted filesystems.  (Ultrix)])
4731   fi
4732 fi
4733
4734 if test -z "$ac_list_mounted_fs"; then
4735   # BeOS
4736   AC_CHECK_FUNCS(next_dev fs_stat_dev)
4737   AC_CHECK_HEADERS(fs_info.h)
4738   AC_MSG_CHECKING([for BEOS mounted file system support functions])
4739   if test $ac_cv_header_fs_info_h = yes \
4740       && test $ac_cv_func_next_dev = yes \
4741         && test $ac_cv_func_fs_stat_dev = yes; then
4742     fu_result=yes
4743   else
4744     fu_result=no
4745   fi
4746   AC_MSG_RESULT($fu_result)
4747   if test $fu_result = yes; then
4748     ac_list_mounted_fs=found
4749     AC_DEFINE(MOUNTED_FS_STAT_DEV, 1,
4750       [Define if there are functions named next_dev and fs_stat_dev for
4751        reading the list of mounted filesystems.  (BeOS)])
4752   fi
4753 fi
4754
4755 if test -z "$ac_list_mounted_fs"; then
4756   # SVR2
4757   AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
4758   AC_CACHE_VAL(fu_cv_sys_mounted_fread,
4759     [AC_TRY_CPP([#include <mnttab.h>],
4760                 fu_cv_sys_mounted_fread=yes,
4761                 fu_cv_sys_mounted_fread=no)])
4762   AC_MSG_RESULT($fu_cv_sys_mounted_fread)
4763   if test $fu_cv_sys_mounted_fread = yes; then
4764     ac_list_mounted_fs=found
4765     AC_DEFINE(MOUNTED_FREAD, 1,
4766               [Define if there is no specific function for reading the list of
4767                mounted filesystems.  fread will be used to read /etc/mnttab.
4768                (SVR2) ])
4769   fi
4770 fi
4771
4772 if test -z "$ac_list_mounted_fs"; then
4773   AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
4774   # FIXME -- no need to abort building the whole package
4775   # Can't build mountlist.c or anything that needs its functions
4776 fi
4777
4778 AS_IF([test $ac_list_mounted_fs = found], [$1], [$2])
4779
4780   ])
4781
4782 #serial 3
4783
4784 dnl From Jim Meyering.
4785 dnl
4786 dnl See if struct statfs has the f_fstypename member.
4787 dnl If so, define HAVE_F_FSTYPENAME_IN_STATFS.
4788 dnl
4789
4790 AC_DEFUN([jm_FSTYPENAME],
4791   [
4792     AC_CACHE_CHECK([for f_fstypename in struct statfs],
4793                    fu_cv_sys_f_fstypename_in_statfs,
4794       [
4795         AC_TRY_COMPILE(
4796           [
4797 #include <sys/param.h>
4798 #include <sys/types.h>
4799 #include <sys/mount.h>
4800           ],
4801           [struct statfs s; int i = sizeof s.f_fstypename;],
4802           fu_cv_sys_f_fstypename_in_statfs=yes,
4803           fu_cv_sys_f_fstypename_in_statfs=no
4804         )
4805       ]
4806     )
4807
4808     if test $fu_cv_sys_f_fstypename_in_statfs = yes; then
4809       AC_DEFINE(HAVE_F_FSTYPENAME_IN_STATFS, 1,
4810                 [Define if struct statfs has the f_fstypename member.])
4811     fi
4812   ]
4813 )
4814
4815 # obstack.m4 serial 1
4816 dnl Copyright (C) 2002 Free Software Foundation, Inc.
4817 dnl This file is free software, distributed under the terms of the GNU
4818 dnl General Public License.  As a special exception to the GNU General
4819 dnl Public License, this file may be distributed as part of a program
4820 dnl that contains a configuration script generated by Autoconf, under
4821 dnl the same distribution terms as the rest of that program.
4822
4823 AC_DEFUN([gl_OBSTACK],
4824 [
4825   dnl Prerequisites of lib/obstack.h.
4826   AC_CHECK_HEADERS_ONCE(stddef.h string.h)
4827
4828   AC_FUNC_OBSTACK
4829   dnl Note: AC_FUNC_OBSTACK does AC_LIBSOURCES([obstack.h, obstack.c]).
4830   if test $ac_cv_func_obstack = no; then
4831     gl_PREREQ_OBSTACK
4832   fi
4833 ])
4834
4835 # Prerequisites of lib/obstack.c.
4836 AC_DEFUN([gl_PREREQ_OBSTACK], [
4837   AC_CHECK_HEADERS_ONCE(stdlib.h)
4838 ])
4839
4840 # pathmax.m4 serial 2
4841 dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
4842 dnl This file is free software, distributed under the terms of the GNU
4843 dnl General Public License.  As a special exception to the GNU General
4844 dnl Public License, this file may be distributed as part of a program
4845 dnl that contains a configuration script generated by Autoconf, under
4846 dnl the same distribution terms as the rest of that program.
4847
4848 AC_DEFUN([gl_PATHMAX],
4849 [
4850   dnl Prerequisites of lib/pathmax.h.
4851   AC_CHECK_HEADERS_ONCE(sys/param.h unistd.h)
4852 ])
4853
4854 # path-concat.m4 serial 1
4855 dnl Copyright (C) 2002 Free Software Foundation, Inc.
4856 dnl This file is free software, distributed under the terms of the GNU
4857 dnl General Public License.  As a special exception to the GNU General
4858 dnl Public License, this file may be distributed as part of a program
4859 dnl that contains a configuration script generated by Autoconf, under
4860 dnl the same distribution terms as the rest of that program.
4861
4862 AC_DEFUN([gl_PATH_CONCAT],
4863 [
4864   dnl Prerequisites of lib/path-concat.c.
4865   AC_REQUIRE([jm_AC_DOS])
4866   AC_REQUIRE([AC_HEADER_STDC])
4867   AC_CHECK_HEADERS_ONCE(memory.h stdlib.h string.h strings.h unistd.h)
4868   AC_CHECK_FUNCS_ONCE(mempcpy)
4869   AC_CHECK_DECLS_ONCE(malloc)
4870 ])
4871
4872 # physmem.m4 serial 2
4873 dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
4874 dnl This file is free software, distributed under the terms of the GNU
4875 dnl General Public License.  As a special exception to the GNU General
4876 dnl Public License, this file may be distributed as part of a program
4877 dnl that contains a configuration script generated by Autoconf, under
4878 dnl the same distribution terms as the rest of that program.
4879
4880 # Check for the external symbol, _system_configuration,
4881 # a struct with member `physmem'.
4882 AC_DEFUN([gl_SYS__SYSTEM_CONFIGURATION],
4883   [AC_CACHE_CHECK(for external symbol _system_configuration,
4884                   gl_cv_var__system_configuration,
4885     [AC_LINK_IFELSE([AC_LANG_PROGRAM(
4886                       [[#include <sys/systemcfg.h>
4887                       ]],
4888                       [double x = _system_configuration.physmem;])],
4889       [gl_cv_var__system_configuration=yes],
4890       [gl_cv_var__system_configuration=no])])
4891
4892     if test $gl_cv_var__system_configuration = yes; then
4893       AC_DEFINE(HAVE__SYSTEM_CONFIGURATION, 1,
4894                 [Define to 1 if you have the external variable,
4895                 _system_configuration with a member named physmem.])
4896     fi
4897   ]
4898 )
4899
4900 AC_DEFUN([gl_PHYSMEM],
4901 [
4902   # Prerequisites of lib/physmem.c.
4903   AC_CHECK_HEADERS_ONCE(unistd.h)
4904   AC_CHECK_HEADERS([sys/pstat.h sys/sysmp.h sys/sysinfo.h \
4905     machine/hal_sysinfo.h sys/table.h sys/param.h sys/sysctl.h \
4906     sys/systemcfg.h],,, [AC_INCLUDES_DEFAULT])
4907
4908   AC_CHECK_FUNCS(pstat_getstatic pstat_getdynamic sysmp getsysinfo sysctl table)
4909   AC_REQUIRE([gl_SYS__SYSTEM_CONFIGURATION])
4910 ])
4911
4912 # posixtm.m4 serial 1
4913 dnl Copyright (C) 2002 Free Software Foundation, Inc.
4914 dnl This file is free software, distributed under the terms of the GNU
4915 dnl General Public License.  As a special exception to the GNU General
4916 dnl Public License, this file may be distributed as part of a program
4917 dnl that contains a configuration script generated by Autoconf, under
4918 dnl the same distribution terms as the rest of that program.
4919
4920 AC_DEFUN([gl_POSIXTM],
4921 [
4922   dnl Prerequisites of lib/posixtm.c.
4923   AC_STRUCT_TM
4924   AC_CHECK_HEADERS_ONCE(stdlib.h string.h)
4925 ])
4926
4927 # posixver.m4 serial 1
4928 dnl Copyright (C) 2002 Free Software Foundation, Inc.
4929 dnl This file is free software, distributed under the terms of the GNU
4930 dnl General Public License.  As a special exception to the GNU General
4931 dnl Public License, this file may be distributed as part of a program
4932 dnl that contains a configuration script generated by Autoconf, under
4933 dnl the same distribution terms as the rest of that program.
4934
4935 AC_DEFUN([gl_POSIXVER],
4936 [
4937   AC_CHECK_HEADERS_ONCE(unistd.h)
4938   AC_CHECK_DECLS_ONCE(getenv)
4939 ])
4940
4941 # quotearg.m4 serial 1
4942 dnl Copyright (C) 2002 Free Software Foundation, Inc.
4943 dnl This file is free software, distributed under the terms of the GNU
4944 dnl General Public License.  As a special exception to the GNU General
4945 dnl Public License, this file may be distributed as part of a program
4946 dnl that contains a configuration script generated by Autoconf, under
4947 dnl the same distribution terms as the rest of that program.
4948
4949 AC_DEFUN([gl_QUOTEARG],
4950 [
4951   dnl Prerequisites of lib/quotearg.c.
4952   AC_CHECK_HEADERS_ONCE(wchar.h wctype.h)
4953   AC_CHECK_FUNCS_ONCE(iswprint mbsinit)
4954   AC_TYPE_MBSTATE_T
4955   jm_FUNC_MBRTOWC
4956 ])
4957
4958 # quote.m4 serial 2
4959 dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
4960 dnl This file is free software, distributed under the terms of the GNU
4961 dnl General Public License.  As a special exception to the GNU General
4962 dnl Public License, this file may be distributed as part of a program
4963 dnl that contains a configuration script generated by Autoconf, under
4964 dnl the same distribution terms as the rest of that program.
4965
4966 AC_DEFUN([gl_QUOTE],
4967 [
4968   dnl Prerequisites of lib/quote.c.
4969   dnl (none)
4970 ])
4971
4972 # readutmp.m4 serial 2
4973 dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
4974 dnl This file is free software, distributed under the terms of the GNU
4975 dnl General Public License.  As a special exception to the GNU General
4976 dnl Public License, this file may be distributed as part of a program
4977 dnl that contains a configuration script generated by Autoconf, under
4978 dnl the same distribution terms as the rest of that program.
4979
4980 AC_DEFUN([gl_READUTMP],
4981 [
4982   dnl Prerequisites of lib/readutmp.h.
4983   AC_CHECK_HEADERS_ONCE(sys/param.h)
4984   AC_CHECK_HEADERS(utmp.h utmpx.h)
4985   AC_CHECK_FUNCS(utmpname utmpxname)
4986   AC_CHECK_DECLS(getutent,,,[
4987 #ifdef HAVE_UTMP_H
4988 # include <utmp.h>
4989 #endif
4990 ])
4991   if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
4992     utmp_includes="\
4993 $ac_includes_default
4994 #ifdef HAVE_UTMPX_H
4995 # include <utmpx.h>
4996 #endif
4997 #ifdef HAVE_UTMP_H
4998 # include <utmp.h>
4999 #endif
5000 "
5001     AC_CHECK_MEMBERS([struct utmpx.ut_user],,,[$utmp_includes])
5002     AC_CHECK_MEMBERS([struct utmp.ut_user],,,[$utmp_includes])
5003     AC_CHECK_MEMBERS([struct utmpx.ut_name],,,[$utmp_includes])
5004     AC_CHECK_MEMBERS([struct utmp.ut_name],,,[$utmp_includes])
5005     AC_CHECK_MEMBERS([struct utmpx.ut_type],,,[$utmp_includes])
5006     AC_CHECK_MEMBERS([struct utmp.ut_type],,,[$utmp_includes])
5007     AC_CHECK_MEMBERS([struct utmpx.ut_pid],,,[$utmp_includes])
5008     AC_CHECK_MEMBERS([struct utmp.ut_pid],,,[$utmp_includes])
5009     AC_CHECK_MEMBERS([struct utmpx.ut_id],,,[$utmp_includes])
5010     AC_CHECK_MEMBERS([struct utmp.ut_id],,,[$utmp_includes])
5011     AC_CHECK_MEMBERS([struct utmpx.ut_exit],,,[$utmp_includes])
5012     AC_CHECK_MEMBERS([struct utmp.ut_exit],,,[$utmp_includes])
5013
5014     AC_CHECK_MEMBERS([struct utmpx.ut_exit.ut_exit],,,[$utmp_includes])
5015     AC_CHECK_MEMBERS([struct utmp.ut_exit.ut_exit],,,[$utmp_includes])
5016     AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_exit],,,[$utmp_includes])
5017     AC_CHECK_MEMBERS([struct utmp.ut_exit.e_exit],,,[$utmp_includes])
5018
5019     AC_CHECK_MEMBERS([struct utmpx.ut_exit.ut_termination],,,[$utmp_includes])
5020     AC_CHECK_MEMBERS([struct utmp.ut_exit.ut_termination],,,[$utmp_includes])
5021     AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_termination],,,[$utmp_includes])
5022     AC_CHECK_MEMBERS([struct utmp.ut_exit.e_termination],,,[$utmp_includes])
5023
5024     AC_LIBOBJ(readutmp)
5025     gl_PREREQ_READUTMP
5026   fi
5027 ])
5028
5029 # Prerequisites of lib/readutmp.c.
5030 AC_DEFUN([gl_PREREQ_READUTMP],
5031 [
5032   AC_REQUIRE([AC_HEADER_STDC])
5033   AC_CHECK_HEADERS_ONCE(string.h)
5034 ])
5035
5036 #serial 19
5037
5038 dnl Initially derived from code in GNU grep.
5039 dnl Mostly written by Jim Meyering.
5040
5041 AC_DEFUN([gl_REGEX],
5042 [
5043   jm_INCLUDED_REGEX([lib/regex.c])
5044 ])
5045
5046 dnl Usage: jm_INCLUDED_REGEX([lib/regex.c])
5047 dnl
5048 AC_DEFUN([jm_INCLUDED_REGEX],
5049   [
5050     dnl Even packages that don't use regex.c can use this macro.
5051     dnl Of course, for them it doesn't do anything.
5052
5053     # Assume we'll default to using the included regex.c.
5054     ac_use_included_regex=yes
5055
5056     # However, if the system regex support is good enough that it passes the
5057     # the following run test, then default to *not* using the included regex.c.
5058     # If cross compiling, assume the test would fail and use the included
5059     # regex.c.  The first failing regular expression is from `Spencer ere
5060     # test #75' in grep-2.3.
5061     AC_CACHE_CHECK([for working re_compile_pattern],
5062                    jm_cv_func_working_re_compile_pattern,
5063       AC_TRY_RUN(
5064 [#include <stdio.h>
5065 #include <string.h>
5066 #include <regex.h>
5067           int
5068           main ()
5069           {
5070             static struct re_pattern_buffer regex;
5071             const char *s;
5072             struct re_registers regs;
5073             re_set_syntax (RE_SYNTAX_POSIX_EGREP);
5074             memset (&regex, 0, sizeof (regex));
5075             [s = re_compile_pattern ("a[[:@:>@:]]b\n", 9, &regex);]
5076             /* This should fail with _Invalid character class name_ error.  */
5077             if (!s)
5078               exit (1);
5079
5080             /* This should succeed, but doesn't for e.g. glibc-2.1.3.  */
5081             memset (&regex, 0, sizeof (regex));
5082             s = re_compile_pattern ("{1", 2, &regex);
5083
5084             if (s)
5085               exit (1);
5086
5087             /* The following example is derived from a problem report
5088                against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>.  */
5089             memset (&regex, 0, sizeof (regex));
5090             s = re_compile_pattern ("[[an\371]]*n", 7, &regex);
5091             if (s)
5092               exit (1);
5093
5094             /* This should match, but doesn't for e.g. glibc-2.2.1.  */
5095             if (re_match (&regex, "an", 2, 0, &regs) != 2)
5096               exit (1);
5097
5098             memset (&regex, 0, sizeof (regex));
5099             s = re_compile_pattern ("x", 1, &regex);
5100             if (s)
5101               exit (1);
5102
5103             /* The version of regex.c in e.g. GNU libc-2.2.93 didn't
5104                work with a negative RANGE argument.  */
5105             if (re_search (&regex, "wxy", 3, 2, -2, &regs) != 1)
5106               exit (1);
5107
5108             exit (0);
5109           }
5110         ],
5111                jm_cv_func_working_re_compile_pattern=yes,
5112                jm_cv_func_working_re_compile_pattern=no,
5113                dnl When crosscompiling, assume it's broken.
5114                jm_cv_func_working_re_compile_pattern=no))
5115     if test $jm_cv_func_working_re_compile_pattern = yes; then
5116       ac_use_included_regex=no
5117     fi
5118
5119     test -n "$1" || AC_MSG_ERROR([missing argument])
5120     m4_syscmd([test -f $1])
5121     ifelse(m4_sysval, 0,
5122       [
5123         AC_ARG_WITH(included-regex,
5124         [  --without-included-regex don't compile regex; this is the default on
5125                           systems with version 2 of the GNU C library
5126                           (use with caution on other system)],
5127                     jm_with_regex=$withval,
5128                     jm_with_regex=$ac_use_included_regex)
5129         if test "$jm_with_regex" = yes; then
5130           AC_LIBOBJ(regex)
5131           jm_PREREQ_REGEX
5132         fi
5133       ],
5134     )
5135   ]
5136 )
5137
5138 # Prerequisites of lib/regex.c.
5139 AC_DEFUN([jm_PREREQ_REGEX],
5140 [
5141   dnl FIXME: Maybe provide a btowc replacement someday: Solaris 2.5.1 lacks it.
5142   dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary
5143   dnl to get them.
5144
5145   dnl Persuade glibc <string.h> to declare mempcpy().
5146   AC_REQUIRE([AC_GNU_SOURCE])
5147
5148   AC_REQUIRE([gl_C_RESTRICT])
5149   AC_REQUIRE([AC_FUNC_ALLOCA])
5150   AC_REQUIRE([AC_HEADER_STDC])
5151   AC_CHECK_HEADERS_ONCE(limits.h string.h wchar.h wctype.h)
5152   AC_CHECK_FUNCS_ONCE(isascii mempcpy)
5153   AC_CHECK_FUNCS(btowc)
5154 ])
5155
5156 #serial 1002
5157 # This macro can be removed once we can rely on Autoconf 2.57a or later,
5158 # since we can then use its AC_C_RESTRICT.
5159
5160 # gl_C_RESTRICT
5161 # --------------
5162 # Determine whether the C/C++ compiler supports the "restrict" keyword
5163 # introduced in ANSI C99, or an equivalent.  Do nothing if the compiler
5164 # accepts it.  Otherwise, if the compiler supports an equivalent,
5165 # define "restrict" to be that.  Here are some variants:
5166 # - GCC supports both __restrict and __restrict__
5167 # - older DEC Alpha C compilers support only __restrict
5168 # - _Restrict is the only spelling accepted by Sun WorkShop 6 update 2 C
5169 # Otherwise, define "restrict" to be empty.
5170 AC_DEFUN([gl_C_RESTRICT],
5171 [AC_CACHE_CHECK([for C/C++ restrict keyword], gl_cv_c_restrict,
5172   [gl_cv_c_restrict=no
5173    # Try the official restrict keyword, then gcc's __restrict, and
5174    # the less common variants.
5175    for ac_kw in restrict __restrict __restrict__ _Restrict; do
5176      AC_COMPILE_IFELSE([AC_LANG_SOURCE(
5177       [float * $ac_kw x;])],
5178       [gl_cv_c_restrict=$ac_kw; break])
5179    done
5180   ])
5181  case $gl_cv_c_restrict in
5182    restrict) ;;
5183    no) AC_DEFINE(restrict,,
5184         [Define to equivalent of C99 restrict keyword, or to nothing if this
5185         is not supported.  Do not define if restrict is supported directly.]) ;;
5186    *)  AC_DEFINE_UNQUOTED(restrict, $gl_cv_c_restrict) ;;
5187  esac
5188 ])
5189
5190 # safe-read.m4 serial 2
5191 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
5192 dnl This file is free software, distributed under the terms of the GNU
5193 dnl General Public License.  As a special exception to the GNU General
5194 dnl Public License, this file may be distributed as part of a program
5195 dnl that contains a configuration script generated by Autoconf, under
5196 dnl the same distribution terms as the rest of that program.
5197
5198 AC_DEFUN([gl_SAFE_READ],
5199 [
5200   gl_PREREQ_SAFE_READ
5201 ])
5202
5203 # Prerequisites of lib/safe-read.c.
5204 AC_DEFUN([gl_PREREQ_SAFE_READ],
5205 [
5206   AC_REQUIRE([gt_TYPE_SSIZE_T])
5207   AC_CHECK_HEADERS_ONCE(unistd.h)
5208 ])
5209
5210 # safe-write.m4 serial 1
5211 dnl Copyright (C) 2002 Free Software Foundation, Inc.
5212 dnl This file is free software, distributed under the terms of the GNU
5213 dnl General Public License.  As a special exception to the GNU General
5214 dnl Public License, this file may be distributed as part of a program
5215 dnl that contains a configuration script generated by Autoconf, under
5216 dnl the same distribution terms as the rest of that program.
5217
5218 AC_DEFUN([gl_SAFE_WRITE],
5219 [
5220   gl_PREREQ_SAFE_WRITE
5221 ])
5222
5223 # Prerequisites of lib/safe-write.c.
5224 AC_DEFUN([gl_PREREQ_SAFE_WRITE],
5225 [
5226   gl_PREREQ_SAFE_READ
5227 ])
5228
5229 # same.m4 serial 2
5230 dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
5231 dnl This file is free software, distributed under the terms of the GNU
5232 dnl General Public License.  As a special exception to the GNU General
5233 dnl Public License, this file may be distributed as part of a program
5234 dnl that contains a configuration script generated by Autoconf, under
5235 dnl the same distribution terms as the rest of that program.
5236
5237 AC_DEFUN([gl_SAME],
5238 [
5239   dnl Prerequisites of lib/same.c.
5240   AC_CHECK_HEADERS_ONCE(unistd.h)
5241   AC_CHECK_FUNCS(pathconf)
5242 ])
5243
5244 # savedir.m4 serial 1
5245 dnl Copyright (C) 2002 Free Software Foundation, Inc.
5246 dnl This file is free software, distributed under the terms of the GNU
5247 dnl General Public License.  As a special exception to the GNU General
5248 dnl Public License, this file may be distributed as part of a program
5249 dnl that contains a configuration script generated by Autoconf, under
5250 dnl the same distribution terms as the rest of that program.
5251
5252 AC_DEFUN([gl_SAVEDIR],
5253 [
5254   dnl Prerequisites of lib/savedir.c.
5255   AC_REQUIRE([AC_HEADER_STDC])
5256   AC_REQUIRE([AC_HEADER_DIRENT])
5257   AC_REQUIRE([AC_FUNC_CLOSEDIR_VOID])
5258 ])
5259
5260 # save-cwd.m4 serial 1
5261 dnl Copyright (C) 2002 Free Software Foundation, Inc.
5262 dnl This file is free software, distributed under the terms of the GNU
5263 dnl General Public License.  As a special exception to the GNU General
5264 dnl Public License, this file may be distributed as part of a program
5265 dnl that contains a configuration script generated by Autoconf, under
5266 dnl the same distribution terms as the rest of that program.
5267
5268 AC_DEFUN([gl_SAVE_CWD],
5269 [
5270   dnl Prerequisites for lib/save-cwd.c.
5271   AC_REQUIRE([AC_HEADER_STDC])
5272   AC_CHECK_HEADERS_ONCE(fcntl.h unistd.h)
5273   AC_CHECK_FUNCS(fchdir)
5274 ])
5275
5276 # settime.m4 serial 1
5277 dnl Copyright (C) 2002 Free Software Foundation, Inc.
5278 dnl This file is free software, distributed under the terms of the GNU
5279 dnl General Public License.  As a special exception to the GNU General
5280 dnl Public License, this file may be distributed as part of a program
5281 dnl that contains a configuration script generated by Autoconf, under
5282 dnl the same distribution terms as the rest of that program.
5283
5284 AC_DEFUN([gl_SETTIME],
5285 [
5286   dnl Prerequisites of lib/settime.c.
5287   # Need clock_settime.
5288   AC_REQUIRE([gl_CLOCK_TIME])
5289 ])
5290
5291 # clock_time.m4 serial 2
5292 dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
5293 dnl This file is free software, distributed under the terms of the GNU
5294 dnl General Public License.  As a special exception to the GNU General
5295 dnl Public License, this file may be distributed as part of a program
5296 dnl that contains a configuration script generated by Autoconf, under
5297 dnl the same distribution terms as the rest of that program.
5298
5299 # Check for clock_gettime and clock_settime, and sets LIB_CLOCK_GETTIME.
5300 AC_DEFUN([gl_CLOCK_TIME],
5301 [
5302   # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
5303   # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
5304
5305   # Save and restore LIBS so e.g., -lrt, isn't added to it.  Otherwise, *all*
5306   # programs in the package would end up linked with that potentially-shared
5307   # library, inducing unnecessary run-time overhead.
5308   fetish_saved_libs=$LIBS
5309     AC_SEARCH_LIBS(clock_gettime, [rt posix4],
5310                    [LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
5311     AC_SUBST(LIB_CLOCK_GETTIME)
5312     AC_CHECK_FUNCS(clock_gettime clock_settime)
5313   LIBS=$fetish_saved_libs
5314 ])
5315
5316 # sha.m4 serial 1
5317 dnl Copyright (C) 2002 Free Software Foundation, Inc.
5318 dnl This file is free software, distributed under the terms of the GNU
5319 dnl General Public License.  As a special exception to the GNU General
5320 dnl Public License, this file may be distributed as part of a program
5321 dnl that contains a configuration script generated by Autoconf, under
5322 dnl the same distribution terms as the rest of that program.
5323
5324 AC_DEFUN([gl_SHA],
5325 [
5326   dnl Prerequisites of lib/sha.c.
5327   AC_REQUIRE([AC_HEADER_STDC])
5328   AC_CHECK_FUNCS_ONCE(memcpy)
5329 ])
5330
5331 # stdio-safer.m4 serial 1
5332 dnl Copyright (C) 2002 Free Software Foundation, Inc.
5333 dnl This file is free software, distributed under the terms of the GNU
5334 dnl General Public License.  As a special exception to the GNU General
5335 dnl Public License, this file may be distributed as part of a program
5336 dnl that contains a configuration script generated by Autoconf, under
5337 dnl the same distribution terms as the rest of that program.
5338
5339 AC_DEFUN([gl_STDIO_SAFER],
5340 [
5341   dnl Prerequisites of lib/fopen-safer.c.
5342   AC_CHECK_HEADERS_ONCE(unistd.h)
5343 ])
5344
5345 # strcase.m4 serial 1
5346 dnl Copyright (C) 2002 Free Software Foundation, Inc.
5347 dnl This file is free software, distributed under the terms of the GNU
5348 dnl General Public License.  As a special exception to the GNU General
5349 dnl Public License, this file may be distributed as part of a program
5350 dnl that contains a configuration script generated by Autoconf, under
5351 dnl the same distribution terms as the rest of that program.
5352
5353 AC_DEFUN([gl_STRCASE],
5354 [
5355   gl_FUNC_STRCASECMP
5356   gl_FUNC_STRNCASECMP
5357 ])
5358
5359 AC_DEFUN([gl_FUNC_STRCASECMP],
5360 [
5361   AC_REPLACE_FUNCS(strcasecmp)
5362   if test $ac_cv_func_strcasecmp = no; then
5363     gl_PREREQ_STRCASECMP
5364   fi
5365 ])
5366
5367 AC_DEFUN([gl_FUNC_STRNCASECMP],
5368 [
5369   AC_REPLACE_FUNCS(strncasecmp)
5370   if test $ac_cv_func_strncasecmp = no; then
5371     gl_PREREQ_STRNCASECMP
5372   fi
5373 ])
5374
5375 # Prerequisites of lib/strcasecmp.c.
5376 AC_DEFUN([gl_PREREQ_STRCASECMP], [
5377   :
5378 ])
5379
5380 # Prerequisites of lib/strncasecmp.c.
5381 AC_DEFUN([gl_PREREQ_STRNCASECMP], [
5382   :
5383 ])
5384
5385 #serial 7
5386
5387 dnl From Jim Meyering
5388
5389 AC_DEFUN([gl_TIMESPEC],
5390 [
5391   dnl Prerequisites of lib/timespec.h.
5392   AC_REQUIRE([AC_HEADER_TIME])
5393   AC_CHECK_HEADERS_ONCE(sys/time.h)
5394   jm_CHECK_TYPE_STRUCT_TIMESPEC
5395   AC_STRUCT_ST_MTIM_NSEC
5396
5397   dnl Persuade glibc <time.h> to declare nanosleep().
5398   AC_REQUIRE([AC_GNU_SOURCE])
5399
5400   AC_CHECK_DECLS(nanosleep, , , [#include <time.h>])
5401 ])
5402
5403 dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
5404 dnl in time.h or sys/time.h.
5405
5406 AC_DEFUN([jm_CHECK_TYPE_STRUCT_TIMESPEC],
5407 [
5408   dnl Persuade pedantic Solaris to declare struct timespec.
5409   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
5410
5411   AC_REQUIRE([AC_HEADER_TIME])
5412   AC_CHECK_HEADERS_ONCE(sys/time.h)
5413   AC_CACHE_CHECK([for struct timespec], fu_cv_sys_struct_timespec,
5414     [AC_TRY_COMPILE(
5415       [
5416 #      if TIME_WITH_SYS_TIME
5417 #       include <sys/time.h>
5418 #       include <time.h>
5419 #      else
5420 #       if HAVE_SYS_TIME_H
5421 #        include <sys/time.h>
5422 #       else
5423 #        include <time.h>
5424 #       endif
5425 #      endif
5426       ],
5427       [static struct timespec x; x.tv_sec = x.tv_nsec;],
5428       fu_cv_sys_struct_timespec=yes,
5429       fu_cv_sys_struct_timespec=no)
5430     ])
5431
5432   if test $fu_cv_sys_struct_timespec = yes; then
5433     AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
5434               [Define if struct timespec is declared in <time.h>. ])
5435   fi
5436 ])
5437
5438 #serial 6
5439
5440 dnl From Paul Eggert.
5441
5442 # Define ST_MTIM_NSEC to be the nanoseconds member of struct stat's st_mtim,
5443 # if it exists.
5444
5445 AC_DEFUN([AC_STRUCT_ST_MTIM_NSEC],
5446  [AC_CACHE_CHECK([for nanoseconds member of struct stat.st_mtim],
5447    ac_cv_struct_st_mtim_nsec,
5448    [ac_save_CPPFLAGS="$CPPFLAGS"
5449     ac_cv_struct_st_mtim_nsec=no
5450     # tv_nsec -- the usual case
5451     # _tv_nsec -- Solaris 2.6, if
5452     #   (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1
5453     #    && !defined __EXTENSIONS__)
5454     # st__tim.tv_nsec -- UnixWare 2.1.2
5455     for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do
5456       CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val"
5457       AC_TRY_COMPILE([#include <sys/types.h>
5458 #include <sys/stat.h>], [struct stat s; s.st_mtim.ST_MTIM_NSEC;],
5459         [ac_cv_struct_st_mtim_nsec=$ac_val; break])
5460     done
5461     CPPFLAGS="$ac_save_CPPFLAGS"])
5462
5463   if test $ac_cv_struct_st_mtim_nsec != no; then
5464     AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec,
5465       [Define to be the nanoseconds member of struct stat's st_mtim,
5466        if it exists.])
5467   fi
5468  ]
5469 )
5470
5471 # unicodeio.m4 serial 1
5472 dnl Copyright (C) 2002 Free Software Foundation, Inc.
5473 dnl This file is free software, distributed under the terms of the GNU
5474 dnl General Public License.  As a special exception to the GNU General
5475 dnl Public License, this file may be distributed as part of a program
5476 dnl that contains a configuration script generated by Autoconf, under
5477 dnl the same distribution terms as the rest of that program.
5478
5479 AC_DEFUN([gl_UNICODEIO],
5480 [
5481   dnl Prerequisites of lib/unicodeio.c.
5482   AC_CHECK_HEADERS_ONCE(string.h)
5483 ])
5484
5485 # unistd-safer.m4 serial 1
5486 dnl Copyright (C) 2002 Free Software Foundation, Inc.
5487 dnl This file is free software, distributed under the terms of the GNU
5488 dnl General Public License.  As a special exception to the GNU General
5489 dnl Public License, this file may be distributed as part of a program
5490 dnl that contains a configuration script generated by Autoconf, under
5491 dnl the same distribution terms as the rest of that program.
5492
5493 AC_DEFUN([gl_UNISTD_SAFER],
5494 [
5495   gl_PREREQ_DUP_SAFER
5496 ])
5497
5498 # Prerequisites of lib/dup-safer.c.
5499 AC_DEFUN([gl_PREREQ_DUP_SAFER], [
5500   AC_CHECK_HEADERS_ONCE(fcntl.h unistd.h)
5501 ])
5502
5503 # userspec.m4 serial 2
5504 dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
5505 dnl This file is free software, distributed under the terms of the GNU
5506 dnl General Public License.  As a special exception to the GNU General
5507 dnl Public License, this file may be distributed as part of a program
5508 dnl that contains a configuration script generated by Autoconf, under
5509 dnl the same distribution terms as the rest of that program.
5510
5511 AC_DEFUN([gl_USERSPEC],
5512 [
5513   dnl Prerequisites of lib/userspec.c.
5514   AC_REQUIRE([AC_HEADER_STDC])
5515   AC_REQUIRE([AC_FUNC_ALLOCA])
5516   AC_CHECK_HEADERS_ONCE(string.h sys/param.h unistd.h)
5517 ])
5518
5519 dnl Copyright (C) 2003 Free Software Foundation, Inc.
5520 dnl This file is free software, distributed under the terms of the GNU
5521 dnl General Public License.  As a special exception to the GNU General
5522 dnl Public License, this file may be distributed as part of a program
5523 dnl that contains a configuration script generated by Autoconf, under
5524 dnl the same distribution terms as the rest of that program.
5525
5526 AC_DEFUN([gl_UTIMENS],
5527 [
5528   dnl Prerequisites of lib/utimens.c.
5529   AC_REQUIRE([gl_TIMESPEC])
5530   AC_REQUIRE([gl_FUNC_UTIMES])
5531   AC_REQUIRE([jm_CHECK_TYPE_STRUCT_TIMESPEC])
5532   AC_REQUIRE([jm_CHECK_TYPE_STRUCT_UTIMBUF])
5533 ])
5534
5535 # See if we need to work around bugs in glibc's implementation of
5536 # utimes from around July/August 2003.
5537 # First, there was a bug that would make utimes set mtime
5538 # and atime to zero (1970-01-01) unconditionally.
5539 # Then, there is/was code to round rather than truncate.
5540 #
5541 # From Jim Meyering, with suggestions from Paul Eggert.
5542
5543 AC_DEFUN([gl_FUNC_UTIMES],
5544 [
5545   AC_CACHE_CHECK([determine whether the utimes function works],
5546                  gl_cv_func_working_utimes,
5547   [
5548   AC_RUN_IFELSE([AC_LANG_SOURCE([[
5549 #include <sys/types.h>
5550 #include <sys/stat.h>
5551 #include <sys/time.h>
5552 #include <unistd.h>
5553 #include <stdlib.h>
5554 #include <stdio.h>
5555 #include <utime.h>
5556
5557 int
5558 main ()
5559 {
5560   static struct timeval timeval[2] = {{9, 10}, {999999, 999999}};
5561   struct stat sbuf;
5562   char const *file = "conftest.utimes";
5563   FILE *f;
5564
5565   exit ( ! ((f = fopen (file, "w"))
5566             && fclose (f) == 0
5567             && utimes (file, timeval) == 0
5568             && lstat (file, &sbuf) == 0
5569             && sbuf.st_atime == timeval[0].tv_sec
5570             && sbuf.st_mtime == timeval[1].tv_sec) );
5571 }
5572   ]])],
5573        [gl_cv_func_working_utimes=yes],
5574        [gl_cv_func_working_utimes=no],
5575        [gl_cv_func_working_utimes=no])])
5576
5577   if test $gl_cv_func_working_utimes = yes; then
5578     AC_DEFINE([HAVE_WORKING_UTIMES], 1, [Define if utimes works properly. ])
5579   fi
5580 ])
5581
5582 # xalloc.m4 serial 1
5583 dnl Copyright (C) 2002 Free Software Foundation, Inc.
5584 dnl This file is free software, distributed under the terms of the GNU
5585 dnl General Public License.  As a special exception to the GNU General
5586 dnl Public License, this file may be distributed as part of a program
5587 dnl that contains a configuration script generated by Autoconf, under
5588 dnl the same distribution terms as the rest of that program.
5589
5590 AC_DEFUN([gl_XALLOC],
5591 [
5592   gl_PREREQ_XMALLOC
5593   gl_PREREQ_XSTRDUP
5594 ])
5595
5596 # Prerequisites of lib/xmalloc.c.
5597 AC_DEFUN([gl_PREREQ_XMALLOC], [
5598   AC_REQUIRE([AC_HEADER_STDC])
5599   AC_REQUIRE([jm_FUNC_MALLOC])
5600   AC_REQUIRE([jm_FUNC_REALLOC])
5601 ])
5602
5603 # Prerequisites of lib/xstrdup.c.
5604 AC_DEFUN([gl_PREREQ_XSTRDUP], [
5605   AC_REQUIRE([AC_HEADER_STDC])
5606   AC_CHECK_HEADERS_ONCE(string.h)
5607 ])
5608
5609 # malloc.m4 serial 7
5610 dnl Copyright (C) 2002 Free Software Foundation, Inc.
5611 dnl This file is free software, distributed under the terms of the GNU
5612 dnl General Public License.  As a special exception to the GNU General
5613 dnl Public License, this file may be distributed as part of a program
5614 dnl that contains a configuration script generated by Autoconf, under
5615 dnl the same distribution terms as the rest of that program.
5616
5617 dnl From Jim Meyering.
5618 dnl Determine whether malloc accepts 0 as its argument.
5619 dnl If it doesn't, arrange to use the replacement function.
5620
5621 AC_DEFUN([jm_FUNC_MALLOC],
5622 [
5623   AC_REQUIRE([AC_FUNC_MALLOC])
5624   dnl autoconf < 2.57 used the symbol ac_cv_func_malloc_works.
5625   if test X"$ac_cv_func_malloc_0_nonnull" = Xno || test X"$ac_cv_func_malloc_works" = Xno; then
5626     gl_PREREQ_MALLOC
5627   fi
5628 ])
5629
5630 # Prerequisites of lib/malloc.c.
5631 AC_DEFUN([gl_PREREQ_MALLOC], [
5632   :
5633 ])
5634
5635 # realloc.m4 serial 7
5636 dnl Copyright (C) 2002 Free Software Foundation, Inc.
5637 dnl This file is free software, distributed under the terms of the GNU
5638 dnl General Public License.  As a special exception to the GNU General
5639 dnl Public License, this file may be distributed as part of a program
5640 dnl that contains a configuration script generated by Autoconf, under
5641 dnl the same distribution terms as the rest of that program.
5642
5643 dnl From Jim Meyering.
5644 dnl Determine whether realloc works when both arguments are 0.
5645 dnl If it doesn't, arrange to use the replacement function.
5646
5647 AC_DEFUN([jm_FUNC_REALLOC],
5648 [
5649   AC_REQUIRE([AC_FUNC_REALLOC])
5650   dnl autoconf < 2.57 used the symbol ac_cv_func_realloc_works.
5651   if test X"$ac_cv_func_realloc_0_nonnull" = Xno || test X"$ac_cv_func_realloc_works" = Xno; then
5652     gl_PREREQ_REALLOC
5653   fi
5654 ])
5655
5656 # Prerequisites of lib/realloc.c.
5657 AC_DEFUN([gl_PREREQ_REALLOC], [
5658   :
5659 ])
5660
5661 # xgetcwd.m4 serial 1
5662 dnl Copyright (C) 2002 Free Software Foundation, Inc.
5663 dnl This file is free software, distributed under the terms of the GNU
5664 dnl General Public License.  As a special exception to the GNU General
5665 dnl Public License, this file may be distributed as part of a program
5666 dnl that contains a configuration script generated by Autoconf, under
5667 dnl the same distribution terms as the rest of that program.
5668
5669 AC_DEFUN([gl_XGETCWD],
5670 [
5671   dnl Prerequisites of lib/xgetcwd.c.
5672   AC_CHECK_HEADERS_ONCE(stdlib.h unistd.h)
5673   AC_CHECK_FUNCS(getcwd)
5674   AC_FUNC_GETCWD_NULL
5675 ])
5676
5677 # getcwd.m4 - check whether getcwd (NULL, 0) allocates memory for result
5678
5679 # Copyright 2001 Free Software Foundation, Inc.
5680
5681 # This program is free software; you can redistribute it and/or modify
5682 # it under the terms of the GNU General Public License as published by
5683 # the Free Software Foundation; either version 2, or (at your option)
5684 # any later version.
5685
5686 # This program is distributed in the hope that it will be useful,
5687 # but WITHOUT ANY WARRANTY; without even the implied warranty of
5688 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5689 # GNU General Public License for more details.
5690
5691 # You should have received a copy of the GNU General Public License
5692 # along with this program; if not, write to the Free Software Foundation,
5693 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
5694
5695 # Written by Paul Eggert.
5696
5697 AC_DEFUN([AC_FUNC_GETCWD_NULL],
5698   [
5699    AC_CHECK_HEADERS_ONCE(stdlib.h unistd.h)
5700    AC_CACHE_CHECK([whether getcwd (NULL, 0) allocates memory for result],
5701      [ac_cv_func_getcwd_null],
5702      [AC_TRY_RUN(
5703         [
5704 #        ifdef HAVE_STDLIB_H
5705 #         include <stdlib.h>
5706 #        endif
5707 #        ifdef HAVE_UNISTD_H
5708 #         include <unistd.h>
5709 #        endif
5710 #        ifndef getcwd
5711          char *getcwd ();
5712 #        endif
5713          int
5714          main ()
5715          {
5716            if (chdir ("/") != 0)
5717              exit (1);
5718            else
5719              {
5720                char *f = getcwd (NULL, 0);
5721                exit (! (f && f[0] == '/' && !f[1]));
5722              }
5723          }],
5724         [ac_cv_func_getcwd_null=yes],
5725         [ac_cv_func_getcwd_null=no],
5726         [ac_cv_func_getcwd_null=no])])
5727    if test $ac_cv_func_getcwd_null = yes; then
5728      AC_DEFINE(HAVE_GETCWD_NULL, 1,
5729                [Define if getcwd (NULL, 0) allocates memory for result.])
5730    fi])
5731
5732 # xreadlink.m4 serial 3
5733 dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
5734 dnl This file is free software, distributed under the terms of the GNU
5735 dnl General Public License.  As a special exception to the GNU General
5736 dnl Public License, this file may be distributed as part of a program
5737 dnl that contains a configuration script generated by Autoconf, under
5738 dnl the same distribution terms as the rest of that program.
5739
5740 AC_DEFUN([gl_XREADLINK],
5741 [
5742   dnl Prerequisites of lib/xreadlink.c.
5743   AC_REQUIRE([gt_TYPE_SSIZE_T])
5744   AC_CHECK_HEADERS_ONCE(stdlib.h unistd.h)
5745 ])
5746
5747 # xstrtod.m4 serial 1
5748 dnl Copyright (C) 2002 Free Software Foundation, Inc.
5749 dnl This file is free software, distributed under the terms of the GNU
5750 dnl General Public License.  As a special exception to the GNU General
5751 dnl Public License, this file may be distributed as part of a program
5752 dnl that contains a configuration script generated by Autoconf, under
5753 dnl the same distribution terms as the rest of that program.
5754
5755 # Prerequisites of lib/xstrtod.c.
5756 AC_DEFUN([gl_XSTRTOD],
5757 [
5758   AC_REQUIRE([AC_HEADER_STDC])
5759 ])
5760
5761 # xstrtol.m4 serial 2
5762 dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
5763 dnl This file is free software, distributed under the terms of the GNU
5764 dnl General Public License.  As a special exception to the GNU General
5765 dnl Public License, this file may be distributed as part of a program
5766 dnl that contains a configuration script generated by Autoconf, under
5767 dnl the same distribution terms as the rest of that program.
5768
5769 AC_DEFUN([gl_XSTRTOL],
5770 [
5771   AC_REQUIRE([gl_PREREQ_XSTRTOL])
5772   AC_REQUIRE([gl_PREREQ_XSTRTOUL])
5773 ])
5774
5775 # Prerequisites of lib/xstrtol.h.
5776 AC_DEFUN([gl_PREREQ_XSTRTOL_H],
5777 [
5778   AC_REQUIRE([jm_AC_TYPE_INTMAX_T])
5779   AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
5780 ])
5781
5782 # Prerequisites of lib/xstrtol.c.
5783 AC_DEFUN([gl_PREREQ_XSTRTOL],
5784 [
5785   AC_REQUIRE([gl_PREREQ_XSTRTOL_H])
5786   AC_REQUIRE([AC_HEADER_STDC])
5787   AC_CHECK_HEADERS_ONCE(string.h)
5788   AC_CHECK_FUNCS_ONCE(isascii)
5789   AC_CHECK_DECLS_ONCE(strtol strtoul)
5790   AC_CHECK_DECLS([strtoimax, strtoumax])
5791 ])
5792
5793 # Prerequisites of lib/xstrtoul.c.
5794 AC_DEFUN([gl_PREREQ_XSTRTOUL],
5795 [
5796   AC_REQUIRE([gl_PREREQ_XSTRTOL])
5797 ])
5798
5799 # yesno.m4 serial 1
5800 dnl Copyright (C) 2002 Free Software Foundation, Inc.
5801 dnl This file is free software, distributed under the terms of the GNU
5802 dnl General Public License.  As a special exception to the GNU General
5803 dnl Public License, this file may be distributed as part of a program
5804 dnl that contains a configuration script generated by Autoconf, under
5805 dnl the same distribution terms as the rest of that program.
5806
5807 AC_DEFUN([gl_YESNO],
5808 [
5809   dnl Prerequisites of lib/yesno.c.
5810   AC_CHECK_HEADERS_ONCE(stdlib.h)
5811 ])
5812
5813 #serial 8 -*- autoconf -*-
5814
5815 dnl From Jim Meyering.
5816 dnl
5817 dnl See if the glibc *_unlocked I/O macros or functions are available.
5818 dnl Use only those *_unlocked macros or functions that are declared
5819 dnl (because some of them were declared in Solaris 2.5.1 but were removed
5820 dnl in Solaris 2.6, whereas we want binaries built on Solaris 2.5.1 to run
5821 dnl on Solaris 2.6).
5822
5823 AC_DEFUN([jm_FUNC_GLIBC_UNLOCKED_IO],
5824 [
5825   dnl Persuade glibc and Solaris <stdio.h> to declare
5826   dnl fgets_unlocked(), fputs_unlocked() etc.
5827   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
5828
5829   AC_CHECK_DECLS_ONCE(
5830      [clearerr_unlocked feof_unlocked ferror_unlocked
5831       fflush_unlocked fgets_unlocked fputc_unlocked fputs_unlocked
5832       fread_unlocked fwrite_unlocked getc_unlocked
5833       getchar_unlocked putc_unlocked putchar_unlocked])
5834 ])
5835
5836 #serial 20
5837
5838 dnl This macro is intended to be used solely in this file.
5839 dnl These are the prerequisite macros for GNU's strftime.c replacement.
5840 AC_DEFUN([_jm_STRFTIME_PREREQS],
5841 [
5842  dnl strftime.c uses the underyling system strftime if it exists.
5843  AC_FUNC_STRFTIME
5844
5845  AC_CHECK_HEADERS_ONCE(limits.h)
5846  AC_CHECK_FUNCS_ONCE(memcpy mempcpy)
5847  AC_CHECK_FUNCS(tzset memset)
5848
5849  # This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE.
5850  AC_STRUCT_TIMEZONE
5851
5852  AC_CHECK_FUNCS(mblen mbrlen)
5853  AC_TYPE_MBSTATE_T
5854
5855  AC_REQUIRE([gl_TM_GMTOFF])
5856  AC_REQUIRE([gl_FUNC_TZSET_CLOBBER])
5857 ])
5858
5859 dnl From Jim Meyering.
5860 dnl
5861 AC_DEFUN([jm_FUNC_GNU_STRFTIME],
5862 [AC_REQUIRE([AC_HEADER_TIME])dnl
5863
5864  _jm_STRFTIME_PREREQS
5865
5866  AC_REQUIRE([AC_C_CONST])dnl
5867  AC_REQUIRE([AC_HEADER_STDC])dnl
5868  AC_CHECK_HEADERS_ONCE(sys/time.h)
5869  AC_DEFINE([my_strftime], [nstrftime],
5870    [Define to the name of the strftime replacement function.])
5871 ])
5872
5873 AC_DEFUN([jm_FUNC_STRFTIME],
5874 [
5875   _jm_STRFTIME_PREREQS
5876 ])
5877
5878 #serial 1
5879 # See if we have a working tzset function.
5880 # If so, arrange to compile the wrapper function.
5881 # For at least Solaris 2.5.1 and 2.6, this is necessary
5882 # because tzset can clobber the contents of the buffer
5883 # used by localtime.
5884
5885 # Written by Paul Eggert and Jim Meyering.
5886
5887 AC_DEFUN([gl_FUNC_TZSET_CLOBBER],
5888 [
5889   AC_REQUIRE([AC_HEADER_TIME])
5890   AC_CACHE_CHECK([whether tzset clobbers localtime buffer],
5891                  gl_cv_func_tzset_clobber,
5892   [
5893   AC_RUN_IFELSE([AC_LANG_SOURCE([[
5894 #if TIME_WITH_SYS_TIME
5895 # include <sys/time.h>
5896 # include <time.h>
5897 #else
5898 # if HAVE_SYS_TIME_H
5899 #  include <sys/time.h>
5900 # else
5901 #  include <time.h>
5902 # endif
5903 #endif
5904 #include <stdlib.h>
5905
5906 int
5907 main ()
5908 {
5909   time_t t1 = 853958121;
5910   struct tm *p, s;
5911   putenv ("TZ=GMT0");
5912   p = localtime (&t1);
5913   s = *p;
5914   putenv ("TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00");
5915   tzset ();
5916   exit (p->tm_year != s.tm_year
5917         || p->tm_mon != s.tm_mon
5918         || p->tm_mday != s.tm_mday
5919         || p->tm_hour != s.tm_hour
5920         || p->tm_min != s.tm_min
5921         || p->tm_sec != s.tm_sec);
5922 }
5923   ]])],
5924        [gl_cv_func_tzset_clobber=no],
5925        [gl_cv_func_tzset_clobber=yes],
5926        [gl_cv_func_tzset_clobber=yes])])
5927
5928   AC_DEFINE(HAVE_RUN_TZSET_TEST, 1,
5929     [Define to 1 if you have run the test for working tzset.])
5930
5931   if test $gl_cv_func_tzset_clobber = yes; then
5932     gl_GETTIMEOFDAY_REPLACE_LOCALTIME
5933
5934     AC_DEFINE(tzset, rpl_tzset,
5935       [Define to rpl_tzset if the wrapper function should be used.])
5936     AC_DEFINE(TZSET_CLOBBERS_LOCALTIME_BUFFER, 1,
5937       [Define if tzset clobbers localtime's static buffer.])
5938   fi
5939 ])
5940
5941 #serial 4
5942
5943 dnl From Jim Meyering.
5944 dnl
5945 dnl See if gettimeofday clobbers the static buffer that localtime uses
5946 dnl for it's return value.  The gettimeofday function from Mac OS X 10.0.4,
5947 dnl i.e. Darwin 1.3.7 has this problem.
5948 dnl
5949 dnl If it does, then arrange to use gettimeofday and localtime only via
5950 dnl the wrapper functions that work around the problem.
5951
5952 AC_DEFUN([AC_FUNC_GETTIMEOFDAY_CLOBBER],
5953 [
5954  AC_REQUIRE([AC_HEADER_TIME])
5955  AC_CHECK_HEADERS_ONCE(stdlib.h string.h)
5956  AC_CACHE_CHECK([whether gettimeofday clobbers localtime buffer],
5957   jm_cv_func_gettimeofday_clobber,
5958   [AC_TRY_RUN([
5959 #include <stdio.h>
5960 #if HAVE_STRING_H
5961 # include <string.h>
5962 #endif
5963
5964 #if TIME_WITH_SYS_TIME
5965 # include <sys/time.h>
5966 # include <time.h>
5967 #else
5968 # if HAVE_SYS_TIME_H
5969 #  include <sys/time.h>
5970 # else
5971 #  include <time.h>
5972 # endif
5973 #endif
5974
5975 #if HAVE_STDLIB_H
5976 # include <stdlib.h>
5977 #endif
5978
5979 int
5980 main ()
5981 {
5982   time_t t = 0;
5983   struct tm *lt;
5984   struct tm saved_lt;
5985   struct timeval tv;
5986   lt = localtime (&t);
5987   saved_lt = *lt;
5988   gettimeofday (&tv, NULL);
5989   if (memcmp (lt, &saved_lt, sizeof (struct tm)) != 0)
5990     exit (1);
5991
5992   exit (0);
5993 }
5994           ],
5995          jm_cv_func_gettimeofday_clobber=no,
5996          jm_cv_func_gettimeofday_clobber=yes,
5997          dnl When crosscompiling, assume it is broken.
5998          jm_cv_func_gettimeofday_clobber=yes)
5999   ])
6000   if test $jm_cv_func_gettimeofday_clobber = yes; then
6001     gl_GETTIMEOFDAY_REPLACE_LOCALTIME
6002
6003     AC_DEFINE(gettimeofday, rpl_gettimeofday,
6004       [Define to rpl_gettimeofday if the replacement function should be used.])
6005     AC_DEFINE(GETTIMEOFDAY_CLOBBERS_LOCALTIME_BUFFER, 1,
6006       [Define if gettimeofday clobbers localtime's static buffer.])
6007     gl_PREREQ_GETTIMEOFDAY
6008   fi
6009 ])
6010
6011 AC_DEFUN([gl_GETTIMEOFDAY_REPLACE_LOCALTIME], [
6012   AC_LIBOBJ(gettimeofday)
6013   AC_DEFINE(gmtime, rpl_gmtime,
6014     [Define to rpl_gmtime if the replacement function should be used.])
6015   AC_DEFINE(localtime, rpl_localtime,
6016     [Define to rpl_localtime if the replacement function should be used.])
6017 ])
6018
6019 # Prerequisites of lib/gettimeofday.c.
6020 AC_DEFUN([gl_PREREQ_GETTIMEOFDAY], [
6021   AC_REQUIRE([AC_HEADER_TIME])
6022 ])
6023
6024 #serial 9
6025
6026 dnl From Jim Meyering.
6027 dnl Determine whether lstat has the bug that it succeeds when given the
6028 dnl zero-length file name argument.  The lstat from SunOS 4.1.4 and the Hurd
6029 dnl (as of 1998-11-01) do this.
6030 dnl
6031 dnl If it does, then define HAVE_LSTAT_EMPTY_STRING_BUG and arrange to
6032 dnl compile the wrapper function.
6033 dnl
6034
6035 AC_DEFUN([jm_FUNC_LSTAT],
6036 [
6037   AC_FUNC_LSTAT
6038   dnl Note: AC_FUNC_LSTAT does AC_LIBOBJ(lstat).
6039   if test $ac_cv_func_lstat_empty_string_bug = yes; then
6040     gl_PREREQ_LSTAT
6041   fi
6042 ])
6043
6044 # Prerequisites of lib/lstat.c.
6045 AC_DEFUN([gl_PREREQ_LSTAT],
6046 [
6047   AC_REQUIRE([AC_HEADER_STAT])
6048   AC_CHECK_HEADERS_ONCE(stdlib.h)
6049   AC_CHECK_DECLS_ONCE(free)
6050 ])
6051
6052 # memcmp.m4 serial 8
6053 dnl Copyright (C) 2002 Free Software Foundation, Inc.
6054 dnl This file is free software, distributed under the terms of the GNU
6055 dnl General Public License.  As a special exception to the GNU General
6056 dnl Public License, this file may be distributed as part of a program
6057 dnl that contains a configuration script generated by Autoconf, under
6058 dnl the same distribution terms as the rest of that program.
6059
6060 AC_DEFUN([jm_FUNC_MEMCMP],
6061 [
6062   AC_REQUIRE([AC_FUNC_MEMCMP])
6063   if test $ac_cv_func_memcmp_working = no; then
6064     AC_DEFINE(memcmp, rpl_memcmp,
6065       [Define to rpl_memcmp if the replacement function should be used.])
6066     gl_PREREQ_MEMCMP
6067   fi
6068 ])
6069
6070 # Prerequisites of lib/memcmp.c.
6071 AC_DEFUN([gl_PREREQ_MEMCMP], [
6072   AC_CHECK_HEADERS_ONCE(string.h)
6073 ])
6074
6075 #serial 9
6076
6077 dnl From Jim Meyering.
6078 dnl Check for the nanosleep function.
6079 dnl If not found, use the supplied replacement.
6080 dnl
6081
6082 AC_DEFUN([jm_FUNC_NANOSLEEP],
6083 [
6084  nanosleep_save_libs=$LIBS
6085
6086  # Solaris 2.5.1 needs -lposix4 to get the nanosleep function.
6087  # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
6088  AC_SEARCH_LIBS(nanosleep, [rt posix4], [LIB_NANOSLEEP=$ac_cv_search_nanosleep])
6089  AC_SUBST(LIB_NANOSLEEP)
6090
6091  AC_CACHE_CHECK([whether nanosleep works],
6092   jm_cv_func_nanosleep_works,
6093   [
6094    AC_REQUIRE([AC_HEADER_TIME])
6095    AC_CHECK_HEADERS_ONCE(sys/time.h)
6096    AC_TRY_RUN([
6097 #   if TIME_WITH_SYS_TIME
6098 #    include <sys/time.h>
6099 #    include <time.h>
6100 #   else
6101 #    if HAVE_SYS_TIME_H
6102 #     include <sys/time.h>
6103 #    else
6104 #     include <time.h>
6105 #    endif
6106 #   endif
6107
6108     int
6109     main ()
6110     {
6111       struct timespec ts_sleep, ts_remaining;
6112       ts_sleep.tv_sec = 0;
6113       ts_sleep.tv_nsec = 1;
6114       exit (nanosleep (&ts_sleep, &ts_remaining) == 0 ? 0 : 1);
6115     }
6116           ],
6117          jm_cv_func_nanosleep_works=yes,
6118          jm_cv_func_nanosleep_works=no,
6119          dnl When crosscompiling, assume the worst.
6120          jm_cv_func_nanosleep_works=no)
6121   ])
6122   if test $jm_cv_func_nanosleep_works = no; then
6123     AC_LIBOBJ(nanosleep)
6124     AC_DEFINE(nanosleep, rpl_nanosleep,
6125       [Define to rpl_nanosleep if the replacement function should be used.])
6126     gl_PREREQ_NANOSLEEP
6127   fi
6128
6129  LIBS=$nanosleep_save_libs
6130 ])
6131
6132 # Prerequisites of lib/nanosleep.c.
6133 AC_DEFUN([gl_PREREQ_NANOSLEEP],
6134 [
6135   AC_CHECK_HEADERS_ONCE(unistd.h)
6136 ])
6137
6138 # putenv.m4 serial 6
6139 dnl Copyright (C) 2002 Free Software Foundation, Inc.
6140 dnl This file is free software, distributed under the terms of the GNU
6141 dnl General Public License.  As a special exception to the GNU General
6142 dnl Public License, this file may be distributed as part of a program
6143 dnl that contains a configuration script generated by Autoconf, under
6144 dnl the same distribution terms as the rest of that program.
6145
6146 dnl From Jim Meyering.
6147 dnl
6148 dnl Check whether putenv ("FOO") removes FOO from the environment.
6149 dnl The putenv in libc on at least SunOS 4.1.4 does *not* do that.
6150
6151 AC_DEFUN([jm_FUNC_PUTENV],
6152 [AC_CACHE_CHECK([for SVID conformant putenv], jm_cv_func_svid_putenv,
6153   [AC_TRY_RUN([
6154     int
6155     main ()
6156     {
6157       /* Put it in env.  */
6158       if (putenv ("CONFTEST_putenv=val"))
6159         exit (1);
6160
6161       /* Try to remove it.  */
6162       if (putenv ("CONFTEST_putenv"))
6163         exit (1);
6164
6165       /* Make sure it was deleted.  */
6166       if (getenv ("CONFTEST_putenv") != 0)
6167         exit (1);
6168
6169       exit (0);
6170     }
6171               ],
6172              jm_cv_func_svid_putenv=yes,
6173              jm_cv_func_svid_putenv=no,
6174              dnl When crosscompiling, assume putenv is broken.
6175              jm_cv_func_svid_putenv=no)
6176   ])
6177   if test $jm_cv_func_svid_putenv = no; then
6178     AC_LIBOBJ(putenv)
6179     AC_DEFINE(putenv, rpl_putenv,
6180       [Define to rpl_putenv if the replacement function should be used.])
6181     gl_PREREQ_PUTENV
6182   fi
6183 ])
6184
6185 # Prerequisites of lib/putenv.c.
6186 AC_DEFUN([gl_PREREQ_PUTENV], [
6187   AC_CHECK_HEADERS_ONCE(string.h unistd.h)
6188   AC_CHECK_FUNCS_ONCE(memcpy)
6189   AC_CHECK_FUNCS(strchr)
6190 ])
6191
6192 #serial 9
6193
6194 dnl From Jim Meyering.
6195 dnl Determine whether stat has the bug that it succeeds when given the
6196 dnl zero-length file name argument.  The stat from SunOS 4.1.4 and the Hurd
6197 dnl (as of 1998-11-01) do this.
6198 dnl
6199 dnl If it does, then define HAVE_STAT_EMPTY_STRING_BUG and arrange to
6200 dnl compile the wrapper function.
6201 dnl
6202
6203 AC_DEFUN([jm_FUNC_STAT],
6204 [
6205   AC_FUNC_STAT
6206   dnl Note: AC_FUNC_STAT does AC_LIBOBJ(stat).
6207   if test $ac_cv_func_stat_empty_string_bug = yes; then
6208     gl_PREREQ_STAT
6209   fi
6210 ])
6211
6212 # Prerequisites of lib/stat.c.
6213 AC_DEFUN([gl_PREREQ_STAT],
6214 [
6215   :
6216 ])
6217
6218 #serial 5
6219
6220 dnl From Jim Meyering
6221 dnl Replace the utime function on systems that need it.
6222
6223 dnl FIXME
6224
6225 AC_DEFUN([jm_FUNC_UTIME],
6226 [
6227   AC_REQUIRE([AC_FUNC_UTIME_NULL])
6228   if test $ac_cv_func_utime_null = no; then
6229     AC_LIBOBJ(utime)
6230     AC_DEFINE(utime, rpl_utime,
6231       [Define to rpl_utime if the replacement function should be used.])
6232     gl_PREREQ_UTIME
6233   fi
6234 ])
6235
6236 # Prerequisites of lib/utime.c.
6237 AC_DEFUN([gl_PREREQ_UTIME],
6238 [
6239   AC_CHECK_HEADERS_ONCE(utime.h)
6240   AC_REQUIRE([jm_CHECK_TYPE_STRUCT_UTIMBUF])
6241   jm_FUNC_UTIMES_NULL
6242 ])
6243
6244 #serial 4
6245
6246 dnl Shamelessly cloned from acspecific.m4's AC_FUNC_UTIME_NULL,
6247 dnl then do case-insensitive s/utime/utimes/.
6248
6249 AC_DEFUN([jm_FUNC_UTIMES_NULL],
6250 [AC_CACHE_CHECK(whether utimes accepts a null argument, ac_cv_func_utimes_null,
6251 [rm -f conftest.data; > conftest.data
6252 AC_TRY_RUN([
6253 /* In case stat has been defined to rpl_stat, undef it here.  */
6254 #undef stat
6255 #include <sys/types.h>
6256 #include <sys/stat.h>
6257 main() {
6258 struct stat s, t;
6259 exit(!(stat ("conftest.data", &s) == 0
6260        && utimes("conftest.data", (long *)0) == 0
6261        && stat("conftest.data", &t) == 0
6262        && t.st_mtime >= s.st_mtime
6263        && t.st_mtime - s.st_mtime < 120));
6264 }],
6265   ac_cv_func_utimes_null=yes,
6266   ac_cv_func_utimes_null=no,
6267   ac_cv_func_utimes_null=no)
6268 rm -f core core.* *.core])
6269
6270     if test $ac_cv_func_utimes_null = yes; then
6271       AC_DEFINE(HAVE_UTIMES_NULL, 1,
6272                 [Define if utimes accepts a null argument])
6273     fi
6274   ]
6275 )
6276
6277 #serial 3
6278 dnl Cloned from xstrtoumax.m4.  Keep these files in sync.
6279
6280 AC_DEFUN([jm_XSTRTOIMAX],
6281 [
6282   dnl Prerequisites of lib/xstrtoimax.c.
6283   AC_REQUIRE([jm_AC_TYPE_INTMAX_T])
6284   AC_REQUIRE([gl_PREREQ_XSTRTOL])
6285 ])
6286
6287 #serial 5
6288 dnl Cloned from xstrtoimax.m4.  Keep these files in sync.
6289
6290 AC_DEFUN([jm_XSTRTOUMAX],
6291 [
6292   dnl Prerequisites of lib/xstrtoumax.c.
6293   AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
6294   AC_REQUIRE([gl_PREREQ_XSTRTOL])
6295 ])
6296
6297 #serial 5
6298
6299 dnl From Volker Borchert.
6300 dnl Determine whether rename works for source paths with a trailing slash.
6301 dnl The rename from SunOS 4.1.1_U1 doesn't.
6302 dnl
6303 dnl If it doesn't, then define RENAME_TRAILING_SLASH_BUG and arrange
6304 dnl to compile the wrapper function.
6305 dnl
6306
6307 AC_DEFUN([vb_FUNC_RENAME],
6308 [
6309  AC_CACHE_CHECK([whether rename is broken],
6310   vb_cv_func_rename_trailing_slash_bug,
6311   [
6312     rm -rf conftest.d1 conftest.d2
6313     mkdir conftest.d1 ||
6314       AC_MSG_ERROR([cannot create temporary directory])
6315     AC_TRY_RUN([
6316 #       include <stdio.h>
6317         int
6318         main ()
6319         {
6320           exit (rename ("conftest.d1/", "conftest.d2") ? 1 : 0);
6321         }
6322       ],
6323       vb_cv_func_rename_trailing_slash_bug=no,
6324       vb_cv_func_rename_trailing_slash_bug=yes,
6325       dnl When crosscompiling, assume rename is broken.
6326       vb_cv_func_rename_trailing_slash_bug=yes)
6327
6328       rm -rf conftest.d1 conftest.d2
6329   ])
6330   if test $vb_cv_func_rename_trailing_slash_bug = yes; then
6331     AC_LIBOBJ(rename)
6332     AC_DEFINE(rename, rpl_rename,
6333       [Define to rpl_rename if the replacement function should be used.])
6334     AC_DEFINE(RENAME_TRAILING_SLASH_BUG, 1,
6335       [Define if rename does not work for source paths with a trailing slash,
6336        like the one from SunOS 4.1.1_U1.])
6337     gl_PREREQ_RENAME
6338   fi
6339 ])
6340
6341 # Prerequisites of lib/rename.c.
6342 AC_DEFUN([gl_PREREQ_RENAME],
6343 [
6344   AC_CHECK_HEADERS_ONCE(stdlib.h string.h)
6345   AC_CHECK_DECLS_ONCE(free)
6346 ])
6347
6348 #serial 6
6349
6350 dnl Find out how to get the file descriptor associated with an open DIR*.
6351 dnl From Jim Meyering
6352
6353 AC_DEFUN([UTILS_FUNC_DIRFD],
6354 [
6355   dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
6356   AC_REQUIRE([AC_PROG_CPP])
6357   AC_REQUIRE([AC_PROG_EGREP])
6358
6359   AC_HEADER_DIRENT
6360   dirfd_headers='
6361 #if HAVE_DIRENT_H
6362 # include <dirent.h>
6363 #else /* not HAVE_DIRENT_H */
6364 # define dirent direct
6365 # if HAVE_SYS_NDIR_H
6366 #  include <sys/ndir.h>
6367 # endif /* HAVE_SYS_NDIR_H */
6368 # if HAVE_SYS_DIR_H
6369 #  include <sys/dir.h>
6370 # endif /* HAVE_SYS_DIR_H */
6371 # if HAVE_NDIR_H
6372 #  include <ndir.h>
6373 # endif /* HAVE_NDIR_H */
6374 #endif /* HAVE_DIRENT_H */
6375 '
6376   AC_CHECK_FUNCS(dirfd)
6377   AC_CHECK_DECLS([dirfd], , , $dirfd_headers)
6378
6379   AC_CACHE_CHECK([whether dirfd is a macro],
6380     jm_cv_func_dirfd_macro,
6381     [AC_EGREP_CPP([dirent_header_defines_dirfd], [$dirfd_headers
6382 #ifdef dirfd
6383  dirent_header_defines_dirfd
6384 #endif],
6385        jm_cv_func_dirfd_macro=yes,
6386        jm_cv_func_dirfd_macro=no)])
6387
6388   # Use the replacement only if we have no function, macro,
6389   # or declaration with that name.
6390   if test $ac_cv_func_dirfd,$ac_cv_have_decl_dirfd,$jm_cv_func_dirfd_macro \
6391       = no,no,no; then
6392     AC_REPLACE_FUNCS([dirfd])
6393     AC_CACHE_CHECK(
6394               [how to get the file descriptor associated with an open DIR*],
6395                    gl_cv_sys_dir_fd_member_name,
6396       [
6397         dirfd_save_CFLAGS=$CFLAGS
6398         for ac_expr in d_fd dd_fd; do
6399
6400           CFLAGS="$CFLAGS -DDIR_FD_MEMBER_NAME=$ac_expr"
6401           AC_TRY_COMPILE(
6402             [$dirfd_headers
6403             ],
6404             [DIR *dir_p = opendir("."); (void) dir_p->DIR_FD_MEMBER_NAME;],
6405             dir_fd_found=yes
6406           )
6407           CFLAGS=$dirfd_save_CFLAGS
6408           test "$dir_fd_found" = yes && break
6409         done
6410         test "$dir_fd_found" = yes || ac_expr=no_such_member
6411
6412         gl_cv_sys_dir_fd_member_name=$ac_expr
6413       ]
6414     )
6415     if test $gl_cv_sys_dir_fd_member_name != no_such_member; then
6416       AC_DEFINE_UNQUOTED(DIR_FD_MEMBER_NAME,
6417         $gl_cv_sys_dir_fd_member_name,
6418         [the name of the file descriptor member of DIR])
6419     fi
6420     AH_VERBATIM(DIR_TO_FD,
6421                 [#ifdef DIR_FD_MEMBER_NAME
6422 # define DIR_TO_FD(Dir_p) ((Dir_p)->DIR_FD_MEMBER_NAME)
6423 #else
6424 # define DIR_TO_FD(Dir_p) -1
6425 #endif
6426 ]
6427     )
6428   fi
6429 ])
6430
6431 # acl.m4 - check for access control list (ACL) primitives
6432
6433 # Copyright (C) 2002 Free Software Foundation, Inc.
6434
6435 # This program is free software; you can redistribute it and/or modify
6436 # it under the terms of the GNU General Public License as published by
6437 # the Free Software Foundation; either version 2, or (at your option)
6438 # any later version.
6439
6440 # This program is distributed in the hope that it will be useful,
6441 # but WITHOUT ANY WARRANTY; without even the implied warranty of
6442 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
6443 # GNU General Public License for more details.
6444
6445 # You should have received a copy of the GNU General Public License
6446 # along with this program; if not, write to the Free Software Foundation,
6447 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
6448
6449 # Written by Paul Eggert.
6450
6451 AC_DEFUN([AC_FUNC_ACL],
6452 [
6453   dnl Prerequisites of lib/acl.c.
6454   AC_CHECK_HEADERS(sys/acl.h)
6455   AC_CHECK_FUNCS(acl)
6456 ])
6457
6458 #serial 2
6459 # Use the replacement ftw.c if the one in the C library is inadequate or buggy.
6460 # For now, we always use the code in lib/ because libc doesn't have the FTW_DCH
6461 # or FTW_DCHP that we need.  Arrange to use lib/ftw.h.  And since that
6462 # implementation uses tsearch.c/tdestroy, add tsearch.o to the list of
6463 # objects and arrange to use lib/search.h if necessary.
6464 # From Jim Meyering
6465
6466 AC_DEFUN([AC_FUNC_FTW],
6467 [
6468   # prerequisites
6469   AC_REQUIRE([AC_HEADER_STAT])
6470   AC_REQUIRE([jm_FUNC_LSTAT])
6471   AC_REQUIRE([AC_HEADER_DIRENT])
6472   AC_CHECK_HEADERS(sys/param.h)
6473   AC_CHECK_DECLS([stpcpy])
6474
6475   # In the event that we have to use the replacement ftw.c,
6476   # see if we'll also need the replacement tsearch.c.
6477   AC_CHECK_FUNC([tdestroy], , [need_tdestroy=1])
6478
6479   AC_CACHE_CHECK([for ftw/FTW_CHDIR that informs callback of failed chdir],
6480                  ac_cv_func_ftw_working,
6481   [
6482   # The following test would fail prior to glibc-2.3.2, because `depth'
6483   # would be 2 rather than 4.  Of course, now that we require FTW_DCH
6484   # and FTW_DCHP, this test fails even with GNU libc's fixed ftw.
6485   mkdir -p conftest.dir/a/b/c
6486   AC_RUN_IFELSE([AC_LANG_SOURCE([[
6487 #include <string.h>
6488 #include <stdlib.h>
6489 #include <ftw.h>
6490
6491 static char *_f[] = { "conftest.dir", "conftest.dir/a",
6492                       "conftest.dir/a/b", "conftest.dir/a/b/c" };
6493 static char **p = _f;
6494 static int depth;
6495
6496 static int
6497 cb (const char *file, const struct stat *sb, int file_type, struct FTW *info)
6498 {
6499   if (strcmp (file, *p++) != 0)
6500     exit (1);
6501   ++depth;
6502   return 0;
6503 }
6504
6505 int
6506 main ()
6507 {
6508   /* Require these symbols, too.  */
6509   int d1 = FTW_DCH;
6510   int d2 = FTW_DCHP;
6511
6512   int err = nftw ("conftest.dir", cb, 30, FTW_PHYS | FTW_MOUNT | FTW_CHDIR);
6513   exit ((err == 0 && depth == 4) ? 0 : 1);
6514 }
6515 ]])],
6516                [ac_cv_func_ftw_working=yes],
6517                [ac_cv_func_ftw_working=no],
6518                [ac_cv_func_ftw_working=no])])
6519   rm -rf conftest.dir
6520   if test $ac_cv_func_ftw_working = no; then
6521     AC_LIBOBJ([ftw])
6522     AC_CONFIG_LINKS([$ac_config_libobj_dir/ftw.h:$ac_config_libobj_dir/ftw_.h])
6523     # Add tsearch.o IFF we have to use the replacement ftw.c.
6524     if test -n "$need_tdestroy"; then
6525       AC_LIBOBJ([tsearch])
6526       # Link search.h to search_.h if we use the replacement tsearch.c.
6527       AC_CONFIG_LINKS(
6528         [$ac_config_libobj_dir/search.h:$ac_config_libobj_dir/search_.h])
6529     fi
6530   fi
6531 ])# AC_FUNC_FTW
6532
6533 #serial 3
6534
6535 dnl From Jim Meyering.
6536 dnl Provide lchown on systems that lack it.
6537
6538 AC_DEFUN([jm_FUNC_LCHOWN],
6539 [
6540   AC_REQUIRE([AC_TYPE_UID_T])
6541   AC_REPLACE_FUNCS(lchown)
6542   if test $ac_cv_func_lchown = no; then
6543     gl_PREREQ_LCHOWN
6544   fi
6545 ])
6546
6547 # Prerequisites of lib/lchown.c.
6548 AC_DEFUN([gl_PREREQ_LCHOWN],
6549 [
6550   AC_REQUIRE([AC_HEADER_STAT])
6551   :
6552 ])
6553
6554 #serial 3
6555
6556 # When rmdir fails because the specified directory is not empty, it sets
6557 # errno to some value, usually ENOTEMPTY.  However, on some AIX systems,
6558 # ENOTEMPTY is mistakenly defined to be EEXIST.  To work around this, and
6559 # in general, to avoid depending on the use of any particular symbol, this
6560 # test runs a test to determine the actual numeric value.
6561 AC_DEFUN([fetish_FUNC_RMDIR_NOTEMPTY],
6562 [dnl
6563   AC_CACHE_CHECK([for rmdir-not-empty errno value],
6564     fetish_cv_func_rmdir_errno_not_empty,
6565     [
6566       # Arrange for deletion of the temporary directory this test creates.
6567       ac_clean_files="$ac_clean_files confdir2"
6568       mkdir confdir2; : > confdir2/file
6569       AC_TRY_RUN([
6570 #include <stdio.h>
6571 #include <errno.h>
6572 #ifndef errno
6573 extern int errno;
6574 #endif
6575         int main ()
6576         {
6577           FILE *s;
6578           int val;
6579           rmdir ("confdir2");
6580           val = errno;
6581           s = fopen ("confdir2/errno", "w");
6582           fprintf (s, "%d\n", val);
6583           exit (0);
6584         }
6585         ],
6586       fetish_cv_func_rmdir_errno_not_empty=`cat confdir2/errno`,
6587       fetish_cv_func_rmdir_errno_not_empty='configure error in rmdir-errno.m4',
6588       fetish_cv_func_rmdir_errno_not_empty=ENOTEMPTY
6589       )
6590     ]
6591   )
6592
6593   AC_DEFINE_UNQUOTED([RMDIR_ERRNO_NOT_EMPTY],
6594     $fetish_cv_func_rmdir_errno_not_empty,
6595     [the value to which errno is set when rmdir fails on a nonempty directory])
6596 ])
6597
6598 #serial 8
6599
6600 dnl From Jim Meyering.
6601 dnl Determine whether chown accepts arguments of -1 for uid and gid.
6602 dnl If it doesn't, arrange to use the replacement function.
6603 dnl
6604
6605 AC_DEFUN([jm_FUNC_CHOWN],
6606 [
6607   AC_REQUIRE([AC_TYPE_UID_T])dnl
6608   AC_REQUIRE([AC_FUNC_CHOWN])
6609   if test $ac_cv_func_chown_works = no; then
6610     AC_LIBOBJ(chown)
6611     AC_DEFINE(chown, rpl_chown,
6612       [Define to rpl_chown if the replacement function should be used.])
6613     gl_PREREQ_CHOWN
6614   fi
6615 ])
6616
6617 # Prerequisites of lib/chown.c.
6618 AC_DEFUN([gl_PREREQ_CHOWN],
6619 [
6620   AC_CHECK_HEADERS_ONCE(unistd.h)
6621 ])
6622
6623 #serial 4
6624
6625 dnl Written by Jim Meyering
6626
6627 AC_DEFUN([jm_FUNC_GROUP_MEMBER],
6628 [
6629   dnl Persuade glibc <unistd.h> to declare group_member().
6630   AC_REQUIRE([AC_GNU_SOURCE])
6631
6632   dnl Do this replacement check manually because I want the hyphen
6633   dnl (not the underscore) in the filename.
6634   AC_CHECK_FUNC(group_member, , [
6635     AC_LIBOBJ(group-member)
6636     gl_PREREQ_GROUP_MEMBER
6637   ])
6638 ])
6639
6640 # Prerequisites of lib/group-member.c.
6641 AC_DEFUN([gl_PREREQ_GROUP_MEMBER],
6642 [
6643   AC_REQUIRE([AC_HEADER_STDC])
6644   AC_CHECK_HEADERS_ONCE(unistd.h)
6645   AC_REQUIRE([AC_FUNC_GETGROUPS])
6646 ])
6647
6648 #serial 5
6649
6650 AC_DEFUN([jm_AFS],
6651   [
6652     AC_MSG_CHECKING(for AFS)
6653     if test -d /afs; then
6654       AC_DEFINE(AFS, 1, [Define if you have the Andrew File System.])
6655       ac_result=yes
6656     else
6657       ac_result=no
6658     fi
6659     AC_MSG_RESULT($ac_result)
6660   ])
6661
6662 #serial 3
6663 dnl Run a program to determine whether whether link(2) follows symlinks.
6664 dnl Set LINK_FOLLOWS_SYMLINKS accordingly.
6665
6666 AC_DEFUN([jm_AC_FUNC_LINK_FOLLOWS_SYMLINK],
6667 [dnl
6668   AC_CACHE_CHECK(
6669     [whether link(2) dereferences a symlink specified with a trailing slash],
6670                  jm_ac_cv_func_link_follows_symlink,
6671   [
6672     dnl poor-man's AC_REQUIRE: FIXME: repair this once autoconf-3 provides
6673     dnl the appropriate framework.
6674     test -z "$ac_cv_header_unistd_h" \
6675       && AC_CHECK_HEADERS(unistd.h)
6676
6677     # Create a regular file.
6678     echo > conftest.file
6679     AC_TRY_RUN(
6680       [
6681 #       include <sys/types.h>
6682 #       include <sys/stat.h>
6683 #       ifdef HAVE_UNISTD_H
6684 #        include <unistd.h>
6685 #       endif
6686
6687 #       define SAME_INODE(Stat_buf_1, Stat_buf_2) \
6688           ((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
6689            && (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)
6690
6691         int
6692         main ()
6693         {
6694           const char *file = "conftest.file";
6695           const char *sym = "conftest.sym";
6696           const char *hard = "conftest.hard";
6697           struct stat sb_file, sb_hard;
6698
6699           /* Create a symlink to the regular file. */
6700           if (symlink (file, sym))
6701             abort ();
6702
6703           /* Create a hard link to that symlink.  */
6704           if (link (sym, hard))
6705             abort ();
6706
6707           if (lstat (hard, &sb_hard))
6708             abort ();
6709           if (lstat (file, &sb_file))
6710             abort ();
6711
6712           /* If the dev/inode of hard and file are the same, then
6713              the link call followed the symlink.  */
6714           return SAME_INODE (sb_hard, sb_file) ? 0 : 1;
6715         }
6716       ],
6717       jm_ac_cv_func_link_follows_symlink=yes,
6718       jm_ac_cv_func_link_follows_symlink=no,
6719       jm_ac_cv_func_link_follows_symlink=yes dnl We're cross compiling.
6720     )
6721   ])
6722   if test $jm_ac_cv_func_link_follows_symlink = yes; then
6723     AC_DEFINE(LINK_FOLLOWS_SYMLINKS, 1,
6724       [Define if `link(2)' dereferences symbolic links.])
6725   fi
6726 ])
6727
6728 #serial 3
6729
6730 dnl From Jim Meyering
6731 dnl Using code from emacs, based on suggestions from Paul Eggert
6732 dnl and Ulrich Drepper.
6733
6734 dnl Find out how to determine the number of pending output bytes on a stream.
6735 dnl glibc (2.1.93 and newer) and Solaris provide __fpending.  On other systems,
6736 dnl we have to grub around in the FILE struct.
6737
6738 AC_DEFUN([jm_FUNC_FPENDING],
6739 [
6740   AC_CHECK_HEADERS(stdio_ext.h)
6741   AC_REPLACE_FUNCS([__fpending])
6742   fp_headers='
6743 #     if HAVE_STDIO_EXT_H
6744 #      include <stdio_ext.h>
6745 #     endif
6746 '
6747   AC_CHECK_DECLS([__fpending], , , $fp_headers)
6748   if test $ac_cv_func___fpending = no; then
6749     AC_CACHE_CHECK(
6750               [how to determine the number of pending output bytes on a stream],
6751                    ac_cv_sys_pending_output_n_bytes,
6752       [
6753         for ac_expr in                                          \
6754                                                                 \
6755             '# glibc2'                                          \
6756             'fp->_IO_write_ptr - fp->_IO_write_base'            \
6757                                                                 \
6758             '# traditional Unix'                                \
6759             'fp->_ptr - fp->_base'                              \
6760                                                                 \
6761             '# BSD'                                             \
6762             'fp->_p - fp->_bf._base'                            \
6763                                                                 \
6764             '# SCO, Unixware'                                   \
6765             'fp->__ptr - fp->__base'                            \
6766                                                                 \
6767             '# old glibc?'                                      \
6768             'fp->__bufp - fp->__buffer'                         \
6769                                                                 \
6770             '# old glibc iostream?'                             \
6771             'fp->_pptr - fp->_pbase'                            \
6772                                                                 \
6773             '# VMS'                                             \
6774             '(*fp)->_ptr - (*fp)->_base'                        \
6775                                                                 \
6776             '# e.g., DGUX R4.11; the info is not available'     \
6777             1                                                   \
6778             ; do
6779
6780           # Skip each embedded comment.
6781           case "$ac_expr" in '#'*) continue;; esac
6782
6783           AC_TRY_COMPILE(
6784             [#include <stdio.h>
6785             ],
6786             [FILE *fp = stdin; (void) ($ac_expr);],
6787             fp_done=yes
6788           )
6789           test "$fp_done" = yes && break
6790         done
6791
6792         ac_cv_sys_pending_output_n_bytes=$ac_expr
6793       ]
6794     )
6795     AC_DEFINE_UNQUOTED(PENDING_OUTPUT_N_BYTES,
6796       $ac_cv_sys_pending_output_n_bytes,
6797       [the number of pending output bytes on stream `fp'])
6798   fi
6799 ])
6800
6801 # inttypes-pri.m4 serial 1 (gettext-0.11.4)
6802 dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
6803 dnl This file is free software, distributed under the terms of the GNU
6804 dnl General Public License.  As a special exception to the GNU General
6805 dnl Public License, this file may be distributed as part of a program
6806 dnl that contains a configuration script generated by Autoconf, under
6807 dnl the same distribution terms as the rest of that program.
6808
6809 dnl From Bruno Haible.
6810
6811 # Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
6812 # macros to non-string values.  This is the case on AIX 4.3.3.
6813
6814 AC_DEFUN([gt_INTTYPES_PRI],
6815 [
6816   AC_REQUIRE([gt_HEADER_INTTYPES_H])
6817   if test $gt_cv_header_inttypes_h = yes; then
6818     AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
6819       gt_cv_inttypes_pri_broken,
6820       [
6821         AC_TRY_COMPILE([#include <inttypes.h>
6822 #ifdef PRId32
6823 char *p = PRId32;
6824 #endif
6825 ], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes)
6826       ])
6827   fi
6828   if test "$gt_cv_inttypes_pri_broken" = yes; then
6829     AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
6830       [Define if <inttypes.h> exists and defines unusable PRI* macros.])
6831   fi
6832 ])
6833
6834 # Assume AM_GNU_GETTEXT([external]) and Autoconf 2.54 or later, for coreutils.
6835
6836 # serial 2
6837
6838 dnl Copyright (C) 2003 Free Software Foundation, Inc.
6839 dnl This file is free software, distributed under the terms of the GNU
6840 dnl General Public License.  As a special exception to the GNU General
6841 dnl Public License, this file may be distributed as part of a program
6842 dnl that contains a configuration script generated by Autoconf, under
6843 dnl the same distribution terms as the rest of that program.
6844
6845 dnl From Paul Eggert
6846
6847 dnl Automake doesn't understand that AM_GNU_GETTEXT([external])
6848 dnl never invokes the following macros, because of the [external].
6849 dnl Insert empty macros to pacify Automake.
6850
6851 AC_DEFUN([AM_LC_MESSAGES])
6852 AC_DEFUN([AM_MKINSTALLDIRS])
6853 AC_DEFUN([gt_INTDIV0])
6854
6855 dnl A simpler substitute for gt_INTTYPES_PRI that assumes Autoconf 2.54
6856 dnl or later.
6857
6858 AC_DEFUN([gt_HEADER_INTTYPES_H], [
6859   AC_REQUIRE([AC_HEADER_STDC])
6860   gt_cv_header_inttypes_h=$ac_cv_header_inttypes_h
6861 ])
6862
6863 #serial 8
6864
6865 dnl From Jim Meyering.
6866 dnl A wrapper around AC_FUNC_GETGROUPS.
6867
6868 AC_DEFUN([jm_FUNC_GETGROUPS],
6869 [
6870   AC_REQUIRE([AC_FUNC_GETGROUPS])
6871   if test $ac_cv_func_getgroups_works = no; then
6872     AC_LIBOBJ(getgroups)
6873     AC_DEFINE(getgroups, rpl_getgroups,
6874       [Define as rpl_getgroups if getgroups doesn't work right.])
6875     gl_PREREQ_GETGROUPS
6876   fi
6877   test -n "$GETGROUPS_LIB" && LIBS="$GETGROUPS_LIB $LIBS"
6878 ])
6879
6880 # Prerequisites of lib/getgroups.c.
6881 AC_DEFUN([gl_PREREQ_GETGROUPS],
6882 [
6883   AC_REQUIRE([AC_TYPE_GETGROUPS])
6884 ])
6885
6886 #serial 5
6887
6888 AC_PREREQ(2.13)
6889
6890 AC_DEFUN([jm_SYS_PROC_UPTIME],
6891 [ dnl Require AC_PROG_CC to see if we're cross compiling.
6892   AC_REQUIRE([AC_PROG_CC])
6893   AC_CACHE_CHECK([for /proc/uptime], jm_cv_have_proc_uptime,
6894   [jm_cv_have_proc_uptime=no
6895     test -f /proc/uptime \
6896       && test "$cross_compiling" = no \
6897       && cat < /proc/uptime >/dev/null 2>/dev/null \
6898       && jm_cv_have_proc_uptime=yes])
6899   if test $jm_cv_have_proc_uptime = yes; then
6900     AC_DEFINE(HAVE_PROC_UPTIME, 1,
6901               [  Define if your system has the /proc/uptime special file.])
6902   fi
6903 ])
6904
6905 #serial 5
6906
6907 # See if we need to emulate a missing ftruncate function using fcntl or chsize.
6908
6909 AC_DEFUN([jm_FUNC_FTRUNCATE],
6910 [
6911   AC_REPLACE_FUNCS(ftruncate)
6912   if test $ac_cv_func_ftruncate = no; then
6913     gl_PREREQ_FTRUNCATE
6914   fi
6915 ])
6916
6917 # Prerequisites of lib/ftruncate.c.
6918 AC_DEFUN([gl_PREREQ_FTRUNCATE],
6919 [
6920   AC_CHECK_HEADERS_ONCE(unistd.h)
6921   AC_CHECK_FUNCS(chsize)
6922 ])
6923
6924 #serial 1
6925 # Determine approximately how many files may be open simultaneously
6926 # in one process.  This is approximate, since while running this test,
6927 # the configure script already has a few files open.
6928 # From Jim Meyering
6929
6930 AC_DEFUN([UTILS_SYS_OPEN_MAX],
6931 [
6932   AC_CACHE_CHECK([determine how many files may be open simultaneously],
6933                  utils_cv_sys_open_max,
6934   [
6935   AC_RUN_IFELSE([AC_LANG_SOURCE([[
6936 #include <stdio.h>
6937 #include <stdlib.h>
6938 #include <unistd.h>
6939     int
6940     main ()
6941     {
6942       FILE *result = fopen ("conftest.omax", "w");
6943       int i = 1;
6944       /* Impose an arbitrary limit, in case some system has no
6945          effective limit on the number of simultaneously open files.  */
6946       while (i < 30000)
6947         {
6948           FILE *s = fopen ("conftest.op", "w");
6949           if (!s)
6950             break;
6951           ++i;
6952         }
6953       fprintf (result, "%d\n", i);
6954       exit (fclose (result) == EOF);
6955     }
6956   ]])],
6957        [utils_cv_sys_open_max=`cat conftest.omax`],
6958        [utils_cv_sys_open_max='internal error in open-max.m4'],
6959        [utils_cv_sys_open_max='cross compiling run-test in open-max.m4'])])
6960
6961   AC_DEFINE_UNQUOTED([UTILS_OPEN_MAX],
6962     $utils_cv_sys_open_max,
6963     [the maximum number of simultaneously open files per process])
6964 ])
6965
6966 #serial 4
6967 # Check whether getcwd has the bug that it succeeds for a working directory
6968 # longer than PATH_MAX, yet returns a truncated directory name.
6969 # If so, arrange to compile the wrapper function.
6970
6971 # This is necessary for at least GNU libc on linux-2.4.19 and 2.4.20.
6972 # I've heard that this is due to a Linux kernel bug, and that it has
6973 # been fixed between 2.4.21-pre3 and 2.4.21-pre4.  */
6974
6975 # From Jim Meyering
6976
6977 AC_DEFUN([GL_FUNC_GETCWD_PATH_MAX],
6978 [
6979   AC_CHECK_DECLS([getcwd])
6980   AC_CACHE_CHECK([whether getcwd properly handles paths longer than PATH_MAX],
6981                  gl_cv_func_getcwd_vs_path_max,
6982   [
6983   # Arrange for deletion of the temporary directory this test creates.
6984   ac_clean_files="$ac_clean_files confdir3"
6985   AC_RUN_IFELSE([AC_LANG_SOURCE([[
6986 #include <stdlib.h>
6987 #include <unistd.h>
6988 #include <string.h>
6989 #include <limits.h>
6990 #include <sys/stat.h>
6991 #include <sys/types.h>
6992
6993 /* Don't get link errors because mkdir is redefined to rpl_mkdir.  */
6994 #undef mkdir
6995
6996 #ifndef CHAR_BIT
6997 # define CHAR_BIT 8
6998 #endif
6999
7000 /* The extra casts work around common compiler bugs.  */
7001 #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
7002 /* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
7003    It is necessary at least when t == time_t.  */
7004 #define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
7005                               ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
7006 #define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
7007
7008 #ifndef INT_MAX
7009 # define INT_MAX TYPE_MAXIMUM (int)
7010 #endif
7011
7012 /* The length of this name must be 8.  */
7013 #define DIR_NAME "confdir3"
7014
7015 int
7016 main ()
7017 {
7018 #ifndef PATH_MAX
7019   /* The Hurd doesn't define this, so getcwd can't exhibit the bug --
7020      at least not on a local file system.  And if we were to start worrying
7021      about remote file systems, we'd have to enable the wrapper function
7022      all of the time, just to be safe.  That's not worth the cost.  */
7023   exit (0);
7024 #elif INT_MAX - 9 <= PATH_MAX
7025   /* The '9', above, comes from strlen (DIR_NAME) + 1.  */
7026   /* FIXME: Assuming there's a system for which this is true,
7027      this should be done in a compile test.  */
7028   exit (0);
7029 #else
7030   char buf[PATH_MAX + 20];
7031   char *cwd = getcwd (buf, PATH_MAX);
7032   size_t cwd_len;
7033   int fail = 0;
7034   size_t n_chdirs = 0;
7035
7036   if (cwd == NULL)
7037     exit (1);
7038
7039   cwd_len = strlen (cwd);
7040
7041   while (1)
7042     {
7043       char *c;
7044       size_t len;
7045
7046       cwd_len += 1 + strlen (DIR_NAME);
7047       /* If mkdir or chdir fails, be pessimistic and consider that
7048          as a failure, too.  */
7049       if (mkdir (DIR_NAME, 0700) < 0 || chdir (DIR_NAME) < 0)
7050         {
7051           fail = 1;
7052           break;
7053         }
7054       if ((c = getcwd (buf, PATH_MAX)) == NULL)
7055         {
7056           /* This allows any failure to indicate there is no bug.
7057              FIXME: check errno?  */
7058           break;
7059         }
7060       if ((len = strlen (c)) != cwd_len)
7061         {
7062           fail = 1;
7063           break;
7064         }
7065       ++n_chdirs;
7066       if (PATH_MAX < len)
7067         break;
7068     }
7069
7070   /* Leaving behind such a deep directory is not polite.
7071      So clean up here, right away, even though the driving
7072      shell script would also clean up.  */
7073   {
7074     size_t i;
7075
7076     /* Unlink first, in case the chdir failed.  */
7077     unlink (DIR_NAME);
7078     for (i = 0; i <= n_chdirs; i++)
7079       {
7080         if (chdir ("..") < 0)
7081           break;
7082         rmdir (DIR_NAME);
7083       }
7084   }
7085
7086   exit (fail);
7087 #endif
7088 }
7089   ]])],
7090        [gl_cv_func_getcwd_vs_path_max=yes],
7091        [gl_cv_func_getcwd_vs_path_max=no],
7092        [gl_cv_func_getcwd_vs_path_max=no])])
7093
7094   if test $gl_cv_func_getcwd_vs_path_max = yes; then
7095     AC_LIBOBJ(getcwd)
7096     AC_DEFINE(getcwd, rpl_getcwd,
7097       [Define to rpl_getcwd if the wrapper function should be used.])
7098   fi
7099 ])
7100
7101 #serial 6
7102
7103 dnl SunOS's readdir is broken in such a way that rm.c has to add extra code
7104 dnl to test whether a NULL return value really means there are no more files
7105 dnl in the directory.
7106 dnl
7107 dnl And the rm from coreutils-5.0 exposes a similar problem when there
7108 dnl are 338 or more files in a directory on a Darwin-6.5 system
7109 dnl
7110 dnl Detect the problem by creating a directory containing 500 files (254 not
7111 dnl counting . and .. is the minimum for SunOS, 338 for Darwin) and see
7112 dnl if a loop doing `readdir; unlink' removes all of them.
7113 dnl
7114 dnl Define HAVE_WORKING_READDIR if readdir does *not* have this problem.
7115
7116 dnl Written by Jim Meyering.
7117
7118 AC_DEFUN([GL_FUNC_READDIR],
7119 [dnl
7120 AC_REQUIRE([AC_HEADER_DIRENT])
7121 AC_CHECK_HEADERS_ONCE(string.h)
7122 AC_CACHE_CHECK([for working readdir], gl_cv_func_working_readdir,
7123   [dnl
7124   # Arrange for deletion of the temporary directory this test creates, in
7125   # case the test itself fails to delete everything -- as happens on Sunos.
7126   ac_clean_files="$ac_clean_files conf-dir"
7127
7128   AC_TRY_RUN(
7129 [#   include <stdio.h>
7130 #   include <sys/types.h>
7131 #   if HAVE_STRING_H
7132 #    include <string.h>
7133 #   endif
7134
7135 #   ifdef HAVE_DIRENT_H
7136 #    include <dirent.h>
7137 #    define NLENGTH(direct) (strlen((direct)->d_name))
7138 #   else /* not HAVE_DIRENT_H */
7139 #    define dirent direct
7140 #    define NLENGTH(direct) ((direct)->d_namlen)
7141 #    ifdef HAVE_SYS_NDIR_H
7142 #     include <sys/ndir.h>
7143 #    endif /* HAVE_SYS_NDIR_H */
7144 #    ifdef HAVE_SYS_DIR_H
7145 #     include <sys/dir.h>
7146 #    endif /* HAVE_SYS_DIR_H */
7147 #    ifdef HAVE_NDIR_H
7148 #     include <ndir.h>
7149 #    endif /* HAVE_NDIR_H */
7150 #   endif /* HAVE_DIRENT_H */
7151
7152 #   define DOT_OR_DOTDOT(Basename) \
7153      (Basename[0] == '.' && (Basename[1] == '\0' \
7154                              || (Basename[1] == '.' && Basename[2] == '\0')))
7155
7156 /* Don't try to use replacement mkdir; it wouldn't resolve at link time.  */
7157 #   undef mkdir
7158
7159     static void
7160     create_N_file_dir (const char *dir, size_t n_files)
7161     {
7162       unsigned int i;
7163
7164       if (mkdir (dir, 0700))
7165         abort ();
7166       if (chdir (dir))
7167         abort ();
7168
7169       for (i = 0; i < n_files; i++)
7170         {
7171           char file_name[4];
7172           FILE *out;
7173
7174           sprintf (file_name, "%03d", i);
7175           out = fopen (file_name, "w");
7176           if (!out)
7177             abort ();
7178           if (fclose (out) == EOF)
7179             abort ();
7180         }
7181
7182       if (chdir (".."))
7183         abort ();
7184     }
7185
7186     static void
7187     remove_dir (const char *dir)
7188     {
7189       DIR *dirp;
7190
7191       if (chdir (dir))
7192         abort ();
7193
7194       dirp = opendir (".");
7195       if (dirp == NULL)
7196         abort ();
7197
7198       while (1)
7199         {
7200           struct dirent *dp = readdir (dirp);
7201           if (dp == NULL)
7202             break;
7203
7204           if (DOT_OR_DOTDOT (dp->d_name))
7205             continue;
7206
7207           if (unlink (dp->d_name))
7208             abort ();
7209         }
7210       closedir (dirp);
7211
7212       if (chdir (".."))
7213         abort ();
7214
7215       if (rmdir (dir))
7216         exit (1);
7217     }
7218
7219     int
7220     main ()
7221     {
7222       const char *dir = "conf-dir";
7223       create_N_file_dir (dir, 500);
7224       remove_dir (dir);
7225       exit (0);
7226     }],
7227   gl_cv_func_working_readdir=yes,
7228   gl_cv_func_working_readdir=no,
7229   gl_cv_func_working_readdir=no)])
7230
7231   if test $gl_cv_func_working_readdir = yes; then
7232     AC_DEFINE(HAVE_WORKING_READDIR, 1,
7233       [Define if readdir is found to work properly in some unusual cases. ])
7234   fi
7235 ])
7236
7237 # codeset.m4 serial AM1 (gettext-0.10.40)
7238 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
7239 dnl This file is free software, distributed under the terms of the GNU
7240 dnl General Public License.  As a special exception to the GNU General
7241 dnl Public License, this file may be distributed as part of a program
7242 dnl that contains a configuration script generated by Autoconf, under
7243 dnl the same distribution terms as the rest of that program.
7244
7245 dnl From Bruno Haible.
7246
7247 AC_DEFUN([AM_LANGINFO_CODESET],
7248 [
7249   AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
7250     [AC_TRY_LINK([#include <langinfo.h>],
7251       [char* cs = nl_langinfo(CODESET);],
7252       am_cv_langinfo_codeset=yes,
7253       am_cv_langinfo_codeset=no)
7254     ])
7255   if test $am_cv_langinfo_codeset = yes; then
7256     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
7257       [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
7258   fi
7259 ])
7260
7261 # glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
7262 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
7263 dnl This file is free software, distributed under the terms of the GNU
7264 dnl General Public License.  As a special exception to the GNU General
7265 dnl Public License, this file may be distributed as part of a program
7266 dnl that contains a configuration script generated by Autoconf, under
7267 dnl the same distribution terms as the rest of that program.
7268
7269 # Test for the GNU C Library, version 2.1 or newer.
7270 # From Bruno Haible.
7271
7272 AC_DEFUN([jm_GLIBC21],
7273   [
7274     AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
7275       ac_cv_gnu_library_2_1,
7276       [AC_EGREP_CPP([Lucky GNU user],
7277         [
7278 #include <features.h>
7279 #ifdef __GNU_LIBRARY__
7280  #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
7281   Lucky GNU user
7282  #endif
7283 #endif
7284         ],
7285         ac_cv_gnu_library_2_1=yes,
7286         ac_cv_gnu_library_2_1=no)
7287       ]
7288     )
7289     AC_SUBST(GLIBC21)
7290     GLIBC21="$ac_cv_gnu_library_2_1"
7291   ]
7292 )
7293
7294 # iconv.m4 serial AM4 (gettext-0.11.3)
7295 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
7296 dnl This file is free software, distributed under the terms of the GNU
7297 dnl General Public License.  As a special exception to the GNU General
7298 dnl Public License, this file may be distributed as part of a program
7299 dnl that contains a configuration script generated by Autoconf, under
7300 dnl the same distribution terms as the rest of that program.
7301
7302 dnl From Bruno Haible.
7303
7304 AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
7305 [
7306   dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
7307   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
7308   AC_REQUIRE([AC_LIB_RPATH])
7309
7310   dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
7311   dnl accordingly.
7312   AC_LIB_LINKFLAGS_BODY([iconv])
7313 ])
7314
7315 AC_DEFUN([AM_ICONV_LINK],
7316 [
7317   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
7318   dnl those with the standalone portable GNU libiconv installed).
7319
7320   dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
7321   dnl accordingly.
7322   AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
7323
7324   dnl Add $INCICONV to CPPFLAGS before performing the following checks,
7325   dnl because if the user has installed libiconv and not disabled its use
7326   dnl via --without-libiconv-prefix, he wants to use it. The first
7327   dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
7328   am_save_CPPFLAGS="$CPPFLAGS"
7329   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
7330
7331   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
7332     am_cv_func_iconv="no, consider installing GNU libiconv"
7333     am_cv_lib_iconv=no
7334     AC_TRY_LINK([#include <stdlib.h>
7335 #include <iconv.h>],
7336       [iconv_t cd = iconv_open("","");
7337        iconv(cd,NULL,NULL,NULL,NULL);
7338        iconv_close(cd);],
7339       am_cv_func_iconv=yes)
7340     if test "$am_cv_func_iconv" != yes; then
7341       am_save_LIBS="$LIBS"
7342       LIBS="$LIBS $LIBICONV"
7343       AC_TRY_LINK([#include <stdlib.h>
7344 #include <iconv.h>],
7345         [iconv_t cd = iconv_open("","");
7346          iconv(cd,NULL,NULL,NULL,NULL);
7347          iconv_close(cd);],
7348         am_cv_lib_iconv=yes
7349         am_cv_func_iconv=yes)
7350       LIBS="$am_save_LIBS"
7351     fi
7352   ])
7353   if test "$am_cv_func_iconv" = yes; then
7354     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
7355   fi
7356   if test "$am_cv_lib_iconv" = yes; then
7357     AC_MSG_CHECKING([how to link with libiconv])
7358     AC_MSG_RESULT([$LIBICONV])
7359   else
7360     dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
7361     dnl either.
7362     CPPFLAGS="$am_save_CPPFLAGS"
7363     LIBICONV=
7364     LTLIBICONV=
7365   fi
7366   AC_SUBST(LIBICONV)
7367   AC_SUBST(LTLIBICONV)
7368 ])
7369
7370 AC_DEFUN([AM_ICONV],
7371 [
7372   AM_ICONV_LINK
7373   if test "$am_cv_func_iconv" = yes; then
7374     AC_MSG_CHECKING([for iconv declaration])
7375     AC_CACHE_VAL(am_cv_proto_iconv, [
7376       AC_TRY_COMPILE([
7377 #include <stdlib.h>
7378 #include <iconv.h>
7379 extern
7380 #ifdef __cplusplus
7381 "C"
7382 #endif
7383 #if defined(__STDC__) || defined(__cplusplus)
7384 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
7385 #else
7386 size_t iconv();
7387 #endif
7388 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
7389       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);"])
7390     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
7391     AC_MSG_RESULT([$]{ac_t:-
7392          }[$]am_cv_proto_iconv)
7393     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
7394       [Define as const if the declaration of iconv() needs const.])
7395   fi
7396 ])
7397
7398 # lib-prefix.m4 serial 2 (gettext-0.12)
7399 dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
7400 dnl This file is free software, distributed under the terms of the GNU
7401 dnl General Public License.  As a special exception to the GNU General
7402 dnl Public License, this file may be distributed as part of a program
7403 dnl that contains a configuration script generated by Autoconf, under
7404 dnl the same distribution terms as the rest of that program.
7405
7406 dnl From Bruno Haible.
7407
7408 dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
7409 dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
7410 dnl require excessive bracketing.
7411 ifdef([AC_HELP_STRING],
7412 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
7413 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
7414
7415 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
7416 dnl to access previously installed libraries. The basic assumption is that
7417 dnl a user will want packages to use other packages he previously installed
7418 dnl with the same --prefix option.
7419 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
7420 dnl libraries, but is otherwise very convenient.
7421 AC_DEFUN([AC_LIB_PREFIX],
7422 [
7423   AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
7424   AC_REQUIRE([AC_PROG_CC])
7425   AC_REQUIRE([AC_CANONICAL_HOST])
7426   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
7427   dnl By default, look in $includedir and $libdir.
7428   use_additional=yes
7429   AC_LIB_WITH_FINAL_PREFIX([
7430     eval additional_includedir=\"$includedir\"
7431     eval additional_libdir=\"$libdir\"
7432   ])
7433   AC_LIB_ARG_WITH([lib-prefix],
7434 [  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
7435   --without-lib-prefix    don't search for libraries in includedir and libdir],
7436 [
7437     if test "X$withval" = "Xno"; then
7438       use_additional=no
7439     else
7440       if test "X$withval" = "X"; then
7441         AC_LIB_WITH_FINAL_PREFIX([
7442           eval additional_includedir=\"$includedir\"
7443           eval additional_libdir=\"$libdir\"
7444         ])
7445       else
7446         additional_includedir="$withval/include"
7447         additional_libdir="$withval/lib"
7448       fi
7449     fi
7450 ])
7451   if test $use_additional = yes; then
7452     dnl Potentially add $additional_includedir to $CPPFLAGS.
7453     dnl But don't add it
7454     dnl   1. if it's the standard /usr/include,
7455     dnl   2. if it's already present in $CPPFLAGS,
7456     dnl   3. if it's /usr/local/include and we are using GCC on Linux,
7457     dnl   4. if it doesn't exist as a directory.
7458     if test "X$additional_includedir" != "X/usr/include"; then
7459       haveit=
7460       for x in $CPPFLAGS; do
7461         AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
7462         if test "X$x" = "X-I$additional_includedir"; then
7463           haveit=yes
7464           break
7465         fi
7466       done
7467       if test -z "$haveit"; then
7468         if test "X$additional_includedir" = "X/usr/local/include"; then
7469           if test -n "$GCC"; then
7470             case $host_os in
7471               linux*) haveit=yes;;
7472             esac
7473           fi
7474         fi
7475         if test -z "$haveit"; then
7476           if test -d "$additional_includedir"; then
7477             dnl Really add $additional_includedir to $CPPFLAGS.
7478             CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
7479           fi
7480         fi
7481       fi
7482     fi
7483     dnl Potentially add $additional_libdir to $LDFLAGS.
7484     dnl But don't add it
7485     dnl   1. if it's the standard /usr/lib,
7486     dnl   2. if it's already present in $LDFLAGS,
7487     dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
7488     dnl   4. if it doesn't exist as a directory.
7489     if test "X$additional_libdir" != "X/usr/lib"; then
7490       haveit=
7491       for x in $LDFLAGS; do
7492         AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
7493         if test "X$x" = "X-L$additional_libdir"; then
7494           haveit=yes
7495           break
7496         fi
7497       done
7498       if test -z "$haveit"; then
7499         if test "X$additional_libdir" = "X/usr/local/lib"; then
7500           if test -n "$GCC"; then
7501             case $host_os in
7502               linux*) haveit=yes;;
7503             esac
7504           fi
7505         fi
7506         if test -z "$haveit"; then
7507           if test -d "$additional_libdir"; then
7508             dnl Really add $additional_libdir to $LDFLAGS.
7509             LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
7510           fi
7511         fi
7512       fi
7513     fi
7514   fi
7515 ])
7516
7517 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
7518 dnl acl_final_exec_prefix, containing the values to which $prefix and
7519 dnl $exec_prefix will expand at the end of the configure script.
7520 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
7521 [
7522   dnl Unfortunately, prefix and exec_prefix get only finally determined
7523   dnl at the end of configure.
7524   if test "X$prefix" = "XNONE"; then
7525     acl_final_prefix="$ac_default_prefix"
7526   else
7527     acl_final_prefix="$prefix"
7528   fi
7529   if test "X$exec_prefix" = "XNONE"; then
7530     acl_final_exec_prefix='${prefix}'
7531   else
7532     acl_final_exec_prefix="$exec_prefix"
7533   fi
7534   acl_save_prefix="$prefix"
7535   prefix="$acl_final_prefix"
7536   eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
7537   prefix="$acl_save_prefix"
7538 ])
7539
7540 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
7541 dnl variables prefix and exec_prefix bound to the values they will have
7542 dnl at the end of the configure script.
7543 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
7544 [
7545   acl_save_prefix="$prefix"
7546   prefix="$acl_final_prefix"
7547   acl_save_exec_prefix="$exec_prefix"
7548   exec_prefix="$acl_final_exec_prefix"
7549   $1
7550   exec_prefix="$acl_save_exec_prefix"
7551   prefix="$acl_save_prefix"
7552 ])
7553
7554 # lib-link.m4 serial 4 (gettext-0.12)
7555 dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
7556 dnl This file is free software, distributed under the terms of the GNU
7557 dnl General Public License.  As a special exception to the GNU General
7558 dnl Public License, this file may be distributed as part of a program
7559 dnl that contains a configuration script generated by Autoconf, under
7560 dnl the same distribution terms as the rest of that program.
7561
7562 dnl From Bruno Haible.
7563
7564 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
7565 dnl the libraries corresponding to explicit and implicit dependencies.
7566 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
7567 dnl augments the CPPFLAGS variable.
7568 AC_DEFUN([AC_LIB_LINKFLAGS],
7569 [
7570   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
7571   AC_REQUIRE([AC_LIB_RPATH])
7572   define([Name],[translit([$1],[./-], [___])])
7573   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
7574                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
7575   AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
7576     AC_LIB_LINKFLAGS_BODY([$1], [$2])
7577     ac_cv_lib[]Name[]_libs="$LIB[]NAME"
7578     ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
7579     ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
7580   ])
7581   LIB[]NAME="$ac_cv_lib[]Name[]_libs"
7582   LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
7583   INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
7584   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
7585   AC_SUBST([LIB]NAME)
7586   AC_SUBST([LTLIB]NAME)
7587   dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
7588   dnl results of this search when this library appears as a dependency.
7589   HAVE_LIB[]NAME=yes
7590   undefine([Name])
7591   undefine([NAME])
7592 ])
7593
7594 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
7595 dnl searches for libname and the libraries corresponding to explicit and
7596 dnl implicit dependencies, together with the specified include files and
7597 dnl the ability to compile and link the specified testcode. If found, it
7598 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
7599 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
7600 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
7601 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
7602 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
7603 [
7604   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
7605   AC_REQUIRE([AC_LIB_RPATH])
7606   define([Name],[translit([$1],[./-], [___])])
7607   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
7608                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
7609
7610   dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
7611   dnl accordingly.
7612   AC_LIB_LINKFLAGS_BODY([$1], [$2])
7613
7614   dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
7615   dnl because if the user has installed lib[]Name and not disabled its use
7616   dnl via --without-lib[]Name-prefix, he wants to use it.
7617   ac_save_CPPFLAGS="$CPPFLAGS"
7618   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
7619
7620   AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
7621     ac_save_LIBS="$LIBS"
7622     LIBS="$LIBS $LIB[]NAME"
7623     AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
7624     LIBS="$ac_save_LIBS"
7625   ])
7626   if test "$ac_cv_lib[]Name" = yes; then
7627     HAVE_LIB[]NAME=yes
7628     AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
7629     AC_MSG_CHECKING([how to link with lib[]$1])
7630     AC_MSG_RESULT([$LIB[]NAME])
7631   else
7632     HAVE_LIB[]NAME=no
7633     dnl If $LIB[]NAME didn't lead to a usable library, we don't need
7634     dnl $INC[]NAME either.
7635     CPPFLAGS="$ac_save_CPPFLAGS"
7636     LIB[]NAME=
7637     LTLIB[]NAME=
7638   fi
7639   AC_SUBST([HAVE_LIB]NAME)
7640   AC_SUBST([LIB]NAME)
7641   AC_SUBST([LTLIB]NAME)
7642   undefine([Name])
7643   undefine([NAME])
7644 ])
7645
7646 dnl Determine the platform dependent parameters needed to use rpath:
7647 dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
7648 dnl hardcode_direct, hardcode_minus_L.
7649 AC_DEFUN([AC_LIB_RPATH],
7650 [
7651   AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
7652   AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
7653   AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
7654   AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
7655   AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
7656     CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
7657     ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
7658     . ./conftest.sh
7659     rm -f ./conftest.sh
7660     acl_cv_rpath=done
7661   ])
7662   wl="$acl_cv_wl"
7663   libext="$acl_cv_libext"
7664   shlibext="$acl_cv_shlibext"
7665   hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
7666   hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
7667   hardcode_direct="$acl_cv_hardcode_direct"
7668   hardcode_minus_L="$acl_cv_hardcode_minus_L"
7669   dnl Determine whether the user wants rpath handling at all.
7670   AC_ARG_ENABLE(rpath,
7671     [  --disable-rpath         do not hardcode runtime library paths],
7672     :, enable_rpath=yes)
7673 ])
7674
7675 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
7676 dnl the libraries corresponding to explicit and implicit dependencies.
7677 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
7678 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
7679 [
7680   define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
7681                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
7682   dnl By default, look in $includedir and $libdir.
7683   use_additional=yes
7684   AC_LIB_WITH_FINAL_PREFIX([
7685     eval additional_includedir=\"$includedir\"
7686     eval additional_libdir=\"$libdir\"
7687   ])
7688   AC_LIB_ARG_WITH([lib$1-prefix],
7689 [  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
7690   --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
7691 [
7692     if test "X$withval" = "Xno"; then
7693       use_additional=no
7694     else
7695       if test "X$withval" = "X"; then
7696         AC_LIB_WITH_FINAL_PREFIX([
7697           eval additional_includedir=\"$includedir\"
7698           eval additional_libdir=\"$libdir\"
7699         ])
7700       else
7701         additional_includedir="$withval/include"
7702         additional_libdir="$withval/lib"
7703       fi
7704     fi
7705 ])
7706   dnl Search the library and its dependencies in $additional_libdir and
7707   dnl $LDFLAGS. Using breadth-first-seach.
7708   LIB[]NAME=
7709   LTLIB[]NAME=
7710   INC[]NAME=
7711   rpathdirs=
7712   ltrpathdirs=
7713   names_already_handled=
7714   names_next_round='$1 $2'
7715   while test -n "$names_next_round"; do
7716     names_this_round="$names_next_round"
7717     names_next_round=
7718     for name in $names_this_round; do
7719       already_handled=
7720       for n in $names_already_handled; do
7721         if test "$n" = "$name"; then
7722           already_handled=yes
7723           break
7724         fi
7725       done
7726       if test -z "$already_handled"; then
7727         names_already_handled="$names_already_handled $name"
7728         dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
7729         dnl or AC_LIB_HAVE_LINKFLAGS call.
7730         uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
7731         eval value=\"\$HAVE_LIB$uppername\"
7732         if test -n "$value"; then
7733           if test "$value" = yes; then
7734             eval value=\"\$LIB$uppername\"
7735             test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
7736             eval value=\"\$LTLIB$uppername\"
7737             test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
7738           else
7739             dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
7740             dnl that this library doesn't exist. So just drop it.
7741             :
7742           fi
7743         else
7744           dnl Search the library lib$name in $additional_libdir and $LDFLAGS
7745           dnl and the already constructed $LIBNAME/$LTLIBNAME.
7746           found_dir=
7747           found_la=
7748           found_so=
7749           found_a=
7750           if test $use_additional = yes; then
7751             if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
7752               found_dir="$additional_libdir"
7753               found_so="$additional_libdir/lib$name.$shlibext"
7754               if test -f "$additional_libdir/lib$name.la"; then
7755                 found_la="$additional_libdir/lib$name.la"
7756               fi
7757             else
7758               if test -f "$additional_libdir/lib$name.$libext"; then
7759                 found_dir="$additional_libdir"
7760                 found_a="$additional_libdir/lib$name.$libext"
7761                 if test -f "$additional_libdir/lib$name.la"; then
7762                   found_la="$additional_libdir/lib$name.la"
7763                 fi
7764               fi
7765             fi
7766           fi
7767           if test "X$found_dir" = "X"; then
7768             for x in $LDFLAGS $LTLIB[]NAME; do
7769               AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
7770               case "$x" in
7771                 -L*)
7772                   dir=`echo "X$x" | sed -e 's/^X-L//'`
7773                   if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
7774                     found_dir="$dir"
7775                     found_so="$dir/lib$name.$shlibext"
7776                     if test -f "$dir/lib$name.la"; then
7777                       found_la="$dir/lib$name.la"
7778                     fi
7779                   else
7780                     if test -f "$dir/lib$name.$libext"; then
7781                       found_dir="$dir"
7782                       found_a="$dir/lib$name.$libext"
7783                       if test -f "$dir/lib$name.la"; then
7784                         found_la="$dir/lib$name.la"
7785                       fi
7786                     fi
7787                   fi
7788                   ;;
7789               esac
7790               if test "X$found_dir" != "X"; then
7791                 break
7792               fi
7793             done
7794           fi
7795           if test "X$found_dir" != "X"; then
7796             dnl Found the library.
7797             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
7798             if test "X$found_so" != "X"; then
7799               dnl Linking with a shared library. We attempt to hardcode its
7800               dnl directory into the executable's runpath, unless it's the
7801               dnl standard /usr/lib.
7802               if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
7803                 dnl No hardcoding is needed.
7804                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
7805               else
7806                 dnl Use an explicit option to hardcode DIR into the resulting
7807                 dnl binary.
7808                 dnl Potentially add DIR to ltrpathdirs.
7809                 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
7810                 haveit=
7811                 for x in $ltrpathdirs; do
7812                   if test "X$x" = "X$found_dir"; then
7813                     haveit=yes
7814                     break
7815                   fi
7816                 done
7817                 if test -z "$haveit"; then
7818                   ltrpathdirs="$ltrpathdirs $found_dir"
7819                 fi
7820                 dnl The hardcoding into $LIBNAME is system dependent.
7821                 if test "$hardcode_direct" = yes; then
7822                   dnl Using DIR/libNAME.so during linking hardcodes DIR into the
7823                   dnl resulting binary.
7824                   LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
7825                 else
7826                   if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
7827                     dnl Use an explicit option to hardcode DIR into the resulting
7828                     dnl binary.
7829                     LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
7830                     dnl Potentially add DIR to rpathdirs.
7831                     dnl The rpathdirs will be appended to $LIBNAME at the end.
7832                     haveit=
7833                     for x in $rpathdirs; do
7834                       if test "X$x" = "X$found_dir"; then
7835                         haveit=yes
7836                         break
7837                       fi
7838                     done
7839                     if test -z "$haveit"; then
7840                       rpathdirs="$rpathdirs $found_dir"
7841                     fi
7842                   else
7843                     dnl Rely on "-L$found_dir".
7844                     dnl But don't add it if it's already contained in the LDFLAGS
7845                     dnl or the already constructed $LIBNAME
7846                     haveit=
7847                     for x in $LDFLAGS $LIB[]NAME; do
7848                       AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
7849                       if test "X$x" = "X-L$found_dir"; then
7850                         haveit=yes
7851                         break
7852                       fi
7853                     done
7854                     if test -z "$haveit"; then
7855                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
7856                     fi
7857                     if test "$hardcode_minus_L" != no; then
7858                       dnl FIXME: Not sure whether we should use
7859                       dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
7860                       dnl here.
7861                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
7862                     else
7863                       dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
7864                       dnl here, because this doesn't fit in flags passed to the
7865                       dnl compiler. So give up. No hardcoding. This affects only
7866                       dnl very old systems.
7867                       dnl FIXME: Not sure whether we should use
7868                       dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
7869                       dnl here.
7870                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
7871                     fi
7872                   fi
7873                 fi
7874               fi
7875             else
7876               if test "X$found_a" != "X"; then
7877                 dnl Linking with a static library.
7878                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
7879               else
7880                 dnl We shouldn't come here, but anyway it's good to have a
7881                 dnl fallback.
7882                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
7883               fi
7884             fi
7885             dnl Assume the include files are nearby.
7886             additional_includedir=
7887             case "$found_dir" in
7888               */lib | */lib/)
7889                 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
7890                 additional_includedir="$basedir/include"
7891                 ;;
7892             esac
7893             if test "X$additional_includedir" != "X"; then
7894               dnl Potentially add $additional_includedir to $INCNAME.
7895               dnl But don't add it
7896               dnl   1. if it's the standard /usr/include,
7897               dnl   2. if it's /usr/local/include and we are using GCC on Linux,
7898               dnl   3. if it's already present in $CPPFLAGS or the already
7899               dnl      constructed $INCNAME,
7900               dnl   4. if it doesn't exist as a directory.
7901               if test "X$additional_includedir" != "X/usr/include"; then
7902                 haveit=
7903                 if test "X$additional_includedir" = "X/usr/local/include"; then
7904                   if test -n "$GCC"; then
7905                     case $host_os in
7906                       linux*) haveit=yes;;
7907                     esac
7908                   fi
7909                 fi
7910                 if test -z "$haveit"; then
7911                   for x in $CPPFLAGS $INC[]NAME; do
7912                     AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
7913                     if test "X$x" = "X-I$additional_includedir"; then
7914                       haveit=yes
7915                       break
7916                     fi
7917                   done
7918                   if test -z "$haveit"; then
7919                     if test -d "$additional_includedir"; then
7920                       dnl Really add $additional_includedir to $INCNAME.
7921                       INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
7922                     fi
7923                   fi
7924                 fi
7925               fi
7926             fi
7927             dnl Look for dependencies.
7928             if test -n "$found_la"; then
7929               dnl Read the .la file. It defines the variables
7930               dnl dlname, library_names, old_library, dependency_libs, current,
7931               dnl age, revision, installed, dlopen, dlpreopen, libdir.
7932               save_libdir="$libdir"
7933               case "$found_la" in
7934                 */* | *\\*) . "$found_la" ;;
7935                 *) . "./$found_la" ;;
7936               esac
7937               libdir="$save_libdir"
7938               dnl We use only dependency_libs.
7939               for dep in $dependency_libs; do
7940                 case "$dep" in
7941                   -L*)
7942                     additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
7943                     dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
7944                     dnl But don't add it
7945                     dnl   1. if it's the standard /usr/lib,
7946                     dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
7947                     dnl   3. if it's already present in $LDFLAGS or the already
7948                     dnl      constructed $LIBNAME,
7949                     dnl   4. if it doesn't exist as a directory.
7950                     if test "X$additional_libdir" != "X/usr/lib"; then
7951                       haveit=
7952                       if test "X$additional_libdir" = "X/usr/local/lib"; then
7953                         if test -n "$GCC"; then
7954                           case $host_os in
7955                             linux*) haveit=yes;;
7956                           esac
7957                         fi
7958                       fi
7959                       if test -z "$haveit"; then
7960                         haveit=
7961                         for x in $LDFLAGS $LIB[]NAME; do
7962                           AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
7963                           if test "X$x" = "X-L$additional_libdir"; then
7964                             haveit=yes
7965                             break
7966                           fi
7967                         done
7968                         if test -z "$haveit"; then
7969                           if test -d "$additional_libdir"; then
7970                             dnl Really add $additional_libdir to $LIBNAME.
7971                             LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
7972                           fi
7973                         fi
7974                         haveit=
7975                         for x in $LDFLAGS $LTLIB[]NAME; do
7976                           AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
7977                           if test "X$x" = "X-L$additional_libdir"; then
7978                             haveit=yes
7979                             break
7980                           fi
7981                         done
7982                         if test -z "$haveit"; then
7983                           if test -d "$additional_libdir"; then
7984                             dnl Really add $additional_libdir to $LTLIBNAME.
7985                             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
7986                           fi
7987                         fi
7988                       fi
7989                     fi
7990                     ;;
7991                   -R*)
7992                     dir=`echo "X$dep" | sed -e 's/^X-R//'`
7993                     if test "$enable_rpath" != no; then
7994                       dnl Potentially add DIR to rpathdirs.
7995                       dnl The rpathdirs will be appended to $LIBNAME at the end.
7996                       haveit=
7997                       for x in $rpathdirs; do
7998                         if test "X$x" = "X$dir"; then
7999                           haveit=yes
8000                           break
8001                         fi
8002                       done
8003                       if test -z "$haveit"; then
8004                         rpathdirs="$rpathdirs $dir"
8005                       fi
8006                       dnl Potentially add DIR to ltrpathdirs.
8007                       dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
8008                       haveit=
8009                       for x in $ltrpathdirs; do
8010                         if test "X$x" = "X$dir"; then
8011                           haveit=yes
8012                           break
8013                         fi
8014                       done
8015                       if test -z "$haveit"; then
8016                         ltrpathdirs="$ltrpathdirs $dir"
8017                       fi
8018                     fi
8019                     ;;
8020                   -l*)
8021                     dnl Handle this in the next round.
8022                     names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
8023                     ;;
8024                   *.la)
8025                     dnl Handle this in the next round. Throw away the .la's
8026                     dnl directory; it is already contained in a preceding -L
8027                     dnl option.
8028                     names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
8029                     ;;
8030                   *)
8031                     dnl Most likely an immediate library name.
8032                     LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
8033                     LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
8034                     ;;
8035                 esac
8036               done
8037             fi
8038           else
8039             dnl Didn't find the library; assume it is in the system directories
8040             dnl known to the linker and runtime loader. (All the system
8041             dnl directories known to the linker should also be known to the
8042             dnl runtime loader, otherwise the system is severely misconfigured.)
8043             LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
8044             LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
8045           fi
8046         fi
8047       fi
8048     done
8049   done
8050   if test "X$rpathdirs" != "X"; then
8051     if test -n "$hardcode_libdir_separator"; then
8052       dnl Weird platform: only the last -rpath option counts, the user must
8053       dnl pass all path elements in one option. We can arrange that for a
8054       dnl single library, but not when more than one $LIBNAMEs are used.
8055       alldirs=
8056       for found_dir in $rpathdirs; do
8057         alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
8058       done
8059       dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
8060       acl_save_libdir="$libdir"
8061       libdir="$alldirs"
8062       eval flag=\"$hardcode_libdir_flag_spec\"
8063       libdir="$acl_save_libdir"
8064       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
8065     else
8066       dnl The -rpath options are cumulative.
8067       for found_dir in $rpathdirs; do
8068         acl_save_libdir="$libdir"
8069         libdir="$found_dir"
8070         eval flag=\"$hardcode_libdir_flag_spec\"
8071         libdir="$acl_save_libdir"
8072         LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
8073       done
8074     fi
8075   fi
8076   if test "X$ltrpathdirs" != "X"; then
8077     dnl When using libtool, the option that works for both libraries and
8078     dnl executables is -R. The -R options are cumulative.
8079     for found_dir in $ltrpathdirs; do
8080       LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
8081     done
8082   fi
8083 ])
8084
8085 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
8086 dnl unless already present in VAR.
8087 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
8088 dnl contains two or three consecutive elements that belong together.
8089 AC_DEFUN([AC_LIB_APPENDTOVAR],
8090 [
8091   for element in [$2]; do
8092     haveit=
8093     for x in $[$1]; do
8094       AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
8095       if test "X$x" = "X$element"; then
8096         haveit=yes
8097         break
8098       fi
8099     done
8100     if test -z "$haveit"; then
8101       [$1]="${[$1]}${[$1]:+ }$element"
8102     fi
8103   done
8104 ])
8105
8106 # lib-ld.m4 serial 1003 (gettext-0.12)
8107 dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
8108 dnl This file is free software, distributed under the terms of the GNU
8109 dnl General Public License.  As a special exception to the GNU General
8110 dnl Public License, this file may be distributed as part of a program
8111 dnl that contains a configuration script generated by Autoconf, under
8112 dnl the same distribution terms as the rest of that program.
8113
8114 dnl Subroutines of libtool.m4,
8115 dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
8116 dnl with libtool.m4.
8117
8118 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
8119 AC_DEFUN([AC_LIB_PROG_LD_GNU],
8120 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
8121 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
8122 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
8123   acl_cv_prog_gnu_ld=yes
8124 else
8125   acl_cv_prog_gnu_ld=no
8126 fi])
8127 with_gnu_ld=$acl_cv_prog_gnu_ld
8128 ])
8129
8130 dnl From libtool-1.4. Sets the variable LD.
8131 AC_DEFUN([AC_LIB_PROG_LD],
8132 [AC_ARG_WITH(gnu-ld,
8133 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
8134 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
8135 AC_REQUIRE([AC_PROG_CC])dnl
8136 AC_REQUIRE([AC_CANONICAL_HOST])dnl
8137 # Prepare PATH_SEPARATOR.
8138 # The user is always right.
8139 if test "${PATH_SEPARATOR+set}" != set; then
8140   echo "#! /bin/sh" >conf$$.sh
8141   echo  "exit 0"   >>conf$$.sh
8142   chmod +x conf$$.sh
8143   if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
8144     PATH_SEPARATOR=';'
8145   else
8146     PATH_SEPARATOR=:
8147   fi
8148   rm -f conf$$.sh
8149 fi
8150 ac_prog=ld
8151 if test "$GCC" = yes; then
8152   # Check if gcc -print-prog-name=ld gives a path.
8153   AC_MSG_CHECKING([for ld used by GCC])
8154   case $host in
8155   *-*-mingw*)
8156     # gcc leaves a trailing carriage return which upsets mingw
8157     ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
8158   *)
8159     ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
8160   esac
8161   case $ac_prog in
8162     # Accept absolute paths.
8163     [[\\/]* | [A-Za-z]:[\\/]*)]
8164       [re_direlt='/[^/][^/]*/\.\./']
8165       # Canonicalize the path of ld
8166       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
8167       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
8168         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
8169       done
8170       test -z "$LD" && LD="$ac_prog"
8171       ;;
8172   "")
8173     # If it fails, then pretend we aren't using GCC.
8174     ac_prog=ld
8175     ;;
8176   *)
8177     # If it is relative, then search for the first ld in PATH.
8178     with_gnu_ld=unknown
8179     ;;
8180   esac
8181 elif test "$with_gnu_ld" = yes; then
8182   AC_MSG_CHECKING([for GNU ld])
8183 else
8184   AC_MSG_CHECKING([for non-GNU ld])
8185 fi
8186 AC_CACHE_VAL(acl_cv_path_LD,
8187 [if test -z "$LD"; then
8188   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
8189   for ac_dir in $PATH; do
8190     test -z "$ac_dir" && ac_dir=.
8191     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
8192       acl_cv_path_LD="$ac_dir/$ac_prog"
8193       # Check to see if the program is GNU ld.  I'd rather use --version,
8194       # but apparently some GNU ld's only accept -v.
8195       # Break only if it was the GNU/non-GNU ld that we prefer.
8196       if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
8197         test "$with_gnu_ld" != no && break
8198       else
8199         test "$with_gnu_ld" != yes && break
8200       fi
8201     fi
8202   done
8203   IFS="$ac_save_ifs"
8204 else
8205   acl_cv_path_LD="$LD" # Let the user override the test with a path.
8206 fi])
8207 LD="$acl_cv_path_LD"
8208 if test -n "$LD"; then
8209   AC_MSG_RESULT($LD)
8210 else
8211   AC_MSG_RESULT(no)
8212 fi
8213 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
8214 AC_LIB_PROG_LD_GNU
8215 ])
8216
8217 #serial 6
8218
8219 dnl From J. David Anglin.
8220
8221 dnl HPUX and other systems can't unlink shared text that is being executed.
8222
8223 AC_DEFUN([jm_FUNC_UNLINK_BUSY_TEXT],
8224 [dnl
8225   AC_CACHE_CHECK([whether a running program can be unlinked],
8226     jm_cv_func_unlink_busy_text,
8227     [
8228       AC_TRY_RUN([
8229         main (argc, argv)
8230           int argc;
8231           char **argv;
8232         {
8233           if (!argc)
8234             exit (-1);
8235           exit (unlink (argv[0]));
8236         }
8237         ],
8238       jm_cv_func_unlink_busy_text=yes,
8239       jm_cv_func_unlink_busy_text=no,
8240       jm_cv_func_unlink_busy_text=no
8241       )
8242     ]
8243   )
8244
8245   if test $jm_cv_func_unlink_busy_text = no; then
8246     INSTALL=$ac_install_sh
8247   fi
8248 ])
8249
8250 #serial 1
8251 AC_DEFUN([AC_FUNC_CANONICALIZE_FILE_NAME],
8252   [
8253     AC_REQUIRE([AC_HEADER_STDC])
8254     AC_CHECK_HEADERS(string.h sys/param.h stddef.h)
8255     AC_CHECK_FUNCS(resolvepath)
8256     AC_REQUIRE([AC_HEADER_STAT])
8257
8258     # This would simply be AC_REPLACE_FUNC([canonicalize_file_name])
8259     # if the function name weren't so long.  Besides, I would rather
8260     # not have underscores in file names.
8261     AC_CHECK_FUNC([canonicalize_file_name], , [AC_LIBOBJ(canonicalize)])
8262   ])
8263
8264
8265 # Copyright 1996, 1997, 1998, 2000, 2001, 2002  Free Software Foundation, Inc.
8266
8267 # This program is free software; you can redistribute it and/or modify
8268 # it under the terms of the GNU General Public License as published by
8269 # the Free Software Foundation; either version 2, or (at your option)
8270 # any later version.
8271
8272 # This program is distributed in the hope that it will be useful,
8273 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8274 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
8275 # GNU General Public License for more details.
8276
8277 # You should have received a copy of the GNU General Public License
8278 # along with this program; if not, write to the Free Software
8279 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
8280 # 02111-1307, USA.
8281
8282 # serial 2
8283
8284 AC_DEFUN([AM_C_PROTOTYPES],
8285 [AC_REQUIRE([AM_PROG_CC_STDC])
8286 AC_REQUIRE([AC_PROG_CPP])
8287 AC_MSG_CHECKING([for function prototypes])
8288 if test "$am_cv_prog_cc_stdc" != no; then
8289   AC_MSG_RESULT(yes)
8290   AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
8291   U= ANSI2KNR=
8292 else
8293   AC_MSG_RESULT(no)
8294   U=_ ANSI2KNR=./ansi2knr
8295 fi
8296 # Ensure some checks needed by ansi2knr itself.
8297 AC_HEADER_STDC
8298 AC_CHECK_HEADERS(string.h)
8299 AC_SUBST(U)dnl
8300 AC_SUBST(ANSI2KNR)dnl
8301 ])
8302
8303 AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
8304
8305
8306 # Copyright 1996, 1997, 1999, 2000, 2001, 2002  Free Software Foundation, Inc.
8307
8308 # This program is free software; you can redistribute it and/or modify
8309 # it under the terms of the GNU General Public License as published by
8310 # the Free Software Foundation; either version 2, or (at your option)
8311 # any later version.
8312
8313 # This program is distributed in the hope that it will be useful,
8314 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8315 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
8316 # GNU General Public License for more details.
8317
8318 # You should have received a copy of the GNU General Public License
8319 # along with this program; if not, write to the Free Software
8320 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
8321 # 02111-1307, USA.
8322
8323 # serial 2
8324
8325 # @defmac AC_PROG_CC_STDC
8326 # @maindex PROG_CC_STDC
8327 # @ovindex CC
8328 # If the C compiler in not in ANSI C mode by default, try to add an option
8329 # to output variable @code{CC} to make it so.  This macro tries various
8330 # options that select ANSI C on some system or another.  It considers the
8331 # compiler to be in ANSI C mode if it handles function prototypes correctly.
8332 #
8333 # If you use this macro, you should check after calling it whether the C
8334 # compiler has been set to accept ANSI C; if not, the shell variable
8335 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
8336 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
8337 # program @code{ansi2knr}, which comes with Ghostscript.
8338 # @end defmac
8339
8340 AC_DEFUN([AM_PROG_CC_STDC],
8341 [AC_REQUIRE([AC_PROG_CC])
8342 AC_BEFORE([$0], [AC_C_INLINE])
8343 AC_BEFORE([$0], [AC_C_CONST])
8344 dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
8345 dnl a magic option to avoid problems with ANSI preprocessor commands
8346 dnl like #elif.
8347 dnl FIXME: can't do this because then AC_AIX won't work due to a
8348 dnl circular dependency.
8349 dnl AC_BEFORE([$0], [AC_PROG_CPP])
8350 AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
8351 AC_CACHE_VAL(am_cv_prog_cc_stdc,
8352 [am_cv_prog_cc_stdc=no
8353 ac_save_CC="$CC"
8354 # Don't try gcc -ansi; that turns off useful extensions and
8355 # breaks some systems' header files.
8356 # AIX                   -qlanglvl=ansi
8357 # Ultrix and OSF/1      -std1
8358 # HP-UX 10.20 and later -Ae
8359 # HP-UX older versions  -Aa -D_HPUX_SOURCE
8360 # SVR4                  -Xc -D__EXTENSIONS__
8361 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
8362 do
8363   CC="$ac_save_CC $ac_arg"
8364   AC_TRY_COMPILE(
8365 [#include <stdarg.h>
8366 #include <stdio.h>
8367 #include <sys/types.h>
8368 #include <sys/stat.h>
8369 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
8370 struct buf { int x; };
8371 FILE * (*rcsopen) (struct buf *, struct stat *, int);
8372 static char *e (p, i)
8373      char **p;
8374      int i;
8375 {
8376   return p[i];
8377 }
8378 static char *f (char * (*g) (char **, int), char **p, ...)
8379 {
8380   char *s;
8381   va_list v;
8382   va_start (v,p);
8383   s = g (p, va_arg (v,int));
8384   va_end (v);
8385   return s;
8386 }
8387 int test (int i, double x);
8388 struct s1 {int (*f) (int a);};
8389 struct s2 {int (*f) (double a);};
8390 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
8391 int argc;
8392 char **argv;
8393 ], [
8394 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
8395 ],
8396 [am_cv_prog_cc_stdc="$ac_arg"; break])
8397 done
8398 CC="$ac_save_CC"
8399 ])
8400 if test -z "$am_cv_prog_cc_stdc"; then
8401   AC_MSG_RESULT([none needed])
8402 else
8403   AC_MSG_RESULT([$am_cv_prog_cc_stdc])
8404 fi
8405 case "x$am_cv_prog_cc_stdc" in
8406   x|xno) ;;
8407   *) CC="$CC $am_cv_prog_cc_stdc" ;;
8408 esac
8409 ])
8410
8411 AU_DEFUN([fp_PROG_CC_STDC], [AM_PROG_CC_STDC])
8412
8413 #serial 3
8414
8415 # Define HAVE_ST_DM_MODE if struct stat has an st_dm_mode member.
8416
8417 AC_DEFUN([AC_STRUCT_ST_DM_MODE],
8418  [AC_CACHE_CHECK([for st_dm_mode in struct stat], ac_cv_struct_st_dm_mode,
8419    [AC_TRY_COMPILE([#include <sys/types.h>
8420 #include <sys/stat.h>], [struct stat s; s.st_dm_mode;],
8421      ac_cv_struct_st_dm_mode=yes,
8422      ac_cv_struct_st_dm_mode=no)])
8423
8424   if test $ac_cv_struct_st_dm_mode = yes; then
8425     AC_DEFINE(HAVE_ST_DM_MODE, 1,
8426               [Define if struct stat has an st_dm_mode member. ])
8427   fi
8428  ]
8429 )
8430
8431 #serial 6
8432 dnl From Jim Meyering and Paul Eggert.
8433 AC_DEFUN([jm_HEADER_TIOCGWINSZ_IN_TERMIOS_H],
8434 [AC_REQUIRE([AC_SYS_POSIX_TERMIOS])
8435  AC_CACHE_CHECK([whether use of TIOCGWINSZ requires termios.h],
8436                 jm_cv_sys_tiocgwinsz_needs_termios_h,
8437   [jm_cv_sys_tiocgwinsz_needs_termios_h=no
8438
8439    if test $ac_cv_sys_posix_termios = yes; then
8440      AC_EGREP_CPP([yes],
8441      [#include <sys/types.h>
8442 #      include <termios.h>
8443 #      ifdef TIOCGWINSZ
8444          yes
8445 #      endif
8446      ], jm_cv_sys_tiocgwinsz_needs_termios_h=yes)
8447    fi
8448   ])
8449 ])
8450
8451 AC_DEFUN([jm_WINSIZE_IN_PTEM],
8452   [AC_REQUIRE([AC_SYS_POSIX_TERMIOS])
8453    AC_CACHE_CHECK([whether use of struct winsize requires sys/ptem.h],
8454      jm_cv_sys_struct_winsize_needs_sys_ptem_h,
8455      [jm_cv_sys_struct_winsize_needs_sys_ptem_h=yes
8456       if test $ac_cv_sys_posix_termios = yes; then
8457         AC_TRY_COMPILE([#include <termios.h>]
8458           [struct winsize x;],
8459           [jm_cv_sys_struct_winsize_needs_sys_ptem_h=no])
8460       fi
8461       if test $jm_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then
8462         AC_TRY_COMPILE([#include <sys/ptem.h>],
8463           [struct winsize x;],
8464           [], [jm_cv_sys_struct_winsize_needs_sys_ptem_h=no])
8465       fi])
8466    if test $jm_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then
8467      AC_DEFINE([WINSIZE_IN_PTEM], 1,
8468        [Define if sys/ptem.h is required for struct winsize.])
8469    fi])
8470
8471 # Determine whether this system has infrastructure for obtaining the boot time.
8472
8473 # GNULIB_BOOT_TIME([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
8474 * ----------------------------------------------------------
8475 AC_DEFUN([GNULIB_BOOT_TIME],
8476 [
8477   AC_CHECK_FUNCS(sysctl)
8478   AC_CHECK_HEADERS(sys/sysctl.h)
8479   AC_CACHE_CHECK(
8480     [whether we can get the system boot time],
8481     [gnulib_cv_have_boot_time],
8482     [
8483       AC_COMPILE_IFELSE(
8484        [AC_LANG_PROGRAM(
8485 [AC_INCLUDES_DEFAULT
8486 #if HAVE_SYSCTL && HAVE_SYS_SYSCTL_H
8487 # include <sys/param.h> /* needed for OpenBSD 3.0 */
8488 # include <sys/sysctl.h>
8489 #endif
8490 #ifdef HAVE_UTMPX_H
8491 # include <utmpx.h>
8492 #else
8493 # include <utmp.h>
8494 #endif
8495 ],
8496 [[
8497 #if defined BOOT_TIME || (defined CTL_KERN && defined KERN_BOOTTIME)
8498 /* your system *does* have the infrastructure to determine boot time */
8499 #else
8500 please_tell_us_how_to_determine_boot_time_on_your_system
8501 #endif
8502 ]])],
8503        gnulib_cv_have_boot_time=yes,
8504        gnulib_cv_have_boot_time=no)
8505     ])
8506   AS_IF([test $gnulib_cv_have_boot_time = yes], [$1], [$2])
8507 ])
8508
8509 #serial 4
8510
8511 AC_DEFUN([jm_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL],
8512 [AC_REQUIRE([jm_HEADER_TIOCGWINSZ_IN_TERMIOS_H])
8513  AC_CACHE_CHECK([whether use of TIOCGWINSZ requires sys/ioctl.h],
8514                 jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h,
8515   [jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h=no
8516
8517   if test $jm_cv_sys_tiocgwinsz_needs_termios_h = no; then
8518     AC_EGREP_CPP([yes],
8519     [#include <sys/types.h>
8520 #     include <sys/ioctl.h>
8521 #     ifdef TIOCGWINSZ
8522         yes
8523 #     endif
8524     ], jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes)
8525   fi
8526   ])
8527   if test $jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h = yes; then
8528     AC_DEFINE(GWINSZ_IN_SYS_IOCTL, 1,
8529       [Define if your system defines TIOCGWINSZ in sys/ioctl.h.])
8530   fi
8531 ])
8532
8533 #serial 5
8534
8535 dnl Misc lib-related macros for fileutils, sh-utils, textutils.
8536
8537 AC_DEFUN([jm_LIB_CHECK],
8538 [
8539
8540   # Check for libypsec.a on Dolphin M88K machines.
8541   AC_CHECK_LIB(ypsec, main)
8542
8543   # m88k running dgux 5.4 needs this
8544   AC_CHECK_LIB(ldgc, main)
8545
8546   # Some programs need to link with -lm.  printf does if it uses
8547   # lib/strtod.c which uses pow.  And seq uses the math functions,
8548   # floor, modf, rint.  And factor uses sqrt.  And sleep uses fesetround.
8549
8550   # Save a copy of $LIBS and add $FLOOR_LIBM before these tests
8551   # Check for these math functions used by seq.
8552   ac_su_saved_lib="$LIBS"
8553   LIBS="$LIBS -lm"
8554   AC_CHECK_FUNCS(floor modf rint)
8555   LIBS="$ac_su_saved_lib"
8556
8557   AC_SUBST(SQRT_LIBM)
8558   AC_CHECK_FUNCS(sqrt)
8559   if test $ac_cv_func_sqrt = no; then
8560     AC_CHECK_LIB(m, sqrt, [SQRT_LIBM=-lm])
8561   fi
8562
8563   AC_SUBST(FESETROUND_LIBM)
8564   AC_CHECK_FUNCS(fesetround)
8565   if test $ac_cv_func_fesetround = no; then
8566     AC_CHECK_LIB(m, fesetround, [FESETROUND_LIBM=-lm])
8567   fi
8568
8569   # The -lsun library is required for YP support on Irix-4.0.5 systems.
8570   # m88k/svr3 DolphinOS systems using YP need -lypsec for id.
8571   AC_SEARCH_LIBS(yp_match, [sun ypsec])
8572
8573   # SysV needs -lsec, older versions of Linux need -lshadow for
8574   # shadow passwords.  UnixWare 7 needs -lgen.
8575   AC_SEARCH_LIBS(getspnam, [shadow sec gen])
8576
8577   AC_CHECK_HEADERS(shadow.h)
8578
8579   # Requirements for su.c.
8580   shadow_includes="\
8581 $ac_includes_default
8582 #if HAVE_SHADOW_H
8583 # include <shadow.h>
8584 #endif
8585 "
8586   AC_CHECK_MEMBERS([struct spwd.sp_pwdp],,,[$shadow_includes])
8587   AC_CHECK_FUNCS(getspnam)
8588
8589   # SCO-ODT-3.0 is reported to need -lufc for crypt.
8590   # NetBSD needs -lcrypt for crypt.
8591   ac_su_saved_lib="$LIBS"
8592   AC_SEARCH_LIBS(crypt, [ufc crypt], [LIB_CRYPT="$ac_cv_search_crypt"])
8593   LIBS="$ac_su_saved_lib"
8594   AC_SUBST(LIB_CRYPT)
8595 ])
8596
8597 # gettext.m4 serial 20 (gettext-0.12)
8598 dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
8599 dnl This file is free software, distributed under the terms of the GNU
8600 dnl General Public License.  As a special exception to the GNU General
8601 dnl Public License, this file may be distributed as part of a program
8602 dnl that contains a configuration script generated by Autoconf, under
8603 dnl the same distribution terms as the rest of that program.
8604 dnl
8605 dnl This file can can be used in projects which are not available under
8606 dnl the GNU General Public License or the GNU Library General Public
8607 dnl License but which still want to provide support for the GNU gettext
8608 dnl functionality.
8609 dnl Please note that the actual code of the GNU gettext library is covered
8610 dnl by the GNU Library General Public License, and the rest of the GNU
8611 dnl gettext package package is covered by the GNU General Public License.
8612 dnl They are *not* in the public domain.
8613
8614 dnl Authors:
8615 dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
8616 dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
8617
8618 dnl Macro to add for using GNU gettext.
8619
8620 dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
8621 dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
8622 dnl    default (if it is not specified or empty) is 'no-libtool'.
8623 dnl    INTLSYMBOL should be 'external' for packages with no intl directory,
8624 dnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
8625 dnl    If INTLSYMBOL is 'use-libtool', then a libtool library
8626 dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
8627 dnl    depending on --{enable,disable}-{shared,static} and on the presence of
8628 dnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
8629 dnl    $(top_builddir)/intl/libintl.a will be created.
8630 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
8631 dnl    implementations (in libc or libintl) without the ngettext() function
8632 dnl    will be ignored.  If NEEDSYMBOL is specified and is
8633 dnl    'need-formatstring-macros', then GNU gettext implementations that don't
8634 dnl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
8635 dnl INTLDIR is used to find the intl libraries.  If empty,
8636 dnl    the value `$(top_builddir)/intl/' is used.
8637 dnl
8638 dnl The result of the configuration is one of three cases:
8639 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
8640 dnl    and used.
8641 dnl    Catalog format: GNU --> install in $(datadir)
8642 dnl    Catalog extension: .mo after installation, .gmo in source tree
8643 dnl 2) GNU gettext has been found in the system's C library.
8644 dnl    Catalog format: GNU --> install in $(datadir)
8645 dnl    Catalog extension: .mo after installation, .gmo in source tree
8646 dnl 3) No internationalization, always use English msgid.
8647 dnl    Catalog format: none
8648 dnl    Catalog extension: none
8649 dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
8650 dnl The use of .gmo is historical (it was needed to avoid overwriting the
8651 dnl GNU format catalogs when building on a platform with an X/Open gettext),
8652 dnl but we keep it in order not to force irrelevant filename changes on the
8653 dnl maintainers.
8654 dnl
8655 AC_DEFUN([AM_GNU_GETTEXT],
8656 [
8657   dnl Argument checking.
8658   ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
8659     [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
8660 ])])])])])
8661   ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
8662     [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
8663 ])])])])
8664   define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
8665   define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
8666
8667   AC_REQUIRE([AM_PO_SUBDIRS])dnl
8668   ifelse(gt_included_intl, yes, [
8669     AC_REQUIRE([AM_INTL_SUBDIR])dnl
8670   ])
8671
8672   dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
8673   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
8674   AC_REQUIRE([AC_LIB_RPATH])
8675
8676   dnl Sometimes libintl requires libiconv, so first search for libiconv.
8677   dnl Ideally we would do this search only after the
8678   dnl      if test "$USE_NLS" = "yes"; then
8679   dnl        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
8680   dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
8681   dnl the configure script would need to contain the same shell code
8682   dnl again, outside any 'if'. There are two solutions:
8683   dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
8684   dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
8685   dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
8686   dnl documented, we avoid it.
8687   ifelse(gt_included_intl, yes, , [
8688     AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
8689   ])
8690
8691   dnl Set USE_NLS.
8692   AM_NLS
8693
8694   ifelse(gt_included_intl, yes, [
8695     BUILD_INCLUDED_LIBINTL=no
8696     USE_INCLUDED_LIBINTL=no
8697   ])
8698   LIBINTL=
8699   LTLIBINTL=
8700   POSUB=
8701
8702   dnl If we use NLS figure out what method
8703   if test "$USE_NLS" = "yes"; then
8704     gt_use_preinstalled_gnugettext=no
8705     ifelse(gt_included_intl, yes, [
8706       AC_MSG_CHECKING([whether included gettext is requested])
8707       AC_ARG_WITH(included-gettext,
8708         [  --with-included-gettext use the GNU gettext library included here],
8709         nls_cv_force_use_gnu_gettext=$withval,
8710         nls_cv_force_use_gnu_gettext=no)
8711       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
8712
8713       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
8714       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
8715     ])
8716         dnl User does not insist on using GNU NLS library.  Figure out what
8717         dnl to use.  If GNU gettext is available we use this.  Else we have
8718         dnl to fall back to GNU NLS library.
8719
8720         dnl Add a version number to the cache macros.
8721         define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
8722         define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
8723         define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
8724
8725         AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
8726          [AC_TRY_LINK([#include <libintl.h>
8727 ]ifelse([$2], [need-formatstring-macros],
8728 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
8729 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
8730 #endif
8731 changequote(,)dnl
8732 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
8733 changequote([,])dnl
8734 ], [])[extern int _nl_msg_cat_cntr;
8735 extern int *_nl_domain_bindings;],
8736             [bindtextdomain ("", "");
8737 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
8738             gt_cv_func_gnugettext_libc=yes,
8739             gt_cv_func_gnugettext_libc=no)])
8740
8741         if test "$gt_cv_func_gnugettext_libc" != "yes"; then
8742           dnl Sometimes libintl requires libiconv, so first search for libiconv.
8743           ifelse(gt_included_intl, yes, , [
8744             AM_ICONV_LINK
8745           ])
8746           dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
8747           dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
8748           dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
8749           dnl even if libiconv doesn't exist.
8750           AC_LIB_LINKFLAGS_BODY([intl])
8751           AC_CACHE_CHECK([for GNU gettext in libintl],
8752             gt_cv_func_gnugettext_libintl,
8753            [gt_save_CPPFLAGS="$CPPFLAGS"
8754             CPPFLAGS="$CPPFLAGS $INCINTL"
8755             gt_save_LIBS="$LIBS"
8756             LIBS="$LIBS $LIBINTL"
8757             dnl Now see whether libintl exists and does not depend on libiconv.
8758             AC_TRY_LINK([#include <libintl.h>
8759 ]ifelse([$2], [need-formatstring-macros],
8760 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
8761 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
8762 #endif
8763 changequote(,)dnl
8764 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
8765 changequote([,])dnl
8766 ], [])[extern int _nl_msg_cat_cntr;
8767 extern
8768 #ifdef __cplusplus
8769 "C"
8770 #endif
8771 const char *_nl_expand_alias ();],
8772               [bindtextdomain ("", "");
8773 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
8774               gt_cv_func_gnugettext_libintl=yes,
8775               gt_cv_func_gnugettext_libintl=no)
8776             dnl Now see whether libintl exists and depends on libiconv.
8777             if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
8778               LIBS="$LIBS $LIBICONV"
8779               AC_TRY_LINK([#include <libintl.h>
8780 ]ifelse([$2], [need-formatstring-macros],
8781 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
8782 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
8783 #endif
8784 changequote(,)dnl
8785 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
8786 changequote([,])dnl
8787 ], [])[extern int _nl_msg_cat_cntr;
8788 extern
8789 #ifdef __cplusplus
8790 "C"
8791 #endif
8792 const char *_nl_expand_alias ();],
8793                 [bindtextdomain ("", "");
8794 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
8795                [LIBINTL="$LIBINTL $LIBICONV"
8796                 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
8797                 gt_cv_func_gnugettext_libintl=yes
8798                ])
8799             fi
8800             CPPFLAGS="$gt_save_CPPFLAGS"
8801             LIBS="$gt_save_LIBS"])
8802         fi
8803
8804         dnl If an already present or preinstalled GNU gettext() is found,
8805         dnl use it.  But if this macro is used in GNU gettext, and GNU
8806         dnl gettext is already preinstalled in libintl, we update this
8807         dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
8808         if test "$gt_cv_func_gnugettext_libc" = "yes" \
8809            || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
8810                 && test "$PACKAGE" != gettext-runtime \
8811                 && test "$PACKAGE" != gettext-tools; }; then
8812           gt_use_preinstalled_gnugettext=yes
8813         else
8814           dnl Reset the values set by searching for libintl.
8815           LIBINTL=
8816           LTLIBINTL=
8817           INCINTL=
8818         fi
8819
8820     ifelse(gt_included_intl, yes, [
8821         if test "$gt_use_preinstalled_gnugettext" != "yes"; then
8822           dnl GNU gettext is not found in the C library.
8823           dnl Fall back on included GNU gettext library.
8824           nls_cv_use_gnu_gettext=yes
8825         fi
8826       fi
8827
8828       if test "$nls_cv_use_gnu_gettext" = "yes"; then
8829         dnl Mark actions used to generate GNU NLS library.
8830         BUILD_INCLUDED_LIBINTL=yes
8831         USE_INCLUDED_LIBINTL=yes
8832         LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
8833         LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
8834         LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
8835       fi
8836
8837       if test "$gt_use_preinstalled_gnugettext" = "yes" \
8838          || test "$nls_cv_use_gnu_gettext" = "yes"; then
8839         dnl Mark actions to use GNU gettext tools.
8840         CATOBJEXT=.gmo
8841       fi
8842     ])
8843
8844     if test "$gt_use_preinstalled_gnugettext" = "yes" \
8845        || test "$nls_cv_use_gnu_gettext" = "yes"; then
8846       AC_DEFINE(ENABLE_NLS, 1,
8847         [Define to 1 if translation of program messages to the user's native language
8848    is requested.])
8849     else
8850       USE_NLS=no
8851     fi
8852   fi
8853
8854   AC_MSG_CHECKING([whether to use NLS])
8855   AC_MSG_RESULT([$USE_NLS])
8856   if test "$USE_NLS" = "yes"; then
8857     AC_MSG_CHECKING([where the gettext function comes from])
8858     if test "$gt_use_preinstalled_gnugettext" = "yes"; then
8859       if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
8860         gt_source="external libintl"
8861       else
8862         gt_source="libc"
8863       fi
8864     else
8865       gt_source="included intl directory"
8866     fi
8867     AC_MSG_RESULT([$gt_source])
8868   fi
8869
8870   if test "$USE_NLS" = "yes"; then
8871
8872     if test "$gt_use_preinstalled_gnugettext" = "yes"; then
8873       if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
8874         AC_MSG_CHECKING([how to link with libintl])
8875         AC_MSG_RESULT([$LIBINTL])
8876         AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
8877       fi
8878
8879       dnl For backward compatibility. Some packages may be using this.
8880       AC_DEFINE(HAVE_GETTEXT, 1,
8881        [Define if the GNU gettext() function is already present or preinstalled.])
8882       AC_DEFINE(HAVE_DCGETTEXT, 1,
8883        [Define if the GNU dcgettext() function is already present or preinstalled.])
8884     fi
8885
8886     dnl We need to process the po/ directory.
8887     POSUB=po
8888   fi
8889
8890   ifelse(gt_included_intl, yes, [
8891     dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
8892     dnl to 'yes' because some of the testsuite requires it.
8893     if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
8894       BUILD_INCLUDED_LIBINTL=yes
8895     fi
8896
8897     dnl Make all variables we use known to autoconf.
8898     AC_SUBST(BUILD_INCLUDED_LIBINTL)
8899     AC_SUBST(USE_INCLUDED_LIBINTL)
8900     AC_SUBST(CATOBJEXT)
8901
8902     dnl For backward compatibility. Some configure.ins may be using this.
8903     nls_cv_header_intl=
8904     nls_cv_header_libgt=
8905
8906     dnl For backward compatibility. Some Makefiles may be using this.
8907     DATADIRNAME=share
8908     AC_SUBST(DATADIRNAME)
8909
8910     dnl For backward compatibility. Some Makefiles may be using this.
8911     INSTOBJEXT=.mo
8912     AC_SUBST(INSTOBJEXT)
8913
8914     dnl For backward compatibility. Some Makefiles may be using this.
8915     GENCAT=gencat
8916     AC_SUBST(GENCAT)
8917
8918     dnl For backward compatibility. Some Makefiles may be using this.
8919     if test "$USE_INCLUDED_LIBINTL" = yes; then
8920       INTLOBJS="\$(GETTOBJS)"
8921     fi
8922     AC_SUBST(INTLOBJS)
8923
8924     dnl Enable libtool support if the surrounding package wishes it.
8925     INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
8926     AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
8927   ])
8928
8929   dnl For backward compatibility. Some Makefiles may be using this.
8930   INTLLIBS="$LIBINTL"
8931   AC_SUBST(INTLLIBS)
8932
8933   dnl Make all documented variables known to autoconf.
8934   AC_SUBST(LIBINTL)
8935   AC_SUBST(LTLIBINTL)
8936   AC_SUBST(POSUB)
8937 ])
8938
8939
8940 dnl Checks for all prerequisites of the intl subdirectory,
8941 dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
8942 dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
8943 AC_DEFUN([AM_INTL_SUBDIR],
8944 [
8945   AC_REQUIRE([AC_PROG_INSTALL])dnl
8946   AC_REQUIRE([AM_MKINSTALLDIRS])dnl
8947   AC_REQUIRE([AC_PROG_CC])dnl
8948   AC_REQUIRE([AC_CANONICAL_HOST])dnl
8949   AC_REQUIRE([AC_PROG_RANLIB])dnl
8950   AC_REQUIRE([AC_ISC_POSIX])dnl
8951   AC_REQUIRE([AC_HEADER_STDC])dnl
8952   AC_REQUIRE([AC_C_CONST])dnl
8953   AC_REQUIRE([AC_C_INLINE])dnl
8954   AC_REQUIRE([AC_TYPE_OFF_T])dnl
8955   AC_REQUIRE([AC_TYPE_SIZE_T])dnl
8956   AC_REQUIRE([AC_FUNC_ALLOCA])dnl
8957   AC_REQUIRE([AC_FUNC_MMAP])dnl
8958   AC_REQUIRE([jm_GLIBC21])dnl
8959   AC_REQUIRE([gt_INTDIV0])dnl
8960   AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
8961   AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
8962   AC_REQUIRE([gt_INTTYPES_PRI])dnl
8963
8964   AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
8965 stdlib.h string.h unistd.h sys/param.h])
8966   AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
8967 geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \
8968 strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next \
8969 __fsetlocking])
8970
8971   AM_ICONV
8972   AM_LANGINFO_CODESET
8973   if test $ac_cv_header_locale_h = yes; then
8974     AM_LC_MESSAGES
8975   fi
8976
8977   dnl intl/plural.c is generated from intl/plural.y. It requires bison,
8978   dnl because plural.y uses bison specific features. It requires at least
8979   dnl bison-1.26 because earlier versions generate a plural.c that doesn't
8980   dnl compile.
8981   dnl bison is only needed for the maintainer (who touches plural.y). But in
8982   dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
8983   dnl the rule in general Makefile. Now, some people carelessly touch the
8984   dnl files or have a broken "make" program, hence the plural.c rule will
8985   dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
8986   dnl present or too old.
8987   AC_CHECK_PROGS([INTLBISON], [bison])
8988   if test -z "$INTLBISON"; then
8989     ac_verc_fail=yes
8990   else
8991     dnl Found it, now check the version.
8992     AC_MSG_CHECKING([version of bison])
8993 changequote(<<,>>)dnl
8994     ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
8995     case $ac_prog_version in
8996       '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
8997       1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
8998 changequote([,])dnl
8999          ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
9000       *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
9001     esac
9002     AC_MSG_RESULT([$ac_prog_version])
9003   fi
9004   if test $ac_verc_fail = yes; then
9005     INTLBISON=:
9006   fi
9007 ])
9008
9009
9010 dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
9011 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
9012
9013 # po.m4 serial 2
9014 dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
9015 dnl This file is free software, distributed under the terms of the GNU
9016 dnl General Public License.  As a special exception to the GNU General
9017 dnl Public License, this file may be distributed as part of a program
9018 dnl that contains a configuration script generated by Autoconf, under
9019 dnl the same distribution terms as the rest of that program.
9020 dnl
9021 dnl This file can can be used in projects which are not available under
9022 dnl the GNU General Public License or the GNU Library General Public
9023 dnl License but which still want to provide support for the GNU gettext
9024 dnl functionality.
9025 dnl Please note that the actual code of the GNU gettext library is covered
9026 dnl by the GNU Library General Public License, and the rest of the GNU
9027 dnl gettext package package is covered by the GNU General Public License.
9028 dnl They are *not* in the public domain.
9029
9030 dnl Authors:
9031 dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
9032 dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
9033
9034 dnl Checks for all prerequisites of the po subdirectory.
9035 AC_DEFUN([AM_PO_SUBDIRS],
9036 [
9037   AC_REQUIRE([AC_PROG_MAKE_SET])dnl
9038   AC_REQUIRE([AC_PROG_INSTALL])dnl
9039   AC_REQUIRE([AM_MKINSTALLDIRS])dnl
9040   AC_REQUIRE([AM_NLS])dnl
9041
9042   dnl Perform the following tests also if --disable-nls has been given,
9043   dnl because they are needed for "make dist" to work.
9044
9045   dnl Search for GNU msgfmt in the PATH.
9046   dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
9047   dnl The second test excludes FreeBSD msgfmt.
9048   AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
9049     [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
9050      (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
9051     :)
9052   AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
9053
9054   dnl Search for GNU xgettext 0.12 or newer in the PATH.
9055   dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
9056   dnl The second test excludes FreeBSD xgettext.
9057   AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
9058     [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
9059      (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
9060     :)
9061   dnl Remove leftover from FreeBSD xgettext call.
9062   rm -f messages.po
9063
9064   dnl Search for GNU msgmerge 0.11 or newer in the PATH.
9065   AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
9066     [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
9067
9068   dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
9069   dnl Test whether we really found GNU msgfmt.
9070   if test "$GMSGFMT" != ":"; then
9071     dnl If it is no GNU msgfmt we define it as : so that the
9072     dnl Makefiles still can work.
9073     if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
9074        (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
9075       : ;
9076     else
9077       GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
9078       AC_MSG_RESULT(
9079         [found $GMSGFMT program is not GNU msgfmt; ignore it])
9080       GMSGFMT=":"
9081     fi
9082   fi
9083
9084   dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
9085   dnl Test whether we really found GNU xgettext.
9086   if test "$XGETTEXT" != ":"; then
9087     dnl If it is no GNU xgettext we define it as : so that the
9088     dnl Makefiles still can work.
9089     if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
9090        (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
9091       : ;
9092     else
9093       AC_MSG_RESULT(
9094         [found xgettext program is not GNU xgettext; ignore it])
9095       XGETTEXT=":"
9096     fi
9097     dnl Remove leftover from FreeBSD xgettext call.
9098     rm -f messages.po
9099   fi
9100
9101   AC_OUTPUT_COMMANDS([
9102     for ac_file in $CONFIG_FILES; do
9103       # Support "outfile[:infile[:infile...]]"
9104       case "$ac_file" in
9105         *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
9106       esac
9107       # PO directories have a Makefile.in generated from Makefile.in.in.
9108       case "$ac_file" in */Makefile.in)
9109         # Adjust a relative srcdir.
9110         ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
9111         ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
9112         ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
9113         # In autoconf-2.13 it is called $ac_given_srcdir.
9114         # In autoconf-2.50 it is called $srcdir.
9115         test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
9116         case "$ac_given_srcdir" in
9117           .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
9118           /*) top_srcdir="$ac_given_srcdir" ;;
9119           *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
9120         esac
9121         if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
9122           rm -f "$ac_dir/POTFILES"
9123           test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
9124           cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[    ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
9125           POMAKEFILEDEPS="POTFILES.in"
9126           # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
9127           # on $ac_dir but don't depend on user-specified configuration
9128           # parameters.
9129           if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
9130             # The LINGUAS file contains the set of available languages.
9131             if test -n "$OBSOLETE_ALL_LINGUAS"; then
9132               test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
9133             fi
9134             ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
9135             # Hide the ALL_LINGUAS assigment from automake.
9136             eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
9137             POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
9138           else
9139             # The set of available languages was given in configure.in.
9140             eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
9141           fi
9142           case "$ac_given_srcdir" in
9143             .) srcdirpre= ;;
9144             *) srcdirpre='$(srcdir)/' ;;
9145           esac
9146           POFILES=
9147           GMOFILES=
9148           UPDATEPOFILES=
9149           DUMMYPOFILES=
9150           for lang in $ALL_LINGUAS; do
9151             POFILES="$POFILES $srcdirpre$lang.po"
9152             GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
9153             UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
9154             DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
9155           done
9156           # CATALOGS depends on both $ac_dir and the user's LINGUAS
9157           # environment variable.
9158           INST_LINGUAS=
9159           if test -n "$ALL_LINGUAS"; then
9160             for presentlang in $ALL_LINGUAS; do
9161               useit=no
9162               if test "%UNSET%" != "$LINGUAS"; then
9163                 desiredlanguages="$LINGUAS"
9164               else
9165                 desiredlanguages="$ALL_LINGUAS"
9166               fi
9167               for desiredlang in $desiredlanguages; do
9168                 # Use the presentlang catalog if desiredlang is
9169                 #   a. equal to presentlang, or
9170                 #   b. a variant of presentlang (because in this case,
9171                 #      presentlang can be used as a fallback for messages
9172                 #      which are not translated in the desiredlang catalog).
9173                 case "$desiredlang" in
9174                   "$presentlang"*) useit=yes;;
9175                 esac
9176               done
9177               if test $useit = yes; then
9178                 INST_LINGUAS="$INST_LINGUAS $presentlang"
9179               fi
9180             done
9181           fi
9182           CATALOGS=
9183           if test -n "$INST_LINGUAS"; then
9184             for lang in $INST_LINGUAS; do
9185               CATALOGS="$CATALOGS $lang.gmo"
9186             done
9187           fi
9188           test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
9189           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" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
9190           for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
9191             if test -f "$f"; then
9192               case "$f" in
9193                 *.orig | *.bak | *~) ;;
9194                 *) cat "$f" >> "$ac_dir/Makefile" ;;
9195               esac
9196             fi
9197           done
9198         fi
9199         ;;
9200       esac
9201     done],
9202    [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
9203     # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
9204     # from automake.
9205     eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
9206     # Capture the value of LINGUAS because we need it to compute CATALOGS.
9207     LINGUAS="${LINGUAS-%UNSET%}"
9208    ])
9209 ])
9210
9211 # nls.m4 serial 2
9212 dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
9213 dnl This file is free software, distributed under the terms of the GNU
9214 dnl General Public License.  As a special exception to the GNU General
9215 dnl Public License, this file may be distributed as part of a program
9216 dnl that contains a configuration script generated by Autoconf, under
9217 dnl the same distribution terms as the rest of that program.
9218 dnl
9219 dnl This file can can be used in projects which are not available under
9220 dnl the GNU General Public License or the GNU Library General Public
9221 dnl License but which still want to provide support for the GNU gettext
9222 dnl functionality.
9223 dnl Please note that the actual code of the GNU gettext library is covered
9224 dnl by the GNU Library General Public License, and the rest of the GNU
9225 dnl gettext package package is covered by the GNU General Public License.
9226 dnl They are *not* in the public domain.
9227
9228 dnl Authors:
9229 dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
9230 dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
9231
9232 AC_DEFUN([AM_NLS],
9233 [
9234   AC_MSG_CHECKING([whether NLS is requested])
9235   dnl Default is enabled NLS
9236   AC_ARG_ENABLE(nls,
9237     [  --disable-nls           do not use Native Language Support],
9238     USE_NLS=$enableval, USE_NLS=yes)
9239   AC_MSG_RESULT($USE_NLS)
9240   AC_SUBST(USE_NLS)
9241 ])
9242
9243 AC_DEFUN([AM_MKINSTALLDIRS],
9244 [
9245   dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
9246   dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
9247   dnl Try to locate it.
9248   MKINSTALLDIRS=
9249   if test -n "$ac_aux_dir"; then
9250     case "$ac_aux_dir" in
9251       /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;;
9252       *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;;
9253     esac
9254   fi
9255   if test -z "$MKINSTALLDIRS"; then
9256     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
9257   fi
9258   AC_SUBST(MKINSTALLDIRS)
9259 ])
9260
9261 # progtest.m4 serial 3 (gettext-0.12)
9262 dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
9263 dnl This file is free software, distributed under the terms of the GNU
9264 dnl General Public License.  As a special exception to the GNU General
9265 dnl Public License, this file may be distributed as part of a program
9266 dnl that contains a configuration script generated by Autoconf, under
9267 dnl the same distribution terms as the rest of that program.
9268 dnl
9269 dnl This file can can be used in projects which are not available under
9270 dnl the GNU General Public License or the GNU Library General Public
9271 dnl License but which still want to provide support for the GNU gettext
9272 dnl functionality.
9273 dnl Please note that the actual code of the GNU gettext library is covered
9274 dnl by the GNU Library General Public License, and the rest of the GNU
9275 dnl gettext package package is covered by the GNU General Public License.
9276 dnl They are *not* in the public domain.
9277
9278 dnl Authors:
9279 dnl   Ulrich Drepper <drepper@cygnus.com>, 1996.
9280
9281 # Search path for a program which passes the given test.
9282
9283 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
9284 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
9285 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
9286 [
9287 # Prepare PATH_SEPARATOR.
9288 # The user is always right.
9289 if test "${PATH_SEPARATOR+set}" != set; then
9290   echo "#! /bin/sh" >conf$$.sh
9291   echo  "exit 0"   >>conf$$.sh
9292   chmod +x conf$$.sh
9293   if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
9294     PATH_SEPARATOR=';'
9295   else
9296     PATH_SEPARATOR=:
9297   fi
9298   rm -f conf$$.sh
9299 fi
9300
9301 # Find out how to test for executable files. Don't use a zero-byte file,
9302 # as systems may use methods other than mode bits to determine executability.
9303 cat >conf$$.file <<_ASEOF
9304 #! /bin/sh
9305 exit 0
9306 _ASEOF
9307 chmod +x conf$$.file
9308 if test -x conf$$.file >/dev/null 2>&1; then
9309   ac_executable_p="test -x"
9310 else
9311   ac_executable_p="test -f"
9312 fi
9313 rm -f conf$$.file
9314
9315 # Extract the first word of "$2", so it can be a program name with args.
9316 set dummy $2; ac_word=[$]2
9317 AC_MSG_CHECKING([for $ac_word])
9318 AC_CACHE_VAL(ac_cv_path_$1,
9319 [case "[$]$1" in
9320   [[\\/]]* | ?:[[\\/]]*)
9321     ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
9322     ;;
9323   *)
9324     ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
9325     for ac_dir in ifelse([$5], , $PATH, [$5]); do
9326       IFS="$ac_save_IFS"
9327       test -z "$ac_dir" && ac_dir=.
9328       for ac_exec_ext in '' $ac_executable_extensions; do
9329         if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
9330           if [$3]; then
9331             ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
9332             break 2
9333           fi
9334         fi
9335       done
9336     done
9337     IFS="$ac_save_IFS"
9338 dnl If no 4th arg is given, leave the cache variable unset,
9339 dnl so AC_PATH_PROGS will keep looking.
9340 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
9341 ])dnl
9342     ;;
9343 esac])dnl
9344 $1="$ac_cv_path_$1"
9345 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
9346   AC_MSG_RESULT([$]$1)
9347 else
9348   AC_MSG_RESULT(no)
9349 fi
9350 AC_SUBST($1)dnl
9351 ])
9352