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