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