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