1 # generated automatically by aclocal 1.7.3 -*- Autoconf -*-
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.
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
14 # Do all the work for Automake. -*- Autoconf -*-
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.
19 # Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
20 # Free Software Foundation, Inc.
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)
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.
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
39 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
40 # written in clear, in which case automake, when reading aclocal.m4,
41 # will think it sees a *use*, and therefore will trigger all it's
42 # C support machinery. Also note that it means that autoscan, seeing
43 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
48 # Autoconf 2.50 wants to disallow AM_ names. We explicitly allow
49 # the ones we care about.
50 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
52 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
53 # AM_INIT_AUTOMAKE([OPTIONS])
54 # -----------------------------------------------
55 # The call with PACKAGE and VERSION arguments is the old style
56 # call (pre autoconf-2.50), which is being phased out. PACKAGE
57 # and VERSION should now be passed to AC_INIT and removed from
58 # the call to AM_INIT_AUTOMAKE.
59 # We support both call styles for the transition. After
60 # the next Automake release, Autoconf can make the AC_INIT
61 # arguments mandatory, and then we can depend on a new Autoconf
62 # release and drop the old call support.
63 AC_DEFUN([AM_INIT_AUTOMAKE],
64 [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
65 AC_REQUIRE([AC_PROG_INSTALL])dnl
66 # test to see if srcdir already configured
67 if test "`cd $srcdir && pwd`" != "`pwd`" &&
68 test -f $srcdir/config.status; then
69 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
72 # test whether we have cygpath
73 if test -z "$CYGPATH_W"; then
74 if (cygpath --version) >/dev/null 2>/dev/null; then
75 CYGPATH_W='cygpath -w'
82 # Define the identity of the package.
83 dnl Distinguish between old-style and new-style calls.
85 [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
86 AC_SUBST([PACKAGE], [$1])dnl
87 AC_SUBST([VERSION], [$2])],
88 [_AM_SET_OPTIONS([$1])dnl
89 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
90 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
92 _AM_IF_OPTION([no-define],,
93 [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
94 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
96 # Some tools Automake needs.
97 AC_REQUIRE([AM_SANITY_CHECK])dnl
98 AC_REQUIRE([AC_ARG_PROGRAM])dnl
99 AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
100 AM_MISSING_PROG(AUTOCONF, autoconf)
101 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
102 AM_MISSING_PROG(AUTOHEADER, autoheader)
103 AM_MISSING_PROG(MAKEINFO, makeinfo)
104 AM_MISSING_PROG(AMTAR, tar)
106 AM_PROG_INSTALL_STRIP
107 # We need awk for the "check" target. The system "awk" is bad on
109 AC_REQUIRE([AC_PROG_AWK])dnl
110 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
111 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
113 _AM_IF_OPTION([no-dependencies],,
114 [AC_PROVIDE_IFELSE([AC_PROG_CC],
115 [_AM_DEPENDENCIES(CC)],
116 [define([AC_PROG_CC],
117 defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
118 AC_PROVIDE_IFELSE([AC_PROG_CXX],
119 [_AM_DEPENDENCIES(CXX)],
120 [define([AC_PROG_CXX],
121 defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
126 # When config.status generates a header, we must update the stamp-h file.
127 # This file resides in the same directory as the config header
128 # that is generated. The stamp files are numbered to have different names.
130 # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
131 # loop where config.status creates the headers, so we can generate
132 # our stamp files there.
133 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
134 [# Compute $1's index in $config_headers.
136 for _am_header in $config_headers :; do
141 _am_stamp_count=`expr $_am_stamp_count + 1` ;;
144 echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
146 # Copyright 2002 Free Software Foundation, Inc.
148 # This program is free software; you can redistribute it and/or modify
149 # it under the terms of the GNU General Public License as published by
150 # the Free Software Foundation; either version 2, or (at your option)
153 # This program is distributed in the hope that it will be useful,
154 # but WITHOUT ANY WARRANTY; without even the implied warranty of
155 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
156 # GNU General Public License for more details.
158 # You should have received a copy of the GNU General Public License
159 # along with this program; if not, write to the Free Software
160 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
162 # AM_AUTOMAKE_VERSION(VERSION)
163 # ----------------------------
164 # Automake X.Y traces this macro to ensure aclocal.m4 has been
165 # generated from the m4 files accompanying Automake X.Y.
166 AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"])
168 # AM_SET_CURRENT_AUTOMAKE_VERSION
169 # -------------------------------
170 # Call AM_AUTOMAKE_VERSION so it can be traced.
171 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
172 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
173 [AM_AUTOMAKE_VERSION([1.7.3])])
175 # Helper functions for option handling. -*- Autoconf -*-
177 # Copyright 2001, 2002 Free Software Foundation, Inc.
179 # This program is free software; you can redistribute it and/or modify
180 # it under the terms of the GNU General Public License as published by
181 # the Free Software Foundation; either version 2, or (at your option)
184 # This program is distributed in the hope that it will be useful,
185 # but WITHOUT ANY WARRANTY; without even the implied warranty of
186 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
187 # GNU General Public License for more details.
189 # You should have received a copy of the GNU General Public License
190 # along with this program; if not, write to the Free Software
191 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
196 # _AM_MANGLE_OPTION(NAME)
197 # -----------------------
198 AC_DEFUN([_AM_MANGLE_OPTION],
199 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
201 # _AM_SET_OPTION(NAME)
202 # ------------------------------
203 # Set option NAME. Presently that only means defining a flag for this option.
204 AC_DEFUN([_AM_SET_OPTION],
205 [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
207 # _AM_SET_OPTIONS(OPTIONS)
208 # ----------------------------------
209 # OPTIONS is a space-separated list of Automake options.
210 AC_DEFUN([_AM_SET_OPTIONS],
211 [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
213 # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
214 # -------------------------------------------
215 # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
216 AC_DEFUN([_AM_IF_OPTION],
217 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
220 # Check to make sure that the build environment is sane.
223 # Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
225 # This program is free software; you can redistribute it and/or modify
226 # it under the terms of the GNU General Public License as published by
227 # the Free Software Foundation; either version 2, or (at your option)
230 # This program is distributed in the hope that it will be useful,
231 # but WITHOUT ANY WARRANTY; without even the implied warranty of
232 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
233 # GNU General Public License for more details.
235 # You should have received a copy of the GNU General Public License
236 # along with this program; if not, write to the Free Software
237 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
244 AC_DEFUN([AM_SANITY_CHECK],
245 [AC_MSG_CHECKING([whether build environment is sane])
248 echo timestamp > conftest.file
249 # Do `set' in a subshell so we don't clobber the current shell's
250 # arguments. Must try -L first in case configure is actually a
251 # symlink; some systems play weird games with the mod time of symlinks
252 # (eg FreeBSD returns the mod time of the symlink's containing
255 set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
256 if test "$[*]" = "X"; then
258 set X `ls -t $srcdir/configure conftest.file`
261 if test "$[*]" != "X $srcdir/configure conftest.file" \
262 && test "$[*]" != "X conftest.file $srcdir/configure"; then
264 # If neither matched, then we have a broken ls. This can happen
265 # if, for instance, CONFIG_SHELL is bash and it inherits a
266 # broken ls alias from the environment. This has actually
267 # happened. Such a system could not be considered "sane".
268 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
269 alias in your environment])
272 test "$[2]" = conftest.file
278 AC_MSG_ERROR([newly created file is older than distributed files!
279 Check your system clock])
286 # Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
288 # This program is free software; you can redistribute it and/or modify
289 # it under the terms of the GNU General Public License as published by
290 # the Free Software Foundation; either version 2, or (at your option)
293 # This program is distributed in the hope that it will be useful,
294 # but WITHOUT ANY WARRANTY; without even the implied warranty of
295 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
296 # GNU General Public License for more details.
298 # You should have received a copy of the GNU General Public License
299 # along with this program; if not, write to the Free Software
300 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
305 # AM_MISSING_PROG(NAME, PROGRAM)
306 # ------------------------------
307 AC_DEFUN([AM_MISSING_PROG],
308 [AC_REQUIRE([AM_MISSING_HAS_RUN])
309 $1=${$1-"${am_missing_run}$2"}
315 # Define MISSING if not defined so far and test if it supports --run.
316 # If it does, set am_missing_run to use it, otherwise, to nothing.
317 AC_DEFUN([AM_MISSING_HAS_RUN],
318 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
319 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
320 # Use eval to expand $SHELL
321 if eval "$MISSING --run true"; then
322 am_missing_run="$MISSING --run "
325 AC_MSG_WARN([`missing' script is too old or missing])
331 # Copyright 2001 Free Software Foundation, Inc.
333 # This program is free software; you can redistribute it and/or modify
334 # it under the terms of the GNU General Public License as published by
335 # the Free Software Foundation; either version 2, or (at your option)
338 # This program is distributed in the hope that it will be useful,
339 # but WITHOUT ANY WARRANTY; without even the implied warranty of
340 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
341 # GNU General Public License for more details.
343 # You should have received a copy of the GNU General Public License
344 # along with this program; if not, write to the Free Software
345 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
348 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
349 # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
350 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
352 # Of course, Automake must honor this variable whenever it calls a
353 # tool from the auxiliary directory. The problem is that $srcdir (and
354 # therefore $ac_aux_dir as well) can be either absolute or relative,
355 # depending on how configure is run. This is pretty annoying, since
356 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
357 # source directory, any form will work fine, but in subdirectories a
358 # relative path needs to be adjusted first.
360 # $ac_aux_dir/missing
361 # fails when called from a subdirectory if $ac_aux_dir is relative
362 # $top_srcdir/$ac_aux_dir/missing
363 # fails if $ac_aux_dir is absolute,
364 # fails when called from a subdirectory in a VPATH build with
365 # a relative $ac_aux_dir
367 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
368 # are both prefixed by $srcdir. In an in-source build this is usually
369 # harmless because $srcdir is `.', but things will broke when you
370 # start a VPATH build or use an absolute $srcdir.
372 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
373 # iff we strip the leading $srcdir from $ac_aux_dir. That would be:
374 # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
375 # and then we would define $MISSING as
376 # MISSING="\${SHELL} $am_aux_dir/missing"
377 # This will work as long as MISSING is not called from configure, because
378 # unfortunately $(top_srcdir) has no meaning in configure.
379 # However there are other variables, like CC, which are often used in
380 # configure, and could therefore not use this "fixed" $ac_aux_dir.
382 # Another solution, used here, is to always expand $ac_aux_dir to an
383 # absolute PATH. The drawback is that using absolute paths prevent a
384 # configured tree to be moved without reconfiguration.
386 # Rely on autoconf to set up CDPATH properly.
389 AC_DEFUN([AM_AUX_DIR_EXPAND], [
390 # expand $ac_aux_dir to an absolute path
391 am_aux_dir=`cd $ac_aux_dir && pwd`
396 # Define $install_sh.
398 # Copyright 2001 Free Software Foundation, Inc.
400 # This program is free software; you can redistribute it and/or modify
401 # it under the terms of the GNU General Public License as published by
402 # the Free Software Foundation; either version 2, or (at your option)
405 # This program is distributed in the hope that it will be useful,
406 # but WITHOUT ANY WARRANTY; without even the implied warranty of
407 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
408 # GNU General Public License for more details.
410 # You should have received a copy of the GNU General Public License
411 # along with this program; if not, write to the Free Software
412 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
415 AC_DEFUN([AM_PROG_INSTALL_SH],
416 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
417 install_sh=${install_sh-"$am_aux_dir/install-sh"}
418 AC_SUBST(install_sh)])
420 # AM_PROG_INSTALL_STRIP
422 # Copyright 2001 Free Software Foundation, Inc.
424 # This program is free software; you can redistribute it and/or modify
425 # it under the terms of the GNU General Public License as published by
426 # the Free Software Foundation; either version 2, or (at your option)
429 # This program is distributed in the hope that it will be useful,
430 # but WITHOUT ANY WARRANTY; without even the implied warranty of
431 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
432 # GNU General Public License for more details.
434 # You should have received a copy of the GNU General Public License
435 # along with this program; if not, write to the Free Software
436 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
439 # One issue with vendor `install' (even GNU) is that you can't
440 # specify the program used to strip binaries. This is especially
441 # annoying in cross-compiling environments, where the build's strip
442 # is unlikely to handle the host's binaries.
443 # Fortunately install-sh will honor a STRIPPROG variable, so we
444 # always use install-sh in `make install-strip', and initialize
445 # STRIPPROG with the value of the STRIP variable (set by the user).
446 AC_DEFUN([AM_PROG_INSTALL_STRIP],
447 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
448 # Installed binaries are usually stripped using `strip' when the user
449 # run `make install-strip'. However `strip' might not be the right
450 # tool to use in cross-compilation environments, therefore Automake
451 # will honor the `STRIP' environment variable to overrule this program.
452 dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
453 if test "$cross_compiling" != no; then
454 AC_CHECK_TOOL([STRIP], [strip], :)
456 INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
457 AC_SUBST([INSTALL_STRIP_PROGRAM])])
460 # Copyright (C) 2003 Free Software Foundation, Inc.
462 # This program is free software; you can redistribute it and/or modify
463 # it under the terms of the GNU General Public License as published by
464 # the Free Software Foundation; either version 2, or (at your option)
467 # This program is distributed in the hope that it will be useful,
468 # but WITHOUT ANY WARRANTY; without even the implied warranty of
469 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
470 # GNU General Public License for more details.
472 # You should have received a copy of the GNU General Public License
473 # along with this program; if not, write to the Free Software
474 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
479 # Check whether the underlying file-system supports filenames
480 # with a leading dot. For instance MS-DOS doesn't.
481 AC_DEFUN([AM_SET_LEADING_DOT],
482 [rm -rf .tst 2>/dev/null
483 mkdir .tst 2>/dev/null
484 if test -d .tst; then
489 rmdir .tst 2>/dev/null
490 AC_SUBST([am__leading_dot])])
492 # serial 5 -*- Autoconf -*-
494 # Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
496 # This program is free software; you can redistribute it and/or modify
497 # it under the terms of the GNU General Public License as published by
498 # the Free Software Foundation; either version 2, or (at your option)
501 # This program is distributed in the hope that it will be useful,
502 # but WITHOUT ANY WARRANTY; without even the implied warranty of
503 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
504 # GNU General Public License for more details.
506 # You should have received a copy of the GNU General Public License
507 # along with this program; if not, write to the Free Software
508 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
512 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
513 # written in clear, in which case automake, when reading aclocal.m4,
514 # will think it sees a *use*, and therefore will trigger all it's
515 # C support machinery. Also note that it means that autoscan, seeing
516 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
520 # _AM_DEPENDENCIES(NAME)
521 # ----------------------
522 # See how the compiler implements dependency checking.
523 # NAME is "CC", "CXX", "GCJ", or "OBJC".
524 # We try a few techniques and use that to set a single cache variable.
526 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
527 # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
528 # dependency, and given that the user is not expected to run this macro,
529 # just rely on AC_PROG_CC.
530 AC_DEFUN([_AM_DEPENDENCIES],
531 [AC_REQUIRE([AM_SET_DEPDIR])dnl
532 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
533 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
534 AC_REQUIRE([AM_DEP_TRACK])dnl
536 ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
537 [$1], CXX, [depcc="$CXX" am_compiler_list=],
538 [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
539 [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
540 [depcc="$$1" am_compiler_list=])
542 AC_CACHE_CHECK([dependency style of $depcc],
543 [am_cv_$1_dependencies_compiler_type],
544 [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
545 # We make a subdir and do the tests there. Otherwise we can end up
546 # making bogus files that we don't know about and never remove. For
547 # instance it was reported that on HP-UX the gcc test will end up
548 # making a dummy file named `D' -- because `-MD' means `put the output
551 # Copy depcomp to subdir because otherwise we won't find it if we're
552 # using a relative directory.
553 cp "$am_depcomp" conftest.dir
556 am_cv_$1_dependencies_compiler_type=none
557 if test "$am_compiler_list" = ""; then
558 am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
560 for depmode in $am_compiler_list; do
561 # We need to recreate these files for each test, as the compiler may
562 # overwrite some of them when testing with obscure command lines.
563 # This happens at least with the AIX C compiler.
564 echo '#include "conftest.h"' > conftest.c
565 echo 'int i;' > conftest.h
566 echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
570 # after this tag, mechanisms are not by side-effect, so they'll
571 # only be used when explicitly requested
572 if test "x$enable_dependency_tracking" = xyes; then
580 # We check with `-c' and `-o' for the sake of the "dashmstdout"
581 # mode. It turns out that the SunPro C++ compiler does not properly
582 # handle `-M -o', and we need to detect this.
583 if depmode=$depmode \
584 source=conftest.c object=conftest.o \
585 depfile=conftest.Po tmpdepfile=conftest.TPo \
586 $SHELL ./depcomp $depcc -c -o conftest.o conftest.c \
587 >/dev/null 2>conftest.err &&
588 grep conftest.h conftest.Po > /dev/null 2>&1 &&
589 ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
590 # icc doesn't choke on unknown options, it will just issue warnings
591 # (even with -Werror). So we grep stderr for any message
592 # that says an option was ignored.
593 if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
594 am_cv_$1_dependencies_compiler_type=$depmode
603 am_cv_$1_dependencies_compiler_type=none
606 AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
607 AM_CONDITIONAL([am__fastdep$1], [
608 test "x$enable_dependency_tracking" != xno \
609 && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
615 # Choose a directory name for dependency files.
616 # This macro is AC_REQUIREd in _AM_DEPENDENCIES
617 AC_DEFUN([AM_SET_DEPDIR],
618 [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
619 AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
625 AC_DEFUN([AM_DEP_TRACK],
626 [AC_ARG_ENABLE(dependency-tracking,
627 [ --disable-dependency-tracking Speeds up one-time builds
628 --enable-dependency-tracking Do not reject slow dependency extractors])
629 if test "x$enable_dependency_tracking" != xno; then
630 am_depcomp="$ac_aux_dir/depcomp"
633 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
634 AC_SUBST([AMDEPBACKSLASH])
637 # Generate code to set up dependency tracking. -*- Autoconf -*-
639 # Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
641 # This program is free software; you can redistribute it and/or modify
642 # it under the terms of the GNU General Public License as published by
643 # the Free Software Foundation; either version 2, or (at your option)
646 # This program is distributed in the hope that it will be useful,
647 # but WITHOUT ANY WARRANTY; without even the implied warranty of
648 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
649 # GNU General Public License for more details.
651 # You should have received a copy of the GNU General Public License
652 # along with this program; if not, write to the Free Software
653 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
658 # _AM_OUTPUT_DEPENDENCY_COMMANDS
659 # ------------------------------
660 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
661 [for mf in $CONFIG_FILES; do
662 # Strip MF so we end up with the name of the file.
663 mf=`echo "$mf" | sed -e 's/:.*$//'`
664 # Check whether this is an Automake generated Makefile or not.
665 # We used to match only the files named `Makefile.in', but
666 # some people rename them; so instead we look at the file content.
667 # Grep'ing the first line is not enough: some people post-process
668 # each Makefile.in and add a new line on top of each file to say so.
669 # So let's grep whole file.
670 if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
671 dirpart=`AS_DIRNAME("$mf")`
675 grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
676 # Extract the definition of DEP_FILES from the Makefile without
678 DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
679 test -z "$DEPDIR" && continue
680 # When using ansi2knr, U may be empty or an underscore; expand it
681 U=`sed -n -e '/^U = / s///p' < "$mf"`
682 test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
683 # We invoke sed twice because it is the simplest approach to
684 # changing $(DEPDIR) to its actual value in the expansion.
685 for file in `sed -n -e '
686 /^DEP_FILES = .*\\\\$/ {
695 /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
696 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
697 # Make sure the directory exists.
698 test -f "$dirpart/$file" && continue
699 fdir=`AS_DIRNAME(["$file"])`
700 AS_MKDIR_P([$dirpart/$fdir])
701 # echo "creating $dirpart/$file"
702 echo '# dummy' > "$dirpart/$file"
705 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
708 # AM_OUTPUT_DEPENDENCY_COMMANDS
709 # -----------------------------
710 # This macro should only be invoked once -- use via AC_REQUIRE.
712 # This code is only required when automatic dependency tracking
713 # is enabled. FIXME. This creates each `.P' file that we will
714 # need in order to bootstrap the dependency handling code.
715 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
716 [AC_CONFIG_COMMANDS([depfiles],
717 [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
718 [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
721 # Check to see how 'make' treats includes. -*- Autoconf -*-
723 # Copyright (C) 2001, 2002 Free Software Foundation, Inc.
725 # This program is free software; you can redistribute it and/or modify
726 # it under the terms of the GNU General Public License as published by
727 # the Free Software Foundation; either version 2, or (at your option)
730 # This program is distributed in the hope that it will be useful,
731 # but WITHOUT ANY WARRANTY; without even the implied warranty of
732 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
733 # GNU General Public License for more details.
735 # You should have received a copy of the GNU General Public License
736 # along with this program; if not, write to the Free Software
737 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
744 # Check to see how make treats includes.
745 AC_DEFUN([AM_MAKE_INCLUDE],
746 [am_make=${MAKE-make}
747 cat > confinc << 'END'
751 # If we don't find an include directive, just comment out the code.
752 AC_MSG_CHECKING([for style of include used by $am_make])
756 # First try GNU make style include.
757 echo "include confinc" > confmf
758 # We grep out `Entering directory' and `Leaving directory'
759 # messages which can occur if `w' ends up in MAKEFLAGS.
760 # In particular we don't look at `^make:' because GNU make might
761 # be invoked under some other name (usually "gmake"), in which
762 # case it prints its new name instead of `make'.
763 if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
768 # Now try BSD make style include.
769 if test "$am__include" = "#"; then
770 echo '.include "confinc"' > confmf
771 if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
777 AC_SUBST(am__include)
779 AC_MSG_RESULT($_am_result)
783 # AM_CONDITIONAL -*- Autoconf -*-
785 # Copyright 1997, 2000, 2001 Free Software Foundation, Inc.
787 # This program is free software; you can redistribute it and/or modify
788 # it under the terms of the GNU General Public License as published by
789 # the Free Software Foundation; either version 2, or (at your option)
792 # This program is distributed in the hope that it will be useful,
793 # but WITHOUT ANY WARRANTY; without even the implied warranty of
794 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
795 # GNU General Public License for more details.
797 # You should have received a copy of the GNU General Public License
798 # along with this program; if not, write to the Free Software
799 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
806 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
807 # -------------------------------------
808 # Define a conditional.
809 AC_DEFUN([AM_CONDITIONAL],
810 [ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
811 [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
821 AC_CONFIG_COMMANDS_PRE(
822 [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
823 AC_MSG_ERROR([conditional "$1" was never defined.
824 Usually this means the macro was only invoked conditionally.])
829 dnl From Jim Meyering.
830 dnl Find a new-enough version of Perl.
835 dnl FIXME: don't hard-code 5.003
836 dnl FIXME: should we cache the result?
837 AC_MSG_CHECKING([for perl5.003 or newer])
838 if test "${PERL+set}" = set; then
839 # `PERL' is set in the user's environment.
840 candidate_perl_names="$PERL"
843 candidate_perl_names='perl perl5'
849 PERL="$missing_dir/missing perl"
850 for perl in $candidate_perl_names; do
851 # Run test in a subshell; some versions of sh will print an error if
852 # an executable is not found, even if stderr is redirected.
853 if ( $perl -e 'require 5.003; use File::Compare' ) > /dev/null 2>&1; then
860 AC_MSG_RESULT($found)
861 test $found = no && AC_MSG_WARN([
862 WARNING: You don't seem to have perl5.003 or newer installed, or you lack
863 a usable version of the Perl File::Compare module. As a result,
864 you may be unable to run a few tests or to regenerate certain
865 files if you modify the sources from which they are derived.
869 #serial 58 -*- autoconf -*-
871 dnl Misc type-related macros for fileutils, sh-utils, textutils.
873 AC_DEFUN([jm_MACROS],
877 GNU_PACKAGE="GNU $PACKAGE"
878 AC_DEFINE_UNQUOTED(GNU_PACKAGE, "$GNU_PACKAGE",
879 [The concatenation of the strings `GNU ', and PACKAGE.])
880 AC_SUBST(GNU_PACKAGE)
882 AM_MISSING_PROG(HELP2MAN, help2man)
883 AC_SUBST(OPTIONAL_BIN_PROGS)
884 AC_SUBST(OPTIONAL_BIN_ZCRIPTS)
888 dnl This macro actually runs replacement code. See isc-posix.m4.
889 AC_REQUIRE([AC_ISC_POSIX])dnl
892 jm_INCLUDED_REGEX([lib/regex.c])
894 AC_REQUIRE([UTILS_HOST_OS])
895 AC_REQUIRE([UTILS_FUNC_MKDIR_TRAILING_SLASH])
896 AC_REQUIRE([jm_BISON])
897 AC_REQUIRE([jm_ASSERT])
898 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_UTIMBUF])
899 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE])
900 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_INO])
901 AC_REQUIRE([jm_CHECK_DECLS])
903 AC_REQUIRE([jm_PREREQ])
905 AC_REQUIRE([UTILS_FUNC_DIRFD])
906 AC_REQUIRE([AC_FUNC_ACL])
907 AC_REQUIRE([AC_FUNC_FTW])
908 AC_REQUIRE([jm_FUNC_LCHOWN])
909 AC_REQUIRE([fetish_FUNC_RMDIR_NOTEMPTY])
910 AC_REQUIRE([jm_FUNC_CHOWN])
911 AC_REQUIRE([jm_FUNC_MKTIME])
912 AC_REQUIRE([jm_FUNC_LSTAT])
913 AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
914 AC_REQUIRE([jm_FUNC_STAT])
915 AC_REQUIRE([AC_FUNC_REALLOC])
916 AC_REQUIRE([AC_FUNC_MALLOC])
917 AC_REQUIRE([AC_FUNC_STRERROR_R])
918 AC_REQUIRE([jm_FUNC_NANOSLEEP])
919 AC_REQUIRE([jm_FUNC_MEMCMP])
920 AC_REQUIRE([jm_FUNC_GLIBC_UNLOCKED_IO])
921 AC_REQUIRE([AC_FUNC_FNMATCH_GNU])
922 AC_REQUIRE([jm_FUNC_GROUP_MEMBER])
923 AC_REQUIRE([jm_FUNC_PUTENV])
925 AC_REQUIRE([jm_AC_PREREQ_XSTRTOUMAX])
926 AC_REQUIRE([jm_AC_PREREQ_XSTRTOIMAX])
927 AC_REQUIRE([jm_AC_FUNC_LINK_FOLLOWS_SYMLINK])
928 AC_REQUIRE([AC_FUNC_ERROR_AT_LINE])
929 AC_REQUIRE([jm_FUNC_GNU_STRFTIME])
930 AC_REQUIRE([jm_FUNC_MKTIME])
931 AC_REQUIRE([jm_FUNC_FPENDING])
932 AC_REQUIRE([AC_SYS_MMAP_STACK])
934 # This is for od and stat, and any other program that
935 # uses the PRI.MAX macros from inttypes.h.
936 AC_REQUIRE([gt_INTTYPES_PRI])
938 AC_REQUIRE([jm_FUNC_GETGROUPS])
940 AC_REQUIRE([AC_FUNC_FSEEKO])
941 AC_REQUIRE([AC_FUNC_VPRINTF])
942 AC_REQUIRE([AC_FUNC_ALLOCA])
944 AC_CONFIG_LIBOBJ_DIR([lib])
947 AC_REQUIRE([jm_SYS_PROC_UPTIME])
948 AC_REQUIRE([jm_FUNC_FTRUNCATE])
949 AC_REQUIRE([vb_FUNC_RENAME])
951 AC_REPLACE_FUNCS(strcasecmp strncasecmp)
952 AC_REPLACE_FUNCS(dup2)
953 AC_REPLACE_FUNCS(gethostname getusershell)
954 AC_REPLACE_FUNCS(sig2str)
955 AC_REPLACE_FUNCS(strcspn stpcpy strstr strtol strtoul)
956 AC_REPLACE_FUNCS(strpbrk)
957 AC_REPLACE_FUNCS(euidaccess memcmp rmdir rpmatch strndup strverscmp)
958 AC_REPLACE_FUNCS(atexit)
959 AC_REPLACE_FUNCS(getpass)
961 # raise is used by at least sort and ls.
962 AC_REPLACE_FUNCS(raise)
964 dnl used by e.g. intl/*domain.c and lib/canon-host.c
965 AC_REPLACE_FUNCS(strdup)
967 AC_REPLACE_FUNCS(memchr memcpy memmove memrchr memset)
968 AC_CHECK_FUNCS(getpagesize)
970 AC_REQUIRE([UTILS_FUNC_MKSTEMP])
972 # By default, argmatch should fail calling usage (1).
973 AC_DEFINE(ARGMATCH_DIE, [usage (1)],
974 [Define to the function xargmatch calls on failures.])
975 AC_DEFINE(ARGMATCH_DIE_DECL, [extern void usage ()],
976 [Define to the declaration of the xargmatch failure function.])
978 dnl Used to define SETVBUF in sys2.h.
979 dnl This evokes the following warning from autoconf:
980 dnl ...: warning: AC_TRY_RUN called without default to allow cross compiling
981 AC_FUNC_SETVBUF_REVERSED
983 # used by sleep and shred
984 # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
985 # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
987 # Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all*
988 # programs in the package would end up linked with that potentially-shared
989 # library, inducing unnecessary run-time overhead.
990 fetish_saved_libs=$LIBS
991 AC_SEARCH_LIBS(clock_gettime, [rt posix4],
992 [LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
993 AC_SUBST(LIB_CLOCK_GETTIME)
994 AC_CHECK_FUNCS(clock_gettime clock_settime)
995 LIBS=$fetish_saved_libs
996 AC_CHECK_FUNCS(gettimeofday)
997 AC_FUNC_GETTIMEOFDAY_CLOBBER
999 AC_REQUIRE([AC_FUNC_CLOSEDIR_VOID])
1000 AC_REQUIRE([jm_FUNC_UTIME])
1034 AC_CHECK_FUNCS(setreuid setregid)
1037 if test $am_cv_func_working_getline != yes; then
1038 AC_CHECK_FUNCS(getdelim)
1043 AC_REQUIRE([UTILS_SYS_OPEN_MAX])
1045 # See if linking `seq' requires -lm.
1046 # It does on nearly every system. The single exception (so far) is
1047 # BeOS which has all the math functions in the normal runtime library
1048 # and doesn't have a separate math library.
1056 AC_TRY_LINK([#include <math.h>], $ac_seq_body, ,
1057 [ac_seq_save_LIBS="$LIBS"
1059 AC_TRY_LINK([#include <math.h>], $ac_seq_body, SEQ_LIBM=-lm)
1060 LIBS="$ac_seq_save_LIBS"
1066 jm_FUNC_UNLINK_BUSY_TEXT
1068 # These tests are for df.
1069 jm_LIST_MOUNTED_FILESYSTEMS([list_mounted_fs=yes], [list_mounted_fs=no])
1071 jm_FILE_SYSTEM_USAGE([space=yes], [space=no])
1072 if test $list_mounted_fs = yes && test $space = yes; then
1075 AC_LIBOBJ(mountlist)
1077 AC_REQUIRE([jm_AC_DOS])
1078 AC_REQUIRE([AC_FUNC_CANONICALIZE_FILE_NAME])
1082 # These tests must be run before any use of AC_CHECK_TYPE,
1083 # because that macro compiles code that tests e.g., HAVE_UNISTD_H.
1084 # See the definition of ac_includes_default in `configure'.
1085 AC_DEFUN([jm_CHECK_ALL_HEADERS],
1128 # This macro must be invoked before any tests that run the compiler.
1129 AC_DEFUN([jm_CHECK_ALL_TYPES],
1131 dnl This test must come as early as possible after the compiler configuration
1132 dnl tests, because the choice of the file model can (in principle) affect
1133 dnl whether functions and headers are available, whether they work, etc.
1134 AC_REQUIRE([AC_SYS_LARGEFILE])
1136 dnl This test must precede tests of compiler characteristics like
1137 dnl that for the inline keyword, since it may change the degree to
1138 dnl which the compiler supports such features.
1139 AC_REQUIRE([AM_C_PROTOTYPES])
1141 dnl Checks for typedefs, structures, and compiler characteristics.
1142 AC_REQUIRE([AC_C_BIGENDIAN])
1143 AC_REQUIRE([AC_C_CONST])
1144 AC_REQUIRE([AC_C_VOLATILE])
1145 AC_REQUIRE([AC_C_INLINE])
1146 AC_REQUIRE([AC_C_LONG_DOUBLE])
1148 AC_REQUIRE([jm_CHECK_ALL_HEADERS])
1149 AC_REQUIRE([AC_HEADER_DIRENT])
1150 AC_REQUIRE([AC_HEADER_STDC])
1152 [struct stat.st_author,
1153 struct stat.st_blksize],,,
1154 [$ac_includes_default
1155 #include <sys/stat.h>
1157 AC_REQUIRE([AC_STRUCT_ST_BLOCKS])
1159 AC_REQUIRE([AC_STRUCT_TM])
1160 AC_REQUIRE([AC_STRUCT_TIMEZONE])
1161 AC_REQUIRE([AC_HEADER_STAT])
1162 AC_REQUIRE([AC_STRUCT_ST_MTIM_NSEC])
1163 AC_REQUIRE([AC_STRUCT_ST_DM_MODE])
1164 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_TIMESPEC])
1166 AC_REQUIRE([AC_TYPE_GETGROUPS])
1167 AC_REQUIRE([AC_TYPE_MODE_T])
1168 AC_REQUIRE([AC_TYPE_OFF_T])
1169 AC_REQUIRE([AC_TYPE_PID_T])
1170 AC_REQUIRE([AC_TYPE_SIGNAL])
1171 AC_REQUIRE([AC_TYPE_SIZE_T])
1172 AC_REQUIRE([AC_TYPE_UID_T])
1173 AC_CHECK_TYPE(ino_t, unsigned long)
1175 dnl This relies on the fact that autoconf 2.14a's implementation of
1176 dnl AC_CHECK_TYPE checks includes unistd.h.
1177 AC_CHECK_TYPE(ssize_t, int)
1178 AC_CHECK_TYPE(major_t, unsigned int)
1179 AC_CHECK_TYPE(minor_t, unsigned int)
1181 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
1182 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
1184 AC_REQUIRE([AC_HEADER_MAJOR])
1185 AC_REQUIRE([AC_HEADER_DIRENT])
1189 # isc-posix.m4 serial 2 (gettext-0.11.2)
1190 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
1191 dnl This file is free software, distributed under the terms of the GNU
1192 dnl General Public License. As a special exception to the GNU General
1193 dnl Public License, this file may be distributed as part of a program
1194 dnl that contains a configuration script generated by Autoconf, under
1195 dnl the same distribution terms as the rest of that program.
1197 # This file is not needed with autoconf-2.53 and newer. Remove it in 2005.
1199 # This test replaces the one in autoconf.
1200 # Currently this macro should have the same name as the autoconf macro
1201 # because gettext's gettext.m4 (distributed in the automake package)
1202 # still uses it. Otherwise, the use in gettext.m4 makes autoheader
1203 # give these diagnostics:
1204 # configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
1205 # configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
1207 undefine([AC_ISC_POSIX])
1209 AC_DEFUN([AC_ISC_POSIX],
1211 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
1212 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
1218 dnl Initially derived from code in GNU grep.
1219 dnl Mostly written by Jim Meyering.
1221 dnl Usage: jm_INCLUDED_REGEX([lib/regex.c])
1223 AC_DEFUN([jm_INCLUDED_REGEX],
1225 dnl Even packages that don't use regex.c can use this macro.
1226 dnl Of course, for them it doesn't do anything.
1228 # Assume we'll default to using the included regex.c.
1229 ac_use_included_regex=yes
1231 # However, if the system regex support is good enough that it passes the
1232 # the following run test, then default to *not* using the included regex.c.
1233 # If cross compiling, assume the test would fail and use the included
1234 # regex.c. The first failing regular expression is from `Spencer ere
1235 # test #75' in grep-2.3.
1236 AC_CACHE_CHECK([for working re_compile_pattern],
1237 jm_cv_func_working_re_compile_pattern,
1245 static struct re_pattern_buffer regex;
1247 struct re_registers regs;
1248 re_set_syntax (RE_SYNTAX_POSIX_EGREP);
1249 memset (®ex, 0, sizeof (regex));
1250 [s = re_compile_pattern ("a[[:@:>@:]]b\n", 9, ®ex);]
1251 /* This should fail with _Invalid character class name_ error. */
1255 /* This should succeed, but doesn't for e.g. glibc-2.1.3. */
1256 memset (®ex, 0, sizeof (regex));
1257 s = re_compile_pattern ("{1", 2, ®ex);
1262 /* The following example is derived from a problem report
1263 against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */
1264 memset (®ex, 0, sizeof (regex));
1265 s = re_compile_pattern ("[[anù]]*n", 7, ®ex);
1269 /* This should match, but doesn't for e.g. glibc-2.2.1. */
1270 if (re_match (®ex, "an", 2, 0, ®s) != 2)
1273 memset (®ex, 0, sizeof (regex));
1274 s = re_compile_pattern ("x", 1, ®ex);
1278 /* The version of regex.c in e.g. GNU libc-2.2.93 didn't
1279 work with a negative RANGE argument. */
1280 if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1)
1286 jm_cv_func_working_re_compile_pattern=yes,
1287 jm_cv_func_working_re_compile_pattern=no,
1288 dnl When crosscompiling, assume it's broken.
1289 jm_cv_func_working_re_compile_pattern=no))
1290 if test $jm_cv_func_working_re_compile_pattern = yes; then
1291 ac_use_included_regex=no
1294 test -n "$1" || AC_MSG_ERROR([missing argument])
1295 m4_syscmd([test -f $1])
1296 ifelse(m4_sysval, 0,
1298 AC_ARG_WITH(included-regex,
1299 [ --without-included-regex don't compile regex; this is the default on
1300 systems with version 2 of the GNU C library
1301 (use with caution on other system)],
1302 jm_with_regex=$withval,
1303 jm_with_regex=$ac_use_included_regex)
1304 if test "$jm_with_regex" = yes; then
1313 # Prerequisites of lib/regex.c.
1314 AC_DEFUN([jm_PREREQ_REGEX],
1316 dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it.
1317 dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary
1320 dnl Persuade glibc <string.h> to declare mempcpy().
1321 AC_REQUIRE([AC_GNU_SOURCE])
1323 AC_REQUIRE([ACX_C_RESTRICT])
1324 AC_REQUIRE([AC_FUNC_ALLOCA])
1325 AC_REQUIRE([AC_HEADER_STDC])
1326 AC_CHECK_HEADERS_ONCE(limits.h string.h wchar.h wctype.h)
1327 AC_CHECK_FUNCS_ONCE(isascii mempcpy)
1328 AC_CHECK_FUNCS(btowc)
1332 dnl based on acx_restrict.m4, from the GNU Autoconf Macro Archive at:
1333 dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_restrict.html
1335 # Determine whether the C/C++ compiler supports the "restrict" keyword
1336 # introduced in ANSI C99, or an equivalent. Do nothing if the compiler
1337 # accepts it. Otherwise, if the compiler supports an equivalent (like
1338 # gcc's __restrict__) define "restrict" to be that. Otherwise, define
1339 # "restrict" to be empty.
1341 AC_DEFUN([ACX_C_RESTRICT],
1342 [AC_CACHE_CHECK([for C/C++ restrict keyword], acx_cv_c_restrict,
1343 [acx_cv_c_restrict=no
1344 # Try the official restrict keyword, then gcc's __restrict__.
1345 for acx_kw in restrict __restrict__; do
1346 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1347 [float * $acx_kw x;])],
1348 [acx_cv_c_restrict=$acx_kw; break])
1351 case $acx_cv_c_restrict in
1353 no) AC_DEFINE(restrict,,
1354 [Define to equivalent of C99 restrict keyword, or to nothing if this
1355 is not supported. Do not define if restrict is supported directly.]) ;;
1356 *) AC_DEFINE_UNQUOTED(restrict, $acx_cv_c_restrict) ;;
1360 # onceonly.m4 serial 1
1361 dnl Copyright (C) 2002 Free Software Foundation, Inc.
1362 dnl This file is free software, distributed under the terms of the GNU
1363 dnl General Public License. As a special exception to the GNU General
1364 dnl Public License, this file may be distributed as part of a program
1365 dnl that contains a configuration script generated by Autoconf, under
1366 dnl the same distribution terms as the rest of that program.
1368 dnl This file defines some "once only" variants of standard autoconf macros.
1369 dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS
1370 dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS
1371 dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS
1372 dnl AC_REQUIRE([AC_HEADER_STDC]) like AC_HEADER_STDC
1373 dnl The advantage is that the check for each of the headers/functions/decls
1374 dnl will be put only once into the 'configure' file. It keeps the size of
1375 dnl the 'configure' file down, and avoids redundant output when 'configure'
1377 dnl The drawback is that the checks cannot be conditionalized. If you write
1378 dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi
1379 dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to
1380 dnl empty, and the check will be inserted before the body of the AC_DEFUNed
1383 # AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
1384 # AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
1385 AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
1387 AC_FOREACH([gl_HEADER_NAME], [$1], [
1388 AC_DEFUN([gl_CHECK_HEADER_]translit(gl_HEADER_NAME,[./-], [___]), [
1389 AC_CHECK_HEADERS(gl_HEADER_NAME)
1391 AC_REQUIRE([gl_CHECK_HEADER_]translit(gl_HEADER_NAME,[./-], [___]))
1395 # AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of
1396 # AC_CHECK_FUNCS(FUNC1 FUNC2 ...).
1397 AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
1399 AC_FOREACH([gl_FUNC_NAME], [$1], [
1400 AC_DEFUN([gl_CHECK_FUNC_]gl_FUNC_NAME, [
1401 AC_CHECK_FUNCS(gl_FUNC_NAME)
1403 AC_REQUIRE([gl_CHECK_FUNC_]gl_FUNC_NAME)
1407 # AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of
1408 # AC_CHECK_DECLS(DECL1, DECL2, ...).
1409 AC_DEFUN([AC_CHECK_DECLS_ONCE], [
1411 AC_FOREACH([gl_DECL_NAME], [$1], [
1412 AC_DEFUN([gl_CHECK_DECL_]gl_DECL_NAME, [
1413 AC_CHECK_DECLS(gl_DECL_NAME)
1415 AC_REQUIRE([gl_CHECK_DECL_]gl_DECL_NAME)
1421 dnl From Paul Eggert.
1423 # Define HOST_OPERATING_SYSTEM to a name for the host operating system.
1424 AC_DEFUN([UTILS_HOST_OS],
1426 AC_CACHE_CHECK([host operating system],
1427 utils_cv_host_operating_system,
1431 # These operating system names do not use the default heuristic below.
1432 # They are in reverse order, so that more-specific prefixes come first.
1433 winnt*) os='Windows NT';;
1435 sysv*) os='Unix System V';;
1436 superux*) os='SUPER-UX';;
1437 sunos*) os='SunOS';;
1439 sco*) os='SCO Unix';;
1440 riscos*) os='RISC OS';;
1441 riscix*) os='RISCiX';;
1445 plan9*) os='Plan 9';;
1448 openbsd*) os='OpenBSD';;
1449 nsk*) os='NonStop Kernel';;
1450 nonstopux*) os='NonStop-UX';;
1451 netbsd*) os='NetBSD';;
1452 msdosdjgpp*) os='DJGPP';;
1453 mpeix*) os='MPE/iX';;
1455 mingw*) os='MinGW';;
1456 lynxos*) os='LynxOS';;
1457 linux*) os='GNU/Linux';;
1461 freebsd*-gnu*) os='GNU/FreeBSD';;
1462 freebsd*) os='FreeBSD';;
1464 bsdi*) os='BSD/OS';;
1468 atheos*) os='AtheOS';;
1469 amigaos*) os='Amiga OS';;
1472 # The default heuristic takes the initial alphabetic string
1473 # from $host_os, but capitalizes its first letter.
1476 expr "X$host_os" : 'X\([A-Za-z]\)' | tr '[a-z]' '[A-Z]'
1478 expr "X$host_os" : 'X.\([A-Za-z]*\)'
1482 # If $host_os does not start with an alphabetic string, use it unchanged.
1486 utils_cv_host_operating_system=$os]])
1487 AC_DEFINE_UNQUOTED(HOST_OPERATING_SYSTEM,
1488 "$utils_cv_host_operating_system",
1489 [The host operating system.])
1494 # On some systems, mkdir ("foo/", 0700) fails because of the trailing slash.
1495 # On such systems, arrange to use a wrapper function that removes any
1497 AC_DEFUN([UTILS_FUNC_MKDIR_TRAILING_SLASH],
1499 AC_CACHE_CHECK([whether mkdir fails due to a trailing slash],
1500 utils_cv_func_mkdir_trailing_slash_bug,
1502 # Arrange for deletion of the temporary directory this test might create.
1503 ac_clean_files="$ac_clean_files confdir-slash"
1505 # include <sys/types.h>
1506 # include <sys/stat.h>
1507 # include <stdlib.h>
1510 rmdir ("confdir-slash");
1511 exit (mkdir ("confdir-slash/", 0700));
1514 utils_cv_func_mkdir_trailing_slash_bug=no,
1515 utils_cv_func_mkdir_trailing_slash_bug=yes,
1516 utils_cv_func_mkdir_trailing_slash_bug=yes
1521 if test $utils_cv_func_mkdir_trailing_slash_bug = yes; then
1523 AC_DEFINE(mkdir, rpl_mkdir,
1524 [Define to rpl_mkdir if the replacement function should be used.])
1530 AC_DEFUN([jm_BISON],
1532 # getdate.y works with bison only.
1533 : ${YACC='bison -y'}
1538 dnl based on code from Eleftherios Gkioulekas
1540 AC_DEFUN([jm_ASSERT],
1542 AC_MSG_CHECKING(whether to enable assertions)
1543 AC_ARG_ENABLE(assert,
1544 [ --disable-assert turn off assertions],
1546 AC_DEFINE(NDEBUG,1,[Define to 1 if assertions should be disabled.]) ],
1547 [ AC_MSG_RESULT(yes) ]
1553 dnl From Jim Meyering
1555 dnl Define HAVE_STRUCT_UTIMBUF if `struct utimbuf' is declared --
1556 dnl usually in <utime.h>.
1557 dnl Some systems have utime.h but don't declare the struct anywhere.
1559 AC_DEFUN([jm_CHECK_TYPE_STRUCT_UTIMBUF],
1561 AC_CHECK_HEADERS(utime.h)
1562 AC_REQUIRE([AC_HEADER_TIME])
1563 AC_CACHE_CHECK([for struct utimbuf], fu_cv_sys_struct_utimbuf,
1566 #ifdef TIME_WITH_SYS_TIME
1567 # include <sys/time.h>
1570 # ifdef HAVE_SYS_TIME_H
1571 # include <sys/time.h>
1580 [static struct utimbuf x; x.actime = x.modtime;],
1581 fu_cv_sys_struct_utimbuf=yes,
1582 fu_cv_sys_struct_utimbuf=no)
1585 if test $fu_cv_sys_struct_utimbuf = yes; then
1586 AC_DEFINE(HAVE_STRUCT_UTIMBUF, 1,
1587 [Define if struct utimbuf is declared -- usually in <utime.h>.
1588 Some systems have utime.h but don't declare the struct anywhere. ])
1594 dnl From Jim Meyering.
1596 dnl Check whether struct dirent has a member named d_type.
1599 AC_DEFUN([jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE],
1600 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
1601 AC_CACHE_CHECK([for d_type member in directory struct],
1602 jm_cv_struct_dirent_d_type,
1605 #include <sys/types.h>
1606 #ifdef HAVE_DIRENT_H
1607 # include <dirent.h>
1608 #else /* not HAVE_DIRENT_H */
1609 # define dirent direct
1610 # ifdef HAVE_SYS_NDIR_H
1611 # include <sys/ndir.h>
1612 # endif /* HAVE_SYS_NDIR_H */
1613 # ifdef HAVE_SYS_DIR_H
1614 # include <sys/dir.h>
1615 # endif /* HAVE_SYS_DIR_H */
1618 # endif /* HAVE_NDIR_H */
1619 #endif /* HAVE_DIRENT_H */
1621 [struct dirent dp; dp.d_type = 0;],
1623 jm_cv_struct_dirent_d_type=yes,
1624 jm_cv_struct_dirent_d_type=no)
1627 if test $jm_cv_struct_dirent_d_type = yes; then
1628 AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE, 1,
1629 [Define if there is a member named d_type in the struct describing
1630 directory headers.])
1637 dnl From Jim Meyering.
1639 dnl Check whether struct dirent has a member named d_ino.
1642 AC_DEFUN([jm_CHECK_TYPE_STRUCT_DIRENT_D_INO],
1643 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
1644 AC_CACHE_CHECK([for d_ino member in directory struct],
1645 jm_cv_struct_dirent_d_ino,
1648 #include <sys/types.h>
1649 #ifdef HAVE_DIRENT_H
1650 # include <dirent.h>
1651 #else /* not HAVE_DIRENT_H */
1652 # define dirent direct
1653 # ifdef HAVE_SYS_NDIR_H
1654 # include <sys/ndir.h>
1655 # endif /* HAVE_SYS_NDIR_H */
1656 # ifdef HAVE_SYS_DIR_H
1657 # include <sys/dir.h>
1658 # endif /* HAVE_SYS_DIR_H */
1661 # endif /* HAVE_NDIR_H */
1662 #endif /* HAVE_DIRENT_H */
1664 [struct dirent dp; dp.d_ino = 0;],
1666 jm_cv_struct_dirent_d_ino=yes,
1667 jm_cv_struct_dirent_d_ino=no)
1670 if test $jm_cv_struct_dirent_d_ino = yes; then
1671 AC_DEFINE(D_INO_IN_DIRENT, 1,
1672 [Define if there is a member named d_ino in the struct describing
1673 directory headers.])
1680 dnl This is just a wrapper function to encapsulate this kludge.
1681 dnl Putting it in a separate file like this helps share it between
1682 dnl different packages.
1683 AC_DEFUN([jm_CHECK_DECLS],
1685 AC_REQUIRE([_jm_DECL_HEADERS])
1686 AC_REQUIRE([AC_HEADER_TIME])
1690 # if !STDC_HEADERS && HAVE_MEMORY_H
1691 # include <memory.h>
1693 # include <string.h>
1696 # include <strings.h>
1700 # include <stdlib.h>
1703 # include <unistd.h>
1706 #include <sys/types.h>
1707 #if TIME_WITH_SYS_TIME
1708 # include <sys/time.h>
1711 # if HAVE_SYS_TIME_H
1712 # include <sys/time.h>
1753 ttyname], , , $headers)
1756 dnl FIXME: when autoconf has support for it.
1757 dnl This is a little helper so we can require these header checks.
1758 AC_DEFUN([_jm_DECL_HEADERS],
1760 AC_REQUIRE([AC_HEADER_STDC])
1761 AC_CHECK_HEADERS(grp.h memory.h pwd.h string.h strings.h stdlib.h \
1762 unistd.h sys/time.h utmp.h utmpx.h)
1767 dnl We use jm_ for non Autoconf macros.
1768 m4_pattern_forbid([^jm_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
1770 # These are the prerequisite macros for files in the lib/
1771 # directory of the coreutils package.
1773 AC_DEFUN([jm_PREREQ],
1775 AC_REQUIRE([jm_PREREQ_ADDEXT])
1776 AC_REQUIRE([jm_PREREQ_C_STACK])
1777 AC_REQUIRE([jm_PREREQ_CANON_HOST])
1778 AC_REQUIRE([jm_PREREQ_DIRNAME])
1779 AC_REQUIRE([jm_PREREQ_ERROR])
1780 AC_REQUIRE([jm_PREREQ_EXCLUDE])
1781 AC_REQUIRE([jm_PREREQ_GETPAGESIZE])
1782 AC_REQUIRE([jm_PREREQ_HARD_LOCALE])
1783 AC_REQUIRE([jm_PREREQ_HASH])
1784 AC_REQUIRE([jm_PREREQ_HUMAN])
1785 AC_REQUIRE([jm_PREREQ_MBSWIDTH])
1786 AC_REQUIRE([jm_PREREQ_MEMCHR])
1787 AC_REQUIRE([jm_PREREQ_PHYSMEM])
1788 AC_REQUIRE([jm_PREREQ_POSIXVER])
1789 AC_REQUIRE([jm_PREREQ_QUOTEARG])
1790 AC_REQUIRE([jm_PREREQ_READUTMP])
1791 AC_REQUIRE([jm_PREREQ_STAT])
1792 AC_REQUIRE([jm_PREREQ_STRNLEN])
1793 AC_REQUIRE([jm_PREREQ_TEMPNAME]) # called by mkstemp
1794 AC_REQUIRE([jm_PREREQ_XGETCWD])
1795 AC_REQUIRE([jm_PREREQ_XREADLINK])
1798 AC_DEFUN([jm_PREREQ_ADDEXT],
1801 AC_REQUIRE([AC_SYS_LONG_FILE_NAMES])
1802 AC_CHECK_FUNCS(pathconf)
1803 AC_CHECK_HEADERS(limits.h string.h unistd.h)
1806 AC_DEFUN([jm_PREREQ_CANON_HOST],
1808 dnl Add any libraries as early as possible.
1809 dnl In particular, inet_ntoa needs -lnsl at least on Solaris5.5.1,
1810 dnl so we have to add -lnsl to LIBS before checking for that function.
1811 AC_SEARCH_LIBS(gethostbyname, [inet nsl])
1813 dnl These come from -lnsl on Solaris5.5.1.
1814 AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
1816 AC_CHECK_HEADERS(unistd.h string.h netdb.h sys/socket.h \
1817 netinet/in.h arpa/inet.h)
1820 AC_DEFUN([jm_PREREQ_DIRNAME],
1822 AC_REQUIRE([AC_HEADER_STDC])
1823 AC_CHECK_HEADERS(string.h)
1826 AC_DEFUN([jm_PREREQ_EXCLUDE],
1828 AC_REQUIRE([AC_FUNC_FNMATCH_GNU])
1829 AC_REQUIRE([AC_HEADER_STDBOOL])
1832 AC_DEFUN([jm_PREREQ_GETPAGESIZE],
1834 AC_CHECK_FUNCS(getpagesize)
1835 AC_CHECK_HEADERS(OS.h unistd.h)
1838 AC_DEFUN([jm_PREREQ_HARD_LOCALE],
1840 AC_CHECK_HEADERS(locale.h stdlib.h string.h)
1841 AC_CHECK_FUNCS(setlocale)
1842 AC_REQUIRE([AM_C_PROTOTYPES])
1845 AC_DEFUN([jm_PREREQ_HASH],
1847 AC_CHECK_HEADERS(stdlib.h)
1848 AC_REQUIRE([AC_HEADER_STDBOOL])
1849 AC_REQUIRE([jm_CHECK_DECLS])
1852 # If you use human.c, you need the following files:
1853 # inttypes.m4 longlong.m4
1854 AC_DEFUN([jm_PREREQ_HUMAN],
1856 AC_CHECK_HEADERS(locale.h)
1857 AC_CHECK_DECLS([getenv])
1858 AC_CHECK_FUNCS(localeconv)
1859 AC_REQUIRE([AC_HEADER_STDBOOL])
1860 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
1863 AC_DEFUN([jm_PREREQ_MEMCHR],
1865 AC_CHECK_HEADERS(limits.h stdlib.h bp-sym.h)
1868 AC_DEFUN([jm_PREREQ_PHYSMEM],
1870 AC_CHECK_HEADERS(sys/pstat.h unistd.h sys/sysmp.h)
1871 AC_CHECK_FUNCS(pstat_getstatic pstat_getdynamic)
1874 AC_DEFUN([jm_PREREQ_POSIXVER],
1876 AC_CHECK_HEADERS(unistd.h)
1877 AC_CHECK_DECLS([getenv])
1880 AC_DEFUN([jm_PREREQ_QUOTEARG],
1882 AC_CHECK_FUNCS(isascii iswprint)
1883 AC_REQUIRE([jm_FUNC_MBRTOWC])
1884 AC_REQUIRE([jm_FUNC_MEMCMP])
1885 AC_CHECK_HEADERS(limits.h stddef.h stdlib.h string.h wchar.h wctype.h)
1886 AC_REQUIRE([AC_HEADER_STDC])
1887 AC_REQUIRE([AC_C_BACKSLASH_A])
1888 AC_REQUIRE([AC_TYPE_MBSTATE_T])
1889 AC_REQUIRE([AM_C_PROTOTYPES])
1892 AC_DEFUN([jm_PREREQ_READUTMP],
1894 AC_REQUIRE([AC_HEADER_STDC])
1895 AC_CHECK_HEADERS(string.h utmp.h utmpx.h sys/param.h)
1896 AC_CHECK_FUNCS(utmpname)
1897 AC_CHECK_FUNCS(utmpxname)
1898 AC_REQUIRE([AM_C_PROTOTYPES])
1900 if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
1902 $ac_includes_default
1910 AC_CHECK_MEMBERS([struct utmpx.ut_user],,,[$utmp_includes])
1911 AC_CHECK_MEMBERS([struct utmp.ut_user],,,[$utmp_includes])
1912 AC_CHECK_MEMBERS([struct utmpx.ut_name],,,[$utmp_includes])
1913 AC_CHECK_MEMBERS([struct utmp.ut_name],,,[$utmp_includes])
1914 AC_CHECK_MEMBERS([struct utmpx.ut_type],,,[$utmp_includes])
1915 AC_CHECK_MEMBERS([struct utmp.ut_type],,,[$utmp_includes])
1916 AC_CHECK_MEMBERS([struct utmpx.ut_pid],,,[$utmp_includes])
1917 AC_CHECK_MEMBERS([struct utmp.ut_pid],,,[$utmp_includes])
1918 AC_CHECK_MEMBERS([struct utmpx.ut_id],,,[$utmp_includes])
1919 AC_CHECK_MEMBERS([struct utmp.ut_id],,,[$utmp_includes])
1921 AC_CHECK_MEMBERS([struct utmpx.ut_exit.ut_exit],,,[$utmp_includes])
1922 AC_CHECK_MEMBERS([struct utmp.ut_exit.ut_exit],,,[$utmp_includes])
1923 AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_exit],,,[$utmp_includes])
1924 AC_CHECK_MEMBERS([struct utmp.ut_exit.e_exit],,,[$utmp_includes])
1926 AC_CHECK_MEMBERS([struct utmpx.ut_exit.ut_termination],,,[$utmp_includes])
1927 AC_CHECK_MEMBERS([struct utmp.ut_exit.ut_termination],,,[$utmp_includes])
1928 AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_termination],,,[$utmp_includes])
1929 AC_CHECK_MEMBERS([struct utmp.ut_exit.e_termination],,,[$utmp_includes])
1934 AC_DEFUN([jm_PREREQ_STAT],
1936 AC_CHECK_HEADERS(sys/sysmacros.h sys/statvfs.h sys/vfs.h inttypes.h)
1937 AC_CHECK_HEADERS(sys/param.h sys/mount.h)
1938 AC_CHECK_FUNCS(statvfs)
1939 AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
1942 $ac_includes_default
1943 #if HAVE_SYS_STATVFS_H
1944 # include <sys/statvfs.h>
1947 # include <sys/vfs.h>
1949 #if ( ! HAVE_SYS_STATVFS_H && ! HAVE_SYS_VFS_H && HAVE_SYS_MOUNT_H && HAVE_SYS_PARAM_H )
1950 /* NetBSD 1.5.2 needs these, for the declaration of struct statfs. */
1951 # include <sys/param.h>
1952 # include <sys/mount.h>
1955 AC_CHECK_MEMBERS([struct statfs.f_basetype],,,[$statxfs_includes])
1956 AC_CHECK_MEMBERS([struct statvfs.f_basetype],,,[$statxfs_includes])
1957 AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$statxfs_includes])
1958 AC_CHECK_MEMBERS([struct statfs.f_type],,,[$statxfs_includes])
1959 AC_CHECK_MEMBERS([struct statvfs.f_type],,,[$statxfs_includes])
1960 AC_CHECK_MEMBERS([struct statfs.f_fsid.__val],,,[$statxfs_includes])
1961 AC_CHECK_MEMBERS([struct statvfs.f_fsid.__val],,,[$statxfs_includes])
1962 AC_CHECK_MEMBERS([struct statfs.f_namemax],,,[$statxfs_includes])
1963 AC_CHECK_MEMBERS([struct statvfs.f_namemax],,,[$statxfs_includes])
1964 AC_CHECK_MEMBERS([struct statfs.f_namelen],,,[$statxfs_includes])
1965 AC_CHECK_MEMBERS([struct statvfs.f_namelen],,,[$statxfs_includes])
1968 AC_DEFUN([jm_PREREQ_STRNLEN],
1970 AC_REQUIRE([AC_FUNC_STRNLEN])
1971 AC_REQUIRE([AC_HEADER_STDC])
1972 AC_CHECK_HEADERS(memory.h)
1973 AC_CHECK_DECLS([memchr])
1975 # This is necessary because automake-1.6.1 doesn't understand
1976 # that the above use of AC_FUNC_STRNLEN means we may have to use
1978 test $ac_cv_func_strnlen_working = yes \
1979 && AC_LIBOBJ(strnlen)
1982 AC_DEFUN([jm_PREREQ_TEMPNAME],
1984 AC_REQUIRE([AC_HEADER_STDC])
1985 AC_REQUIRE([AC_HEADER_STAT])
1986 AC_CHECK_HEADERS(fcntl.h sys/time.h stdint.h unistd.h)
1987 AC_CHECK_FUNCS(__secure_getenv gettimeofday)
1988 AC_CHECK_DECLS([getenv])
1989 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
1992 AC_DEFUN([jm_PREREQ_XGETCWD],
1994 AC_REQUIRE([AC_C_PROTOTYPES])
1995 AC_CHECK_HEADERS(limits.h stdlib.h sys/param.h unistd.h)
1996 AC_CHECK_FUNCS(getcwd)
1997 AC_REQUIRE([AC_FUNC_GETCWD_NULL])
2000 AC_DEFUN([jm_PREREQ_XREADLINK],
2002 AC_REQUIRE([AC_C_PROTOTYPES])
2003 AC_CHECK_HEADERS(limits.h stdlib.h sys/types.h unistd.h)
2006 # Check prerequisites for compiling lib/c-stack.c.
2008 # Copyright (C) 2002, 2003 Free Software Foundation, Inc.
2010 # This program is free software; you can redistribute it and/or modify
2011 # it under the terms of the GNU General Public License as published by
2012 # the Free Software Foundation; either version 2, or (at your option)
2013 # any later version.
2015 # This program is distributed in the hope that it will be useful,
2016 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2017 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2018 # GNU General Public License for more details.
2020 # You should have received a copy of the GNU General Public License
2021 # along with this program; if not, write to the Free Software
2022 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2025 # Written by Paul Eggert.
2027 AC_DEFUN([AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC],
2028 [# for STACK_DIRECTION
2029 AC_REQUIRE([AC_FUNC_ALLOCA])
2030 AC_CHECK_FUNCS(setrlimit)
2032 AC_CACHE_CHECK([for working C stack overflow detection],
2033 ac_cv_sys_xsi_stack_overflow_heuristic,
2038 #include <ucontext.h>
2040 # include <sys/types.h>
2041 # include <sys/time.h>
2042 # include <sys/resource.h>
2047 char buffer[SIGSTKSZ];
2051 } alternate_signal_stack;
2054 # define find_stack_direction(ptr) STACK_DIRECTION
2057 find_stack_direction (char const *addr)
2060 return (! addr ? find_stack_direction (&dummy)
2061 : addr < &dummy ? 1 : -1);
2066 segv_handler (int signo, siginfo_t *info, void *context)
2068 if (0 < info->si_code)
2070 ucontext_t const *user_context = context;
2071 char const *stack_min = user_context->uc_stack.ss_sp;
2072 size_t stack_size = user_context->uc_stack.ss_size;
2073 char const *faulting_address = info->si_addr;
2074 size_t s = faulting_address - stack_min;
2075 size_t page_size = sysconf (_SC_PAGESIZE);
2076 if (find_stack_direction (0) < 0)
2078 if (s < stack_size + page_size)
2086 c_stack_action (void)
2089 struct sigaction act;
2093 st.ss_sp = alternate_signal_stack.buffer;
2094 st.ss_size = sizeof alternate_signal_stack.buffer;
2095 r = sigaltstack (&st, 0);
2099 sigemptyset (&act.sa_mask);
2100 act.sa_flags = SA_NODEFER | SA_ONSTACK | SA_RESETHAND | SA_SIGINFO;
2101 act.sa_sigaction = segv_handler;
2102 return sigaction (SIGSEGV, &act, 0);
2110 return *p + recurse (array);
2116 #if HAVE_SETRLIMIT && defined RLIMIT_STACK
2117 /* Before starting the endless recursion, try to be friendly
2118 to the user's machine. On some Linux 2.2.x systems, there
2119 is no stack limit for user processes at all. We don't want
2120 to kill such systems. */
2122 rl.rlim_cur = rl.rlim_max = 0x100000; /* 1 MB */
2123 setrlimit (RLIMIT_STACK, &rl);
2127 return recurse ("\1");
2130 [ac_cv_sys_xsi_stack_overflow_heuristic=yes],
2131 [ac_cv_sys_xsi_stack_overflow_heuristic=no],
2132 [ac_cv_sys_xsi_stack_overflow_heuristic=cross-compiling])])
2134 if test $ac_cv_sys_xsi_stack_overflow_heuristic = yes; then
2135 AC_DEFINE(HAVE_XSI_STACK_OVERFLOW_HEURISTIC, 1,
2136 [Define to 1 if extending the stack slightly past the limit causes
2137 a SIGSEGV, and an alternate stack can be established with sigaltstack,
2138 and the signal handler is passed a context that specifies the
2139 run time stack. This behavior is defined by POSIX 1003.1-2001
2140 with the X/Open System Interface (XSI) option
2141 and is a standardized way to implement a SEGV-based stack
2142 overflow detection heuristic.])
2146 AC_DEFUN([jm_PREREQ_C_STACK],
2147 [AC_REQUIRE([AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC])
2149 # for STACK_DIRECTION
2150 AC_REQUIRE([AC_FUNC_ALLOCA])
2152 AC_CHECK_FUNCS(getcontext sigaltstack)
2153 AC_CHECK_DECLS([getcontext], , , [#include <ucontext.h>])
2154 AC_CHECK_DECLS([sigaltstack], , , [#include <signal.h>])
2156 AC_CHECK_HEADERS(sys/resource.h ucontext.h unistd.h)
2158 AC_CHECK_TYPES([stack_t], , , [#include <signal.h>])])
2162 dnl FIXME: put these prerequisite-only *.m4 files in a separate
2163 dnl directory -- otherwise, they'll conflict with existing files.
2165 dnl These are the prerequisite macros for GNU's error.c file.
2166 AC_DEFUN([jm_PREREQ_ERROR],
2168 AC_CHECK_FUNCS(strerror vprintf doprnt)
2169 AC_CHECK_DECLS([strerror])
2170 AC_CHECK_HEADERS([libintl.h])
2177 dnl autoconf tests required for use of mbswidth.c
2178 dnl From Bruno Haible.
2180 AC_DEFUN([jm_PREREQ_MBSWIDTH],
2182 AC_REQUIRE([AC_HEADER_STDC])
2183 AC_CHECK_HEADERS(limits.h stdlib.h string.h wchar.h wctype.h)
2184 AC_CHECK_FUNCS(isascii iswcntrl iswprint mbsinit wcwidth)
2187 AC_CACHE_CHECK([whether wcwidth is declared], ac_cv_have_decl_wcwidth,
2189 /* AIX 3.2.5 declares wcwidth in <string.h>. */
2191 # include <string.h>
2198 char *p = (char *) wcwidth;
2200 ], ac_cv_have_decl_wcwidth=yes, ac_cv_have_decl_wcwidth=no)])
2201 if test $ac_cv_have_decl_wcwidth = yes; then
2206 AC_DEFINE_UNQUOTED(HAVE_DECL_WCWIDTH, $ac_val,
2207 [Define to 1 if you have the declaration of wcwidth(), and to 0 otherwise.])
2212 # mbrtowc.m4 serial 4 (fileutils-4.1.3)
2213 dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
2214 dnl This file is free software, distributed under the terms of the GNU
2215 dnl General Public License. As a special exception to the GNU General
2216 dnl Public License, this file may be distributed as part of a program
2217 dnl that contains a configuration script generated by Autoconf, under
2218 dnl the same distribution terms as the rest of that program.
2220 dnl From Paul Eggert
2222 AC_DEFUN([jm_FUNC_MBRTOWC],
2224 AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
2227 [#include <wchar.h>],
2228 [mbstate_t state; return ! (sizeof state && mbrtowc);],
2229 jm_cv_func_mbrtowc=yes,
2230 jm_cv_func_mbrtowc=no)])
2231 if test $jm_cv_func_mbrtowc = yes; then
2232 AC_DEFINE(HAVE_MBRTOWC, 1,
2233 [Define to 1 if mbrtowc and mbstate_t are properly declared.])
2239 dnl A replacement for autoconf's macro by the same name. This version
2240 dnl uses `ac_lib' rather than `i' for the loop variable, but more importantly
2241 dnl moves the ACTION-IF-FOUND ([$]3) into the inner `if'-block so that it is
2242 dnl run only if one of the listed libraries ends up being used (and not in
2243 dnl the `none required' case.
2244 dnl I hope it's only temporary while we wait for that version to be fixed.
2245 undefine([AC_SEARCH_LIBS])
2247 # AC_SEARCH_LIBS(FUNCTION, SEARCH-LIBS,
2248 # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
2249 # [OTHER-LIBRARIES])
2250 # --------------------------------------------------------
2251 # Search for a library defining FUNC, if it's not already available.
2252 AC_DEFUN([AC_SEARCH_LIBS],
2254 AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1],
2256 ac_func_search_save_LIBS=$LIBS
2258 AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1='none required'])
2259 if test "$ac_cv_search_$1" = no; then
2260 for ac_lib in $2; do
2261 LIBS="-l$ac_lib $5 $ac_func_search_save_LIBS"
2262 AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="-l$ac_lib"; break])
2265 LIBS=$ac_func_search_save_LIBS
2268 if test "$ac_cv_search_$1" = no; then :
2271 if test "$ac_cv_search_$1" = 'none required'; then :
2274 LIBS="$ac_cv_search_$1 $LIBS"
2280 # Check for stdbool.h that conforms to C99.
2282 # Copyright (C) 2002 Free Software Foundation, Inc.
2284 # This program is free software; you can redistribute it and/or modify
2285 # it under the terms of the GNU General Public License as published by
2286 # the Free Software Foundation; either version 2, or (at your option)
2287 # any later version.
2289 # This program is distributed in the hope that it will be useful,
2290 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2291 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2292 # GNU General Public License for more details.
2294 # You should have received a copy of the GNU General Public License
2295 # along with this program; if not, write to the Free Software
2296 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2299 AC_DEFUN([AC_HEADER_STDBOOL],
2300 [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
2301 [ac_cv_header_stdbool_h],
2304 #include <stdbool.h>
2306 "error: bool is not defined"
2309 "error: false is not defined"
2312 "error: false is not 0"
2315 "error: false is not defined"
2318 "error: true is not 1"
2320 #ifndef __bool_true_false_are_defined
2321 "error: __bool_true_false_are_defined is not defined"
2324 struct s { _Bool s: 1; _Bool t; } s;
2326 char a[true == 1 ? 1 : -1];
2327 char b[false == 0 ? 1 : -1];
2328 char c[__bool_true_false_are_defined == 1 ? 1 : -1];
2329 char d[(bool) -0.5 == true ? 1 : -1];
2331 char f[(_Bool) -0.0 == false ? 1 : -1];
2333 char h[sizeof (_Bool)];
2336 [ return !a + !b + !c + !d + !e + !f + !g + !h + !i; ],
2337 [ac_cv_header_stdbool_h=yes],
2338 [ac_cv_header_stdbool_h=no])])
2339 if test $ac_cv_header_stdbool_h = yes; then
2340 AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.])
2344 # Copyright 1996, 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
2346 # This program is free software; you can redistribute it and/or modify
2347 # it under the terms of the GNU General Public License as published by
2348 # the Free Software Foundation; either version 2, or (at your option)
2349 # any later version.
2351 # This program is distributed in the hope that it will be useful,
2352 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2353 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2354 # GNU General Public License for more details.
2356 # You should have received a copy of the GNU General Public License
2357 # along with this program; if not, write to the Free Software
2358 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2363 AC_DEFUN([AM_C_PROTOTYPES],
2364 [AC_REQUIRE([AM_PROG_CC_STDC])
2365 AC_REQUIRE([AC_PROG_CPP])
2366 AC_MSG_CHECKING([for function prototypes])
2367 if test "$am_cv_prog_cc_stdc" != no; then
2369 AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
2373 U=_ ANSI2KNR=./ansi2knr
2375 # Ensure some checks needed by ansi2knr itself.
2377 AC_CHECK_HEADERS(string.h)
2379 AC_SUBST(ANSI2KNR)dnl
2382 AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
2385 # Copyright 1996, 1997, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
2387 # This program is free software; you can redistribute it and/or modify
2388 # it under the terms of the GNU General Public License as published by
2389 # the Free Software Foundation; either version 2, or (at your option)
2390 # any later version.
2392 # This program is distributed in the hope that it will be useful,
2393 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2394 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2395 # GNU General Public License for more details.
2397 # You should have received a copy of the GNU General Public License
2398 # along with this program; if not, write to the Free Software
2399 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2404 # @defmac AC_PROG_CC_STDC
2405 # @maindex PROG_CC_STDC
2407 # If the C compiler in not in ANSI C mode by default, try to add an option
2408 # to output variable @code{CC} to make it so. This macro tries various
2409 # options that select ANSI C on some system or another. It considers the
2410 # compiler to be in ANSI C mode if it handles function prototypes correctly.
2412 # If you use this macro, you should check after calling it whether the C
2413 # compiler has been set to accept ANSI C; if not, the shell variable
2414 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
2415 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
2416 # program @code{ansi2knr}, which comes with Ghostscript.
2419 AC_DEFUN([AM_PROG_CC_STDC],
2420 [AC_REQUIRE([AC_PROG_CC])
2421 AC_BEFORE([$0], [AC_C_INLINE])
2422 AC_BEFORE([$0], [AC_C_CONST])
2423 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
2424 dnl a magic option to avoid problems with ANSI preprocessor commands
2426 dnl FIXME: can't do this because then AC_AIX won't work due to a
2427 dnl circular dependency.
2428 dnl AC_BEFORE([$0], [AC_PROG_CPP])
2429 AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
2430 AC_CACHE_VAL(am_cv_prog_cc_stdc,
2431 [am_cv_prog_cc_stdc=no
2433 # Don't try gcc -ansi; that turns off useful extensions and
2434 # breaks some systems' header files.
2435 # AIX -qlanglvl=ansi
2436 # Ultrix and OSF/1 -std1
2437 # HP-UX 10.20 and later -Ae
2438 # HP-UX older versions -Aa -D_HPUX_SOURCE
2439 # SVR4 -Xc -D__EXTENSIONS__
2440 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
2442 CC="$ac_save_CC $ac_arg"
2444 [#include <stdarg.h>
2446 #include <sys/types.h>
2447 #include <sys/stat.h>
2448 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
2449 struct buf { int x; };
2450 FILE * (*rcsopen) (struct buf *, struct stat *, int);
2451 static char *e (p, i)
2457 static char *f (char * (*g) (char **, int), char **p, ...)
2462 s = g (p, va_arg (v,int));
2466 int test (int i, double x);
2467 struct s1 {int (*f) (int a);};
2468 struct s2 {int (*f) (double a);};
2469 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
2473 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
2475 [am_cv_prog_cc_stdc="$ac_arg"; break])
2479 if test -z "$am_cv_prog_cc_stdc"; then
2480 AC_MSG_RESULT([none needed])
2482 AC_MSG_RESULT([$am_cv_prog_cc_stdc])
2484 case "x$am_cv_prog_cc_stdc" in
2486 *) CC="$CC $am_cv_prog_cc_stdc" ;;
2490 AU_DEFUN([fp_PROG_CC_STDC], [AM_PROG_CC_STDC])
2494 dnl From Paul Eggert.
2498 # Define intmax_t to long or long long if <inttypes.h> doesn't define.
2500 AC_DEFUN([jm_AC_TYPE_INTMAX_T],
2502 AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
2503 AC_CHECK_TYPE(intmax_t, ,
2504 [test $ac_cv_type_long_long = yes \
2505 && ac_type='long long' \
2507 AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
2508 [Define to widest signed type if <inttypes.h> doesn't define.])])
2511 # Define uintmax_t to unsigned long or unsigned long long
2512 # if <inttypes.h> doesn't define.
2514 AC_DEFUN([jm_AC_TYPE_UINTMAX_T],
2516 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
2517 AC_CHECK_TYPE(uintmax_t, ,
2518 [test $ac_cv_type_unsigned_long_long = yes \
2519 && ac_type='unsigned long long' \
2520 || ac_type='unsigned long'
2521 AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
2522 [Define to widest unsigned type if <inttypes.h> doesn't define.])])
2527 dnl From Paul Eggert.
2529 # Define HAVE_LONG_LONG if 'long long' works.
2531 AC_DEFUN([jm_AC_TYPE_LONG_LONG],
2533 AC_CACHE_CHECK([for long long], ac_cv_type_long_long,
2534 [AC_TRY_LINK([long long ll = 1; int i = 63;],
2535 [long long llmax = (long long) -1;
2536 return ll << i | ll >> i | llmax / ll | llmax % ll;],
2537 ac_cv_type_long_long=yes,
2538 ac_cv_type_long_long=no)])
2539 if test $ac_cv_type_long_long = yes; then
2540 AC_DEFINE(HAVE_LONG_LONG, 1,
2541 [Define if you have the long long type.])
2545 # Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works.
2547 AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
2549 AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
2550 [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
2551 [unsigned long long ullmax = (unsigned long long) -1;
2552 return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
2553 ac_cv_type_unsigned_long_long=yes,
2554 ac_cv_type_unsigned_long_long=no)])
2555 if test $ac_cv_type_unsigned_long_long = yes; then
2556 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
2557 [Define if you have the unsigned long long type.])
2563 AC_DEFUN([jm_FUNC_MEMCMP],
2564 [AC_REQUIRE([AC_FUNC_MEMCMP])dnl
2565 if test $ac_cv_func_memcmp_working = no; then
2566 AC_DEFINE(memcmp, rpl_memcmp,
2567 [Define to rpl_memcmp if the replacement function should be used.])
2571 # getcwd.m4 - check whether getcwd (NULL, 0) allocates memory for result
2573 # Copyright 2001 Free Software Foundation, Inc.
2575 # This program is free software; you can redistribute it and/or modify
2576 # it under the terms of the GNU General Public License as published by
2577 # the Free Software Foundation; either version 2, or (at your option)
2578 # any later version.
2580 # This program is distributed in the hope that it will be useful,
2581 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2582 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2583 # GNU General Public License for more details.
2585 # You should have received a copy of the GNU General Public License
2586 # along with this program; if not, write to the Free Software Foundation,
2587 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
2589 # Written by Paul Eggert.
2591 AC_DEFUN([AC_FUNC_GETCWD_NULL],
2592 [AC_CHECK_HEADERS(stdlib.h unistd.h)
2593 AC_CACHE_CHECK([whether getcwd (NULL, 0) allocates memory for result],
2594 [ac_cv_func_getcwd_null],
2597 # ifdef HAVE_STDLIB_H
2598 # include <stdlib.h>
2600 # ifdef HAVE_UNISTD_H
2601 # include <unistd.h>
2609 if (chdir ("/") != 0)
2613 char *f = getcwd (NULL, 0);
2614 exit (! (f && f[0] == '/' && !f[1]));
2617 [ac_cv_func_getcwd_null=yes],
2618 [ac_cv_func_getcwd_null=no],
2619 [ac_cv_func_getcwd_null=no])])
2620 if test $ac_cv_func_getcwd_null = yes; then
2621 AC_DEFINE(HAVE_GETCWD_NULL, 1,
2622 [Define if getcwd (NULL, 0) allocates memory for result.])
2627 dnl Find out how to get the file descriptor associated with an open DIR*.
2628 dnl From Jim Meyering
2630 AC_DEFUN([UTILS_FUNC_DIRFD],
2632 dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
2633 AC_REQUIRE([AC_PROG_CPP])
2634 AC_REQUIRE([AC_PROG_EGREP])
2639 # include <dirent.h>
2640 #else /* not HAVE_DIRENT_H */
2641 # define dirent direct
2642 # if HAVE_SYS_NDIR_H
2643 # include <sys/ndir.h>
2644 # endif /* HAVE_SYS_NDIR_H */
2646 # include <sys/dir.h>
2647 # endif /* HAVE_SYS_DIR_H */
2650 # endif /* HAVE_NDIR_H */
2651 #endif /* HAVE_DIRENT_H */
2653 AC_CHECK_FUNCS(dirfd)
2654 AC_CHECK_DECLS([dirfd], , , $dirfd_headers)
2656 AC_CACHE_CHECK([whether dirfd is a macro],
2657 jm_cv_func_dirfd_macro,
2658 AC_EGREP_CPP([dirent_header_defines_dirfd], [$dirfd_headers
2660 dirent_header_defines_dirfd
2662 jm_cv_func_dirfd_macro=yes,
2663 jm_cv_func_dirfd_macro=no))
2665 # Use the replacement only if we have no function, macro,
2666 # or declaration with that name.
2667 if test $ac_cv_func_dirfd,$ac_cv_have_decl_dirfd,$jm_cv_func_dirfd_macro \
2669 AC_REPLACE_FUNCS([dirfd])
2671 [how to get the file descriptor associated with an open DIR*],
2672 ac_cv_sys_dir_fd_member_name,
2674 dirfd_save_CFLAGS=$CFLAGS
2675 for ac_expr in d_fd dd_fd; do
2677 CFLAGS="$CFLAGS -DDIR_FD_MEMBER_NAME=$ac_expr"
2681 [DIR *dir_p = opendir("."); (void) dir_p->DIR_FD_MEMBER_NAME;],
2684 CFLAGS=$dirfd_save_CFLAGS
2685 test "$dir_fd_found" = yes && break
2687 test "$dir_fd_found" = yes || ac_expr=-1
2689 ac_cv_sys_dir_fd_member_name=$ac_expr
2692 if test $ac_cv_have_decl_dirfd = no; then
2693 AC_DEFINE_UNQUOTED(DIR_FD_MEMBER_NAME,
2694 $ac_cv_sys_dir_fd_member_name,
2695 [the name of the file descriptor member of DIR])
2697 AH_VERBATIM(DIR_TO_FD,
2698 [#ifdef DIR_FD_MEMBER_NAME
2699 # define DIR_TO_FD(Dir_p) ((Dir_p)->DIR_FD_MEMBER_NAME)
2701 # define DIR_TO_FD(Dir_p) -1
2708 # acl.m4 - check for access control list (ACL) primitives
2710 # Copyright (C) 2002 Free Software Foundation, Inc.
2712 # This program is free software; you can redistribute it and/or modify
2713 # it under the terms of the GNU General Public License as published by
2714 # the Free Software Foundation; either version 2, or (at your option)
2715 # any later version.
2717 # This program is distributed in the hope that it will be useful,
2718 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2719 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2720 # GNU General Public License for more details.
2722 # You should have received a copy of the GNU General Public License
2723 # along with this program; if not, write to the Free Software Foundation,
2724 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
2726 # Written by Paul Eggert.
2728 AC_DEFUN([AC_FUNC_ACL],
2729 [AC_CHECK_HEADERS(sys/acl.h)
2730 AC_CHECK_FUNCS(acl)])
2733 # Use the replacement ftw.c if the one in the C library is inadequate or buggy.
2734 # For now, we always use the code in lib/ because libc doesn't have the FTW_DCH
2735 # or FTW_DCHP that we need. Arrange to use lib/ftw.h. And since that
2736 # implementation uses tsearch.c/tdestroy, add tsearch.o to the list of
2737 # objects and arrange to use lib/search.h if necessary.
2740 AC_DEFUN([AC_FUNC_FTW],
2743 AC_REQUIRE([jm_FUNC_LSTAT])
2744 AC_REQUIRE([AC_HEADER_DIRENT])
2745 AC_CHECK_HEADERS(sys/param.h)
2746 AC_CHECK_DECLS([stpcpy])
2748 # In the event that we have to use the replacement ftw.c,
2749 # see if we'll also need the replacement tsearch.c.
2750 AC_CHECK_FUNC([tdestroy], , [need_tdestroy=1])
2752 AC_CACHE_CHECK([for ftw/FTW_CHDIR that informs callback of failed chdir],
2753 ac_cv_func_ftw_working,
2755 # The following test would fail prior to glibc-2.3.2, because `depth'
2756 # would be 2 rather than 4. Of course, now that we require FTW_DCH
2757 # and FTW_DCHP, this test fails even with GNU libc's fixed ftw.
2758 mkdir -p conftest.dir/a/b/c
2759 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2764 static char *_f[] = { "conftest.dir", "conftest.dir/a",
2765 "conftest.dir/a/b", "conftest.dir/a/b/c" };
2766 static char **p = _f;
2770 cb (const char *file, const struct stat *sb, int file_type, struct FTW *info)
2772 if (strcmp (file, *p++) != 0)
2781 /* Require these symbols, too. */
2785 int err = nftw ("conftest.dir", cb, 30, FTW_PHYS | FTW_MOUNT | FTW_CHDIR);
2786 exit ((err == 0 && depth == 4) ? 0 : 1);
2789 [ac_cv_func_ftw_working=yes],
2790 [ac_cv_func_ftw_working=no],
2791 [ac_cv_func_ftw_working=no])])
2793 if test $ac_cv_func_ftw_working = no; then
2795 AC_CONFIG_LINKS([$ac_config_libobj_dir/ftw.h:$ac_config_libobj_dir/ftw_.h])
2796 # Add tsearch.o IFF we have to use the replacement ftw.c.
2797 if test -n "$need_tdestroy"; then
2798 AC_LIBOBJ([tsearch])
2799 # Link search.h to search_.h if we use the replacement tsearch.c.
2801 [$ac_config_libobj_dir/search.h:$ac_config_libobj_dir/search_.h])
2808 dnl From Jim Meyering.
2809 dnl Determine whether lstat has the bug that it succeeds when given the
2810 dnl zero-length file name argument. The lstat from SunOS4.1.4 and the Hurd
2811 dnl (as of 1998-11-01) do this.
2813 dnl If it does, then define HAVE_LSTAT_EMPTY_STRING_BUG and arrange to
2814 dnl compile the wrapper function.
2817 AC_DEFUN([jm_FUNC_LSTAT],
2819 AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
2820 AC_CACHE_CHECK([whether lstat accepts an empty string],
2821 jm_cv_func_lstat_empty_string_bug,
2823 # include <sys/types.h>
2824 # include <sys/stat.h>
2830 exit (lstat ("", &sbuf) ? 1 : 0);
2833 jm_cv_func_lstat_empty_string_bug=yes,
2834 jm_cv_func_lstat_empty_string_bug=no,
2835 dnl When crosscompiling, assume lstat is broken.
2836 jm_cv_func_lstat_empty_string_bug=yes)
2838 if test $jm_cv_func_lstat_empty_string_bug = yes; then
2840 AC_DEFINE(HAVE_LSTAT_EMPTY_STRING_BUG, 1,
2841 [Define if lstat has the bug that it succeeds when given the zero-length
2842 file name argument. The lstat from SunOS4.1.4 and the Hurd as of 1998-11-01)
2849 dnl From Jim Meyering.
2850 dnl Provide lchown on systems that lack it.
2852 AC_DEFUN([jm_FUNC_LCHOWN],
2854 AC_REQUIRE([AC_TYPE_UID_T])
2855 AC_REPLACE_FUNCS(lchown)
2860 # When rmdir fails because the specified directory is not empty, it sets
2861 # errno to some value, usually ENOTEMPTY. However, on some AIX systems,
2862 # ENOTEMPTY is mistakenly defined to be EEXIST. To work around this, and
2863 # in general, to avoid depending on the use of any particular symbol, this
2864 # test runs a test to determine the actual numeric value.
2865 AC_DEFUN([fetish_FUNC_RMDIR_NOTEMPTY],
2867 AC_CACHE_CHECK([for rmdir-not-empty errno value],
2868 fetish_cv_func_rmdir_errno_not_empty,
2870 # Arrange for deletion of the temporary directory this test creates.
2871 ac_clean_files="$ac_clean_files confdir2"
2872 mkdir confdir2; : > confdir2/file
2885 s = fopen ("confdir2/errno", "w");
2886 fprintf (s, "%d\n", val);
2890 fetish_cv_func_rmdir_errno_not_empty=`cat confdir2/errno`,
2891 fetish_cv_func_rmdir_errno_not_empty='configure error in rmdir-errno.m4',
2892 fetish_cv_func_rmdir_errno_not_empty=ENOTEMPTY
2897 AC_DEFINE_UNQUOTED([RMDIR_ERRNO_NOT_EMPTY],
2898 $fetish_cv_func_rmdir_errno_not_empty,
2899 [the value to which errno is set when rmdir fails on a nonempty directory])
2904 dnl From Jim Meyering.
2905 dnl Determine whether chown accepts arguments of -1 for uid and gid.
2906 dnl If it doesn't, arrange to use the replacement function.
2909 AC_DEFUN([jm_FUNC_CHOWN],
2910 [AC_REQUIRE([AC_TYPE_UID_T])dnl
2911 test -z "$ac_cv_header_unistd_h" \
2912 && AC_CHECK_HEADERS(unistd.h)
2913 AC_CACHE_CHECK([for working chown], jm_cv_func_working_chown,
2915 # include <sys/types.h>
2916 # include <sys/stat.h>
2918 # ifdef HAVE_UNISTD_H
2919 # include <unistd.h>
2925 char *f = "conftest.chown";
2926 struct stat before, after;
2928 if (creat (f, 0600) < 0)
2930 if (stat (f, &before) < 0)
2932 if (chown (f, (uid_t) -1, (gid_t) -1) == -1)
2934 if (stat (f, &after) < 0)
2936 exit ((before.st_uid == after.st_uid
2937 && before.st_gid == after.st_gid) ? 0 : 1);
2940 jm_cv_func_working_chown=yes,
2941 jm_cv_func_working_chown=no,
2942 dnl When crosscompiling, assume chown is broken.
2943 jm_cv_func_working_chown=no)
2945 if test $jm_cv_func_working_chown = no; then
2947 AC_DEFINE(chown, rpl_chown,
2948 [Define to rpl_chown if the replacement function should be used.])
2954 dnl From Jim Meyering.
2955 dnl A wrapper around AC_FUNC_MKTIME.
2957 AC_DEFUN([jm_FUNC_MKTIME],
2958 [AC_REQUIRE([AC_FUNC_MKTIME])dnl
2960 dnl mktime.c uses localtime_r if it exists. Check for it.
2961 AC_CHECK_FUNCS(localtime_r)
2963 if test $ac_cv_func_working_mktime = no; then
2964 AC_DEFINE(mktime, rpl_mktime,
2965 [Define to rpl_mktime if the replacement function should be used.])
2971 dnl From Jim Meyering.
2972 dnl Determine whether stat has the bug that it succeeds when given the
2973 dnl zero-length file name argument. The stat from SunOS4.1.4 and the Hurd
2974 dnl (as of 1998-11-01) do this.
2976 dnl If it does, then define HAVE_STAT_EMPTY_STRING_BUG and arrange to
2977 dnl compile the wrapper function.
2980 AC_DEFUN([jm_FUNC_STAT],
2982 AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
2983 AC_CACHE_CHECK([whether stat accepts an empty string],
2984 jm_cv_func_stat_empty_string_bug,
2986 # include <sys/types.h>
2987 # include <sys/stat.h>
2993 exit (stat ("", &sbuf) ? 1 : 0);
2996 jm_cv_func_stat_empty_string_bug=yes,
2997 jm_cv_func_stat_empty_string_bug=no,
2998 dnl When crosscompiling, assume stat is broken.
2999 jm_cv_func_stat_empty_string_bug=yes)
3001 if test $jm_cv_func_stat_empty_string_bug = yes; then
3003 AC_DEFINE(HAVE_STAT_EMPTY_STRING_BUG, 1,
3004 [Define if stat has the bug that it succeeds when given the zero-length
3005 file name argument. The stat from SunOS4.1.4 and the Hurd as of 1998-11-01)
3012 dnl From Jim Meyering.
3013 dnl Check for the nanosleep function.
3014 dnl If not found, use the supplied replacement.
3017 AC_DEFUN([jm_FUNC_NANOSLEEP],
3019 nanosleep_save_libs=$LIBS
3021 # Solaris 2.5.1 needs -lposix4 to get the nanosleep function.
3022 # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
3023 AC_SEARCH_LIBS(nanosleep, [rt posix4], [LIB_NANOSLEEP=$ac_cv_search_nanosleep])
3024 AC_SUBST(LIB_NANOSLEEP)
3026 AC_CACHE_CHECK([whether nanosleep works],
3027 jm_cv_func_nanosleep_works,
3029 AC_REQUIRE([AC_HEADER_TIME])
3031 # if TIME_WITH_SYS_TIME
3032 # include <sys/time.h>
3035 # if HAVE_SYS_TIME_H
3036 # include <sys/time.h>
3045 struct timespec ts_sleep, ts_remaining;
3046 ts_sleep.tv_sec = 0;
3047 ts_sleep.tv_nsec = 1;
3048 exit (nanosleep (&ts_sleep, &ts_remaining) == 0 ? 0 : 1);
3051 jm_cv_func_nanosleep_works=yes,
3052 jm_cv_func_nanosleep_works=no,
3053 dnl When crosscompiling, assume the worst.
3054 jm_cv_func_nanosleep_works=no)
3056 if test $jm_cv_func_nanosleep_works = no; then
3057 AC_LIBOBJ(nanosleep)
3058 AC_DEFINE(nanosleep, rpl_nanosleep,
3059 [Define to rpl_nanosleep if the replacement function should be used.])
3062 LIBS=$nanosleep_save_libs
3065 #serial 7 -*- autoconf -*-
3067 dnl From Jim Meyering.
3069 dnl See if the glibc *_unlocked I/O macros are available.
3070 dnl Use only those *_unlocked macros that are declared.
3073 AC_DEFUN([jm_FUNC_GLIBC_UNLOCKED_IO],
3075 [clearerr_unlocked, feof_unlocked, ferror_unlocked,
3076 fflush_unlocked, fgets_unlocked, fputc_unlocked, fputs_unlocked,
3077 fread_unlocked, fwrite_unlocked, getc_unlocked,
3078 getchar_unlocked, putc_unlocked, putchar_unlocked])])
3082 dnl Written by Jim Meyering
3084 AC_DEFUN([jm_FUNC_GROUP_MEMBER],
3086 dnl Do this replacement check manually because I want the hyphen
3087 dnl (not the underscore) in the filename.
3088 AC_CHECK_FUNC(group_member, , [AC_LIBOBJ(group-member)])
3094 dnl From Jim Meyering.
3096 dnl Check whether putenv ("FOO") removes FOO from the environment.
3097 dnl The putenv in libc on at least SunOS 4.1.4 does *not* do that.
3100 AC_DEFUN([jm_FUNC_PUTENV],
3101 [AC_CACHE_CHECK([for SVID conformant putenv], jm_cv_func_svid_putenv,
3106 /* Put it in env. */
3107 if (putenv ("CONFTEST_putenv=val"))
3110 /* Try to remove it. */
3111 if (putenv ("CONFTEST_putenv"))
3114 /* Make sure it was deleted. */
3115 if (getenv ("CONFTEST_putenv") != 0)
3121 jm_cv_func_svid_putenv=yes,
3122 jm_cv_func_svid_putenv=no,
3123 dnl When crosscompiling, assume putenv is broken.
3124 jm_cv_func_svid_putenv=no)
3126 if test $jm_cv_func_svid_putenv = no; then
3128 AC_DEFINE(putenv, rpl_putenv,
3129 [Define to rpl_putenv if the replacement function should be used.])
3137 AC_MSG_CHECKING(for AFS)
3138 if test -d /afs; then
3139 AC_DEFINE(AFS, 1, [Define if you have the Andrew File System.])
3144 AC_MSG_RESULT($ac_result)
3149 # autoconf tests required for use of xstrtoumax.c
3151 AC_DEFUN([jm_AC_PREREQ_XSTRTOUMAX],
3153 AC_REQUIRE([jm_AC_TYPE_INTMAX_T])
3154 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
3155 AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
3156 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
3157 AC_CHECK_DECLS([strtol, strtoul, strtoull, strtoimax, strtoumax])
3158 AC_CHECK_HEADERS(limits.h stdlib.h inttypes.h)
3160 AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro],
3161 jm_cv_func_strtoumax_macro,
3162 AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include <inttypes.h>
3164 inttypes_h_defines_strtoumax
3166 jm_cv_func_strtoumax_macro=yes,
3167 jm_cv_func_strtoumax_macro=no))
3169 if test "$jm_cv_func_strtoumax_macro" != yes; then
3170 AC_REPLACE_FUNCS(strtoumax)
3173 dnl Only the replacement strtoumax invokes strtoul and strtoull,
3174 dnl so we need the replacements only if strtoumax does not exist.
3175 case "$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in
3177 AC_REPLACE_FUNCS(strtoul)
3179 dnl We don't need (and can't compile) the replacement strtoull
3180 dnl unless the type `unsigned long long' exists.
3181 if test "$ac_cv_type_unsigned_long_long" = yes; then
3182 AC_REPLACE_FUNCS(strtoull)
3189 dnl Cloned from xstrtoumax.m4. Keep these files in sync.
3191 # autoconf tests required for use of xstrtoimax.c
3193 AC_DEFUN([jm_AC_PREREQ_XSTRTOIMAX],
3195 AC_REQUIRE([jm_AC_TYPE_INTMAX_T])
3196 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
3197 AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
3198 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
3199 AC_CHECK_DECLS([strtol, strtoul, strtoll, strtoimax, strtoumax])
3200 AC_CHECK_HEADERS(limits.h stdlib.h inttypes.h)
3202 AC_CACHE_CHECK([whether <inttypes.h> defines strtoimax as a macro],
3203 jm_cv_func_strtoimax_macro,
3204 AC_EGREP_CPP([inttypes_h_defines_strtoimax], [#include <inttypes.h>
3206 inttypes_h_defines_strtoimax
3208 jm_cv_func_strtoimax_macro=yes,
3209 jm_cv_func_strtoimax_macro=no))
3211 if test "$jm_cv_func_strtoimax_macro" != yes; then
3212 AC_REPLACE_FUNCS(strtoimax)
3215 dnl Only the replacement strtoimax invokes strtol and strtoll,
3216 dnl so we need the replacements only if strtoimax does not exist.
3217 case "$jm_cv_func_strtoimax_macro,$ac_cv_func_strtoimax" in
3219 AC_REPLACE_FUNCS(strtol)
3221 dnl We don't need (and can't compile) the replacement strtoll
3222 dnl unless the type `long long' exists.
3223 if test "$ac_cv_type_long_long" = yes; then
3224 AC_REPLACE_FUNCS(strtoll)
3231 dnl Run a program to determine whether whether link(2) follows symlinks.
3232 dnl Set LINK_FOLLOWS_SYMLINKS accordingly.
3234 AC_DEFUN([jm_AC_FUNC_LINK_FOLLOWS_SYMLINK],
3237 [whether link(2) dereferences a symlink specified with a trailing slash],
3238 jm_ac_cv_func_link_follows_symlink,
3240 dnl poor-man's AC_REQUIRE: FIXME: repair this once autoconf-3 provides
3241 dnl the appropriate framework.
3242 test -z "$ac_cv_header_unistd_h" \
3243 && AC_CHECK_HEADERS(unistd.h)
3245 # Create a regular file.
3246 echo > conftest.file
3249 # include <sys/types.h>
3250 # include <sys/stat.h>
3251 # ifdef HAVE_UNISTD_H
3252 # include <unistd.h>
3255 # define SAME_INODE(Stat_buf_1, Stat_buf_2) \
3256 ((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
3257 && (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)
3262 const char *file = "conftest.file";
3263 const char *sym = "conftest.sym";
3264 const char *hard = "conftest.hard";
3265 struct stat sb_file, sb_hard;
3267 /* Create a symlink to the regular file. */
3268 if (symlink (file, sym))
3271 /* Create a hard link to that symlink. */
3272 if (link (sym, hard))
3275 if (lstat (hard, &sb_hard))
3277 if (lstat (file, &sb_file))
3280 /* If the dev/inode of hard and file are the same, then
3281 the link call followed the symlink. */
3282 return SAME_INODE (sb_hard, sb_file) ? 0 : 1;
3285 jm_ac_cv_func_link_follows_symlink=yes,
3286 jm_ac_cv_func_link_follows_symlink=no,
3287 jm_ac_cv_func_link_follows_symlink=yes dnl We're cross compiling.
3290 if test $jm_ac_cv_func_link_follows_symlink = yes; then
3291 AC_DEFINE(LINK_FOLLOWS_SYMLINKS, 1,
3292 [Define if `link(2)' dereferences symbolic links.])
3298 dnl This macro is intended to be used solely in this file.
3299 dnl These are the prerequisite macros for GNU's strftime.c replacement.
3300 AC_DEFUN([_jm_STRFTIME_PREREQS],
3302 dnl strftime.c uses localtime_r and the underyling system strftime
3304 AC_CHECK_FUNCS(localtime_r strftime)
3306 AC_CHECK_HEADERS(limits.h)
3307 AC_CHECK_FUNCS(bcopy tzset mempcpy memcpy memset)
3309 # This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE.
3312 AC_CHECK_FUNCS(mblen mbrlen)
3314 AC_CHECK_MEMBER([struct tm.tm_gmtoff],
3315 [AC_DEFINE(HAVE_TM_GMTOFF, 1,
3316 [Define if struct tm has the tm_gmtoff member.])],
3318 [#include <time.h>])
3321 dnl From Jim Meyering.
3323 AC_DEFUN([jm_FUNC_GNU_STRFTIME],
3324 [AC_REQUIRE([AC_HEADER_TIME])dnl
3326 _jm_STRFTIME_PREREQS
3328 AC_REQUIRE([AC_C_CONST])dnl
3329 AC_REQUIRE([AC_HEADER_STDC])dnl
3330 AC_CHECK_HEADERS(sys/time.h)
3331 AC_DEFINE([my_strftime], [nstrftime],
3332 [Define to the name of the strftime replacement function.])
3335 AC_DEFUN([jm_FUNC_STRFTIME],
3337 _jm_STRFTIME_PREREQS
3342 dnl From Jim Meyering
3343 dnl Using code from emacs, based on suggestions from Paul Eggert
3344 dnl and Ulrich Drepper.
3346 dnl Find out how to determine the number of pending output bytes on a stream.
3347 dnl glibc (2.1.93 and newer) and Solaris provide __fpending. On other systems,
3348 dnl we have to grub around in the FILE struct.
3350 AC_DEFUN([jm_FUNC_FPENDING],
3352 AC_CHECK_HEADERS(stdio_ext.h)
3353 AC_REPLACE_FUNCS([__fpending])
3355 # if HAVE_STDIO_EXT_H
3356 # include <stdio_ext.h>
3359 AC_CHECK_DECLS([__fpending], , , $fp_headers)
3360 if test $ac_cv_func___fpending = no; then
3362 [how to determine the number of pending output bytes on a stream],
3363 ac_cv_sys_pending_output_n_bytes,
3368 'fp->_IO_write_ptr - fp->_IO_write_base' \
3370 '# traditional Unix' \
3371 'fp->_ptr - fp->_base' \
3374 'fp->_p - fp->_bf._base' \
3377 'fp->__ptr - fp->__base' \
3380 'fp->__bufp - fp->__buffer' \
3382 '# old glibc iostream?' \
3383 'fp->_pptr - fp->_pbase' \
3386 '(*fp)->_ptr - (*fp)->_base' \
3388 '# e.g., DGUX R4.11; the info is not available' \
3392 # Skip each embedded comment.
3393 case "$ac_expr" in '#'*) continue;; esac
3398 [FILE *fp = stdin; (void) ($ac_expr);],
3401 test "$fp_done" = yes && break
3404 ac_cv_sys_pending_output_n_bytes=$ac_expr
3407 AC_DEFINE_UNQUOTED(PENDING_OUTPUT_N_BYTES,
3408 $ac_cv_sys_pending_output_n_bytes,
3409 [the number of pending output bytes on stream `fp'])
3414 # Arrange to define HAVE_MMAP_STACK and to compile mmap-stack.c
3415 # if there is sufficient support.
3418 AC_DEFUN([AC_SYS_MMAP_STACK],
3421 AC_REQUIRE([AC_FUNC_MMAP])
3422 AC_CHECK_HEADERS_ONCE(sys/mman.h ucontext.h stdarg.h)
3423 AC_CHECK_FUNCS_ONCE(getcontext makecontext setcontext)
3425 # For now, require tmpfile. FIXME: if there's a system with working mmap
3426 # and *context functions yet that lacks tmpfile, we can provide a replacement.
3427 AC_CHECK_FUNCS_ONCE(tmpfile)
3429 ac_i=$ac_cv_func_tmpfile
3430 ac_i=$ac_i:$ac_cv_func_getcontext
3431 ac_i=$ac_i:$ac_cv_func_makecontext
3432 ac_i=$ac_i:$ac_cv_func_setcontext
3433 ac_i=$ac_i:$ac_cv_func_mmap_fixed_mapped
3435 if test $ac_i = yes:yes:yes:yes:yes; then
3436 AC_LIBOBJ(mmap-stack)
3437 AC_DEFINE(HAVE_MMAP_STACK, 1,
3438 [Define to 1 if there is sufficient support (mmap, getcontext,
3439 makecontext, setcontext) for running a process with mmap'd
3440 memory for its stack.])
3444 # inttypes-pri.m4 serial 1001 (based on gettext-0.11.4's `serial 1')
3445 dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
3446 dnl This file is free software, distributed under the terms of the GNU
3447 dnl General Public License. As a special exception to the GNU General
3448 dnl Public License, this file may be distributed as part of a program
3449 dnl that contains a configuration script generated by Autoconf, under
3450 dnl the same distribution terms as the rest of that program.
3452 dnl From Bruno Haible.
3454 # Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
3455 # macros to non-string values. This is the case on AIX 4.3.3.
3457 AC_DEFUN([gt_INTTYPES_PRI],
3459 # autoconf-2.52 has a proper check for inttypes.h.
3462 if test $ac_cv_header_inttypes_h = yes; then
3463 AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
3464 gt_cv_inttypes_pri_broken,
3466 AC_TRY_COMPILE([#include <inttypes.h>
3470 ], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes)
3473 if test "$gt_cv_inttypes_pri_broken" = yes; then
3474 AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
3475 [Define if <inttypes.h> exists and defines unusable PRI* macros.])
3481 dnl From Jim Meyering.
3482 dnl A wrapper around AC_FUNC_GETGROUPS.
3484 AC_DEFUN([jm_FUNC_GETGROUPS],
3485 [AC_REQUIRE([AC_FUNC_GETGROUPS])dnl
3486 if test $ac_cv_func_getgroups_works = no; then
3487 AC_LIBOBJ(getgroups)
3488 AC_DEFINE(getgroups, rpl_getgroups,
3489 [Define as rpl_getgroups if getgroups doesn't work right.])
3491 test -n "$GETGROUPS_LIB" && LIBS="$GETGROUPS_LIB $LIBS"
3498 AC_DEFUN([jm_SYS_PROC_UPTIME],
3499 [ dnl Require AC_PROG_CC to see if we're cross compiling.
3500 AC_REQUIRE([AC_PROG_CC])
3501 AC_CACHE_CHECK([for /proc/uptime], jm_cv_have_proc_uptime,
3502 [jm_cv_have_proc_uptime=no
3503 test -f /proc/uptime \
3504 && test "$cross_compiling" = no \
3505 && cat < /proc/uptime >/dev/null 2>/dev/null \
3506 && jm_cv_have_proc_uptime=yes])
3507 if test $jm_cv_have_proc_uptime = yes; then
3508 AC_DEFINE(HAVE_PROC_UPTIME, 1,
3509 [ Define if your system has the /proc/uptime special file.])
3515 # See if we need to emulate a missing ftruncate function using fcntl or chsize.
3517 AC_DEFUN([jm_FUNC_FTRUNCATE],
3519 AC_CHECK_FUNCS(ftruncate, , [ftruncate_missing=yes])
3521 if test "$ftruncate_missing" = yes; then
3522 AC_CHECK_HEADERS([unistd.h])
3523 AC_CHECK_FUNCS([chsize])
3524 AC_LIBOBJ(ftruncate)
3530 dnl From Volker Borchert.
3531 dnl Determine whether rename works for source paths with a trailing slash.
3532 dnl The rename from SunOS 4.1.1_U1 doesn't.
3534 dnl If it doesn't, then define RENAME_TRAILING_SLASH_BUG and arrange
3535 dnl to compile the wrapper function.
3538 AC_DEFUN([vb_FUNC_RENAME],
3540 AC_CACHE_CHECK([whether rename is broken],
3541 vb_cv_func_rename_trailing_slash_bug,
3543 rm -rf conftest.d1 conftest.d2
3544 mkdir conftest.d1 ||
3545 AC_MSG_ERROR([cannot create temporary directory])
3551 exit (rename ("conftest.d1/", "conftest.d2") ? 1 : 0);
3554 vb_cv_func_rename_trailing_slash_bug=no,
3555 vb_cv_func_rename_trailing_slash_bug=yes,
3556 dnl When crosscompiling, assume rename is broken.
3557 vb_cv_func_rename_trailing_slash_bug=yes)
3559 rm -rf conftest.d1 conftest.d2
3561 if test $vb_cv_func_rename_trailing_slash_bug = yes; then
3563 AC_DEFINE(RENAME_TRAILING_SLASH_BUG, 1,
3564 [Define if rename does not work for source paths with a trailing slash,
3565 like the one from SunOS 4.1.1_U1.])
3571 # On some systems (e.g., HPUX-10.20, SunOS4.1.4, solaris2.5.1), mkstemp has the
3572 # silly limit that it can create no more than 26 files from a given template.
3573 # Other systems lack mkstemp altogether. On either type of system, arrange
3574 # to use the replacement function.
3575 AC_DEFUN([UTILS_FUNC_MKSTEMP],
3577 AC_REPLACE_FUNCS(mkstemp)
3578 if test $ac_cv_func_mkstemp = no; then
3579 utils_cv_func_mkstemp_limitations=yes
3581 AC_CACHE_CHECK([for mkstemp limitations],
3582 utils_cv_func_mkstemp_limitations,
3585 # include <stdlib.h>
3589 for (i = 0; i < 30; i++)
3591 char template[] = "conftestXXXXXX";
3592 int fd = mkstemp (template);
3600 utils_cv_func_mkstemp_limitations=no,
3601 utils_cv_func_mkstemp_limitations=yes,
3602 utils_cv_func_mkstemp_limitations=yes
3608 if test $utils_cv_func_mkstemp_limitations = yes; then
3611 AC_DEFINE(mkstemp, rpl_mkstemp,
3612 [Define to rpl_mkstemp if the replacement function should be used.])
3618 dnl From Jim Meyering.
3620 dnl See if gettimeofday clobbers the static buffer that localtime uses
3621 dnl for it's return value. The gettimeofday function from Mac OS X 10.0.4,
3622 dnl i.e. Darwin 1.3.7 has this problem.
3624 dnl If it does, then arrange to use gettimeofday and localtime only via
3625 dnl the wrapper functions that work around the problem.
3627 AC_DEFUN([AC_FUNC_GETTIMEOFDAY_CLOBBER],
3629 AC_REQUIRE([AC_HEADER_TIME])
3630 AC_CHECK_HEADERS(string.h stdlib.h)
3631 AC_CACHE_CHECK([whether gettimeofday clobbers localtime buffer],
3632 jm_cv_func_gettimeofday_clobber,
3636 # include <string.h>
3639 #if TIME_WITH_SYS_TIME
3640 # include <sys/time.h>
3643 # if HAVE_SYS_TIME_H
3644 # include <sys/time.h>
3651 # include <stdlib.h>
3661 lt = localtime (&t);
3663 gettimeofday (&tv, NULL);
3664 if (memcmp (lt, &saved_lt, sizeof (struct tm)) != 0)
3670 jm_cv_func_gettimeofday_clobber=no,
3671 jm_cv_func_gettimeofday_clobber=yes,
3672 dnl When crosscompiling, assume it is broken.
3673 jm_cv_func_gettimeofday_clobber=yes)
3675 if test $jm_cv_func_gettimeofday_clobber = yes; then
3676 AC_LIBOBJ(gettimeofday)
3677 AC_DEFINE(localtime, rpl_localtime,
3678 [Define to rpl_localtime if the replacement function should be used.])
3679 AC_DEFINE(gettimeofday, rpl_gettimeofday,
3680 [Define to rpl_gettimeofday if the replacement function should be used.])
3681 AC_DEFINE(GETTIMEOFDAY_CLOBBERS_LOCALTIME_BUFFER, 1,
3682 [Define if gettimeofday clobbers localtime's static buffer.])
3688 dnl From Jim Meyering
3689 dnl Replace the utime function on systems that need it.
3693 AC_DEFUN([jm_FUNC_UTIME],
3695 AC_CHECK_HEADERS(utime.h)
3696 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_UTIMBUF])
3697 AC_REQUIRE([AC_FUNC_UTIME_NULL])
3699 if test $ac_cv_func_utime_null = no; then
3701 AC_REPLACE_FUNCS(utime)
3707 dnl Shamelessly cloned from acspecific.m4's AC_FUNC_UTIME_NULL,
3708 dnl then do case-insensitive s/utime/utimes/.
3710 AC_DEFUN([jm_FUNC_UTIMES_NULL],
3711 [AC_CACHE_CHECK(whether utimes accepts a null argument, ac_cv_func_utimes_null,
3712 [rm -f conftest.data; > conftest.data
3714 /* In case stat has been defined to rpl_stat, undef it here. */
3716 #include <sys/types.h>
3717 #include <sys/stat.h>
3720 exit(!(stat ("conftest.data", &s) == 0
3721 && utimes("conftest.data", (long *)0) == 0
3722 && stat("conftest.data", &t) == 0
3723 && t.st_mtime >= s.st_mtime
3724 && t.st_mtime - s.st_mtime < 120));
3726 ac_cv_func_utimes_null=yes,
3727 ac_cv_func_utimes_null=no,
3728 ac_cv_func_utimes_null=no)
3729 rm -f core core.* *.core])
3731 if test $ac_cv_func_utimes_null = yes; then
3732 AC_DEFINE(HAVE_UTIMES_NULL, 1,
3733 [Define if utimes accepts a null argument])
3740 dnl See if there's a working, system-supplied version of the getline function.
3741 dnl We can't just do AC_REPLACE_FUNCS(getline) because some systems
3742 dnl have a function by that name in -linet that doesn't have anything
3743 dnl to do with the function we need.
3744 AC_DEFUN([AM_FUNC_GETLINE],
3746 am_getline_needs_run_time_check=no
3747 AC_CHECK_FUNC(getline,
3748 dnl Found it in some library. Verify that it works.
3749 am_getline_needs_run_time_check=yes,
3750 am_cv_func_working_getline=no)
3751 if test $am_getline_needs_run_time_check = yes; then
3752 AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline,
3753 [echo fooN |tr -d '\012'|tr N '\012' > conftest.data
3756 # include <sys/types.h>
3757 # include <string.h>
3759 { /* Based on a test program from Karl Heuer. */
3763 FILE *in = fopen ("./conftest.data", "r");
3766 len = getline (&line, &siz, in);
3767 exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1);
3769 ], am_cv_func_working_getline=yes dnl The library version works.
3770 , am_cv_func_working_getline=no dnl The library version does NOT work.
3771 , am_cv_func_working_getline=no dnl We're cross compiling.
3775 if test $am_cv_func_working_getline = no; then
3781 # Determine approximately how many files may be open simultaneously
3782 # in one process. This is approximate, since while running this test,
3783 # the configure script already has a few files open.
3786 AC_DEFUN([UTILS_SYS_OPEN_MAX],
3788 AC_CACHE_CHECK([determine how many files may be open simultaneously],
3789 utils_cv_sys_open_max,
3791 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3798 FILE *result = fopen ("conftest.omax", "w");
3800 /* Impose an arbitrary limit, in case some system has no
3801 effective limit on the number of simultaneously open files. */
3804 FILE *s = fopen ("conftest.op", "w");
3809 fprintf (result, "%d\n", i);
3810 exit (fclose (result) == EOF);
3813 [utils_cv_sys_open_max=`cat conftest.omax`],
3814 [utils_cv_sys_open_max='internal error in open-max.m4'],
3815 [utils_cv_sys_open_max='cross compiling run-test in open-max.m4'])])
3817 AC_DEFINE_UNQUOTED([UTILS_OPEN_MAX],
3818 $utils_cv_sys_open_max,
3819 [the maximum number of simultaneously open files per process])
3822 # codeset.m4 serial AM1 (gettext-0.10.40)
3823 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
3824 dnl This file is free software, distributed under the terms of the GNU
3825 dnl General Public License. As a special exception to the GNU General
3826 dnl Public License, this file may be distributed as part of a program
3827 dnl that contains a configuration script generated by Autoconf, under
3828 dnl the same distribution terms as the rest of that program.
3830 dnl From Bruno Haible.
3832 AC_DEFUN([AM_LANGINFO_CODESET],
3834 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
3835 [AC_TRY_LINK([#include <langinfo.h>],
3836 [char* cs = nl_langinfo(CODESET);],
3837 am_cv_langinfo_codeset=yes,
3838 am_cv_langinfo_codeset=no)
3840 if test $am_cv_langinfo_codeset = yes; then
3841 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
3842 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
3846 # glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
3847 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
3848 dnl This file is free software, distributed under the terms of the GNU
3849 dnl General Public License. As a special exception to the GNU General
3850 dnl Public License, this file may be distributed as part of a program
3851 dnl that contains a configuration script generated by Autoconf, under
3852 dnl the same distribution terms as the rest of that program.
3854 # Test for the GNU C Library, version 2.1 or newer.
3855 # From Bruno Haible.
3857 AC_DEFUN([jm_GLIBC21],
3859 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
3860 ac_cv_gnu_library_2_1,
3861 [AC_EGREP_CPP([Lucky GNU user],
3863 #include <features.h>
3864 #ifdef __GNU_LIBRARY__
3865 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
3870 ac_cv_gnu_library_2_1=yes,
3871 ac_cv_gnu_library_2_1=no)
3875 GLIBC21="$ac_cv_gnu_library_2_1"
3879 # iconv.m4 serial AM4 (gettext-0.11.3)
3880 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
3881 dnl This file is free software, distributed under the terms of the GNU
3882 dnl General Public License. As a special exception to the GNU General
3883 dnl Public License, this file may be distributed as part of a program
3884 dnl that contains a configuration script generated by Autoconf, under
3885 dnl the same distribution terms as the rest of that program.
3887 dnl From Bruno Haible.
3889 AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
3891 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
3892 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
3893 AC_REQUIRE([AC_LIB_RPATH])
3895 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
3897 AC_LIB_LINKFLAGS_BODY([iconv])
3900 AC_DEFUN([AM_ICONV_LINK],
3902 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
3903 dnl those with the standalone portable GNU libiconv installed).
3905 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
3907 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
3909 dnl Add $INCICONV to CPPFLAGS before performing the following checks,
3910 dnl because if the user has installed libiconv and not disabled its use
3911 dnl via --without-libiconv-prefix, he wants to use it. The first
3912 dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
3913 am_save_CPPFLAGS="$CPPFLAGS"
3914 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
3916 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
3917 am_cv_func_iconv="no, consider installing GNU libiconv"
3919 AC_TRY_LINK([#include <stdlib.h>
3920 #include <iconv.h>],
3921 [iconv_t cd = iconv_open("","");
3922 iconv(cd,NULL,NULL,NULL,NULL);
3924 am_cv_func_iconv=yes)
3925 if test "$am_cv_func_iconv" != yes; then
3926 am_save_LIBS="$LIBS"
3927 LIBS="$LIBS $LIBICONV"
3928 AC_TRY_LINK([#include <stdlib.h>
3929 #include <iconv.h>],
3930 [iconv_t cd = iconv_open("","");
3931 iconv(cd,NULL,NULL,NULL,NULL);
3934 am_cv_func_iconv=yes)
3935 LIBS="$am_save_LIBS"
3938 if test "$am_cv_func_iconv" = yes; then
3939 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
3941 if test "$am_cv_lib_iconv" = yes; then
3942 AC_MSG_CHECKING([how to link with libiconv])
3943 AC_MSG_RESULT([$LIBICONV])
3945 dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
3947 CPPFLAGS="$am_save_CPPFLAGS"
3952 AC_SUBST(LTLIBICONV)
3955 AC_DEFUN([AM_ICONV],
3958 if test "$am_cv_func_iconv" = yes; then
3959 AC_MSG_CHECKING([for iconv declaration])
3960 AC_CACHE_VAL(am_cv_proto_iconv, [
3968 #if defined(__STDC__) || defined(__cplusplus)
3969 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
3973 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
3974 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);"])
3975 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
3976 AC_MSG_RESULT([$]{ac_t:-
3977 }[$]am_cv_proto_iconv)
3978 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
3979 [Define as const if the declaration of iconv() needs const.])
3983 # lib-prefix.m4 serial 1 (gettext-0.11)
3984 dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
3985 dnl This file is free software, distributed under the terms of the GNU
3986 dnl General Public License. As a special exception to the GNU General
3987 dnl Public License, this file may be distributed as part of a program
3988 dnl that contains a configuration script generated by Autoconf, under
3989 dnl the same distribution terms as the rest of that program.
3991 dnl From Bruno Haible.
3993 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
3994 dnl to access previously installed libraries. The basic assumption is that
3995 dnl a user will want packages to use other packages he previously installed
3996 dnl with the same --prefix option.
3997 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
3998 dnl libraries, but is otherwise very convenient.
3999 AC_DEFUN([AC_LIB_PREFIX],
4001 AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
4002 AC_REQUIRE([AC_PROG_CC])
4003 AC_REQUIRE([AC_CANONICAL_HOST])
4004 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
4005 dnl By default, look in $includedir and $libdir.
4007 AC_LIB_WITH_FINAL_PREFIX([
4008 eval additional_includedir=\"$includedir\"
4009 eval additional_libdir=\"$libdir\"
4011 AC_ARG_WITH([lib-prefix],
4012 [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
4013 --without-lib-prefix don't search for libraries in includedir and libdir],
4015 if test "X$withval" = "Xno"; then
4018 if test "X$withval" = "X"; then
4019 AC_LIB_WITH_FINAL_PREFIX([
4020 eval additional_includedir=\"$includedir\"
4021 eval additional_libdir=\"$libdir\"
4024 additional_includedir="$withval/include"
4025 additional_libdir="$withval/lib"
4029 if test $use_additional = yes; then
4030 dnl Potentially add $additional_includedir to $CPPFLAGS.
4031 dnl But don't add it
4032 dnl 1. if it's the standard /usr/include,
4033 dnl 2. if it's already present in $CPPFLAGS,
4034 dnl 3. if it's /usr/local/include and we are using GCC on Linux,
4035 dnl 4. if it doesn't exist as a directory.
4036 if test "X$additional_includedir" != "X/usr/include"; then
4038 for x in $CPPFLAGS; do
4039 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
4040 if test "X$x" = "X-I$additional_includedir"; then
4045 if test -z "$haveit"; then
4046 if test "X$additional_includedir" = "X/usr/local/include"; then
4047 if test -n "$GCC"; then
4049 linux*) haveit=yes;;
4053 if test -z "$haveit"; then
4054 if test -d "$additional_includedir"; then
4055 dnl Really add $additional_includedir to $CPPFLAGS.
4056 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
4061 dnl Potentially add $additional_libdir to $LDFLAGS.
4062 dnl But don't add it
4063 dnl 1. if it's the standard /usr/lib,
4064 dnl 2. if it's already present in $LDFLAGS,
4065 dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
4066 dnl 4. if it doesn't exist as a directory.
4067 if test "X$additional_libdir" != "X/usr/lib"; then
4069 for x in $LDFLAGS; do
4070 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
4071 if test "X$x" = "X-L$additional_libdir"; then
4076 if test -z "$haveit"; then
4077 if test "X$additional_libdir" = "X/usr/local/lib"; then
4078 if test -n "$GCC"; then
4080 linux*) haveit=yes;;
4084 if test -z "$haveit"; then
4085 if test -d "$additional_libdir"; then
4086 dnl Really add $additional_libdir to $LDFLAGS.
4087 LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
4095 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
4096 dnl acl_final_exec_prefix, containing the values to which $prefix and
4097 dnl $exec_prefix will expand at the end of the configure script.
4098 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
4100 dnl Unfortunately, prefix and exec_prefix get only finally determined
4101 dnl at the end of configure.
4102 if test "X$prefix" = "XNONE"; then
4103 acl_final_prefix="$ac_default_prefix"
4105 acl_final_prefix="$prefix"
4107 if test "X$exec_prefix" = "XNONE"; then
4108 acl_final_exec_prefix='${prefix}'
4110 acl_final_exec_prefix="$exec_prefix"
4112 acl_save_prefix="$prefix"
4113 prefix="$acl_final_prefix"
4114 eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
4115 prefix="$acl_save_prefix"
4118 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
4119 dnl variables prefix and exec_prefix bound to the values they will have
4120 dnl at the end of the configure script.
4121 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
4123 acl_save_prefix="$prefix"
4124 prefix="$acl_final_prefix"
4125 acl_save_exec_prefix="$exec_prefix"
4126 exec_prefix="$acl_final_exec_prefix"
4128 exec_prefix="$acl_save_exec_prefix"
4129 prefix="$acl_save_prefix"
4132 # lib-link.m4 serial 3 (gettext-0.11.3)
4133 dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
4134 dnl This file is free software, distributed under the terms of the GNU
4135 dnl General Public License. As a special exception to the GNU General
4136 dnl Public License, this file may be distributed as part of a program
4137 dnl that contains a configuration script generated by Autoconf, under
4138 dnl the same distribution terms as the rest of that program.
4140 dnl From Bruno Haible.
4142 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
4143 dnl the libraries corresponding to explicit and implicit dependencies.
4144 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
4145 dnl augments the CPPFLAGS variable.
4146 AC_DEFUN([AC_LIB_LINKFLAGS],
4148 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
4149 AC_REQUIRE([AC_LIB_RPATH])
4150 define([Name],[translit([$1],[./-], [___])])
4151 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
4152 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
4153 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
4154 AC_LIB_LINKFLAGS_BODY([$1], [$2])
4155 ac_cv_lib[]Name[]_libs="$LIB[]NAME"
4156 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
4157 ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
4159 LIB[]NAME="$ac_cv_lib[]Name[]_libs"
4160 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
4161 INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
4162 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
4164 AC_SUBST([LTLIB]NAME)
4165 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
4166 dnl results of this search when this library appears as a dependency.
4172 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
4173 dnl searches for libname and the libraries corresponding to explicit and
4174 dnl implicit dependencies, together with the specified include files and
4175 dnl the ability to compile and link the specified testcode. If found, it
4176 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
4177 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
4178 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
4179 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
4180 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
4182 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
4183 AC_REQUIRE([AC_LIB_RPATH])
4184 define([Name],[translit([$1],[./-], [___])])
4185 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
4186 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
4188 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
4190 AC_LIB_LINKFLAGS_BODY([$1], [$2])
4192 dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
4193 dnl because if the user has installed lib[]Name and not disabled its use
4194 dnl via --without-lib[]Name-prefix, he wants to use it.
4195 ac_save_CPPFLAGS="$CPPFLAGS"
4196 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
4198 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
4199 ac_save_LIBS="$LIBS"
4200 LIBS="$LIBS $LIB[]NAME"
4201 AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
4202 LIBS="$ac_save_LIBS"
4204 if test "$ac_cv_lib[]Name" = yes; then
4206 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
4207 AC_MSG_CHECKING([how to link with lib[]$1])
4208 AC_MSG_RESULT([$LIB[]NAME])
4211 dnl If $LIB[]NAME didn't lead to a usable library, we don't need
4212 dnl $INC[]NAME either.
4213 CPPFLAGS="$ac_save_CPPFLAGS"
4217 AC_SUBST([HAVE_LIB]NAME)
4219 AC_SUBST([LTLIB]NAME)
4224 dnl Determine the platform dependent parameters needed to use rpath:
4225 dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
4226 dnl hardcode_direct, hardcode_minus_L,
4227 dnl sys_lib_search_path_spec, sys_lib_dlsearch_path_spec.
4228 AC_DEFUN([AC_LIB_RPATH],
4230 AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
4231 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
4232 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
4233 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
4234 AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
4235 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
4236 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
4242 libext="$acl_cv_libext"
4243 shlibext="$acl_cv_shlibext"
4244 hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
4245 hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
4246 hardcode_direct="$acl_cv_hardcode_direct"
4247 hardcode_minus_L="$acl_cv_hardcode_minus_L"
4248 sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec"
4249 sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec"
4250 dnl Determine whether the user wants rpath handling at all.
4251 AC_ARG_ENABLE(rpath,
4252 [ --disable-rpath do not hardcode runtime library paths],
4253 :, enable_rpath=yes)
4256 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
4257 dnl the libraries corresponding to explicit and implicit dependencies.
4258 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
4259 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
4261 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
4262 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
4263 dnl By default, look in $includedir and $libdir.
4265 AC_LIB_WITH_FINAL_PREFIX([
4266 eval additional_includedir=\"$includedir\"
4267 eval additional_libdir=\"$libdir\"
4269 AC_ARG_WITH([lib$1-prefix],
4270 [ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
4271 --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
4273 if test "X$withval" = "Xno"; then
4276 if test "X$withval" = "X"; then
4277 AC_LIB_WITH_FINAL_PREFIX([
4278 eval additional_includedir=\"$includedir\"
4279 eval additional_libdir=\"$libdir\"
4282 additional_includedir="$withval/include"
4283 additional_libdir="$withval/lib"
4287 dnl Search the library and its dependencies in $additional_libdir and
4288 dnl $LDFLAGS. Using breadth-first-seach.
4294 names_already_handled=
4295 names_next_round='$1 $2'
4296 while test -n "$names_next_round"; do
4297 names_this_round="$names_next_round"
4299 for name in $names_this_round; do
4301 for n in $names_already_handled; do
4302 if test "$n" = "$name"; then
4307 if test -z "$already_handled"; then
4308 names_already_handled="$names_already_handled $name"
4309 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
4310 dnl or AC_LIB_HAVE_LINKFLAGS call.
4311 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
4312 eval value=\"\$HAVE_LIB$uppername\"
4313 if test -n "$value"; then
4314 if test "$value" = yes; then
4315 eval value=\"\$LIB$uppername\"
4316 test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
4317 eval value=\"\$LTLIB$uppername\"
4318 test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
4320 dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
4321 dnl that this library doesn't exist. So just drop it.
4325 dnl Search the library lib$name in $additional_libdir and $LDFLAGS
4326 dnl and the already constructed $LIBNAME/$LTLIBNAME.
4331 if test $use_additional = yes; then
4332 if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
4333 found_dir="$additional_libdir"
4334 found_so="$additional_libdir/lib$name.$shlibext"
4335 if test -f "$additional_libdir/lib$name.la"; then
4336 found_la="$additional_libdir/lib$name.la"
4339 if test -f "$additional_libdir/lib$name.$libext"; then
4340 found_dir="$additional_libdir"
4341 found_a="$additional_libdir/lib$name.$libext"
4342 if test -f "$additional_libdir/lib$name.la"; then
4343 found_la="$additional_libdir/lib$name.la"
4348 if test "X$found_dir" = "X"; then
4349 for x in $LDFLAGS $LTLIB[]NAME; do
4350 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
4353 dir=`echo "X$x" | sed -e 's/^X-L//'`
4354 if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
4356 found_so="$dir/lib$name.$shlibext"
4357 if test -f "$dir/lib$name.la"; then
4358 found_la="$dir/lib$name.la"
4361 if test -f "$dir/lib$name.$libext"; then
4363 found_a="$dir/lib$name.$libext"
4364 if test -f "$dir/lib$name.la"; then
4365 found_la="$dir/lib$name.la"
4371 if test "X$found_dir" != "X"; then
4376 if test "X$found_dir" != "X"; then
4377 dnl Found the library.
4378 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
4379 if test "X$found_so" != "X"; then
4380 dnl Linking with a shared library. We attempt to hardcode its
4381 dnl directory into the executable's runpath, unless it's the
4382 dnl standard /usr/lib.
4383 if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
4384 dnl No hardcoding is needed.
4385 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
4387 dnl Use an explicit option to hardcode DIR into the resulting
4389 dnl Potentially add DIR to ltrpathdirs.
4390 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
4392 for x in $ltrpathdirs; do
4393 if test "X$x" = "X$found_dir"; then
4398 if test -z "$haveit"; then
4399 ltrpathdirs="$ltrpathdirs $found_dir"
4401 dnl The hardcoding into $LIBNAME is system dependent.
4402 if test "$hardcode_direct" = yes; then
4403 dnl Using DIR/libNAME.so during linking hardcodes DIR into the
4404 dnl resulting binary.
4405 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
4407 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
4408 dnl Use an explicit option to hardcode DIR into the resulting
4410 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
4411 dnl Potentially add DIR to rpathdirs.
4412 dnl The rpathdirs will be appended to $LIBNAME at the end.
4414 for x in $rpathdirs; do
4415 if test "X$x" = "X$found_dir"; then
4420 if test -z "$haveit"; then
4421 rpathdirs="$rpathdirs $found_dir"
4424 dnl Rely on "-L$found_dir".
4425 dnl But don't add it if it's already contained in the LDFLAGS
4426 dnl or the already constructed $LIBNAME
4428 for x in $LDFLAGS $LIB[]NAME; do
4429 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
4430 if test "X$x" = "X-L$found_dir"; then
4435 if test -z "$haveit"; then
4436 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
4438 if test "$hardcode_minus_L" != no; then
4439 dnl FIXME: Not sure whether we should use
4440 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
4442 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
4444 dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
4445 dnl here, because this doesn't fit in flags passed to the
4446 dnl compiler. So give up. No hardcoding. This affects only
4447 dnl very old systems.
4448 dnl FIXME: Not sure whether we should use
4449 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
4451 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
4457 if test "X$found_a" != "X"; then
4458 dnl Linking with a static library.
4459 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
4461 dnl We shouldn't come here, but anyway it's good to have a
4463 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
4466 dnl Assume the include files are nearby.
4467 additional_includedir=
4468 case "$found_dir" in
4470 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
4471 additional_includedir="$basedir/include"
4474 if test "X$additional_includedir" != "X"; then
4475 dnl Potentially add $additional_includedir to $INCNAME.
4476 dnl But don't add it
4477 dnl 1. if it's the standard /usr/include,
4478 dnl 2. if it's /usr/local/include and we are using GCC on Linux,
4479 dnl 3. if it's already present in $CPPFLAGS or the already
4480 dnl constructed $INCNAME,
4481 dnl 4. if it doesn't exist as a directory.
4482 if test "X$additional_includedir" != "X/usr/include"; then
4484 if test "X$additional_includedir" = "X/usr/local/include"; then
4485 if test -n "$GCC"; then
4487 linux*) haveit=yes;;
4491 if test -z "$haveit"; then
4492 for x in $CPPFLAGS $INC[]NAME; do
4493 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
4494 if test "X$x" = "X-I$additional_includedir"; then
4499 if test -z "$haveit"; then
4500 if test -d "$additional_includedir"; then
4501 dnl Really add $additional_includedir to $INCNAME.
4502 INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
4508 dnl Look for dependencies.
4509 if test -n "$found_la"; then
4510 dnl Read the .la file. It defines the variables
4511 dnl dlname, library_names, old_library, dependency_libs, current,
4512 dnl age, revision, installed, dlopen, dlpreopen, libdir.
4513 save_libdir="$libdir"
4515 */* | *\\*) . "$found_la" ;;
4516 *) . "./$found_la" ;;
4518 libdir="$save_libdir"
4519 dnl We use only dependency_libs.
4520 for dep in $dependency_libs; do
4523 additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
4524 dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
4525 dnl But don't add it
4526 dnl 1. if it's the standard /usr/lib,
4527 dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
4528 dnl 3. if it's already present in $LDFLAGS or the already
4529 dnl constructed $LIBNAME,
4530 dnl 4. if it doesn't exist as a directory.
4531 if test "X$additional_libdir" != "X/usr/lib"; then
4533 if test "X$additional_libdir" = "X/usr/local/lib"; then
4534 if test -n "$GCC"; then
4536 linux*) haveit=yes;;
4540 if test -z "$haveit"; then
4542 for x in $LDFLAGS $LIB[]NAME; do
4543 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
4544 if test "X$x" = "X-L$additional_libdir"; then
4549 if test -z "$haveit"; then
4550 if test -d "$additional_libdir"; then
4551 dnl Really add $additional_libdir to $LIBNAME.
4552 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
4556 for x in $LDFLAGS $LTLIB[]NAME; do
4557 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
4558 if test "X$x" = "X-L$additional_libdir"; then
4563 if test -z "$haveit"; then
4564 if test -d "$additional_libdir"; then
4565 dnl Really add $additional_libdir to $LTLIBNAME.
4566 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
4573 dir=`echo "X$dep" | sed -e 's/^X-R//'`
4574 if test "$enable_rpath" != no; then
4575 dnl Potentially add DIR to rpathdirs.
4576 dnl The rpathdirs will be appended to $LIBNAME at the end.
4578 for x in $rpathdirs; do
4579 if test "X$x" = "X$dir"; then
4584 if test -z "$haveit"; then
4585 rpathdirs="$rpathdirs $dir"
4587 dnl Potentially add DIR to ltrpathdirs.
4588 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
4590 for x in $ltrpathdirs; do
4591 if test "X$x" = "X$dir"; then
4596 if test -z "$haveit"; then
4597 ltrpathdirs="$ltrpathdirs $dir"
4602 dnl Handle this in the next round.
4603 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
4606 dnl Handle this in the next round. Throw away the .la's
4607 dnl directory; it is already contained in a preceding -L
4609 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
4612 dnl Most likely an immediate library name.
4613 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
4614 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
4620 dnl Didn't find the library; assume it is in the system directories
4621 dnl known to the linker and runtime loader. (All the system
4622 dnl directories known to the linker should also be known to the
4623 dnl runtime loader, otherwise the system is severely misconfigured.)
4624 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
4625 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
4631 if test "X$rpathdirs" != "X"; then
4632 if test -n "$hardcode_libdir_separator"; then
4633 dnl Weird platform: only the last -rpath option counts, the user must
4634 dnl pass all path elements in one option. We can arrange that for a
4635 dnl single library, but not when more than one $LIBNAMEs are used.
4637 for found_dir in $rpathdirs; do
4638 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
4640 dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
4641 acl_save_libdir="$libdir"
4643 eval flag=\"$hardcode_libdir_flag_spec\"
4644 libdir="$acl_save_libdir"
4645 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
4647 dnl The -rpath options are cumulative.
4648 for found_dir in $rpathdirs; do
4649 acl_save_libdir="$libdir"
4651 eval flag=\"$hardcode_libdir_flag_spec\"
4652 libdir="$acl_save_libdir"
4653 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
4657 if test "X$ltrpathdirs" != "X"; then
4658 dnl When using libtool, the option that works for both libraries and
4659 dnl executables is -R. The -R options are cumulative.
4660 for found_dir in $ltrpathdirs; do
4661 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
4666 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
4667 dnl unless already present in VAR.
4668 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
4669 dnl contains two or three consecutive elements that belong together.
4670 AC_DEFUN([AC_LIB_APPENDTOVAR],
4672 for element in [$2]; do
4675 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
4676 if test "X$x" = "X$element"; then
4681 if test -z "$haveit"; then
4682 [$1]="${[$1]}${[$1]:+ }$element"
4687 # lib-ld.m4 serial 1 (gettext-0.11)
4688 dnl Copyright (C) 1996-2002 Free Software Foundation, Inc.
4689 dnl This file is free software, distributed under the terms of the GNU
4690 dnl General Public License. As a special exception to the GNU General
4691 dnl Public License, this file may be distributed as part of a program
4692 dnl that contains a configuration script generated by Autoconf, under
4693 dnl the same distribution terms as the rest of that program.
4695 dnl Subroutines of libtool.m4,
4696 dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
4697 dnl with libtool.m4.
4699 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
4700 AC_DEFUN([AC_LIB_PROG_LD_GNU],
4701 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
4702 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
4703 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
4704 acl_cv_prog_gnu_ld=yes
4706 acl_cv_prog_gnu_ld=no
4708 with_gnu_ld=$acl_cv_prog_gnu_ld
4711 dnl From libtool-1.4. Sets the variable LD.
4712 AC_DEFUN([AC_LIB_PROG_LD],
4713 [AC_ARG_WITH(gnu-ld,
4714 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
4715 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
4716 AC_REQUIRE([AC_PROG_CC])dnl
4717 AC_REQUIRE([AC_CANONICAL_HOST])dnl
4719 if test "$GCC" = yes; then
4720 # Check if gcc -print-prog-name=ld gives a path.
4721 AC_MSG_CHECKING([for ld used by GCC])
4724 # gcc leaves a trailing carriage return which upsets mingw
4725 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
4727 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
4730 # Accept absolute paths.
4731 [[\\/]* | [A-Za-z]:[\\/]*)]
4732 [re_direlt='/[^/][^/]*/\.\./']
4733 # Canonicalize the path of ld
4734 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
4735 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
4736 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
4738 test -z "$LD" && LD="$ac_prog"
4741 # If it fails, then pretend we aren't using GCC.
4745 # If it is relative, then search for the first ld in PATH.
4749 elif test "$with_gnu_ld" = yes; then
4750 AC_MSG_CHECKING([for GNU ld])
4752 AC_MSG_CHECKING([for non-GNU ld])
4754 AC_CACHE_VAL(acl_cv_path_LD,
4755 [if test -z "$LD"; then
4756 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
4757 for ac_dir in $PATH; do
4758 test -z "$ac_dir" && ac_dir=.
4759 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
4760 acl_cv_path_LD="$ac_dir/$ac_prog"
4761 # Check to see if the program is GNU ld. I'd rather use --version,
4762 # but apparently some GNU ld's only accept -v.
4763 # Break only if it was the GNU/non-GNU ld that we prefer.
4764 if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
4765 test "$with_gnu_ld" != no && break
4767 test "$with_gnu_ld" != yes && break
4773 acl_cv_path_LD="$LD" # Let the user override the test with a path.
4775 LD="$acl_cv_path_LD"
4776 if test -n "$LD"; then
4781 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
4787 dnl From J. David Anglin.
4789 dnl HPUX and other systems can't unlink shared text that is being executed.
4791 AC_DEFUN([jm_FUNC_UNLINK_BUSY_TEXT],
4793 AC_CACHE_CHECK([whether a running program can be unlinked],
4794 jm_cv_func_unlink_busy_text,
4803 exit (unlink (argv[0]));
4806 jm_cv_func_unlink_busy_text=yes,
4807 jm_cv_func_unlink_busy_text=no,
4808 jm_cv_func_unlink_busy_text=no
4813 if test $jm_cv_func_unlink_busy_text = no; then
4814 INSTALL=$ac_install_sh
4820 dnl From Jim Meyering.
4822 dnl This is not pretty. I've just taken the autoconf code and wrapped
4823 dnl it in an AC_DEFUN.
4826 # jm_LIST_MOUNTED_FILESYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
4827 AC_DEFUN([jm_LIST_MOUNTED_FILESYSTEMS],
4829 AC_CHECK_FUNCS(listmntent getmntinfo)
4830 AC_CHECK_HEADERS(mntent.h sys/param.h sys/ucred.h sys/mount.h sys/fs_types.h)
4831 getfsstat_includes="\
4832 $ac_includes_default
4833 #if HAVE_SYS_PARAM_H
4834 # include <sys/param.h> /* needed by powerpc-apple-darwin1.3.7 */
4836 #if HAVE_SYS_UCRED_H
4837 # include <sys/ucred.h> /* needed by powerpc-apple-darwin1.3.7 */
4839 #if HAVE_SYS_MOUNT_H
4840 # include <sys/mount.h>
4842 #if HAVE_SYS_FS_TYPES_H
4843 # include <sys/fs_types.h> /* needed by powerpc-apple-darwin1.3.7 */
4846 AC_CHECK_MEMBERS([struct fsstat.f_fstypename],,,[$getfsstat_includes])
4848 # Determine how to get the list of mounted filesystems.
4851 # If the getmntent function is available but not in the standard library,
4852 # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
4855 # This test must precede the ones for getmntent because Unicos-9 is
4856 # reported to have the getmntent function, but its support is incompatible
4857 # with other getmntent implementations.
4859 # NOTE: Normally, I wouldn't use a check for system type as I've done for
4860 # `CRAY' below since that goes against the whole autoconf philosophy. But
4861 # I think there is too great a chance that some non-Cray system has a
4862 # function named listmntent to risk the false positive.
4864 if test -z "$ac_list_mounted_fs"; then
4866 AC_MSG_CHECKING([for listmntent of Cray/Unicos-9])
4867 AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent,
4868 [fu_cv_sys_mounted_cray_listmntent=no
4873 ], [test $ac_cv_func_listmntent = yes \
4874 && fu_cv_sys_mounted_cray_listmntent=yes]
4878 AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent)
4879 if test $fu_cv_sys_mounted_cray_listmntent = yes; then
4880 ac_list_mounted_fs=found
4881 AC_DEFINE(MOUNTED_LISTMNTENT, 1,
4882 [Define if there is a function named listmntent that can be used to
4883 list all mounted filesystems. (UNICOS)])
4887 if test $ac_cv_func_getmntent = yes; then
4889 # This system has the getmntent function.
4890 # Determine whether it's the one-argument variant or the two-argument one.
4892 if test -z "$ac_list_mounted_fs"; then
4893 # 4.3BSD, SunOS, HP-UX, Dynix, Irix
4894 AC_MSG_CHECKING([for one-argument getmntent function])
4895 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
4897 /* SunOS 4.1.x /usr/include/mntent.h needs this for FILE */
4901 #if !defined MOUNTED
4902 # if defined _PATH_MOUNTED /* GNU libc */
4903 # define MOUNTED _PATH_MOUNTED
4905 # if defined MNT_MNTTAB /* HP-UX. */
4906 # define MOUNTED MNT_MNTTAB
4908 # if defined MNTTABNAME /* Dynix. */
4909 # define MOUNTED MNTTABNAME
4913 [ struct mntent *mnt = 0; char *table = MOUNTED; ],
4914 fu_cv_sys_mounted_getmntent1=yes,
4915 fu_cv_sys_mounted_getmntent1=no)])
4916 AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
4917 if test $fu_cv_sys_mounted_getmntent1 = yes; then
4918 ac_list_mounted_fs=found
4919 AC_DEFINE(MOUNTED_GETMNTENT1, 1,
4920 [Define if there is a function named getmntent for reading the list
4921 of mounted filesystems, and that function takes a single argument.
4922 (4.3BSD, SunOS, HP-UX, Dynix, Irix)])
4926 if test -z "$ac_list_mounted_fs"; then
4928 AC_MSG_CHECKING([for two-argument getmntent function])
4929 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
4930 [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
4931 fu_cv_sys_mounted_getmntent2=yes,
4932 fu_cv_sys_mounted_getmntent2=no)])
4933 AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2)
4934 if test $fu_cv_sys_mounted_getmntent2 = yes; then
4935 ac_list_mounted_fs=found
4936 AC_DEFINE(MOUNTED_GETMNTENT2, 1,
4937 [Define if there is a function named getmntent for reading the list of
4938 mounted filesystems, and that function takes two arguments. (SVR4)])
4944 if test -z "$ac_list_mounted_fs"; then
4945 # DEC Alpha running OSF/1, and Apple Darwin 1.3.
4946 # powerpc-apple-darwin1.3.7 needs sys/param.h sys/ucred.h sys/fs_types.h
4948 AC_MSG_CHECKING([for getfsstat function])
4949 AC_CACHE_VAL(fu_cv_sys_mounted_getfsstat,
4951 #include <sys/types.h>
4952 #if HAVE_STRUCT_FSSTAT_F_FSTYPENAME
4953 # define FS_TYPE(Ent) ((Ent).f_fstypename)
4955 # define FS_TYPE(Ent) mnt_names[(Ent).f_type]
4957 ]$getfsstat_includes
4959 [struct statfs *stats;
4960 int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT);
4961 char *t = FS_TYPE (*stats); ],
4962 fu_cv_sys_mounted_getfsstat=yes,
4963 fu_cv_sys_mounted_getfsstat=no)])
4964 AC_MSG_RESULT($fu_cv_sys_mounted_getfsstat)
4965 if test $fu_cv_sys_mounted_getfsstat = yes; then
4966 ac_list_mounted_fs=found
4967 AC_DEFINE(MOUNTED_GETFSSTAT, 1,
4968 [Define if there is a function named getfsstat for reading the
4969 list of mounted filesystems. (DEC Alpha running OSF/1)])
4973 if test -z "$ac_list_mounted_fs"; then
4975 AC_MSG_CHECKING([for mntctl function and struct vmount])
4976 AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
4977 [AC_TRY_CPP([#include <fshelp.h>],
4978 fu_cv_sys_mounted_vmount=yes,
4979 fu_cv_sys_mounted_vmount=no)])
4980 AC_MSG_RESULT($fu_cv_sys_mounted_vmount)
4981 if test $fu_cv_sys_mounted_vmount = yes; then
4982 ac_list_mounted_fs=found
4983 AC_DEFINE(MOUNTED_VMOUNT, 1,
4984 [Define if there is a function named mntctl that can be used to read
4985 the list of mounted filesystems, and there is a system header file
4986 that declares `struct vmount.' (AIX)])
4990 if test -z "$ac_list_mounted_fs"; then
4992 AC_MSG_CHECKING([for FIXME existence of three headers])
4993 AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
4995 #include <sys/statfs.h>
4996 #include <sys/fstyp.h>
4997 #include <mnttab.h>],
4998 fu_cv_sys_mounted_fread_fstyp=yes,
4999 fu_cv_sys_mounted_fread_fstyp=no)])
5000 AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp)
5001 if test $fu_cv_sys_mounted_fread_fstyp = yes; then
5002 ac_list_mounted_fs=found
5003 AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
5004 [Define if (like SVR2) there is no specific function for reading the
5005 list of mounted filesystems, and your system has these header files:
5006 <sys/fstyp.h> and <sys/statfs.h>. (SVR3)])
5010 if test -z "$ac_list_mounted_fs"; then
5011 # 4.4BSD and DEC OSF/1.
5012 AC_MSG_CHECKING([for getmntinfo function])
5013 AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
5015 test "$ac_cv_func_getmntinfo" = yes \
5016 && fu_cv_sys_mounted_getmntinfo=yes \
5017 || fu_cv_sys_mounted_getmntinfo=no
5019 AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
5020 if test $fu_cv_sys_mounted_getmntinfo = yes; then
5021 ac_list_mounted_fs=found
5022 AC_DEFINE(MOUNTED_GETMNTINFO, 1,
5023 [Define if there is a function named getmntinfo for reading the
5024 list of mounted filesystems. (4.4BSD, Darwin)])
5028 if test -z "$ac_list_mounted_fs"; then
5030 AC_MSG_CHECKING([for getmnt function])
5031 AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
5033 #include <sys/fs_types.h>
5034 #include <sys/mount.h>],
5035 fu_cv_sys_mounted_getmnt=yes,
5036 fu_cv_sys_mounted_getmnt=no)])
5037 AC_MSG_RESULT($fu_cv_sys_mounted_getmnt)
5038 if test $fu_cv_sys_mounted_getmnt = yes; then
5039 ac_list_mounted_fs=found
5040 AC_DEFINE(MOUNTED_GETMNT, 1,
5041 [Define if there is a function named getmnt for reading the list of
5042 mounted filesystems. (Ultrix)])
5046 if test -z "$ac_list_mounted_fs"; then
5048 AC_CHECK_FUNCS(next_dev fs_stat_dev)
5049 AC_CHECK_HEADERS(fs_info.h)
5050 AC_MSG_CHECKING([for BEOS mounted file system support functions])
5051 if test $ac_cv_header_fs_info_h = yes \
5052 && test $ac_cv_func_next_dev = yes \
5053 && test $ac_cv_func_fs_stat_dev = yes; then
5058 AC_MSG_RESULT($fu_result)
5059 if test $fu_result = yes; then
5060 ac_list_mounted_fs=found
5061 AC_DEFINE(MOUNTED_FS_STAT_DEV, 1,
5062 [Define if there are functions named next_dev and fs_stat_dev for
5063 reading the list of mounted filesystems. (BeOS)])
5067 if test -z "$ac_list_mounted_fs"; then
5069 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
5070 AC_CACHE_VAL(fu_cv_sys_mounted_fread,
5071 [AC_TRY_CPP([#include <mnttab.h>],
5072 fu_cv_sys_mounted_fread=yes,
5073 fu_cv_sys_mounted_fread=no)])
5074 AC_MSG_RESULT($fu_cv_sys_mounted_fread)
5075 if test $fu_cv_sys_mounted_fread = yes; then
5076 ac_list_mounted_fs=found
5077 AC_DEFINE(MOUNTED_FREAD, 1,
5078 [Define if there is no specific function for reading the list of
5079 mounted filesystems. fread will be used to read /etc/mnttab. (SVR2) ])
5083 if test -z "$ac_list_mounted_fs"; then
5084 AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
5085 # FIXME -- no need to abort building the whole package
5086 # Can't build mountlist.c or anything that needs its functions
5089 AS_IF([test $ac_list_mounted_fs = found], [$1], [$2])
5095 dnl From Jim Meyering.
5097 dnl See if struct statfs has the f_fstypename member.
5098 dnl If so, define HAVE_F_FSTYPENAME_IN_STATFS.
5101 AC_DEFUN([jm_FSTYPENAME],
5103 AC_CACHE_CHECK([for f_fstypename in struct statfs],
5104 fu_cv_sys_f_fstypename_in_statfs,
5108 #include <sys/param.h>
5109 #include <sys/types.h>
5110 #include <sys/mount.h>
5112 [struct statfs s; int i = sizeof s.f_fstypename;],
5113 fu_cv_sys_f_fstypename_in_statfs=yes,
5114 fu_cv_sys_f_fstypename_in_statfs=no
5119 if test $fu_cv_sys_f_fstypename_in_statfs = yes; then
5120 AC_DEFINE(HAVE_F_FSTYPENAME_IN_STATFS, 1,
5121 [Define if struct statfs has the f_fstypename member.])
5128 # From fileutils/configure.in
5130 # Try to determine how a program can obtain filesystem usage information.
5131 # If successful, define the appropriate symbol (see fsusage.c) and
5132 # execute ACTION-IF-FOUND. Otherwise, execute ACTION-IF-NOT-FOUND.
5134 # jm_FILE_SYSTEM_USAGE([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
5136 AC_DEFUN([jm_FILE_SYSTEM_USAGE],
5139 echo "checking how to get filesystem space usage..."
5142 # Perform only the link test since it seems there are no variants of the
5143 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
5144 # because that got a false positive on SCO OSR5. Adding the declaration
5145 # of a `struct statvfs' causes this test to fail (as it should) on such
5146 # systems. That system is reported to work fine with STAT_STATFS4 which
5147 # is what it gets when this test fails.
5148 if test $ac_fsusage_space = no; then
5150 AC_CACHE_CHECK([for statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
5151 [AC_TRY_LINK([#include <sys/types.h>
5152 #include <sys/statvfs.h>],
5153 [struct statvfs fsd; statvfs (0, &fsd);],
5154 fu_cv_sys_stat_statvfs=yes,
5155 fu_cv_sys_stat_statvfs=no)])
5156 if test $fu_cv_sys_stat_statvfs = yes; then
5157 ac_fsusage_space=yes
5158 AC_DEFINE(STAT_STATVFS, 1,
5159 [ Define if there is a function named statvfs. (SVR4)])
5163 if test $ac_fsusage_space = no; then
5164 # DEC Alpha running OSF/1
5165 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
5166 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
5168 #include <sys/param.h>
5169 #include <sys/types.h>
5170 #include <sys/mount.h>
5175 exit (statfs (".", &fsd, sizeof (struct statfs)));
5177 fu_cv_sys_stat_statfs3_osf1=yes,
5178 fu_cv_sys_stat_statfs3_osf1=no,
5179 fu_cv_sys_stat_statfs3_osf1=no)])
5180 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
5181 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
5182 ac_fsusage_space=yes
5183 AC_DEFINE(STAT_STATFS3_OSF1, 1,
5184 [ Define if statfs takes 3 args. (DEC Alpha running OSF/1)])
5188 if test $ac_fsusage_space = no; then
5190 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
5191 member (AIX, 4.3BSD)])
5192 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
5194 #ifdef HAVE_SYS_PARAM_H
5195 #include <sys/param.h>
5197 #ifdef HAVE_SYS_MOUNT_H
5198 #include <sys/mount.h>
5200 #ifdef HAVE_SYS_VFS_H
5201 #include <sys/vfs.h>
5207 exit (statfs (".", &fsd));
5209 fu_cv_sys_stat_statfs2_bsize=yes,
5210 fu_cv_sys_stat_statfs2_bsize=no,
5211 fu_cv_sys_stat_statfs2_bsize=no)])
5212 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
5213 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
5214 ac_fsusage_space=yes
5215 AC_DEFINE(STAT_STATFS2_BSIZE, 1,
5216 [ Define if statfs takes 2 args and struct statfs has a field named f_bsize.
5217 (4.3BSD, SunOS 4, HP-UX, AIX PS/2)])
5221 if test $ac_fsusage_space = no; then
5223 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
5224 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
5225 [AC_TRY_RUN([#include <sys/types.h>
5226 #include <sys/statfs.h>
5230 exit (statfs (".", &fsd, sizeof fsd, 0));
5232 fu_cv_sys_stat_statfs4=yes,
5233 fu_cv_sys_stat_statfs4=no,
5234 fu_cv_sys_stat_statfs4=no)])
5235 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
5236 if test $fu_cv_sys_stat_statfs4 = yes; then
5237 ac_fsusage_space=yes
5238 AC_DEFINE(STAT_STATFS4, 1,
5239 [ Define if statfs takes 4 args. (SVR3, Dynix, Irix, Dolphin)])
5243 if test $ac_fsusage_space = no; then
5245 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
5246 member (4.4BSD and NetBSD)])
5247 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
5248 [AC_TRY_RUN([#include <sys/types.h>
5249 #ifdef HAVE_SYS_PARAM_H
5250 #include <sys/param.h>
5252 #ifdef HAVE_SYS_MOUNT_H
5253 #include <sys/mount.h>
5259 exit (statfs (".", &fsd));
5261 fu_cv_sys_stat_statfs2_fsize=yes,
5262 fu_cv_sys_stat_statfs2_fsize=no,
5263 fu_cv_sys_stat_statfs2_fsize=no)])
5264 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
5265 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
5266 ac_fsusage_space=yes
5267 AC_DEFINE(STAT_STATFS2_FSIZE, 1,
5268 [ Define if statfs takes 2 args and struct statfs has a field named f_fsize.
5273 if test $ac_fsusage_space = no; then
5275 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
5276 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
5277 [AC_TRY_RUN([#include <sys/types.h>
5278 #ifdef HAVE_SYS_PARAM_H
5279 #include <sys/param.h>
5281 #ifdef HAVE_SYS_MOUNT_H
5282 #include <sys/mount.h>
5284 #ifdef HAVE_SYS_FS_TYPES_H
5285 #include <sys/fs_types.h>
5290 /* Ultrix's statfs returns 1 for success,
5291 0 for not mounted, -1 for failure. */
5292 exit (statfs (".", &fsd) != 1);
5294 fu_cv_sys_stat_fs_data=yes,
5295 fu_cv_sys_stat_fs_data=no,
5296 fu_cv_sys_stat_fs_data=no)])
5297 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
5298 if test $fu_cv_sys_stat_fs_data = yes; then
5299 ac_fsusage_space=yes
5300 AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
5301 [ Define if statfs takes 2 args and the second argument has
5302 type struct fs_data. (Ultrix)])
5306 if test $ac_fsusage_space = no; then
5308 AC_TRY_CPP([#include <sys/filsys.h>
5310 AC_DEFINE(STAT_READ_FILSYS, 1,
5311 [Define if there is no specific function for reading filesystems usage
5312 information and you have the <sys/filsys.h> header file. (SVR2)])
5313 ac_fsusage_space=yes)
5316 AS_IF([test $ac_fsusage_space = yes], [$1], [$2])
5322 # Define some macros required for proper operation of code in lib/*.c
5323 # on MSDOS/Windows systems.
5325 # From Jim Meyering.
5327 AC_DEFUN([jm_AC_DOS],
5329 AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos],
5332 [#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__
5333 neither MSDOS nor Windows
5335 [ac_cv_win_or_dos=yes],
5336 [ac_cv_win_or_dos=no])
5339 if test x"$ac_cv_win_or_dos" = xyes; then
5340 ac_fs_accepts_drive_letter_prefix=1
5341 ac_fs_backslash_is_file_name_separator=1
5343 ac_fs_accepts_drive_letter_prefix=0
5344 ac_fs_backslash_is_file_name_separator=0
5347 AH_VERBATIM(FILESYSTEM_PREFIX_LEN,
5348 [#if FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
5349 # define FILESYSTEM_PREFIX_LEN(Filename) \
5350 ((Filename)[0] && (Filename)[1] == ':' ? 2 : 0)
5352 # define FILESYSTEM_PREFIX_LEN(Filename) 0
5355 AC_DEFINE_UNQUOTED([FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
5356 $ac_fs_accepts_drive_letter_prefix,
5357 [Define on systems for which file names may have a so-called
5358 `drive letter' prefix, define this to compute the length of that
5359 prefix, including the colon.])
5361 AH_VERBATIM(ISSLASH,
5362 [#if FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
5363 # define ISSLASH(C) ((C) == '/' || (C) == '\\')
5365 # define ISSLASH(C) ((C) == '/')
5368 AC_DEFINE_UNQUOTED([FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR],
5369 $ac_fs_backslash_is_file_name_separator,
5370 [Define if the backslash character may also serve as a file name
5371 component separator.])
5375 AC_DEFUN([AC_FUNC_CANONICALIZE_FILE_NAME],
5377 AC_REQUIRE([AC_HEADER_STDC])
5378 AC_CHECK_HEADERS(string.h sys/param.h stddef.h)
5379 AC_CHECK_FUNCS(resolvepath)
5380 AC_REQUIRE([AC_HEADER_STAT])
5382 # This would simply be AC_REPLACE_FUNC([canonicalize_file_name])
5383 # if the function name weren't so long. Besides, I would rather
5384 # not have underscores in file names.
5385 AC_CHECK_FUNC([canonicalize_file_name], , [AC_LIBOBJ(canonicalize)])
5390 dnl From Paul Eggert.
5392 # Define ST_MTIM_NSEC to be the nanoseconds member of struct stat's st_mtim,
5395 AC_DEFUN([AC_STRUCT_ST_MTIM_NSEC],
5396 [AC_CACHE_CHECK([for nanoseconds member of struct stat.st_mtim],
5397 ac_cv_struct_st_mtim_nsec,
5398 [ac_save_CPPFLAGS="$CPPFLAGS"
5399 ac_cv_struct_st_mtim_nsec=no
5400 # tv_nsec -- the usual case
5401 # _tv_nsec -- Solaris 2.6, if
5402 # (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1
5403 # && !defined __EXTENSIONS__)
5404 # st__tim.tv_nsec -- UnixWare 2.1.2
5405 for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do
5406 CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val"
5407 AC_TRY_COMPILE([#include <sys/types.h>
5408 #include <sys/stat.h>], [struct stat s; s.st_mtim.ST_MTIM_NSEC;],
5409 [ac_cv_struct_st_mtim_nsec=$ac_val; break])
5411 CPPFLAGS="$ac_save_CPPFLAGS"])
5413 if test $ac_cv_struct_st_mtim_nsec != no; then
5414 AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec,
5415 [Define to be the nanoseconds member of struct stat's st_mtim,
5423 # Define HAVE_ST_DM_MODE if struct stat has an st_dm_mode member.
5425 AC_DEFUN([AC_STRUCT_ST_DM_MODE],
5426 [AC_CACHE_CHECK([for st_dm_mode in struct stat], ac_cv_struct_st_dm_mode,
5427 [AC_TRY_COMPILE([#include <sys/types.h>
5428 #include <sys/stat.h>], [struct stat s; s.st_dm_mode;],
5429 ac_cv_struct_st_dm_mode=yes,
5430 ac_cv_struct_st_dm_mode=no)])
5432 if test $ac_cv_struct_st_dm_mode = yes; then
5433 AC_DEFINE(HAVE_ST_DM_MODE, 1,
5434 [Define if struct stat has an st_dm_mode member. ])
5441 dnl From Jim Meyering
5443 dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
5444 dnl in time.h or sys/time.h.
5446 AC_DEFUN([jm_CHECK_TYPE_STRUCT_TIMESPEC],
5448 AC_REQUIRE([AC_HEADER_TIME])
5449 AC_CACHE_CHECK([for struct timespec], fu_cv_sys_struct_timespec,
5452 # if TIME_WITH_SYS_TIME
5453 # include <sys/time.h>
5456 # if HAVE_SYS_TIME_H
5457 # include <sys/time.h>
5463 [static struct timespec x; x.tv_sec = x.tv_nsec;],
5464 fu_cv_sys_struct_timespec=yes,
5465 fu_cv_sys_struct_timespec=no)
5468 if test $fu_cv_sys_struct_timespec = yes; then
5469 AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
5470 [Define if struct timespec is declared in <time.h>. ])
5475 dnl From Jim Meyering and Paul Eggert.
5476 AC_DEFUN([jm_HEADER_TIOCGWINSZ_IN_TERMIOS_H],
5477 [AC_REQUIRE([AC_SYS_POSIX_TERMIOS])
5478 AC_CACHE_CHECK([whether use of TIOCGWINSZ requires termios.h],
5479 jm_cv_sys_tiocgwinsz_needs_termios_h,
5480 [jm_cv_sys_tiocgwinsz_needs_termios_h=no
5482 if test $ac_cv_sys_posix_termios = yes; then
5484 [#include <sys/types.h>
5485 # include <termios.h>
5489 ], jm_cv_sys_tiocgwinsz_needs_termios_h=yes)
5494 AC_DEFUN([jm_WINSIZE_IN_PTEM],
5495 [AC_REQUIRE([AC_SYS_POSIX_TERMIOS])
5496 AC_CACHE_CHECK([whether use of struct winsize requires sys/ptem.h],
5497 jm_cv_sys_struct_winsize_needs_sys_ptem_h,
5498 [jm_cv_sys_struct_winsize_needs_sys_ptem_h=yes
5499 if test $ac_cv_sys_posix_termios = yes; then
5500 AC_TRY_COMPILE([#include <termios.h>]
5501 [struct winsize x;],
5502 [jm_cv_sys_struct_winsize_needs_sys_ptem_h=no])
5504 if test $jm_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then
5505 AC_TRY_COMPILE([#include <sys/ptem.h>],
5506 [struct winsize x;],
5507 [], [jm_cv_sys_struct_winsize_needs_sys_ptem_h=no])
5509 if test $jm_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then
5510 AC_DEFINE([WINSIZE_IN_PTEM], 1,
5511 [Define if sys/ptem.h is required for struct winsize.])
5514 # Determine whether this system has infrastructure for obtaining the boot time.
5516 # GNULIB_BOOT_TIME([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
5517 * ----------------------------------------------------------
5518 AC_DEFUN([GNULIB_BOOT_TIME],
5520 AC_CHECK_FUNCS(sysctl)
5521 AC_CHECK_HEADERS(sys/sysctl.h)
5523 [whether we can get the system boot time],
5524 [gnulib_cv_have_boot_time],
5528 [AC_INCLUDES_DEFAULT
5529 #if HAVE_SYSCTL && HAVE_SYS_SYSCTL_H
5530 # include <sys/param.h> /* needed for OpenBSD 3.0 */
5531 # include <sys/sysctl.h>
5540 #if defined BOOT_TIME || (defined CTL_KERN && defined KERN_BOOTTIME)
5541 /* your system *does* have the infrastructure to determine boot time */
5543 please_tell_us_how_to_determine_boot_time_on_your_system
5546 gnulib_cv_have_boot_time=yes,
5547 gnulib_cv_have_boot_time=no)
5549 AS_IF([test $gnulib_cv_have_boot_time = yes], [$1], [$2])
5554 AC_DEFUN([jm_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL],
5555 [AC_REQUIRE([jm_HEADER_TIOCGWINSZ_IN_TERMIOS_H])
5556 AC_CACHE_CHECK([whether use of TIOCGWINSZ requires sys/ioctl.h],
5557 jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h,
5558 [jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h=no
5560 if test $jm_cv_sys_tiocgwinsz_needs_termios_h = no; then
5562 [#include <sys/types.h>
5563 # include <sys/ioctl.h>
5567 ], jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes)
5570 if test $jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h = yes; then
5571 AC_DEFINE(GWINSZ_IN_SYS_IOCTL, 1,
5572 [Define if your system defines TIOCGWINSZ in sys/ioctl.h.])
5578 dnl Misc lib-related macros for fileutils, sh-utils, textutils.
5580 AC_DEFUN([jm_LIB_CHECK],
5583 # Check for libypsec.a on Dolphin M88K machines.
5584 AC_CHECK_LIB(ypsec, main)
5586 # m88k running dgux 5.4 needs this
5587 AC_CHECK_LIB(ldgc, main)
5589 # Some programs need to link with -lm. printf does if it uses
5590 # lib/strtod.c which uses pow. And seq uses the math functions,
5591 # floor, modf, rint. And factor uses sqrt. And sleep uses fesetround.
5593 # Save a copy of $LIBS and add $FLOOR_LIBM before these tests
5594 # Check for these math functions used by seq.
5595 ac_su_saved_lib="$LIBS"
5597 AC_CHECK_FUNCS(floor modf rint)
5598 LIBS="$ac_su_saved_lib"
5601 AC_CHECK_FUNCS(sqrt)
5602 if test $ac_cv_func_sqrt = no; then
5603 AC_CHECK_LIB(m, sqrt, [SQRT_LIBM=-lm])
5606 AC_SUBST(FESETROUND_LIBM)
5607 AC_CHECK_FUNCS(fesetround)
5608 if test $ac_cv_func_fesetround = no; then
5609 AC_CHECK_LIB(m, fesetround, [FESETROUND_LIBM=-lm])
5612 # The -lsun library is required for YP support on Irix-4.0.5 systems.
5613 # m88k/svr3 DolphinOS systems using YP need -lypsec for id.
5614 AC_SEARCH_LIBS(yp_match, [sun ypsec])
5616 # SysV needs -lsec, older versions of Linux need -lshadow for
5617 # shadow passwords. UnixWare 7 needs -lgen.
5618 AC_SEARCH_LIBS(getspnam, [shadow sec gen])
5620 AC_CHECK_HEADERS(shadow.h)
5622 # Requirements for su.c.
5624 $ac_includes_default
5626 # include <shadow.h>
5629 AC_CHECK_MEMBERS([struct spwd.sp_pwdp],,,[$shadow_includes])
5630 AC_CHECK_FUNCS(getspnam)
5632 # SCO-ODT-3.0 is reported to need -lufc for crypt.
5633 # NetBSD needs -lcrypt for crypt.
5634 ac_su_saved_lib="$LIBS"
5635 AC_SEARCH_LIBS(crypt, [ufc crypt], [LIB_CRYPT="$ac_cv_search_crypt"])
5636 LIBS="$ac_su_saved_lib"
5640 # gettext.m4 serial 17 (gettext-0.11.5)
5641 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
5642 dnl This file is free software, distributed under the terms of the GNU
5643 dnl General Public License. As a special exception to the GNU General
5644 dnl Public License, this file may be distributed as part of a program
5645 dnl that contains a configuration script generated by Autoconf, under
5646 dnl the same distribution terms as the rest of that program.
5648 dnl This file can can be used in projects which are not available under
5649 dnl the GNU General Public License or the GNU Library General Public
5650 dnl License but which still want to provide support for the GNU gettext
5652 dnl Please note that the actual code of the GNU gettext library is covered
5653 dnl by the GNU Library General Public License, and the rest of the GNU
5654 dnl gettext package package is covered by the GNU General Public License.
5655 dnl They are *not* in the public domain.
5658 dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
5659 dnl Bruno Haible <haible@clisp.cons.org>, 2000-2002.
5661 dnl Macro to add for using GNU gettext.
5663 dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
5664 dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
5665 dnl default (if it is not specified or empty) is 'no-libtool'.
5666 dnl INTLSYMBOL should be 'external' for packages with no intl directory,
5667 dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory.
5668 dnl If INTLSYMBOL is 'use-libtool', then a libtool library
5669 dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
5670 dnl depending on --{enable,disable}-{shared,static} and on the presence of
5671 dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
5672 dnl $(top_builddir)/intl/libintl.a will be created.
5673 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
5674 dnl implementations (in libc or libintl) without the ngettext() function
5675 dnl will be ignored. If NEEDSYMBOL is specified and is
5676 dnl 'need-formatstring-macros', then GNU gettext implementations that don't
5677 dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
5678 dnl INTLDIR is used to find the intl libraries. If empty,
5679 dnl the value `$(top_builddir)/intl/' is used.
5681 dnl The result of the configuration is one of three cases:
5682 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
5684 dnl Catalog format: GNU --> install in $(datadir)
5685 dnl Catalog extension: .mo after installation, .gmo in source tree
5686 dnl 2) GNU gettext has been found in the system's C library.
5687 dnl Catalog format: GNU --> install in $(datadir)
5688 dnl Catalog extension: .mo after installation, .gmo in source tree
5689 dnl 3) No internationalization, always use English msgid.
5690 dnl Catalog format: none
5691 dnl Catalog extension: none
5692 dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
5693 dnl The use of .gmo is historical (it was needed to avoid overwriting the
5694 dnl GNU format catalogs when building on a platform with an X/Open gettext),
5695 dnl but we keep it in order not to force irrelevant filename changes on the
5698 AC_DEFUN([AM_GNU_GETTEXT],
5700 dnl Argument checking.
5701 ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
5702 [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
5704 ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
5705 [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
5707 define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
5708 define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
5710 AC_REQUIRE([AM_PO_SUBDIRS])dnl
5711 ifelse(gt_included_intl, yes, [
5712 AC_REQUIRE([AM_INTL_SUBDIR])dnl
5715 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
5716 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
5717 AC_REQUIRE([AC_LIB_RPATH])
5719 dnl Sometimes libintl requires libiconv, so first search for libiconv.
5720 dnl Ideally we would do this search only after the
5721 dnl if test "$USE_NLS" = "yes"; then
5722 dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then
5723 dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
5724 dnl the configure script would need to contain the same shell code
5725 dnl again, outside any 'if'. There are two solutions:
5726 dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
5727 dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
5728 dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
5729 dnl documented, we avoid it.
5730 ifelse(gt_included_intl, yes, , [
5731 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
5734 AC_MSG_CHECKING([whether NLS is requested])
5735 dnl Default is enabled NLS
5737 [ --disable-nls do not use Native Language Support],
5738 USE_NLS=$enableval, USE_NLS=yes)
5739 AC_MSG_RESULT($USE_NLS)
5742 ifelse(gt_included_intl, yes, [
5743 BUILD_INCLUDED_LIBINTL=no
5744 USE_INCLUDED_LIBINTL=no
5750 dnl If we use NLS figure out what method
5751 if test "$USE_NLS" = "yes"; then
5752 gt_use_preinstalled_gnugettext=no
5753 ifelse(gt_included_intl, yes, [
5754 AC_MSG_CHECKING([whether included gettext is requested])
5755 AC_ARG_WITH(included-gettext,
5756 [ --with-included-gettext use the GNU gettext library included here],
5757 nls_cv_force_use_gnu_gettext=$withval,
5758 nls_cv_force_use_gnu_gettext=no)
5759 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
5761 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
5762 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
5764 dnl User does not insist on using GNU NLS library. Figure out what
5765 dnl to use. If GNU gettext is available we use this. Else we have
5766 dnl to fall back to GNU NLS library.
5768 dnl Add a version number to the cache macros.
5769 define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
5770 define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
5771 define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
5773 AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
5774 [AC_TRY_LINK([#include <libintl.h>
5775 ]ifelse([$2], [need-formatstring-macros],
5776 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
5777 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
5780 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
5782 ], [])[extern int _nl_msg_cat_cntr;
5783 extern int *_nl_domain_bindings;],
5784 [bindtextdomain ("", "");
5785 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
5786 gt_cv_func_gnugettext_libc=yes,
5787 gt_cv_func_gnugettext_libc=no)])
5789 if test "$gt_cv_func_gnugettext_libc" != "yes"; then
5790 dnl Sometimes libintl requires libiconv, so first search for libiconv.
5791 ifelse(gt_included_intl, yes, , [
5794 dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
5795 dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
5796 dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
5797 dnl even if libiconv doesn't exist.
5798 AC_LIB_LINKFLAGS_BODY([intl])
5799 AC_CACHE_CHECK([for GNU gettext in libintl],
5800 gt_cv_func_gnugettext_libintl,
5801 [gt_save_CPPFLAGS="$CPPFLAGS"
5802 CPPFLAGS="$CPPFLAGS $INCINTL"
5803 gt_save_LIBS="$LIBS"
5804 LIBS="$LIBS $LIBINTL"
5805 dnl Now see whether libintl exists and does not depend on libiconv.
5806 AC_TRY_LINK([#include <libintl.h>
5807 ]ifelse([$2], [need-formatstring-macros],
5808 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
5809 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
5812 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
5814 ], [])[extern int _nl_msg_cat_cntr;
5819 const char *_nl_expand_alias ();],
5820 [bindtextdomain ("", "");
5821 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
5822 gt_cv_func_gnugettext_libintl=yes,
5823 gt_cv_func_gnugettext_libintl=no)
5824 dnl Now see whether libintl exists and depends on libiconv.
5825 if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
5826 LIBS="$LIBS $LIBICONV"
5827 AC_TRY_LINK([#include <libintl.h>
5828 ]ifelse([$2], [need-formatstring-macros],
5829 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
5830 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
5833 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
5835 ], [])[extern int _nl_msg_cat_cntr;
5840 const char *_nl_expand_alias ();],
5841 [bindtextdomain ("", "");
5842 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
5843 [LIBINTL="$LIBINTL $LIBICONV"
5844 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
5845 gt_cv_func_gnugettext_libintl=yes
5848 CPPFLAGS="$gt_save_CPPFLAGS"
5849 LIBS="$gt_save_LIBS"])
5852 dnl If an already present or preinstalled GNU gettext() is found,
5853 dnl use it. But if this macro is used in GNU gettext, and GNU
5854 dnl gettext is already preinstalled in libintl, we update this
5855 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
5856 if test "$gt_cv_func_gnugettext_libc" = "yes" \
5857 || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
5858 && test "$PACKAGE" != gettext; }; then
5859 gt_use_preinstalled_gnugettext=yes
5861 dnl Reset the values set by searching for libintl.
5867 ifelse(gt_included_intl, yes, [
5868 if test "$gt_use_preinstalled_gnugettext" != "yes"; then
5869 dnl GNU gettext is not found in the C library.
5870 dnl Fall back on included GNU gettext library.
5871 nls_cv_use_gnu_gettext=yes
5875 if test "$nls_cv_use_gnu_gettext" = "yes"; then
5876 dnl Mark actions used to generate GNU NLS library.
5877 INTLOBJS="\$(GETTOBJS)"
5878 BUILD_INCLUDED_LIBINTL=yes
5879 USE_INCLUDED_LIBINTL=yes
5880 LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
5881 LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
5882 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
5885 if test "$gt_use_preinstalled_gnugettext" = "yes" \
5886 || test "$nls_cv_use_gnu_gettext" = "yes"; then
5887 dnl Mark actions to use GNU gettext tools.
5892 if test "$gt_use_preinstalled_gnugettext" = "yes" \
5893 || test "$nls_cv_use_gnu_gettext" = "yes"; then
5894 AC_DEFINE(ENABLE_NLS, 1,
5895 [Define to 1 if translation of program messages to the user's native language
5902 if test "$USE_NLS" = "yes"; then
5904 if test "$gt_use_preinstalled_gnugettext" = "yes"; then
5905 if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
5906 AC_MSG_CHECKING([how to link with libintl])
5907 AC_MSG_RESULT([$LIBINTL])
5908 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
5911 dnl For backward compatibility. Some packages may be using this.
5912 AC_DEFINE(HAVE_GETTEXT, 1,
5913 [Define if the GNU gettext() function is already present or preinstalled.])
5914 AC_DEFINE(HAVE_DCGETTEXT, 1,
5915 [Define if the GNU dcgettext() function is already present or preinstalled.])
5918 dnl We need to process the po/ directory.
5922 ifelse(gt_included_intl, yes, [
5923 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
5924 dnl to 'yes' because some of the testsuite requires it.
5925 if test "$PACKAGE" = gettext; then
5926 BUILD_INCLUDED_LIBINTL=yes
5929 dnl Make all variables we use known to autoconf.
5930 AC_SUBST(BUILD_INCLUDED_LIBINTL)
5931 AC_SUBST(USE_INCLUDED_LIBINTL)
5935 dnl For backward compatibility. Some configure.ins may be using this.
5937 nls_cv_header_libgt=
5939 dnl For backward compatibility. Some Makefiles may be using this.
5941 AC_SUBST(DATADIRNAME)
5943 dnl For backward compatibility. Some Makefiles may be using this.
5945 AC_SUBST(INSTOBJEXT)
5947 dnl For backward compatibility. Some Makefiles may be using this.
5951 dnl Enable libtool support if the surrounding package wishes it.
5952 INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
5953 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
5956 dnl For backward compatibility. Some Makefiles may be using this.
5960 dnl Make all documented variables known to autoconf.
5967 dnl Checks for all prerequisites of the po subdirectory,
5968 dnl except for USE_NLS.
5969 AC_DEFUN([AM_PO_SUBDIRS],
5971 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
5972 AC_REQUIRE([AC_PROG_INSTALL])dnl
5973 AC_REQUIRE([AM_MKINSTALLDIRS])dnl
5975 dnl Perform the following tests also if --disable-nls has been given,
5976 dnl because they are needed for "make dist" to work.
5978 dnl Search for GNU msgfmt in the PATH.
5979 dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
5980 dnl The second test excludes FreeBSD msgfmt.
5981 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
5982 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
5983 (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
5985 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
5987 dnl Search for GNU xgettext 0.11 or newer in the PATH.
5988 dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
5989 dnl The second test excludes FreeBSD xgettext.
5990 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
5991 [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
5992 (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)],
5994 dnl Remove leftover from FreeBSD xgettext call.
5997 dnl Search for GNU msgmerge 0.11 or newer in the PATH.
5998 AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
5999 [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
6001 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
6002 dnl Test whether we really found GNU msgfmt.
6003 if test "$GMSGFMT" != ":"; then
6004 dnl If it is no GNU msgfmt we define it as : so that the
6005 dnl Makefiles still can work.
6006 if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
6007 (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
6010 GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
6012 [found $GMSGFMT program is not GNU msgfmt; ignore it])
6017 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
6018 dnl Test whether we really found GNU xgettext.
6019 if test "$XGETTEXT" != ":"; then
6020 dnl If it is no GNU xgettext we define it as : so that the
6021 dnl Makefiles still can work.
6022 if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
6023 (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
6027 [found xgettext program is not GNU xgettext; ignore it])
6030 dnl Remove leftover from FreeBSD xgettext call.
6034 AC_OUTPUT_COMMANDS([
6035 for ac_file in $CONFIG_FILES; do
6036 # Support "outfile[:infile[:infile...]]"
6038 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
6040 # PO directories have a Makefile.in generated from Makefile.in.in.
6041 case "$ac_file" in */Makefile.in)
6042 # Adjust a relative srcdir.
6043 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
6044 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
6045 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
6046 # In autoconf-2.13 it is called $ac_given_srcdir.
6047 # In autoconf-2.50 it is called $srcdir.
6048 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
6049 case "$ac_given_srcdir" in
6050 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
6051 /*) top_srcdir="$ac_given_srcdir" ;;
6052 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
6054 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
6055 rm -f "$ac_dir/POTFILES"
6056 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
6057 cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
6058 # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
6059 # on $ac_dir but don't depend on user-specified configuration
6061 if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
6062 # The LINGUAS file contains the set of available languages.
6063 if test -n "$ALL_LINGUAS"; then
6064 test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
6066 ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
6067 # Hide the ALL_LINGUAS assigment from automake.
6068 eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
6070 case "$ac_given_srcdir" in
6072 *) srcdirpre='$(srcdir)/' ;;
6078 for lang in $ALL_LINGUAS; do
6079 POFILES="$POFILES $srcdirpre$lang.po"
6080 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
6081 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
6082 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
6084 # CATALOGS depends on both $ac_dir and the user's LINGUAS
6085 # environment variable.
6087 if test -n "$ALL_LINGUAS"; then
6088 for presentlang in $ALL_LINGUAS; do
6090 if test "%UNSET%" != "$LINGUAS"; then
6091 desiredlanguages="$LINGUAS"
6093 desiredlanguages="$ALL_LINGUAS"
6095 for desiredlang in $desiredlanguages; do
6096 # Use the presentlang catalog if desiredlang is
6097 # a. equal to presentlang, or
6098 # b. a variant of presentlang (because in this case,
6099 # presentlang can be used as a fallback for messages
6100 # which are not translated in the desiredlang catalog).
6101 case "$desiredlang" in
6102 "$presentlang"*) useit=yes;;
6105 if test $useit = yes; then
6106 INST_LINGUAS="$INST_LINGUAS $presentlang"
6111 if test -n "$INST_LINGUAS"; then
6112 for lang in $INST_LINGUAS; do
6113 CATALOGS="$CATALOGS $lang.gmo"
6116 test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
6117 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"
6118 for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
6119 if test -f "$f"; then
6121 *.orig | *.bak | *~) ;;
6122 *) cat "$f" >> "$ac_dir/Makefile" ;;
6130 [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
6131 # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
6133 eval 'ALL_LINGUAS''="$ALL_LINGUAS"'
6134 # Capture the value of LINGUAS because we need it to compute CATALOGS.
6135 LINGUAS="${LINGUAS-%UNSET%}"
6140 dnl Checks for all prerequisites of the intl subdirectory,
6141 dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
6142 dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
6143 AC_DEFUN([AM_INTL_SUBDIR],
6145 AC_REQUIRE([AC_PROG_INSTALL])dnl
6146 AC_REQUIRE([AM_MKINSTALLDIRS])dnl
6147 AC_REQUIRE([AC_PROG_CC])dnl
6148 AC_REQUIRE([AC_CANONICAL_HOST])dnl
6149 AC_REQUIRE([AC_PROG_RANLIB])dnl
6150 AC_REQUIRE([AC_ISC_POSIX])dnl
6151 AC_REQUIRE([AC_HEADER_STDC])dnl
6152 AC_REQUIRE([AC_C_CONST])dnl
6153 AC_REQUIRE([AC_C_INLINE])dnl
6154 AC_REQUIRE([AC_TYPE_OFF_T])dnl
6155 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
6156 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
6157 AC_REQUIRE([AC_FUNC_MMAP])dnl
6158 AC_REQUIRE([jm_GLIBC21])dnl
6159 AC_REQUIRE([gt_INTDIV0])dnl
6160 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
6161 AC_REQUIRE([gt_INTTYPES_PRI])dnl
6163 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
6164 stdlib.h string.h unistd.h sys/param.h])
6165 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
6166 geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \
6167 strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
6171 if test $ac_cv_header_locale_h = yes; then
6175 dnl intl/plural.c is generated from intl/plural.y. It requires bison,
6176 dnl because plural.y uses bison specific features. It requires at least
6177 dnl bison-1.26 because earlier versions generate a plural.c that doesn't
6179 dnl bison is only needed for the maintainer (who touches plural.y). But in
6180 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
6181 dnl the rule in general Makefile. Now, some people carelessly touch the
6182 dnl files or have a broken "make" program, hence the plural.c rule will
6183 dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
6184 dnl present or too old.
6185 AC_CHECK_PROGS([INTLBISON], [bison])
6186 if test -z "$INTLBISON"; then
6189 dnl Found it, now check the version.
6190 AC_MSG_CHECKING([version of bison])
6191 changequote(<<,>>)dnl
6192 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
6193 case $ac_prog_version in
6194 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
6195 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
6197 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
6198 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
6200 AC_MSG_RESULT([$ac_prog_version])
6202 if test $ac_verc_fail = yes; then
6208 AC_DEFUN([AM_MKINSTALLDIRS],
6210 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
6211 dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
6212 dnl Try to locate is.
6214 if test -n "$ac_aux_dir"; then
6215 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
6217 if test -z "$MKINSTALLDIRS"; then
6218 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
6220 AC_SUBST(MKINSTALLDIRS)
6224 dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
6225 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
6227 # progtest.m4 serial 2 (gettext-0.10.40)
6228 dnl Copyright (C) 1996-2002 Free Software Foundation, Inc.
6229 dnl This file is free software, distributed under the terms of the GNU
6230 dnl General Public License. As a special exception to the GNU General
6231 dnl Public License, this file may be distributed as part of a program
6232 dnl that contains a configuration script generated by Autoconf, under
6233 dnl the same distribution terms as the rest of that program.
6235 dnl This file can can be used in projects which are not available under
6236 dnl the GNU General Public License or the GNU Library General Public
6237 dnl License but which still want to provide support for the GNU gettext
6239 dnl Please note that the actual code of the GNU gettext library is covered
6240 dnl by the GNU Library General Public License, and the rest of the GNU
6241 dnl gettext package package is covered by the GNU General Public License.
6242 dnl They are *not* in the public domain.
6245 dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
6247 # Search path for a program which passes the given test.
6249 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
6250 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
6251 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
6252 [# Extract the first word of "$2", so it can be a program name with args.
6253 set dummy $2; ac_word=[$]2
6254 AC_MSG_CHECKING([for $ac_word])
6255 AC_CACHE_VAL(ac_cv_path_$1,
6258 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
6261 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
6262 for ac_dir in ifelse([$5], , $PATH, [$5]); do
6263 test -z "$ac_dir" && ac_dir=.
6264 if test -f $ac_dir/$ac_word; then
6266 ac_cv_path_$1="$ac_dir/$ac_word"
6272 dnl If no 4th arg is given, leave the cache variable unset,
6273 dnl so AC_PATH_PROGS will keep looking.
6274 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
6279 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
6280 AC_MSG_RESULT([$]$1)
6287 # intdiv0.m4 serial 1 (gettext-0.11.3)
6288 dnl Copyright (C) 2002 Free Software Foundation, Inc.
6289 dnl This file is free software, distributed under the terms of the GNU
6290 dnl General Public License. As a special exception to the GNU General
6291 dnl Public License, this file may be distributed as part of a program
6292 dnl that contains a configuration script generated by Autoconf, under
6293 dnl the same distribution terms as the rest of that program.
6295 dnl From Bruno Haible.
6297 AC_DEFUN([gt_INTDIV0],
6299 AC_REQUIRE([AC_PROG_CC])dnl
6300 AC_REQUIRE([AC_CANONICAL_HOST])dnl
6302 AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
6303 gt_cv_int_divbyzero_sigfpe,
6311 sigfpe_handler (int sig)
6313 sigfpe_handler (sig) int sig;
6316 /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
6317 exit (sig != SIGFPE);
6327 signal (SIGFPE, sigfpe_handler);
6328 /* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */
6329 #if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
6330 signal (SIGTRAP, sigfpe_handler);
6332 /* Linux/SPARC yields signal SIGILL. */
6333 #if defined (__sparc__) && defined (__linux__)
6334 signal (SIGILL, sigfpe_handler);
6341 ], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
6343 # Guess based on the CPU.
6345 alpha* | i[34567]86 | m68k | s390*)
6346 gt_cv_int_divbyzero_sigfpe="guessing yes";;
6348 gt_cv_int_divbyzero_sigfpe="guessing no";;
6352 case "$gt_cv_int_divbyzero_sigfpe" in
6356 AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
6357 [Define if integer division by zero raises signal SIGFPE.])
6360 # lcmessage.m4 serial 3 (gettext-0.11.3)
6361 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
6362 dnl This file is free software, distributed under the terms of the GNU
6363 dnl General Public License. As a special exception to the GNU General
6364 dnl Public License, this file may be distributed as part of a program
6365 dnl that contains a configuration script generated by Autoconf, under
6366 dnl the same distribution terms as the rest of that program.
6368 dnl This file can can be used in projects which are not available under
6369 dnl the GNU General Public License or the GNU Library General Public
6370 dnl License but which still want to provide support for the GNU gettext
6372 dnl Please note that the actual code of the GNU gettext library is covered
6373 dnl by the GNU Library General Public License, and the rest of the GNU
6374 dnl gettext package package is covered by the GNU General Public License.
6375 dnl They are *not* in the public domain.
6378 dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
6380 # Check whether LC_MESSAGES is available in <locale.h>.
6382 AC_DEFUN([AM_LC_MESSAGES],
6384 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
6385 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
6386 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
6387 if test $am_cv_val_LC_MESSAGES = yes; then
6388 AC_DEFINE(HAVE_LC_MESSAGES, 1,
6389 [Define if your <locale.h> file defines LC_MESSAGES.])