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