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