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