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