1 # generated automatically by aclocal 1.7.2 -*- 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
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
112 _AM_IF_OPTION([no-dependencies],,
113 [AC_PROVIDE_IFELSE([AC_PROG_CC],
114 [_AM_DEPENDENCIES(CC)],
115 [define([AC_PROG_CC],
116 defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
117 AC_PROVIDE_IFELSE([AC_PROG_CXX],
118 [_AM_DEPENDENCIES(CXX)],
119 [define([AC_PROG_CXX],
120 defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
125 # When config.status generates a header, we must update the stamp-h file.
126 # This file resides in the same directory as the config header
127 # that is generated. The stamp files are numbered to have different names.
129 # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
130 # loop where config.status creates the headers, so we can generate
131 # our stamp files there.
132 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
133 [_am_stamp_count=`expr ${_am_stamp_count-0} + 1`
134 echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
136 # Copyright 2002 Free Software Foundation, Inc.
138 # This program is free software; you can redistribute it and/or modify
139 # it under the terms of the GNU General Public License as published by
140 # the Free Software Foundation; either version 2, or (at your option)
143 # This program is distributed in the hope that it will be useful,
144 # but WITHOUT ANY WARRANTY; without even the implied warranty of
145 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
146 # GNU General Public License for more details.
148 # You should have received a copy of the GNU General Public License
149 # along with this program; if not, write to the Free Software
150 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
152 # AM_AUTOMAKE_VERSION(VERSION)
153 # ----------------------------
154 # Automake X.Y traces this macro to ensure aclocal.m4 has been
155 # generated from the m4 files accompanying Automake X.Y.
156 AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"])
158 # AM_SET_CURRENT_AUTOMAKE_VERSION
159 # -------------------------------
160 # Call AM_AUTOMAKE_VERSION so it can be traced.
161 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
162 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
163 [AM_AUTOMAKE_VERSION([1.7.2])])
165 # Helper functions for option handling. -*- Autoconf -*-
167 # Copyright 2001, 2002 Free Software Foundation, Inc.
169 # This program is free software; you can redistribute it and/or modify
170 # it under the terms of the GNU General Public License as published by
171 # the Free Software Foundation; either version 2, or (at your option)
174 # This program is distributed in the hope that it will be useful,
175 # but WITHOUT ANY WARRANTY; without even the implied warranty of
176 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
177 # GNU General Public License for more details.
179 # You should have received a copy of the GNU General Public License
180 # along with this program; if not, write to the Free Software
181 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
186 # _AM_MANGLE_OPTION(NAME)
187 # -----------------------
188 AC_DEFUN([_AM_MANGLE_OPTION],
189 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
191 # _AM_SET_OPTION(NAME)
192 # ------------------------------
193 # Set option NAME. Presently that only means defining a flag for this option.
194 AC_DEFUN([_AM_SET_OPTION],
195 [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
197 # _AM_SET_OPTIONS(OPTIONS)
198 # ----------------------------------
199 # OPTIONS is a space-separated list of Automake options.
200 AC_DEFUN([_AM_SET_OPTIONS],
201 [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
203 # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
204 # -------------------------------------------
205 # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
206 AC_DEFUN([_AM_IF_OPTION],
207 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
210 # Check to make sure that the build environment is sane.
213 # Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
215 # This program is free software; you can redistribute it and/or modify
216 # it under the terms of the GNU General Public License as published by
217 # the Free Software Foundation; either version 2, or (at your option)
220 # This program is distributed in the hope that it will be useful,
221 # but WITHOUT ANY WARRANTY; without even the implied warranty of
222 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
223 # GNU General Public License for more details.
225 # You should have received a copy of the GNU General Public License
226 # along with this program; if not, write to the Free Software
227 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
234 AC_DEFUN([AM_SANITY_CHECK],
235 [AC_MSG_CHECKING([whether build environment is sane])
238 echo timestamp > conftest.file
239 # Do `set' in a subshell so we don't clobber the current shell's
240 # arguments. Must try -L first in case configure is actually a
241 # symlink; some systems play weird games with the mod time of symlinks
242 # (eg FreeBSD returns the mod time of the symlink's containing
245 set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
246 if test "$[*]" = "X"; then
248 set X `ls -t $srcdir/configure conftest.file`
251 if test "$[*]" != "X $srcdir/configure conftest.file" \
252 && test "$[*]" != "X conftest.file $srcdir/configure"; then
254 # If neither matched, then we have a broken ls. This can happen
255 # if, for instance, CONFIG_SHELL is bash and it inherits a
256 # broken ls alias from the environment. This has actually
257 # happened. Such a system could not be considered "sane".
258 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
259 alias in your environment])
262 test "$[2]" = conftest.file
268 AC_MSG_ERROR([newly created file is older than distributed files!
269 Check your system clock])
276 # Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
278 # This program is free software; you can redistribute it and/or modify
279 # it under the terms of the GNU General Public License as published by
280 # the Free Software Foundation; either version 2, or (at your option)
283 # This program is distributed in the hope that it will be useful,
284 # but WITHOUT ANY WARRANTY; without even the implied warranty of
285 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
286 # GNU General Public License for more details.
288 # You should have received a copy of the GNU General Public License
289 # along with this program; if not, write to the Free Software
290 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
295 # AM_MISSING_PROG(NAME, PROGRAM)
296 # ------------------------------
297 AC_DEFUN([AM_MISSING_PROG],
298 [AC_REQUIRE([AM_MISSING_HAS_RUN])
299 $1=${$1-"${am_missing_run}$2"}
305 # Define MISSING if not defined so far and test if it supports --run.
306 # If it does, set am_missing_run to use it, otherwise, to nothing.
307 AC_DEFUN([AM_MISSING_HAS_RUN],
308 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
309 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
310 # Use eval to expand $SHELL
311 if eval "$MISSING --run true"; then
312 am_missing_run="$MISSING --run "
315 AC_MSG_WARN([`missing' script is too old or missing])
321 # Copyright 2001 Free Software Foundation, Inc.
323 # This program is free software; you can redistribute it and/or modify
324 # it under the terms of the GNU General Public License as published by
325 # the Free Software Foundation; either version 2, or (at your option)
328 # This program is distributed in the hope that it will be useful,
329 # but WITHOUT ANY WARRANTY; without even the implied warranty of
330 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
331 # GNU General Public License for more details.
333 # You should have received a copy of the GNU General Public License
334 # along with this program; if not, write to the Free Software
335 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
338 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
339 # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
340 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
342 # Of course, Automake must honor this variable whenever it calls a
343 # tool from the auxiliary directory. The problem is that $srcdir (and
344 # therefore $ac_aux_dir as well) can be either absolute or relative,
345 # depending on how configure is run. This is pretty annoying, since
346 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
347 # source directory, any form will work fine, but in subdirectories a
348 # relative path needs to be adjusted first.
350 # $ac_aux_dir/missing
351 # fails when called from a subdirectory if $ac_aux_dir is relative
352 # $top_srcdir/$ac_aux_dir/missing
353 # fails if $ac_aux_dir is absolute,
354 # fails when called from a subdirectory in a VPATH build with
355 # a relative $ac_aux_dir
357 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
358 # are both prefixed by $srcdir. In an in-source build this is usually
359 # harmless because $srcdir is `.', but things will broke when you
360 # start a VPATH build or use an absolute $srcdir.
362 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
363 # iff we strip the leading $srcdir from $ac_aux_dir. That would be:
364 # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
365 # and then we would define $MISSING as
366 # MISSING="\${SHELL} $am_aux_dir/missing"
367 # This will work as long as MISSING is not called from configure, because
368 # unfortunately $(top_srcdir) has no meaning in configure.
369 # However there are other variables, like CC, which are often used in
370 # configure, and could therefore not use this "fixed" $ac_aux_dir.
372 # Another solution, used here, is to always expand $ac_aux_dir to an
373 # absolute PATH. The drawback is that using absolute paths prevent a
374 # configured tree to be moved without reconfiguration.
376 # Rely on autoconf to set up CDPATH properly.
379 AC_DEFUN([AM_AUX_DIR_EXPAND], [
380 # expand $ac_aux_dir to an absolute path
381 am_aux_dir=`cd $ac_aux_dir && pwd`
386 # Define $install_sh.
388 # Copyright 2001 Free Software Foundation, Inc.
390 # This program is free software; you can redistribute it and/or modify
391 # it under the terms of the GNU General Public License as published by
392 # the Free Software Foundation; either version 2, or (at your option)
395 # This program is distributed in the hope that it will be useful,
396 # but WITHOUT ANY WARRANTY; without even the implied warranty of
397 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
398 # GNU General Public License for more details.
400 # You should have received a copy of the GNU General Public License
401 # along with this program; if not, write to the Free Software
402 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
405 AC_DEFUN([AM_PROG_INSTALL_SH],
406 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
407 install_sh=${install_sh-"$am_aux_dir/install-sh"}
408 AC_SUBST(install_sh)])
410 # AM_PROG_INSTALL_STRIP
412 # Copyright 2001 Free Software Foundation, Inc.
414 # This program is free software; you can redistribute it and/or modify
415 # it under the terms of the GNU General Public License as published by
416 # the Free Software Foundation; either version 2, or (at your option)
419 # This program is distributed in the hope that it will be useful,
420 # but WITHOUT ANY WARRANTY; without even the implied warranty of
421 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
422 # GNU General Public License for more details.
424 # You should have received a copy of the GNU General Public License
425 # along with this program; if not, write to the Free Software
426 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
429 # One issue with vendor `install' (even GNU) is that you can't
430 # specify the program used to strip binaries. This is especially
431 # annoying in cross-compiling environments, where the build's strip
432 # is unlikely to handle the host's binaries.
433 # Fortunately install-sh will honor a STRIPPROG variable, so we
434 # always use install-sh in `make install-strip', and initialize
435 # STRIPPROG with the value of the STRIP variable (set by the user).
436 AC_DEFUN([AM_PROG_INSTALL_STRIP],
437 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
438 # Installed binaries are usually stripped using `strip' when the user
439 # run `make install-strip'. However `strip' might not be the right
440 # tool to use in cross-compilation environments, therefore Automake
441 # will honor the `STRIP' environment variable to overrule this program.
442 dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
443 if test "$cross_compiling" != no; then
444 AC_CHECK_TOOL([STRIP], [strip], :)
446 INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
447 AC_SUBST([INSTALL_STRIP_PROGRAM])])
449 # serial 4 -*- Autoconf -*-
451 # Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
453 # This program is free software; you can redistribute it and/or modify
454 # it under the terms of the GNU General Public License as published by
455 # the Free Software Foundation; either version 2, or (at your option)
458 # This program is distributed in the hope that it will be useful,
459 # but WITHOUT ANY WARRANTY; without even the implied warranty of
460 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
461 # GNU General Public License for more details.
463 # You should have received a copy of the GNU General Public License
464 # along with this program; if not, write to the Free Software
465 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
469 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
470 # written in clear, in which case automake, when reading aclocal.m4,
471 # will think it sees a *use*, and therefore will trigger all it's
472 # C support machinery. Also note that it means that autoscan, seeing
473 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
477 # _AM_DEPENDENCIES(NAME)
478 # ----------------------
479 # See how the compiler implements dependency checking.
480 # NAME is "CC", "CXX", "GCJ", or "OBJC".
481 # We try a few techniques and use that to set a single cache variable.
483 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
484 # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
485 # dependency, and given that the user is not expected to run this macro,
486 # just rely on AC_PROG_CC.
487 AC_DEFUN([_AM_DEPENDENCIES],
488 [AC_REQUIRE([AM_SET_DEPDIR])dnl
489 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
490 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
491 AC_REQUIRE([AM_DEP_TRACK])dnl
493 ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
494 [$1], CXX, [depcc="$CXX" am_compiler_list=],
495 [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
496 [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
497 [depcc="$$1" am_compiler_list=])
499 AC_CACHE_CHECK([dependency style of $depcc],
500 [am_cv_$1_dependencies_compiler_type],
501 [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
502 # We make a subdir and do the tests there. Otherwise we can end up
503 # making bogus files that we don't know about and never remove. For
504 # instance it was reported that on HP-UX the gcc test will end up
505 # making a dummy file named `D' -- because `-MD' means `put the output
508 # Copy depcomp to subdir because otherwise we won't find it if we're
509 # using a relative directory.
510 cp "$am_depcomp" conftest.dir
513 am_cv_$1_dependencies_compiler_type=none
514 if test "$am_compiler_list" = ""; then
515 am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
517 for depmode in $am_compiler_list; do
518 # We need to recreate these files for each test, as the compiler may
519 # overwrite some of them when testing with obscure command lines.
520 # This happens at least with the AIX C compiler.
521 echo '#include "conftest.h"' > conftest.c
522 echo 'int i;' > conftest.h
523 echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
527 # after this tag, mechanisms are not by side-effect, so they'll
528 # only be used when explicitly requested
529 if test "x$enable_dependency_tracking" = xyes; then
537 # We check with `-c' and `-o' for the sake of the "dashmstdout"
538 # mode. It turns out that the SunPro C++ compiler does not properly
539 # handle `-M -o', and we need to detect this.
540 if depmode=$depmode \
541 source=conftest.c object=conftest.o \
542 depfile=conftest.Po tmpdepfile=conftest.TPo \
543 $SHELL ./depcomp $depcc -c -o conftest.o conftest.c >/dev/null 2>&1 &&
544 grep conftest.h conftest.Po > /dev/null 2>&1 &&
545 ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
546 am_cv_$1_dependencies_compiler_type=$depmode
554 am_cv_$1_dependencies_compiler_type=none
557 AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
558 AM_CONDITIONAL([am__fastdep$1], [
559 test "x$enable_dependency_tracking" != xno \
560 && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
566 # Choose a directory name for dependency files.
567 # This macro is AC_REQUIREd in _AM_DEPENDENCIES
568 AC_DEFUN([AM_SET_DEPDIR],
569 [rm -f .deps 2>/dev/null
570 mkdir .deps 2>/dev/null
571 if test -d .deps; then
574 # MS-DOS does not allow filenames that begin with a dot.
577 rmdir .deps 2>/dev/null
584 AC_DEFUN([AM_DEP_TRACK],
585 [AC_ARG_ENABLE(dependency-tracking,
586 [ --disable-dependency-tracking Speeds up one-time builds
587 --enable-dependency-tracking Do not reject slow dependency extractors])
588 if test "x$enable_dependency_tracking" != xno; then
589 am_depcomp="$ac_aux_dir/depcomp"
592 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
593 AC_SUBST([AMDEPBACKSLASH])
596 # Generate code to set up dependency tracking. -*- Autoconf -*-
598 # Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
600 # This program is free software; you can redistribute it and/or modify
601 # it under the terms of the GNU General Public License as published by
602 # the Free Software Foundation; either version 2, or (at your option)
605 # This program is distributed in the hope that it will be useful,
606 # but WITHOUT ANY WARRANTY; without even the implied warranty of
607 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
608 # GNU General Public License for more details.
610 # You should have received a copy of the GNU General Public License
611 # along with this program; if not, write to the Free Software
612 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
617 # _AM_OUTPUT_DEPENDENCY_COMMANDS
618 # ------------------------------
619 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
620 [for mf in $CONFIG_FILES; do
621 # Strip MF so we end up with the name of the file.
622 mf=`echo "$mf" | sed -e 's/:.*$//'`
623 # Check whether this is an Automake generated Makefile or not.
624 # We used to match only the files named `Makefile.in', but
625 # some people rename them; so instead we look at the file content.
626 # Grep'ing the first line is not enough: some people post-process
627 # each Makefile.in and add a new line on top of each file to say so.
628 # So let's grep whole file.
629 if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
630 dirpart=`AS_DIRNAME("$mf")`
634 grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
635 # Extract the definition of DEP_FILES from the Makefile without
637 DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
638 test -z "$DEPDIR" && continue
639 # When using ansi2knr, U may be empty or an underscore; expand it
640 U=`sed -n -e '/^U = / s///p' < "$mf"`
641 test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
642 # We invoke sed twice because it is the simplest approach to
643 # changing $(DEPDIR) to its actual value in the expansion.
644 for file in `sed -n -e '
645 /^DEP_FILES = .*\\\\$/ {
654 /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
655 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
656 # Make sure the directory exists.
657 test -f "$dirpart/$file" && continue
658 fdir=`AS_DIRNAME(["$file"])`
659 AS_MKDIR_P([$dirpart/$fdir])
660 # echo "creating $dirpart/$file"
661 echo '# dummy' > "$dirpart/$file"
664 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
667 # AM_OUTPUT_DEPENDENCY_COMMANDS
668 # -----------------------------
669 # This macro should only be invoked once -- use via AC_REQUIRE.
671 # This code is only required when automatic dependency tracking
672 # is enabled. FIXME. This creates each `.P' file that we will
673 # need in order to bootstrap the dependency handling code.
674 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
675 [AC_CONFIG_COMMANDS([depfiles],
676 [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
677 [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
680 # Check to see how 'make' treats includes. -*- Autoconf -*-
682 # Copyright (C) 2001, 2002 Free Software Foundation, Inc.
684 # This program is free software; you can redistribute it and/or modify
685 # it under the terms of the GNU General Public License as published by
686 # the Free Software Foundation; either version 2, or (at your option)
689 # This program is distributed in the hope that it will be useful,
690 # but WITHOUT ANY WARRANTY; without even the implied warranty of
691 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
692 # GNU General Public License for more details.
694 # You should have received a copy of the GNU General Public License
695 # along with this program; if not, write to the Free Software
696 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
703 # Check to see how make treats includes.
704 AC_DEFUN([AM_MAKE_INCLUDE],
705 [am_make=${MAKE-make}
706 cat > confinc << 'END'
710 # If we don't find an include directive, just comment out the code.
711 AC_MSG_CHECKING([for style of include used by $am_make])
715 # First try GNU make style include.
716 echo "include confinc" > confmf
717 # We grep out `Entering directory' and `Leaving directory'
718 # messages which can occur if `w' ends up in MAKEFLAGS.
719 # In particular we don't look at `^make:' because GNU make might
720 # be invoked under some other name (usually "gmake"), in which
721 # case it prints its new name instead of `make'.
722 if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
727 # Now try BSD make style include.
728 if test "$am__include" = "#"; then
729 echo '.include "confinc"' > confmf
730 if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
736 AC_SUBST(am__include)
738 AC_MSG_RESULT($_am_result)
742 # AM_CONDITIONAL -*- Autoconf -*-
744 # Copyright 1997, 2000, 2001 Free Software Foundation, Inc.
746 # This program is free software; you can redistribute it and/or modify
747 # it under the terms of the GNU General Public License as published by
748 # the Free Software Foundation; either version 2, or (at your option)
751 # This program is distributed in the hope that it will be useful,
752 # but WITHOUT ANY WARRANTY; without even the implied warranty of
753 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
754 # GNU General Public License for more details.
756 # You should have received a copy of the GNU General Public License
757 # along with this program; if not, write to the Free Software
758 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
765 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
766 # -------------------------------------
767 # Define a conditional.
768 AC_DEFUN([AM_CONDITIONAL],
769 [ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
770 [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
780 AC_CONFIG_COMMANDS_PRE(
781 [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
782 AC_MSG_ERROR([conditional "$1" was never defined.
783 Usually this means the macro was only invoked conditionally.])
788 dnl From Jim Meyering.
789 dnl Find a new-enough version of Perl.
794 dnl FIXME: don't hard-code 5.003
795 dnl FIXME: should we cache the result?
796 AC_MSG_CHECKING([for perl5.003 or newer])
797 if test "${PERL+set}" = set; then
798 # `PERL' is set in the user's environment.
799 candidate_perl_names="$PERL"
802 candidate_perl_names='perl perl5'
808 PERL="$missing_dir/missing perl"
809 for perl in $candidate_perl_names; do
810 # Run test in a subshell; some versions of sh will print an error if
811 # an executable is not found, even if stderr is redirected.
812 if ( $perl -e 'require 5.003; use File::Compare' ) > /dev/null 2>&1; then
819 AC_MSG_RESULT($found)
820 test $found = no && AC_MSG_WARN([
821 WARNING: You don't seem to have perl5.003 or newer installed, or you lack
822 a usable version of the Perl File::Compare module. As a result,
823 you may be unable to run a few tests or to regenerate certain
824 files if you modify the sources from which they are derived.
828 #serial 58 -*- autoconf -*-
830 dnl Misc type-related macros for fileutils, sh-utils, textutils.
832 AC_DEFUN([jm_MACROS],
836 GNU_PACKAGE="GNU $PACKAGE"
837 AC_DEFINE_UNQUOTED(GNU_PACKAGE, "$GNU_PACKAGE",
838 [The concatenation of the strings `GNU ', and PACKAGE.])
839 AC_SUBST(GNU_PACKAGE)
841 AM_MISSING_PROG(HELP2MAN, help2man)
842 AC_SUBST(OPTIONAL_BIN_PROGS)
843 AC_SUBST(OPTIONAL_BIN_ZCRIPTS)
847 dnl This macro actually runs replacement code. See isc-posix.m4.
848 AC_REQUIRE([AC_ISC_POSIX])dnl
851 jm_INCLUDED_REGEX([lib/regex.c])
853 AC_REQUIRE([UTILS_HOST_OS])
854 AC_REQUIRE([UTILS_FUNC_MKDIR_TRAILING_SLASH])
855 AC_REQUIRE([jm_BISON])
856 AC_REQUIRE([jm_ASSERT])
857 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_UTIMBUF])
858 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE])
859 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_INO])
860 AC_REQUIRE([jm_CHECK_DECLS])
862 AC_REQUIRE([jm_PREREQ])
864 AC_REQUIRE([UTILS_FUNC_DIRFD])
865 AC_REQUIRE([AC_FUNC_ACL])
866 AC_REQUIRE([AC_FUNC_FTW])
867 AC_REQUIRE([jm_FUNC_LCHOWN])
868 AC_REQUIRE([fetish_FUNC_RMDIR_NOTEMPTY])
869 AC_REQUIRE([jm_FUNC_CHOWN])
870 AC_REQUIRE([jm_FUNC_MKTIME])
871 AC_REQUIRE([jm_FUNC_LSTAT])
872 AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
873 AC_REQUIRE([jm_FUNC_STAT])
874 AC_REQUIRE([AC_FUNC_REALLOC])
875 AC_REQUIRE([AC_FUNC_MALLOC])
876 AC_REQUIRE([AC_FUNC_STRERROR_R])
877 AC_REQUIRE([jm_FUNC_NANOSLEEP])
878 AC_REQUIRE([jm_FUNC_MEMCMP])
879 AC_REQUIRE([jm_FUNC_GLIBC_UNLOCKED_IO])
880 AC_REQUIRE([AC_FUNC_FNMATCH_GNU])
881 AC_REQUIRE([jm_FUNC_GROUP_MEMBER])
882 AC_REQUIRE([jm_FUNC_PUTENV])
884 AC_REQUIRE([jm_AC_PREREQ_XSTRTOUMAX])
885 AC_REQUIRE([jm_AC_PREREQ_XSTRTOIMAX])
886 AC_REQUIRE([jm_AC_FUNC_LINK_FOLLOWS_SYMLINK])
887 AC_REQUIRE([AC_FUNC_ERROR_AT_LINE])
888 AC_REQUIRE([jm_FUNC_GNU_STRFTIME])
889 AC_REQUIRE([jm_FUNC_MKTIME])
890 AC_REQUIRE([jm_FUNC_FPENDING])
891 AC_REQUIRE([AC_SYS_MMAP_STACK])
893 # This is for od and stat, and any other program that
894 # uses the PRI.MAX macros from inttypes.h.
895 AC_REQUIRE([gt_INTTYPES_PRI])
897 AC_REQUIRE([jm_FUNC_GETGROUPS])
899 AC_REQUIRE([AC_FUNC_FSEEKO])
900 AC_REQUIRE([AC_FUNC_VPRINTF])
901 AC_REQUIRE([AC_FUNC_ALLOCA])
903 AC_CONFIG_LIBOBJ_DIR([lib])
906 AC_REQUIRE([jm_SYS_PROC_UPTIME])
907 AC_REQUIRE([jm_FUNC_FTRUNCATE])
908 AC_REQUIRE([vb_FUNC_RENAME])
910 AC_REPLACE_FUNCS(strcasecmp strncasecmp)
911 AC_REPLACE_FUNCS(dup2)
912 AC_REPLACE_FUNCS(gethostname getusershell)
913 AC_REPLACE_FUNCS(sig2str)
914 AC_REPLACE_FUNCS(strcspn stpcpy strstr strtol strtoul)
915 AC_REPLACE_FUNCS(strpbrk)
916 AC_REPLACE_FUNCS(euidaccess memcmp rmdir rpmatch strndup strverscmp)
917 AC_REPLACE_FUNCS(atexit)
918 AC_REPLACE_FUNCS(getpass)
920 # raise is used by at least sort and ls.
921 AC_REPLACE_FUNCS(raise)
923 dnl used by e.g. intl/*domain.c and lib/canon-host.c
924 AC_REPLACE_FUNCS(strdup)
926 AC_REPLACE_FUNCS(memchr memcpy memmove memrchr memset)
927 AC_CHECK_FUNCS(getpagesize)
929 AC_REQUIRE([UTILS_FUNC_MKSTEMP])
931 # By default, argmatch should fail calling usage (1).
932 AC_DEFINE(ARGMATCH_DIE, [usage (1)],
933 [Define to the function xargmatch calls on failures.])
934 AC_DEFINE(ARGMATCH_DIE_DECL, [extern void usage ()],
935 [Define to the declaration of the xargmatch failure function.])
937 dnl Used to define SETVBUF in sys2.h.
938 dnl This evokes the following warning from autoconf:
939 dnl ...: warning: AC_TRY_RUN called without default to allow cross compiling
940 AC_FUNC_SETVBUF_REVERSED
942 # used by sleep and shred
943 # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
944 # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
946 # Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all*
947 # programs in the package would end up linked with that potentially-shared
948 # library, inducing unnecessary run-time overhead.
949 fetish_saved_libs=$LIBS
950 AC_SEARCH_LIBS(clock_gettime, [rt posix4],
951 [LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
952 AC_SUBST(LIB_CLOCK_GETTIME)
953 AC_CHECK_FUNCS(clock_gettime clock_settime)
954 LIBS=$fetish_saved_libs
955 AC_CHECK_FUNCS(gettimeofday)
956 AC_FUNC_GETTIMEOFDAY_CLOBBER
958 AC_REQUIRE([AC_FUNC_CLOSEDIR_VOID])
959 AC_REQUIRE([jm_FUNC_UTIME])
993 AC_CHECK_FUNCS(setreuid setregid)
996 if test $am_cv_func_working_getline != yes; then
997 AC_CHECK_FUNCS(getdelim)
1002 AC_REQUIRE([UTILS_SYS_OPEN_MAX])
1004 # See if linking `seq' requires -lm.
1005 # It does on nearly every system. The single exception (so far) is
1006 # BeOS which has all the math functions in the normal runtime library
1007 # and doesn't have a separate math library.
1015 AC_TRY_LINK([#include <math.h>], $ac_seq_body, ,
1016 [ac_seq_save_LIBS="$LIBS"
1018 AC_TRY_LINK([#include <math.h>], $ac_seq_body, SEQ_LIBM=-lm)
1019 LIBS="$ac_seq_save_LIBS"
1025 jm_FUNC_UNLINK_BUSY_TEXT
1027 # These tests are for df.
1028 jm_LIST_MOUNTED_FILESYSTEMS([list_mounted_fs=yes], [list_mounted_fs=no])
1030 jm_FILE_SYSTEM_USAGE([space=yes], [space=no])
1031 if test $list_mounted_fs = yes && test $space = yes; then
1034 AC_LIBOBJ(mountlist)
1036 AC_REQUIRE([jm_AC_DOS])
1037 AC_REQUIRE([AC_FUNC_CANONICALIZE_FILE_NAME])
1041 # These tests must be run before any use of AC_CHECK_TYPE,
1042 # because that macro compiles code that tests e.g., HAVE_UNISTD_H.
1043 # See the definition of ac_includes_default in `configure'.
1044 AC_DEFUN([jm_CHECK_ALL_HEADERS],
1087 # This macro must be invoked before any tests that run the compiler.
1088 AC_DEFUN([jm_CHECK_ALL_TYPES],
1090 dnl This test must come as early as possible after the compiler configuration
1091 dnl tests, because the choice of the file model can (in principle) affect
1092 dnl whether functions and headers are available, whether they work, etc.
1093 AC_REQUIRE([AC_SYS_LARGEFILE])
1095 dnl This test must precede tests of compiler characteristics like
1096 dnl that for the inline keyword, since it may change the degree to
1097 dnl which the compiler supports such features.
1098 AC_REQUIRE([AM_C_PROTOTYPES])
1100 dnl Checks for typedefs, structures, and compiler characteristics.
1101 AC_REQUIRE([AC_C_BIGENDIAN])
1102 AC_REQUIRE([AC_C_CONST])
1103 AC_REQUIRE([AC_C_VOLATILE])
1104 AC_REQUIRE([AC_C_INLINE])
1105 AC_REQUIRE([AC_C_LONG_DOUBLE])
1107 AC_REQUIRE([jm_CHECK_ALL_HEADERS])
1108 AC_REQUIRE([AC_HEADER_DIRENT])
1109 AC_REQUIRE([AC_HEADER_STDC])
1111 [struct stat.st_author,
1112 struct stat.st_blksize],,,
1113 [$ac_includes_default
1114 #include <sys/stat.h>
1116 AC_REQUIRE([AC_STRUCT_ST_BLOCKS])
1118 AC_REQUIRE([AC_STRUCT_TM])
1119 AC_REQUIRE([AC_STRUCT_TIMEZONE])
1120 AC_REQUIRE([AC_HEADER_STAT])
1121 AC_REQUIRE([AC_STRUCT_ST_MTIM_NSEC])
1122 AC_REQUIRE([AC_STRUCT_ST_DM_MODE])
1123 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_TIMESPEC])
1125 AC_REQUIRE([AC_TYPE_GETGROUPS])
1126 AC_REQUIRE([AC_TYPE_MODE_T])
1127 AC_REQUIRE([AC_TYPE_OFF_T])
1128 AC_REQUIRE([AC_TYPE_PID_T])
1129 AC_REQUIRE([AC_TYPE_SIGNAL])
1130 AC_REQUIRE([AC_TYPE_SIZE_T])
1131 AC_REQUIRE([AC_TYPE_UID_T])
1132 AC_CHECK_TYPE(ino_t, unsigned long)
1134 dnl This relies on the fact that autoconf 2.14a's implementation of
1135 dnl AC_CHECK_TYPE checks includes unistd.h.
1136 AC_CHECK_TYPE(ssize_t, int)
1137 AC_CHECK_TYPE(major_t, unsigned int)
1138 AC_CHECK_TYPE(minor_t, unsigned int)
1140 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
1141 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
1143 AC_REQUIRE([AC_HEADER_MAJOR])
1144 AC_REQUIRE([AC_HEADER_DIRENT])
1148 # isc-posix.m4 serial 2 (gettext-0.11.2)
1149 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
1150 dnl This file is free software, distributed under the terms of the GNU
1151 dnl General Public License. As a special exception to the GNU General
1152 dnl Public License, this file may be distributed as part of a program
1153 dnl that contains a configuration script generated by Autoconf, under
1154 dnl the same distribution terms as the rest of that program.
1156 # This file is not needed with autoconf-2.53 and newer. Remove it in 2005.
1158 # This test replaces the one in autoconf.
1159 # Currently this macro should have the same name as the autoconf macro
1160 # because gettext's gettext.m4 (distributed in the automake package)
1161 # still uses it. Otherwise, the use in gettext.m4 makes autoheader
1162 # give these diagnostics:
1163 # configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
1164 # configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
1166 undefine([AC_ISC_POSIX])
1168 AC_DEFUN([AC_ISC_POSIX],
1170 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
1171 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
1177 dnl Initially derived from code in GNU grep.
1178 dnl Mostly written by Jim Meyering.
1180 dnl Usage: jm_INCLUDED_REGEX([lib/regex.c])
1182 AC_DEFUN([jm_INCLUDED_REGEX],
1184 dnl Even packages that don't use regex.c can use this macro.
1185 dnl Of course, for them it doesn't do anything.
1187 # Assume we'll default to using the included regex.c.
1188 ac_use_included_regex=yes
1190 # However, if the system regex support is good enough that it passes the
1191 # the following run test, then default to *not* using the included regex.c.
1192 # If cross compiling, assume the test would fail and use the included
1193 # regex.c. The first failing regular expression is from `Spencer ere
1194 # test #75' in grep-2.3.
1195 AC_CACHE_CHECK([for working re_compile_pattern],
1196 jm_cv_func_working_re_compile_pattern,
1204 static struct re_pattern_buffer regex;
1206 struct re_registers regs;
1207 re_set_syntax (RE_SYNTAX_POSIX_EGREP);
1208 memset (®ex, 0, sizeof (regex));
1209 [s = re_compile_pattern ("a[[:@:>@:]]b\n", 9, ®ex);]
1210 /* This should fail with _Invalid character class name_ error. */
1214 /* This should succeed, but doesn't for e.g. glibc-2.1.3. */
1215 memset (®ex, 0, sizeof (regex));
1216 s = re_compile_pattern ("{1", 2, ®ex);
1221 /* The following example is derived from a problem report
1222 against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */
1223 memset (®ex, 0, sizeof (regex));
1224 s = re_compile_pattern ("[[anù]]*n", 7, ®ex);
1228 /* This should match, but doesn't for e.g. glibc-2.2.1. */
1229 if (re_match (®ex, "an", 2, 0, ®s) != 2)
1232 memset (®ex, 0, sizeof (regex));
1233 s = re_compile_pattern ("x", 1, ®ex);
1237 /* The version of regex.c in e.g. GNU libc-2.2.93 didn't
1238 work with a negative RANGE argument. */
1239 if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1)
1245 jm_cv_func_working_re_compile_pattern=yes,
1246 jm_cv_func_working_re_compile_pattern=no,
1247 dnl When crosscompiling, assume it's broken.
1248 jm_cv_func_working_re_compile_pattern=no))
1249 if test $jm_cv_func_working_re_compile_pattern = yes; then
1250 ac_use_included_regex=no
1253 test -n "$1" || AC_MSG_ERROR([missing argument])
1254 m4_syscmd([test -f $1])
1255 ifelse(m4_sysval, 0,
1257 AC_ARG_WITH(included-regex,
1258 [ --without-included-regex don't compile regex; this is the default on
1259 systems with version 2 of the GNU C library
1260 (use with caution on other system)],
1261 jm_with_regex=$withval,
1262 jm_with_regex=$ac_use_included_regex)
1263 if test "$jm_with_regex" = yes; then
1272 # Prerequisites of lib/regex.c.
1273 AC_DEFUN([jm_PREREQ_REGEX],
1275 dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it.
1276 dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary
1279 dnl Persuade glibc <string.h> to declare mempcpy().
1280 AC_REQUIRE([AC_GNU_SOURCE])
1282 AC_REQUIRE([ACX_C_RESTRICT])
1283 AC_REQUIRE([AC_FUNC_ALLOCA])
1284 AC_REQUIRE([AC_HEADER_STDC])
1285 AC_CHECK_HEADERS_ONCE(limits.h string.h wchar.h wctype.h)
1286 AC_CHECK_FUNCS_ONCE(isascii mempcpy)
1287 AC_CHECK_FUNCS(btowc)
1291 dnl based on acx_restrict.m4, from the GNU Autoconf Macro Archive at:
1292 dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_restrict.html
1294 # Determine whether the C/C++ compiler supports the "restrict" keyword
1295 # introduced in ANSI C99, or an equivalent. Do nothing if the compiler
1296 # accepts it. Otherwise, if the compiler supports an equivalent (like
1297 # gcc's __restrict__) define "restrict" to be that. Otherwise, define
1298 # "restrict" to be empty.
1300 AC_DEFUN([ACX_C_RESTRICT],
1301 [AC_CACHE_CHECK([for C/C++ restrict keyword], acx_cv_c_restrict,
1302 [acx_cv_c_restrict=no
1303 # Try the official restrict keyword, then gcc's __restrict__.
1304 for acx_kw in restrict __restrict__; do
1305 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1306 [float * $acx_kw x;])],
1307 [acx_cv_c_restrict=$acx_kw; break])
1310 case $acx_cv_c_restrict in
1312 no) AC_DEFINE(restrict,,
1313 [Define to equivalent of C99 restrict keyword, or to nothing if this
1314 is not supported. Do not define if restrict is supported directly.]) ;;
1315 *) AC_DEFINE_UNQUOTED(restrict, $acx_cv_c_restrict) ;;
1319 # onceonly.m4 serial 1
1320 dnl Copyright (C) 2002 Free Software Foundation, Inc.
1321 dnl This file is free software, distributed under the terms of the GNU
1322 dnl General Public License. As a special exception to the GNU General
1323 dnl Public License, this file may be distributed as part of a program
1324 dnl that contains a configuration script generated by Autoconf, under
1325 dnl the same distribution terms as the rest of that program.
1327 dnl This file defines some "once only" variants of standard autoconf macros.
1328 dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS
1329 dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS
1330 dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS
1331 dnl AC_REQUIRE([AC_HEADER_STDC]) like AC_HEADER_STDC
1332 dnl The advantage is that the check for each of the headers/functions/decls
1333 dnl will be put only once into the 'configure' file. It keeps the size of
1334 dnl the 'configure' file down, and avoids redundant output when 'configure'
1336 dnl The drawback is that the checks cannot be conditionalized. If you write
1337 dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi
1338 dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to
1339 dnl empty, and the check will be inserted before the body of the AC_DEFUNed
1342 # AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
1343 # AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
1344 AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
1346 AC_FOREACH([gl_HEADER_NAME], [$1], [
1347 AC_DEFUN([gl_CHECK_HEADER_]translit(gl_HEADER_NAME,[./-], [___]), [
1348 AC_CHECK_HEADERS(gl_HEADER_NAME)
1350 AC_REQUIRE([gl_CHECK_HEADER_]translit(gl_HEADER_NAME,[./-], [___]))
1354 # AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of
1355 # AC_CHECK_FUNCS(FUNC1 FUNC2 ...).
1356 AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
1358 AC_FOREACH([gl_FUNC_NAME], [$1], [
1359 AC_DEFUN([gl_CHECK_FUNC_]gl_FUNC_NAME, [
1360 AC_CHECK_FUNCS(gl_FUNC_NAME)
1362 AC_REQUIRE([gl_CHECK_FUNC_]gl_FUNC_NAME)
1366 # AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of
1367 # AC_CHECK_DECLS(DECL1, DECL2, ...).
1368 AC_DEFUN([AC_CHECK_DECLS_ONCE], [
1370 AC_FOREACH([gl_DECL_NAME], [$1], [
1371 AC_DEFUN([gl_CHECK_DECL_]gl_DECL_NAME, [
1372 AC_CHECK_DECLS(gl_DECL_NAME)
1374 AC_REQUIRE([gl_CHECK_DECL_]gl_DECL_NAME)
1380 dnl From Paul Eggert.
1382 # Define HOST_OPERATING_SYSTEM to a name for the host operating system.
1383 AC_DEFUN([UTILS_HOST_OS],
1385 AC_CACHE_CHECK([host operating system],
1386 utils_cv_host_operating_system,
1390 # These operating system names do not use the default heuristic below.
1391 # They are in reverse order, so that more-specific prefixes come first.
1392 winnt*) os='Windows NT';;
1394 sysv*) os='Unix System V';;
1395 superux*) os='SUPER-UX';;
1396 sunos*) os='SunOS';;
1398 sco*) os='SCO Unix';;
1399 riscos*) os='RISC OS';;
1400 riscix*) os='RISCiX';;
1404 plan9*) os='Plan 9';;
1407 openbsd*) os='OpenBSD';;
1408 nsk*) os='NonStop Kernel';;
1409 nonstopux*) os='NonStop-UX';;
1410 netbsd*) os='NetBSD';;
1411 msdosdjgpp*) os='DJGPP';;
1412 mpeix*) os='MPE/iX';;
1414 mingw*) os='MinGW';;
1415 lynxos*) os='LynxOS';;
1416 linux*) os='GNU/Linux';;
1420 freebsd*-gnu*) os='GNU/FreeBSD';;
1421 freebsd*) os='FreeBSD';;
1423 bsdi*) os='BSD/OS';;
1427 atheos*) os='AtheOS';;
1428 amigaos*) os='Amiga OS';;
1431 # The default heuristic takes the initial alphabetic string
1432 # from $host_os, but capitalizes its first letter.
1435 expr "X$host_os" : 'X\([A-Za-z]\)' | tr '[a-z]' '[A-Z]'
1437 expr "X$host_os" : 'X.\([A-Za-z]*\)'
1441 # If $host_os does not start with an alphabetic string, use it unchanged.
1445 utils_cv_host_operating_system=$os]])
1446 AC_DEFINE_UNQUOTED(HOST_OPERATING_SYSTEM,
1447 "$utils_cv_host_operating_system",
1448 [The host operating system.])
1453 # On some systems, mkdir ("foo/", 0700) fails because of the trailing slash.
1454 # On such systems, arrange to use a wrapper function that removes any
1456 AC_DEFUN([UTILS_FUNC_MKDIR_TRAILING_SLASH],
1458 AC_CACHE_CHECK([whether mkdir fails due to a trailing slash],
1459 utils_cv_func_mkdir_trailing_slash_bug,
1461 # Arrange for deletion of the temporary directory this test might create.
1462 ac_clean_files="$ac_clean_files confdir-slash"
1464 # include <sys/types.h>
1465 # include <sys/stat.h>
1466 # include <stdlib.h>
1469 rmdir ("confdir-slash");
1470 exit (mkdir ("confdir-slash/", 0700));
1473 utils_cv_func_mkdir_trailing_slash_bug=no,
1474 utils_cv_func_mkdir_trailing_slash_bug=yes,
1475 utils_cv_func_mkdir_trailing_slash_bug=yes
1480 if test $utils_cv_func_mkdir_trailing_slash_bug = yes; then
1482 AC_DEFINE(mkdir, rpl_mkdir,
1483 [Define to rpl_mkdir if the replacement function should be used.])
1489 AC_DEFUN([jm_BISON],
1491 # getdate.y works with bison only.
1492 : ${YACC='bison -y'}
1497 dnl based on code from Eleftherios Gkioulekas
1499 AC_DEFUN([jm_ASSERT],
1501 AC_MSG_CHECKING(whether to enable assertions)
1502 AC_ARG_ENABLE(assert,
1503 [ --disable-assert turn off assertions],
1505 AC_DEFINE(NDEBUG,1,[Define to 1 if assertions should be disabled.]) ],
1506 [ AC_MSG_RESULT(yes) ]
1512 dnl From Jim Meyering
1514 dnl Define HAVE_STRUCT_UTIMBUF if `struct utimbuf' is declared --
1515 dnl usually in <utime.h>.
1516 dnl Some systems have utime.h but don't declare the struct anywhere.
1518 AC_DEFUN([jm_CHECK_TYPE_STRUCT_UTIMBUF],
1520 AC_CHECK_HEADERS(utime.h)
1521 AC_REQUIRE([AC_HEADER_TIME])
1522 AC_CACHE_CHECK([for struct utimbuf], fu_cv_sys_struct_utimbuf,
1525 #ifdef TIME_WITH_SYS_TIME
1526 # include <sys/time.h>
1529 # ifdef HAVE_SYS_TIME_H
1530 # include <sys/time.h>
1539 [static struct utimbuf x; x.actime = x.modtime;],
1540 fu_cv_sys_struct_utimbuf=yes,
1541 fu_cv_sys_struct_utimbuf=no)
1544 if test $fu_cv_sys_struct_utimbuf = yes; then
1545 AC_DEFINE(HAVE_STRUCT_UTIMBUF, 1,
1546 [Define if struct utimbuf is declared -- usually in <utime.h>.
1547 Some systems have utime.h but don't declare the struct anywhere. ])
1553 dnl From Jim Meyering.
1555 dnl Check whether struct dirent has a member named d_type.
1558 AC_DEFUN([jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE],
1559 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
1560 AC_CACHE_CHECK([for d_type member in directory struct],
1561 jm_cv_struct_dirent_d_type,
1564 #include <sys/types.h>
1565 #ifdef HAVE_DIRENT_H
1566 # include <dirent.h>
1567 #else /* not HAVE_DIRENT_H */
1568 # define dirent direct
1569 # ifdef HAVE_SYS_NDIR_H
1570 # include <sys/ndir.h>
1571 # endif /* HAVE_SYS_NDIR_H */
1572 # ifdef HAVE_SYS_DIR_H
1573 # include <sys/dir.h>
1574 # endif /* HAVE_SYS_DIR_H */
1577 # endif /* HAVE_NDIR_H */
1578 #endif /* HAVE_DIRENT_H */
1580 [struct dirent dp; dp.d_type = 0;],
1582 jm_cv_struct_dirent_d_type=yes,
1583 jm_cv_struct_dirent_d_type=no)
1586 if test $jm_cv_struct_dirent_d_type = yes; then
1587 AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE, 1,
1588 [Define if there is a member named d_type in the struct describing
1589 directory headers.])
1596 dnl From Jim Meyering.
1598 dnl Check whether struct dirent has a member named d_ino.
1601 AC_DEFUN([jm_CHECK_TYPE_STRUCT_DIRENT_D_INO],
1602 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
1603 AC_CACHE_CHECK([for d_ino member in directory struct],
1604 jm_cv_struct_dirent_d_ino,
1607 #include <sys/types.h>
1608 #ifdef HAVE_DIRENT_H
1609 # include <dirent.h>
1610 #else /* not HAVE_DIRENT_H */
1611 # define dirent direct
1612 # ifdef HAVE_SYS_NDIR_H
1613 # include <sys/ndir.h>
1614 # endif /* HAVE_SYS_NDIR_H */
1615 # ifdef HAVE_SYS_DIR_H
1616 # include <sys/dir.h>
1617 # endif /* HAVE_SYS_DIR_H */
1620 # endif /* HAVE_NDIR_H */
1621 #endif /* HAVE_DIRENT_H */
1623 [struct dirent dp; dp.d_ino = 0;],
1625 jm_cv_struct_dirent_d_ino=yes,
1626 jm_cv_struct_dirent_d_ino=no)
1629 if test $jm_cv_struct_dirent_d_ino = yes; then
1630 AC_DEFINE(D_INO_IN_DIRENT, 1,
1631 [Define if there is a member named d_ino in the struct describing
1632 directory headers.])
1639 dnl This is just a wrapper function to encapsulate this kludge.
1640 dnl Putting it in a separate file like this helps share it between
1641 dnl different packages.
1642 AC_DEFUN([jm_CHECK_DECLS],
1644 AC_REQUIRE([_jm_DECL_HEADERS])
1645 AC_REQUIRE([AC_HEADER_TIME])
1649 # if !STDC_HEADERS && HAVE_MEMORY_H
1650 # include <memory.h>
1652 # include <string.h>
1655 # include <strings.h>
1659 # include <stdlib.h>
1662 # include <unistd.h>
1665 #include <sys/types.h>
1666 #if TIME_WITH_SYS_TIME
1667 # include <sys/time.h>
1670 # if HAVE_SYS_TIME_H
1671 # include <sys/time.h>
1712 ttyname], , , $headers)
1715 dnl FIXME: when autoconf has support for it.
1716 dnl This is a little helper so we can require these header checks.
1717 AC_DEFUN([_jm_DECL_HEADERS],
1719 AC_REQUIRE([AC_HEADER_STDC])
1720 AC_CHECK_HEADERS(grp.h memory.h pwd.h string.h strings.h stdlib.h \
1721 unistd.h sys/time.h utmp.h utmpx.h)
1726 dnl We use jm_ for non Autoconf macros.
1727 m4_pattern_forbid([^jm_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
1729 # These are the prerequisite macros for files in the lib/
1730 # directory of the coreutils package.
1732 AC_DEFUN([jm_PREREQ],
1734 AC_REQUIRE([jm_PREREQ_ADDEXT])
1735 AC_REQUIRE([jm_PREREQ_C_STACK])
1736 AC_REQUIRE([jm_PREREQ_CANON_HOST])
1737 AC_REQUIRE([jm_PREREQ_DIRNAME])
1738 AC_REQUIRE([jm_PREREQ_ERROR])
1739 AC_REQUIRE([jm_PREREQ_EXCLUDE])
1740 AC_REQUIRE([jm_PREREQ_GETPAGESIZE])
1741 AC_REQUIRE([jm_PREREQ_HARD_LOCALE])
1742 AC_REQUIRE([jm_PREREQ_HASH])
1743 AC_REQUIRE([jm_PREREQ_HUMAN])
1744 AC_REQUIRE([jm_PREREQ_MBSWIDTH])
1745 AC_REQUIRE([jm_PREREQ_MEMCHR])
1746 AC_REQUIRE([jm_PREREQ_PHYSMEM])
1747 AC_REQUIRE([jm_PREREQ_POSIXVER])
1748 AC_REQUIRE([jm_PREREQ_QUOTEARG])
1749 AC_REQUIRE([jm_PREREQ_READUTMP])
1750 AC_REQUIRE([jm_PREREQ_STAT])
1751 AC_REQUIRE([jm_PREREQ_STRNLEN])
1752 AC_REQUIRE([jm_PREREQ_TEMPNAME]) # called by mkstemp
1753 AC_REQUIRE([jm_PREREQ_XGETCWD])
1754 AC_REQUIRE([jm_PREREQ_XREADLINK])
1757 AC_DEFUN([jm_PREREQ_ADDEXT],
1760 AC_REQUIRE([AC_SYS_LONG_FILE_NAMES])
1761 AC_CHECK_FUNCS(pathconf)
1762 AC_CHECK_HEADERS(limits.h string.h unistd.h)
1765 AC_DEFUN([jm_PREREQ_CANON_HOST],
1767 dnl Add any libraries as early as possible.
1768 dnl In particular, inet_ntoa needs -lnsl at least on Solaris5.5.1,
1769 dnl so we have to add -lnsl to LIBS before checking for that function.
1770 AC_SEARCH_LIBS(gethostbyname, [inet nsl])
1772 dnl These come from -lnsl on Solaris5.5.1.
1773 AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
1775 AC_CHECK_HEADERS(unistd.h string.h netdb.h sys/socket.h \
1776 netinet/in.h arpa/inet.h)
1779 AC_DEFUN([jm_PREREQ_DIRNAME],
1781 AC_REQUIRE([AC_HEADER_STDC])
1782 AC_CHECK_HEADERS(string.h)
1785 AC_DEFUN([jm_PREREQ_EXCLUDE],
1787 AC_REQUIRE([AC_FUNC_FNMATCH_GNU])
1788 AC_REQUIRE([AC_HEADER_STDBOOL])
1791 AC_DEFUN([jm_PREREQ_GETPAGESIZE],
1793 AC_CHECK_FUNCS(getpagesize)
1794 AC_CHECK_HEADERS(OS.h unistd.h)
1797 AC_DEFUN([jm_PREREQ_HARD_LOCALE],
1799 AC_CHECK_HEADERS(locale.h stdlib.h string.h)
1800 AC_CHECK_FUNCS(setlocale)
1801 AC_REQUIRE([AM_C_PROTOTYPES])
1804 AC_DEFUN([jm_PREREQ_HASH],
1806 AC_CHECK_HEADERS(stdlib.h)
1807 AC_REQUIRE([AC_HEADER_STDBOOL])
1808 AC_REQUIRE([jm_CHECK_DECLS])
1811 # If you use human.c, you need the following files:
1812 # inttypes.m4 longlong.m4
1813 AC_DEFUN([jm_PREREQ_HUMAN],
1815 AC_CHECK_HEADERS(locale.h)
1816 AC_CHECK_DECLS([getenv])
1817 AC_CHECK_FUNCS(localeconv)
1818 AC_REQUIRE([AC_HEADER_STDBOOL])
1819 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
1822 AC_DEFUN([jm_PREREQ_MEMCHR],
1824 AC_CHECK_HEADERS(limits.h stdlib.h bp-sym.h)
1827 AC_DEFUN([jm_PREREQ_PHYSMEM],
1829 AC_CHECK_HEADERS(sys/pstat.h unistd.h sys/sysmp.h)
1830 AC_CHECK_FUNCS(pstat_getstatic pstat_getdynamic)
1833 AC_DEFUN([jm_PREREQ_POSIXVER],
1835 AC_CHECK_HEADERS(unistd.h)
1836 AC_CHECK_DECLS([getenv])
1839 AC_DEFUN([jm_PREREQ_QUOTEARG],
1841 AC_CHECK_FUNCS(isascii iswprint)
1842 AC_REQUIRE([jm_FUNC_MBRTOWC])
1843 AC_REQUIRE([jm_FUNC_MEMCMP])
1844 AC_CHECK_HEADERS(limits.h stddef.h stdlib.h string.h wchar.h wctype.h)
1845 AC_REQUIRE([AC_HEADER_STDC])
1846 AC_REQUIRE([AC_C_BACKSLASH_A])
1847 AC_REQUIRE([AC_TYPE_MBSTATE_T])
1848 AC_REQUIRE([AM_C_PROTOTYPES])
1851 AC_DEFUN([jm_PREREQ_READUTMP],
1853 AC_REQUIRE([AC_HEADER_STDC])
1854 AC_CHECK_HEADERS(string.h utmp.h utmpx.h sys/param.h)
1855 AC_CHECK_FUNCS(utmpname)
1856 AC_CHECK_FUNCS(utmpxname)
1857 AC_REQUIRE([AM_C_PROTOTYPES])
1859 if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
1861 $ac_includes_default
1869 AC_CHECK_MEMBERS([struct utmpx.ut_user],,,[$utmp_includes])
1870 AC_CHECK_MEMBERS([struct utmp.ut_user],,,[$utmp_includes])
1871 AC_CHECK_MEMBERS([struct utmpx.ut_name],,,[$utmp_includes])
1872 AC_CHECK_MEMBERS([struct utmp.ut_name],,,[$utmp_includes])
1873 AC_CHECK_MEMBERS([struct utmpx.ut_type],,,[$utmp_includes])
1874 AC_CHECK_MEMBERS([struct utmp.ut_type],,,[$utmp_includes])
1875 AC_CHECK_MEMBERS([struct utmpx.ut_pid],,,[$utmp_includes])
1876 AC_CHECK_MEMBERS([struct utmp.ut_pid],,,[$utmp_includes])
1877 AC_CHECK_MEMBERS([struct utmpx.ut_id],,,[$utmp_includes])
1878 AC_CHECK_MEMBERS([struct utmp.ut_id],,,[$utmp_includes])
1880 AC_CHECK_MEMBERS([struct utmpx.ut_exit.ut_exit],,,[$utmp_includes])
1881 AC_CHECK_MEMBERS([struct utmp.ut_exit.ut_exit],,,[$utmp_includes])
1882 AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_exit],,,[$utmp_includes])
1883 AC_CHECK_MEMBERS([struct utmp.ut_exit.e_exit],,,[$utmp_includes])
1885 AC_CHECK_MEMBERS([struct utmpx.ut_exit.ut_termination],,,[$utmp_includes])
1886 AC_CHECK_MEMBERS([struct utmp.ut_exit.ut_termination],,,[$utmp_includes])
1887 AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_termination],,,[$utmp_includes])
1888 AC_CHECK_MEMBERS([struct utmp.ut_exit.e_termination],,,[$utmp_includes])
1893 AC_DEFUN([jm_PREREQ_STAT],
1895 AC_CHECK_HEADERS(sys/sysmacros.h sys/statvfs.h sys/vfs.h inttypes.h)
1896 AC_CHECK_HEADERS(sys/param.h sys/mount.h)
1897 AC_CHECK_FUNCS(statvfs)
1898 AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
1901 $ac_includes_default
1902 #if HAVE_SYS_STATVFS_H
1903 # include <sys/statvfs.h>
1906 # include <sys/vfs.h>
1908 #if ( ! HAVE_SYS_STATVFS_H && ! HAVE_SYS_VFS_H && HAVE_SYS_MOUNT_H && HAVE_SYS_PARAM_H )
1909 /* NetBSD 1.5.2 needs these, for the declaration of struct statfs. */
1910 # include <sys/param.h>
1911 # include <sys/mount.h>
1914 AC_CHECK_MEMBERS([struct statfs.f_basetype],,,[$statxfs_includes])
1915 AC_CHECK_MEMBERS([struct statvfs.f_basetype],,,[$statxfs_includes])
1916 AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$statxfs_includes])
1917 AC_CHECK_MEMBERS([struct statfs.f_type],,,[$statxfs_includes])
1918 AC_CHECK_MEMBERS([struct statvfs.f_type],,,[$statxfs_includes])
1919 AC_CHECK_MEMBERS([struct statfs.f_fsid.__val],,,[$statxfs_includes])
1920 AC_CHECK_MEMBERS([struct statvfs.f_fsid.__val],,,[$statxfs_includes])
1921 AC_CHECK_MEMBERS([struct statfs.f_namemax],,,[$statxfs_includes])
1922 AC_CHECK_MEMBERS([struct statvfs.f_namemax],,,[$statxfs_includes])
1923 AC_CHECK_MEMBERS([struct statfs.f_namelen],,,[$statxfs_includes])
1924 AC_CHECK_MEMBERS([struct statvfs.f_namelen],,,[$statxfs_includes])
1927 AC_DEFUN([jm_PREREQ_STRNLEN],
1929 AC_REQUIRE([AC_FUNC_STRNLEN])
1930 AC_REQUIRE([AC_HEADER_STDC])
1931 AC_CHECK_HEADERS(memory.h)
1932 AC_CHECK_DECLS([memchr])
1934 # This is necessary because automake-1.6.1 doesn't understand
1935 # that the above use of AC_FUNC_STRNLEN means we may have to use
1937 test $ac_cv_func_strnlen_working = yes \
1938 && AC_LIBOBJ(strnlen)
1941 AC_DEFUN([jm_PREREQ_TEMPNAME],
1943 AC_REQUIRE([AC_HEADER_STDC])
1944 AC_REQUIRE([AC_HEADER_STAT])
1945 AC_CHECK_HEADERS(fcntl.h sys/time.h stdint.h unistd.h)
1946 AC_CHECK_FUNCS(__secure_getenv gettimeofday)
1947 AC_CHECK_DECLS([getenv])
1948 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
1951 AC_DEFUN([jm_PREREQ_XGETCWD],
1953 AC_REQUIRE([AC_C_PROTOTYPES])
1954 AC_CHECK_HEADERS(limits.h stdlib.h sys/param.h unistd.h)
1955 AC_CHECK_FUNCS(getcwd)
1956 AC_REQUIRE([AC_FUNC_GETCWD_NULL])
1959 AC_DEFUN([jm_PREREQ_XREADLINK],
1961 AC_REQUIRE([AC_C_PROTOTYPES])
1962 AC_CHECK_HEADERS(limits.h stdlib.h sys/types.h unistd.h)
1965 # Check prerequisites for compiling lib/c-stack.c.
1967 # Copyright (C) 2002, 2003 Free Software Foundation, Inc.
1969 # This program is free software; you can redistribute it and/or modify
1970 # it under the terms of the GNU General Public License as published by
1971 # the Free Software Foundation; either version 2, or (at your option)
1972 # any later version.
1974 # This program is distributed in the hope that it will be useful,
1975 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1976 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1977 # GNU General Public License for more details.
1979 # You should have received a copy of the GNU General Public License
1980 # along with this program; if not, write to the Free Software
1981 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1984 # Written by Paul Eggert.
1986 AC_DEFUN([AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC],
1987 [# for STACK_DIRECTION
1988 AC_REQUIRE([AC_FUNC_ALLOCA])
1990 AC_CACHE_CHECK([for working C stack overflow detection],
1991 ac_cv_sys_xsi_stack_overflow_heuristic,
1996 #include <ucontext.h>
2000 char buffer[SIGSTKSZ];
2004 } alternate_signal_stack;
2007 # define find_stack_direction(ptr) STACK_DIRECTION
2010 find_stack_direction (char const *addr)
2013 return (! addr ? find_stack_direction (&dummy)
2014 : addr < &dummy ? 1 : -1);
2019 segv_handler (int signo, siginfo_t *info, void *context)
2021 if (0 < info->si_code)
2023 ucontext_t const *user_context = context;
2024 char const *stack_min = user_context->uc_stack.ss_sp;
2025 size_t stack_size = user_context->uc_stack.ss_size;
2026 char const *faulting_address = info->si_addr;
2027 size_t s = faulting_address - stack_min;
2028 size_t page_size = sysconf (_SC_PAGESIZE);
2029 if (find_stack_direction (0) < 0)
2031 if (s < stack_size + page_size)
2039 c_stack_action (void)
2042 struct sigaction act;
2046 st.ss_sp = alternate_signal_stack.buffer;
2047 st.ss_size = sizeof alternate_signal_stack.buffer;
2048 r = sigaltstack (&st, 0);
2052 sigemptyset (&act.sa_mask);
2053 act.sa_flags = SA_NODEFER | SA_ONSTACK | SA_RESETHAND | SA_SIGINFO;
2054 act.sa_sigaction = segv_handler;
2055 return sigaction (SIGSEGV, &act, 0);
2063 return *p + recurse (array);
2070 return recurse ("\1");
2073 [ac_cv_sys_xsi_stack_overflow_heuristic=yes],
2074 [ac_cv_sys_xsi_stack_overflow_heuristic=no],
2075 [ac_cv_sys_xsi_stack_overflow_heuristic=cross-compiling])])
2077 if test $ac_cv_sys_xsi_stack_overflow_heuristic = yes; then
2078 AC_DEFINE(HAVE_XSI_STACK_OVERFLOW_HEURISTIC, 1,
2079 [Define to 1 if extending the stack slightly past the limit causes
2080 a SIGSEGV, and an alternate stack can be established with sigaltstack,
2081 and the signal handler is passed a context that specifies the
2082 run time stack. This behavior is defined by POSIX 1003.1-2001
2083 with the X/Open System Interface (XSI) option
2084 and is a standardized way to implement a SEGV-based stack
2085 overflow detection heuristic.])
2089 AC_DEFUN([jm_PREREQ_C_STACK],
2090 [AC_REQUIRE([AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC])
2092 # for STACK_DIRECTION
2093 AC_REQUIRE([AC_FUNC_ALLOCA])
2095 AC_CHECK_FUNCS(getcontext sigaltstack)
2096 AC_CHECK_DECLS([getcontext], , , [#include <ucontext.h>])
2097 AC_CHECK_DECLS([sigaltstack], , , [#include <signal.h>])
2099 AC_CHECK_HEADERS(sys/resource.h ucontext.h unistd.h)
2101 AC_CHECK_TYPES([stack_t], , , [#include <signal.h>])])
2105 dnl FIXME: put these prerequisite-only *.m4 files in a separate
2106 dnl directory -- otherwise, they'll conflict with existing files.
2108 dnl These are the prerequisite macros for GNU's error.c file.
2109 AC_DEFUN([jm_PREREQ_ERROR],
2111 AC_CHECK_FUNCS(strerror vprintf doprnt)
2112 AC_CHECK_DECLS([strerror])
2113 AC_CHECK_HEADERS([libintl.h])
2120 dnl autoconf tests required for use of mbswidth.c
2121 dnl From Bruno Haible.
2123 AC_DEFUN([jm_PREREQ_MBSWIDTH],
2125 AC_REQUIRE([AC_HEADER_STDC])
2126 AC_CHECK_HEADERS(limits.h stdlib.h string.h wchar.h wctype.h)
2127 AC_CHECK_FUNCS(isascii iswcntrl iswprint mbsinit wcwidth)
2130 AC_CACHE_CHECK([whether wcwidth is declared], ac_cv_have_decl_wcwidth,
2132 /* AIX 3.2.5 declares wcwidth in <string.h>. */
2134 # include <string.h>
2141 char *p = (char *) wcwidth;
2143 ], ac_cv_have_decl_wcwidth=yes, ac_cv_have_decl_wcwidth=no)])
2144 if test $ac_cv_have_decl_wcwidth = yes; then
2149 AC_DEFINE_UNQUOTED(HAVE_DECL_WCWIDTH, $ac_val,
2150 [Define to 1 if you have the declaration of wcwidth(), and to 0 otherwise.])
2155 # mbrtowc.m4 serial 4 (fileutils-4.1.3)
2156 dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
2157 dnl This file is free software, distributed under the terms of the GNU
2158 dnl General Public License. As a special exception to the GNU General
2159 dnl Public License, this file may be distributed as part of a program
2160 dnl that contains a configuration script generated by Autoconf, under
2161 dnl the same distribution terms as the rest of that program.
2163 dnl From Paul Eggert
2165 AC_DEFUN([jm_FUNC_MBRTOWC],
2167 AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
2170 [#include <wchar.h>],
2171 [mbstate_t state; return ! (sizeof state && mbrtowc);],
2172 jm_cv_func_mbrtowc=yes,
2173 jm_cv_func_mbrtowc=no)])
2174 if test $jm_cv_func_mbrtowc = yes; then
2175 AC_DEFINE(HAVE_MBRTOWC, 1,
2176 [Define to 1 if mbrtowc and mbstate_t are properly declared.])
2182 dnl A replacement for autoconf's macro by the same name. This version
2183 dnl uses `ac_lib' rather than `i' for the loop variable, but more importantly
2184 dnl moves the ACTION-IF-FOUND ([$]3) into the inner `if'-block so that it is
2185 dnl run only if one of the listed libraries ends up being used (and not in
2186 dnl the `none required' case.
2187 dnl I hope it's only temporary while we wait for that version to be fixed.
2188 undefine([AC_SEARCH_LIBS])
2190 # AC_SEARCH_LIBS(FUNCTION, SEARCH-LIBS,
2191 # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
2192 # [OTHER-LIBRARIES])
2193 # --------------------------------------------------------
2194 # Search for a library defining FUNC, if it's not already available.
2195 AC_DEFUN([AC_SEARCH_LIBS],
2197 AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1],
2199 ac_func_search_save_LIBS=$LIBS
2201 AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1='none required'])
2202 if test "$ac_cv_search_$1" = no; then
2203 for ac_lib in $2; do
2204 LIBS="-l$ac_lib $5 $ac_func_search_save_LIBS"
2205 AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="-l$ac_lib"; break])
2208 LIBS=$ac_func_search_save_LIBS
2211 if test "$ac_cv_search_$1" = no; then :
2214 if test "$ac_cv_search_$1" = 'none required'; then :
2217 LIBS="$ac_cv_search_$1 $LIBS"
2223 # Check for stdbool.h that conforms to C99.
2225 # Copyright (C) 2002 Free Software Foundation, Inc.
2227 # This program is free software; you can redistribute it and/or modify
2228 # it under the terms of the GNU General Public License as published by
2229 # the Free Software Foundation; either version 2, or (at your option)
2230 # any later version.
2232 # This program is distributed in the hope that it will be useful,
2233 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2234 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2235 # GNU General Public License for more details.
2237 # You should have received a copy of the GNU General Public License
2238 # along with this program; if not, write to the Free Software
2239 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2242 AC_DEFUN([AC_HEADER_STDBOOL],
2243 [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
2244 [ac_cv_header_stdbool_h],
2247 #include <stdbool.h>
2249 "error: bool is not defined"
2252 "error: false is not defined"
2255 "error: false is not 0"
2258 "error: false is not defined"
2261 "error: true is not 1"
2263 #ifndef __bool_true_false_are_defined
2264 "error: __bool_true_false_are_defined is not defined"
2267 struct s { _Bool s: 1; _Bool t; } s;
2269 char a[true == 1 ? 1 : -1];
2270 char b[false == 0 ? 1 : -1];
2271 char c[__bool_true_false_are_defined == 1 ? 1 : -1];
2272 char d[(bool) -0.5 == true ? 1 : -1];
2274 char f[(_Bool) -0.0 == false ? 1 : -1];
2276 char h[sizeof (_Bool)];
2279 [ return !a + !b + !c + !d + !e + !f + !g + !h + !i; ],
2280 [ac_cv_header_stdbool_h=yes],
2281 [ac_cv_header_stdbool_h=no])])
2282 if test $ac_cv_header_stdbool_h = yes; then
2283 AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.])
2287 # Copyright 1996, 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
2289 # This program is free software; you can redistribute it and/or modify
2290 # it under the terms of the GNU General Public License as published by
2291 # the Free Software Foundation; either version 2, or (at your option)
2292 # any later version.
2294 # This program is distributed in the hope that it will be useful,
2295 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2296 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2297 # GNU General Public License for more details.
2299 # You should have received a copy of the GNU General Public License
2300 # along with this program; if not, write to the Free Software
2301 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2306 AC_DEFUN([AM_C_PROTOTYPES],
2307 [AC_REQUIRE([AM_PROG_CC_STDC])
2308 AC_REQUIRE([AC_PROG_CPP])
2309 AC_MSG_CHECKING([for function prototypes])
2310 if test "$am_cv_prog_cc_stdc" != no; then
2312 AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
2316 U=_ ANSI2KNR=./ansi2knr
2318 # Ensure some checks needed by ansi2knr itself.
2320 AC_CHECK_HEADERS(string.h)
2322 AC_SUBST(ANSI2KNR)dnl
2325 AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
2328 # Copyright 1996, 1997, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
2330 # This program is free software; you can redistribute it and/or modify
2331 # it under the terms of the GNU General Public License as published by
2332 # the Free Software Foundation; either version 2, or (at your option)
2333 # any later version.
2335 # This program is distributed in the hope that it will be useful,
2336 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2337 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2338 # GNU General Public License for more details.
2340 # You should have received a copy of the GNU General Public License
2341 # along with this program; if not, write to the Free Software
2342 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2347 # @defmac AC_PROG_CC_STDC
2348 # @maindex PROG_CC_STDC
2350 # If the C compiler in not in ANSI C mode by default, try to add an option
2351 # to output variable @code{CC} to make it so. This macro tries various
2352 # options that select ANSI C on some system or another. It considers the
2353 # compiler to be in ANSI C mode if it handles function prototypes correctly.
2355 # If you use this macro, you should check after calling it whether the C
2356 # compiler has been set to accept ANSI C; if not, the shell variable
2357 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
2358 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
2359 # program @code{ansi2knr}, which comes with Ghostscript.
2362 AC_DEFUN([AM_PROG_CC_STDC],
2363 [AC_REQUIRE([AC_PROG_CC])
2364 AC_BEFORE([$0], [AC_C_INLINE])
2365 AC_BEFORE([$0], [AC_C_CONST])
2366 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
2367 dnl a magic option to avoid problems with ANSI preprocessor commands
2369 dnl FIXME: can't do this because then AC_AIX won't work due to a
2370 dnl circular dependency.
2371 dnl AC_BEFORE([$0], [AC_PROG_CPP])
2372 AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
2373 AC_CACHE_VAL(am_cv_prog_cc_stdc,
2374 [am_cv_prog_cc_stdc=no
2376 # Don't try gcc -ansi; that turns off useful extensions and
2377 # breaks some systems' header files.
2378 # AIX -qlanglvl=ansi
2379 # Ultrix and OSF/1 -std1
2380 # HP-UX 10.20 and later -Ae
2381 # HP-UX older versions -Aa -D_HPUX_SOURCE
2382 # SVR4 -Xc -D__EXTENSIONS__
2383 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
2385 CC="$ac_save_CC $ac_arg"
2387 [#include <stdarg.h>
2389 #include <sys/types.h>
2390 #include <sys/stat.h>
2391 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
2392 struct buf { int x; };
2393 FILE * (*rcsopen) (struct buf *, struct stat *, int);
2394 static char *e (p, i)
2400 static char *f (char * (*g) (char **, int), char **p, ...)
2405 s = g (p, va_arg (v,int));
2409 int test (int i, double x);
2410 struct s1 {int (*f) (int a);};
2411 struct s2 {int (*f) (double a);};
2412 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
2416 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
2418 [am_cv_prog_cc_stdc="$ac_arg"; break])
2422 if test -z "$am_cv_prog_cc_stdc"; then
2423 AC_MSG_RESULT([none needed])
2425 AC_MSG_RESULT([$am_cv_prog_cc_stdc])
2427 case "x$am_cv_prog_cc_stdc" in
2429 *) CC="$CC $am_cv_prog_cc_stdc" ;;
2433 AU_DEFUN([fp_PROG_CC_STDC], [AM_PROG_CC_STDC])
2437 dnl From Paul Eggert.
2441 # Define intmax_t to long or long long if <inttypes.h> doesn't define.
2443 AC_DEFUN([jm_AC_TYPE_INTMAX_T],
2445 AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
2446 AC_CHECK_TYPE(intmax_t, ,
2447 [test $ac_cv_type_long_long = yes \
2448 && ac_type='long long' \
2450 AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
2451 [Define to widest signed type if <inttypes.h> doesn't define.])])
2454 # Define uintmax_t to unsigned long or unsigned long long
2455 # if <inttypes.h> doesn't define.
2457 AC_DEFUN([jm_AC_TYPE_UINTMAX_T],
2459 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
2460 AC_CHECK_TYPE(uintmax_t, ,
2461 [test $ac_cv_type_unsigned_long_long = yes \
2462 && ac_type='unsigned long long' \
2463 || ac_type='unsigned long'
2464 AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
2465 [Define to widest unsigned type if <inttypes.h> doesn't define.])])
2470 dnl From Paul Eggert.
2472 # Define HAVE_LONG_LONG if 'long long' works.
2474 AC_DEFUN([jm_AC_TYPE_LONG_LONG],
2476 AC_CACHE_CHECK([for long long], ac_cv_type_long_long,
2477 [AC_TRY_LINK([long long ll = 1; int i = 63;],
2478 [long long llmax = (long long) -1;
2479 return ll << i | ll >> i | llmax / ll | llmax % ll;],
2480 ac_cv_type_long_long=yes,
2481 ac_cv_type_long_long=no)])
2482 if test $ac_cv_type_long_long = yes; then
2483 AC_DEFINE(HAVE_LONG_LONG, 1,
2484 [Define if you have the long long type.])
2488 # Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works.
2490 AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
2492 AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
2493 [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
2494 [unsigned long long ullmax = (unsigned long long) -1;
2495 return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
2496 ac_cv_type_unsigned_long_long=yes,
2497 ac_cv_type_unsigned_long_long=no)])
2498 if test $ac_cv_type_unsigned_long_long = yes; then
2499 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
2500 [Define if you have the unsigned long long type.])
2506 AC_DEFUN([jm_FUNC_MEMCMP],
2507 [AC_REQUIRE([AC_FUNC_MEMCMP])dnl
2508 if test $ac_cv_func_memcmp_working = no; then
2509 AC_DEFINE(memcmp, rpl_memcmp,
2510 [Define to rpl_memcmp if the replacement function should be used.])
2514 # getcwd.m4 - check whether getcwd (NULL, 0) allocates memory for result
2516 # Copyright 2001 Free Software Foundation, Inc.
2518 # This program is free software; you can redistribute it and/or modify
2519 # it under the terms of the GNU General Public License as published by
2520 # the Free Software Foundation; either version 2, or (at your option)
2521 # any later version.
2523 # This program is distributed in the hope that it will be useful,
2524 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2525 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2526 # GNU General Public License for more details.
2528 # You should have received a copy of the GNU General Public License
2529 # along with this program; if not, write to the Free Software Foundation,
2530 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
2532 # Written by Paul Eggert.
2534 AC_DEFUN([AC_FUNC_GETCWD_NULL],
2535 [AC_CHECK_HEADERS(stdlib.h unistd.h)
2536 AC_CACHE_CHECK([whether getcwd (NULL, 0) allocates memory for result],
2537 [ac_cv_func_getcwd_null],
2540 # ifdef HAVE_STDLIB_H
2541 # include <stdlib.h>
2543 # ifdef HAVE_UNISTD_H
2544 # include <unistd.h>
2552 if (chdir ("/") != 0)
2556 char *f = getcwd (NULL, 0);
2557 exit (! (f && f[0] == '/' && !f[1]));
2560 [ac_cv_func_getcwd_null=yes],
2561 [ac_cv_func_getcwd_null=no],
2562 [ac_cv_func_getcwd_null=no])])
2563 if test $ac_cv_func_getcwd_null = yes; then
2564 AC_DEFINE(HAVE_GETCWD_NULL, 1,
2565 [Define if getcwd (NULL, 0) allocates memory for result.])
2570 dnl Find out how to get the file descriptor associated with an open DIR*.
2571 dnl From Jim Meyering
2573 AC_DEFUN([UTILS_FUNC_DIRFD],
2575 dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
2576 AC_REQUIRE([AC_PROG_CPP])
2577 AC_REQUIRE([AC_PROG_EGREP])
2582 # include <dirent.h>
2583 #else /* not HAVE_DIRENT_H */
2584 # define dirent direct
2585 # if HAVE_SYS_NDIR_H
2586 # include <sys/ndir.h>
2587 # endif /* HAVE_SYS_NDIR_H */
2589 # include <sys/dir.h>
2590 # endif /* HAVE_SYS_DIR_H */
2593 # endif /* HAVE_NDIR_H */
2594 #endif /* HAVE_DIRENT_H */
2596 AC_CHECK_FUNCS(dirfd)
2597 AC_CHECK_DECLS([dirfd], , , $dirfd_headers)
2599 AC_CACHE_CHECK([whether dirfd is a macro],
2600 jm_cv_func_dirfd_macro,
2601 AC_EGREP_CPP([dirent_header_defines_dirfd], [$dirfd_headers
2603 dirent_header_defines_dirfd
2605 jm_cv_func_dirfd_macro=yes,
2606 jm_cv_func_dirfd_macro=no))
2608 # Use the replacement only if we have no function, macro,
2609 # or declaration with that name.
2610 if test $ac_cv_func_dirfd,$ac_cv_have_decl_dirfd,$jm_cv_func_dirfd_macro \
2612 AC_REPLACE_FUNCS([dirfd])
2614 [how to get the file descriptor associated with an open DIR*],
2615 ac_cv_sys_dir_fd_member_name,
2617 dirfd_save_CFLAGS=$CFLAGS
2618 for ac_expr in d_fd dd_fd; do
2620 CFLAGS="$CFLAGS -DDIR_FD_MEMBER_NAME=$ac_expr"
2624 [DIR *dir_p = opendir("."); (void) dir_p->DIR_FD_MEMBER_NAME;],
2627 CFLAGS=$dirfd_save_CFLAGS
2628 test "$dir_fd_found" = yes && break
2630 test "$dir_fd_found" = yes || ac_expr=-1
2632 ac_cv_sys_dir_fd_member_name=$ac_expr
2635 if test $ac_cv_have_decl_dirfd = no; then
2636 AC_DEFINE_UNQUOTED(DIR_FD_MEMBER_NAME,
2637 $ac_cv_sys_dir_fd_member_name,
2638 [the name of the file descriptor member of DIR])
2640 AH_VERBATIM(DIR_TO_FD,
2641 [#ifdef DIR_FD_MEMBER_NAME
2642 # define DIR_TO_FD(Dir_p) ((Dir_p)->DIR_FD_MEMBER_NAME)
2644 # define DIR_TO_FD(Dir_p) -1
2651 # acl.m4 - check for access control list (ACL) primitives
2653 # Copyright (C) 2002 Free Software Foundation, Inc.
2655 # This program is free software; you can redistribute it and/or modify
2656 # it under the terms of the GNU General Public License as published by
2657 # the Free Software Foundation; either version 2, or (at your option)
2658 # any later version.
2660 # This program is distributed in the hope that it will be useful,
2661 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2662 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2663 # GNU General Public License for more details.
2665 # You should have received a copy of the GNU General Public License
2666 # along with this program; if not, write to the Free Software Foundation,
2667 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
2669 # Written by Paul Eggert.
2671 AC_DEFUN([AC_FUNC_ACL],
2672 [AC_CHECK_HEADERS(sys/acl.h)
2673 AC_CHECK_FUNCS(acl)])
2676 # Use the replacement ftw.c if the one in the C library is inadequate or buggy.
2677 # For now, we always use the code in lib/ because libc doesn't have the FTW_DCH
2678 # or FTW_DCHP that we need. Arrange to use lib/ftw.h. And since that
2679 # implementation uses tsearch.c/tdestroy, add tsearch.o to the list of
2680 # objects and arrange to use lib/search.h if necessary.
2683 AC_DEFUN([AC_FUNC_FTW],
2686 AC_REQUIRE([jm_FUNC_LSTAT])
2687 AC_REQUIRE([AC_HEADER_DIRENT])
2688 AC_CHECK_HEADERS(sys/param.h)
2689 AC_CHECK_DECLS([stpcpy])
2691 # In the event that we have to use the replacement ftw.c,
2692 # see if we'll also need the replacement tsearch.c.
2693 AC_CHECK_FUNC([tdestroy], , [need_tdestroy=1])
2695 AC_CACHE_CHECK([for ftw/FTW_CHDIR that informs callback of failed chdir],
2696 ac_cv_func_ftw_working,
2698 # The following test would fail prior to glibc-2.3.2, because `depth'
2699 # would be 2 rather than 4. Of course, now that we require FTW_DCH
2700 # and FTW_DCHP, this test fails even with GNU libc's fixed ftw.
2701 mkdir -p conftest.dir/a/b/c
2702 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2707 static char *_f[] = { "conftest.dir", "conftest.dir/a",
2708 "conftest.dir/a/b", "conftest.dir/a/b/c" };
2709 static char **p = _f;
2713 cb (const char *file, const struct stat *sb, int file_type, struct FTW *info)
2715 if (strcmp (file, *p++) != 0)
2724 /* Require these symbols, too. */
2728 int err = nftw ("conftest.dir", cb, 30, FTW_PHYS | FTW_MOUNT | FTW_CHDIR);
2729 exit ((err == 0 && depth == 4) ? 0 : 1);
2732 [ac_cv_func_ftw_working=yes],
2733 [ac_cv_func_ftw_working=no],
2734 [ac_cv_func_ftw_working=no])])
2736 if test $ac_cv_func_ftw_working = no; then
2738 AC_CONFIG_LINKS([$ac_config_libobj_dir/ftw.h:$ac_config_libobj_dir/ftw_.h])
2739 # Add tsearch.o IFF we have to use the replacement ftw.c.
2740 if test -n "$need_tdestroy"; then
2741 AC_LIBOBJ([tsearch])
2742 # Link search.h to search_.h if we use the replacement tsearch.c.
2744 [$ac_config_libobj_dir/search.h:$ac_config_libobj_dir/search_.h])
2751 dnl From Jim Meyering.
2752 dnl Determine whether lstat has the bug that it succeeds when given the
2753 dnl zero-length file name argument. The lstat from SunOS4.1.4 and the Hurd
2754 dnl (as of 1998-11-01) do this.
2756 dnl If it does, then define HAVE_LSTAT_EMPTY_STRING_BUG and arrange to
2757 dnl compile the wrapper function.
2760 AC_DEFUN([jm_FUNC_LSTAT],
2762 AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
2763 AC_CACHE_CHECK([whether lstat accepts an empty string],
2764 jm_cv_func_lstat_empty_string_bug,
2766 # include <sys/types.h>
2767 # include <sys/stat.h>
2773 exit (lstat ("", &sbuf) ? 1 : 0);
2776 jm_cv_func_lstat_empty_string_bug=yes,
2777 jm_cv_func_lstat_empty_string_bug=no,
2778 dnl When crosscompiling, assume lstat is broken.
2779 jm_cv_func_lstat_empty_string_bug=yes)
2781 if test $jm_cv_func_lstat_empty_string_bug = yes; then
2783 AC_DEFINE(HAVE_LSTAT_EMPTY_STRING_BUG, 1,
2784 [Define if lstat has the bug that it succeeds when given the zero-length
2785 file name argument. The lstat from SunOS4.1.4 and the Hurd as of 1998-11-01)
2792 dnl From Jim Meyering.
2793 dnl Provide lchown on systems that lack it.
2795 AC_DEFUN([jm_FUNC_LCHOWN],
2797 AC_REQUIRE([AC_TYPE_UID_T])
2798 AC_REPLACE_FUNCS(lchown)
2803 # When rmdir fails because the specified directory is not empty, it sets
2804 # errno to some value, usually ENOTEMPTY. However, on some AIX systems,
2805 # ENOTEMPTY is mistakenly defined to be EEXIST. To work around this, and
2806 # in general, to avoid depending on the use of any particular symbol, this
2807 # test runs a test to determine the actual numeric value.
2808 AC_DEFUN([fetish_FUNC_RMDIR_NOTEMPTY],
2810 AC_CACHE_CHECK([for rmdir-not-empty errno value],
2811 fetish_cv_func_rmdir_errno_not_empty,
2813 # Arrange for deletion of the temporary directory this test creates.
2814 ac_clean_files="$ac_clean_files confdir2"
2815 mkdir confdir2; : > confdir2/file
2828 s = fopen ("confdir2/errno", "w");
2829 fprintf (s, "%d\n", val);
2833 fetish_cv_func_rmdir_errno_not_empty=`cat confdir2/errno`,
2834 fetish_cv_func_rmdir_errno_not_empty='configure error in rmdir-errno.m4',
2835 fetish_cv_func_rmdir_errno_not_empty=ENOTEMPTY
2840 AC_DEFINE_UNQUOTED([RMDIR_ERRNO_NOT_EMPTY],
2841 $fetish_cv_func_rmdir_errno_not_empty,
2842 [the value to which errno is set when rmdir fails on a nonempty directory])
2847 dnl From Jim Meyering.
2848 dnl Determine whether chown accepts arguments of -1 for uid and gid.
2849 dnl If it doesn't, arrange to use the replacement function.
2852 AC_DEFUN([jm_FUNC_CHOWN],
2853 [AC_REQUIRE([AC_TYPE_UID_T])dnl
2854 test -z "$ac_cv_header_unistd_h" \
2855 && AC_CHECK_HEADERS(unistd.h)
2856 AC_CACHE_CHECK([for working chown], jm_cv_func_working_chown,
2858 # include <sys/types.h>
2859 # include <sys/stat.h>
2861 # ifdef HAVE_UNISTD_H
2862 # include <unistd.h>
2868 char *f = "conftest.chown";
2869 struct stat before, after;
2871 if (creat (f, 0600) < 0)
2873 if (stat (f, &before) < 0)
2875 if (chown (f, (uid_t) -1, (gid_t) -1) == -1)
2877 if (stat (f, &after) < 0)
2879 exit ((before.st_uid == after.st_uid
2880 && before.st_gid == after.st_gid) ? 0 : 1);
2883 jm_cv_func_working_chown=yes,
2884 jm_cv_func_working_chown=no,
2885 dnl When crosscompiling, assume chown is broken.
2886 jm_cv_func_working_chown=no)
2888 if test $jm_cv_func_working_chown = no; then
2890 AC_DEFINE(chown, rpl_chown,
2891 [Define to rpl_chown if the replacement function should be used.])
2897 dnl From Jim Meyering.
2898 dnl A wrapper around AC_FUNC_MKTIME.
2900 AC_DEFUN([jm_FUNC_MKTIME],
2901 [AC_REQUIRE([AC_FUNC_MKTIME])dnl
2903 dnl mktime.c uses localtime_r if it exists. Check for it.
2904 AC_CHECK_FUNCS(localtime_r)
2906 if test $ac_cv_func_working_mktime = no; then
2907 AC_DEFINE(mktime, rpl_mktime,
2908 [Define to rpl_mktime if the replacement function should be used.])
2914 dnl From Jim Meyering.
2915 dnl Determine whether stat has the bug that it succeeds when given the
2916 dnl zero-length file name argument. The stat from SunOS4.1.4 and the Hurd
2917 dnl (as of 1998-11-01) do this.
2919 dnl If it does, then define HAVE_STAT_EMPTY_STRING_BUG and arrange to
2920 dnl compile the wrapper function.
2923 AC_DEFUN([jm_FUNC_STAT],
2925 AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
2926 AC_CACHE_CHECK([whether stat accepts an empty string],
2927 jm_cv_func_stat_empty_string_bug,
2929 # include <sys/types.h>
2930 # include <sys/stat.h>
2936 exit (stat ("", &sbuf) ? 1 : 0);
2939 jm_cv_func_stat_empty_string_bug=yes,
2940 jm_cv_func_stat_empty_string_bug=no,
2941 dnl When crosscompiling, assume stat is broken.
2942 jm_cv_func_stat_empty_string_bug=yes)
2944 if test $jm_cv_func_stat_empty_string_bug = yes; then
2946 AC_DEFINE(HAVE_STAT_EMPTY_STRING_BUG, 1,
2947 [Define if stat has the bug that it succeeds when given the zero-length
2948 file name argument. The stat from SunOS4.1.4 and the Hurd as of 1998-11-01)
2955 dnl From Jim Meyering.
2956 dnl Check for the nanosleep function.
2957 dnl If not found, use the supplied replacement.
2960 AC_DEFUN([jm_FUNC_NANOSLEEP],
2962 nanosleep_save_libs=$LIBS
2964 # Solaris 2.5.1 needs -lposix4 to get the nanosleep function.
2965 # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
2966 AC_SEARCH_LIBS(nanosleep, [rt posix4], [LIB_NANOSLEEP=$ac_cv_search_nanosleep])
2967 AC_SUBST(LIB_NANOSLEEP)
2969 AC_CACHE_CHECK([whether nanosleep works],
2970 jm_cv_func_nanosleep_works,
2972 AC_REQUIRE([AC_HEADER_TIME])
2974 # if TIME_WITH_SYS_TIME
2975 # include <sys/time.h>
2978 # if HAVE_SYS_TIME_H
2979 # include <sys/time.h>
2988 struct timespec ts_sleep, ts_remaining;
2989 ts_sleep.tv_sec = 0;
2990 ts_sleep.tv_nsec = 1;
2991 exit (nanosleep (&ts_sleep, &ts_remaining) == 0 ? 0 : 1);
2994 jm_cv_func_nanosleep_works=yes,
2995 jm_cv_func_nanosleep_works=no,
2996 dnl When crosscompiling, assume the worst.
2997 jm_cv_func_nanosleep_works=no)
2999 if test $jm_cv_func_nanosleep_works = no; then
3000 AC_LIBOBJ(nanosleep)
3001 AC_DEFINE(nanosleep, rpl_nanosleep,
3002 [Define to rpl_nanosleep if the replacement function should be used.])
3005 LIBS=$nanosleep_save_libs
3008 #serial 7 -*- autoconf -*-
3010 dnl From Jim Meyering.
3012 dnl See if the glibc *_unlocked I/O macros are available.
3013 dnl Use only those *_unlocked macros that are declared.
3016 AC_DEFUN([jm_FUNC_GLIBC_UNLOCKED_IO],
3018 [clearerr_unlocked, feof_unlocked, ferror_unlocked,
3019 fflush_unlocked, fgets_unlocked, fputc_unlocked, fputs_unlocked,
3020 fread_unlocked, fwrite_unlocked, getc_unlocked,
3021 getchar_unlocked, putc_unlocked, putchar_unlocked])])
3025 dnl Written by Jim Meyering
3027 AC_DEFUN([jm_FUNC_GROUP_MEMBER],
3029 dnl Do this replacement check manually because I want the hyphen
3030 dnl (not the underscore) in the filename.
3031 AC_CHECK_FUNC(group_member, , [AC_LIBOBJ(group-member)])
3037 dnl From Jim Meyering.
3039 dnl Check whether putenv ("FOO") removes FOO from the environment.
3040 dnl The putenv in libc on at least SunOS 4.1.4 does *not* do that.
3043 AC_DEFUN([jm_FUNC_PUTENV],
3044 [AC_CACHE_CHECK([for SVID conformant putenv], jm_cv_func_svid_putenv,
3049 /* Put it in env. */
3050 if (putenv ("CONFTEST_putenv=val"))
3053 /* Try to remove it. */
3054 if (putenv ("CONFTEST_putenv"))
3057 /* Make sure it was deleted. */
3058 if (getenv ("CONFTEST_putenv") != 0)
3064 jm_cv_func_svid_putenv=yes,
3065 jm_cv_func_svid_putenv=no,
3066 dnl When crosscompiling, assume putenv is broken.
3067 jm_cv_func_svid_putenv=no)
3069 if test $jm_cv_func_svid_putenv = no; then
3071 AC_DEFINE(putenv, rpl_putenv,
3072 [Define to rpl_putenv if the replacement function should be used.])
3080 AC_MSG_CHECKING(for AFS)
3081 if test -d /afs; then
3082 AC_DEFINE(AFS, 1, [Define if you have the Andrew File System.])
3087 AC_MSG_RESULT($ac_result)
3092 # autoconf tests required for use of xstrtoumax.c
3094 AC_DEFUN([jm_AC_PREREQ_XSTRTOUMAX],
3096 AC_REQUIRE([jm_AC_TYPE_INTMAX_T])
3097 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
3098 AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
3099 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
3100 AC_CHECK_DECLS([strtol, strtoul, strtoull, strtoimax, strtoumax])
3101 AC_CHECK_HEADERS(limits.h stdlib.h inttypes.h)
3103 AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro],
3104 jm_cv_func_strtoumax_macro,
3105 AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include <inttypes.h>
3107 inttypes_h_defines_strtoumax
3109 jm_cv_func_strtoumax_macro=yes,
3110 jm_cv_func_strtoumax_macro=no))
3112 if test "$jm_cv_func_strtoumax_macro" != yes; then
3113 AC_REPLACE_FUNCS(strtoumax)
3116 dnl Only the replacement strtoumax invokes strtoul and strtoull,
3117 dnl so we need the replacements only if strtoumax does not exist.
3118 case "$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in
3120 AC_REPLACE_FUNCS(strtoul)
3122 dnl We don't need (and can't compile) the replacement strtoull
3123 dnl unless the type `unsigned long long' exists.
3124 if test "$ac_cv_type_unsigned_long_long" = yes; then
3125 AC_REPLACE_FUNCS(strtoull)
3132 dnl Cloned from xstrtoumax.m4. Keep these files in sync.
3134 # autoconf tests required for use of xstrtoimax.c
3136 AC_DEFUN([jm_AC_PREREQ_XSTRTOIMAX],
3138 AC_REQUIRE([jm_AC_TYPE_INTMAX_T])
3139 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
3140 AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
3141 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
3142 AC_CHECK_DECLS([strtol, strtoul, strtoll, strtoimax, strtoumax])
3143 AC_CHECK_HEADERS(limits.h stdlib.h inttypes.h)
3145 AC_CACHE_CHECK([whether <inttypes.h> defines strtoimax as a macro],
3146 jm_cv_func_strtoimax_macro,
3147 AC_EGREP_CPP([inttypes_h_defines_strtoimax], [#include <inttypes.h>
3149 inttypes_h_defines_strtoimax
3151 jm_cv_func_strtoimax_macro=yes,
3152 jm_cv_func_strtoimax_macro=no))
3154 if test "$jm_cv_func_strtoimax_macro" != yes; then
3155 AC_REPLACE_FUNCS(strtoimax)
3158 dnl Only the replacement strtoimax invokes strtol and strtoll,
3159 dnl so we need the replacements only if strtoimax does not exist.
3160 case "$jm_cv_func_strtoimax_macro,$ac_cv_func_strtoimax" in
3162 AC_REPLACE_FUNCS(strtol)
3164 dnl We don't need (and can't compile) the replacement strtoll
3165 dnl unless the type `long long' exists.
3166 if test "$ac_cv_type_long_long" = yes; then
3167 AC_REPLACE_FUNCS(strtoll)
3174 dnl Run a program to determine whether whether link(2) follows symlinks.
3175 dnl Set LINK_FOLLOWS_SYMLINKS accordingly.
3177 AC_DEFUN([jm_AC_FUNC_LINK_FOLLOWS_SYMLINK],
3180 [whether link(2) dereferences a symlink specified with a trailing slash],
3181 jm_ac_cv_func_link_follows_symlink,
3183 dnl poor-man's AC_REQUIRE: FIXME: repair this once autoconf-3 provides
3184 dnl the appropriate framework.
3185 test -z "$ac_cv_header_unistd_h" \
3186 && AC_CHECK_HEADERS(unistd.h)
3188 # Create a regular file.
3189 echo > conftest.file
3192 # include <sys/types.h>
3193 # include <sys/stat.h>
3194 # ifdef HAVE_UNISTD_H
3195 # include <unistd.h>
3198 # define SAME_INODE(Stat_buf_1, Stat_buf_2) \
3199 ((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
3200 && (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)
3205 const char *file = "conftest.file";
3206 const char *sym = "conftest.sym";
3207 const char *hard = "conftest.hard";
3208 struct stat sb_file, sb_hard;
3210 /* Create a symlink to the regular file. */
3211 if (symlink (file, sym))
3214 /* Create a hard link to that symlink. */
3215 if (link (sym, hard))
3218 if (lstat (hard, &sb_hard))
3220 if (lstat (file, &sb_file))
3223 /* If the dev/inode of hard and file are the same, then
3224 the link call followed the symlink. */
3225 return SAME_INODE (sb_hard, sb_file) ? 0 : 1;
3228 jm_ac_cv_func_link_follows_symlink=yes,
3229 jm_ac_cv_func_link_follows_symlink=no,
3230 jm_ac_cv_func_link_follows_symlink=yes dnl We're cross compiling.
3233 if test $jm_ac_cv_func_link_follows_symlink = yes; then
3234 AC_DEFINE(LINK_FOLLOWS_SYMLINKS, 1,
3235 [Define if `link(2)' dereferences symbolic links.])
3241 dnl This macro is intended to be used solely in this file.
3242 dnl These are the prerequisite macros for GNU's strftime.c replacement.
3243 AC_DEFUN([_jm_STRFTIME_PREREQS],
3245 dnl strftime.c uses localtime_r and the underyling system strftime
3247 AC_CHECK_FUNCS(localtime_r strftime)
3249 AC_CHECK_HEADERS(limits.h)
3250 AC_CHECK_FUNCS(bcopy tzset mempcpy memcpy memset)
3252 # This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE.
3255 AC_CHECK_FUNCS(mblen mbrlen)
3257 AC_CHECK_MEMBER([struct tm.tm_gmtoff],
3258 [AC_DEFINE(HAVE_TM_GMTOFF, 1,
3259 [Define if struct tm has the tm_gmtoff member.])],
3261 [#include <time.h>])
3264 dnl From Jim Meyering.
3266 AC_DEFUN([jm_FUNC_GNU_STRFTIME],
3267 [AC_REQUIRE([AC_HEADER_TIME])dnl
3269 _jm_STRFTIME_PREREQS
3271 AC_REQUIRE([AC_C_CONST])dnl
3272 AC_REQUIRE([AC_HEADER_STDC])dnl
3273 AC_CHECK_HEADERS(sys/time.h)
3274 AC_DEFINE([my_strftime], [nstrftime],
3275 [Define to the name of the strftime replacement function.])
3278 AC_DEFUN([jm_FUNC_STRFTIME],
3280 _jm_STRFTIME_PREREQS
3285 dnl From Jim Meyering
3286 dnl Using code from emacs, based on suggestions from Paul Eggert
3287 dnl and Ulrich Drepper.
3289 dnl Find out how to determine the number of pending output bytes on a stream.
3290 dnl glibc (2.1.93 and newer) and Solaris provide __fpending. On other systems,
3291 dnl we have to grub around in the FILE struct.
3293 AC_DEFUN([jm_FUNC_FPENDING],
3295 AC_CHECK_HEADERS(stdio_ext.h)
3296 AC_REPLACE_FUNCS([__fpending])
3298 # if HAVE_STDIO_EXT_H
3299 # include <stdio_ext.h>
3302 AC_CHECK_DECLS([__fpending], , , $fp_headers)
3303 if test $ac_cv_func___fpending = no; then
3305 [how to determine the number of pending output bytes on a stream],
3306 ac_cv_sys_pending_output_n_bytes,
3311 'fp->_IO_write_ptr - fp->_IO_write_base' \
3313 '# traditional Unix' \
3314 'fp->_ptr - fp->_base' \
3317 'fp->_p - fp->_bf._base' \
3320 'fp->__ptr - fp->__base' \
3323 'fp->__bufp - fp->__buffer' \
3325 '# old glibc iostream?' \
3326 'fp->_pptr - fp->_pbase' \
3329 '(*fp)->_ptr - (*fp)->_base' \
3331 '# e.g., DGUX R4.11; the info is not available' \
3335 # Skip each embedded comment.
3336 case "$ac_expr" in '#'*) continue;; esac
3341 [FILE *fp = stdin; (void) ($ac_expr);],
3344 test "$fp_done" = yes && break
3347 ac_cv_sys_pending_output_n_bytes=$ac_expr
3350 AC_DEFINE_UNQUOTED(PENDING_OUTPUT_N_BYTES,
3351 $ac_cv_sys_pending_output_n_bytes,
3352 [the number of pending output bytes on stream `fp'])
3357 # Arrange to define HAVE_MMAP_STACK and to compile mmap-stack.c
3358 # if there is sufficient support.
3361 AC_DEFUN([AC_SYS_MMAP_STACK],
3364 AC_REQUIRE([AC_FUNC_MMAP])
3365 AC_CHECK_HEADERS_ONCE(sys/mman.h ucontext.h stdarg.h)
3366 AC_CHECK_FUNCS_ONCE(getcontext makecontext setcontext)
3368 # For now, require tmpfile. FIXME: if there's a system with working mmap
3369 # and *context functions yet that lacks tmpfile, we can provide a replacement.
3370 AC_CHECK_FUNCS_ONCE(tmpfile)
3372 ac_i=$ac_cv_func_tmpfile
3373 ac_i=$ac_i:$ac_cv_func_getcontext
3374 ac_i=$ac_i:$ac_cv_func_makecontext
3375 ac_i=$ac_i:$ac_cv_func_setcontext
3376 ac_i=$ac_i:$ac_cv_func_mmap_fixed_mapped
3378 if test $ac_i = yes:yes:yes:yes:yes; then
3379 AC_LIBOBJ(mmap-stack)
3380 AC_DEFINE(HAVE_MMAP_STACK, 1,
3381 [Define to 1 if there is sufficient support (mmap, getcontext,
3382 makecontext, setcontext) for running a process with mmap'd
3383 memory for its stack.])
3387 # inttypes-pri.m4 serial 1001 (based on gettext-0.11.4's `serial 1')
3388 dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
3389 dnl This file is free software, distributed under the terms of the GNU
3390 dnl General Public License. As a special exception to the GNU General
3391 dnl Public License, this file may be distributed as part of a program
3392 dnl that contains a configuration script generated by Autoconf, under
3393 dnl the same distribution terms as the rest of that program.
3395 dnl From Bruno Haible.
3397 # Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
3398 # macros to non-string values. This is the case on AIX 4.3.3.
3400 AC_DEFUN([gt_INTTYPES_PRI],
3402 # autoconf-2.52 has a proper check for inttypes.h.
3405 if test $ac_cv_header_inttypes_h = yes; then
3406 AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
3407 gt_cv_inttypes_pri_broken,
3409 AC_TRY_COMPILE([#include <inttypes.h>
3413 ], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes)
3416 if test "$gt_cv_inttypes_pri_broken" = yes; then
3417 AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
3418 [Define if <inttypes.h> exists and defines unusable PRI* macros.])
3424 dnl From Jim Meyering.
3425 dnl A wrapper around AC_FUNC_GETGROUPS.
3427 AC_DEFUN([jm_FUNC_GETGROUPS],
3428 [AC_REQUIRE([AC_FUNC_GETGROUPS])dnl
3429 if test $ac_cv_func_getgroups_works = no; then
3430 AC_LIBOBJ(getgroups)
3431 AC_DEFINE(getgroups, rpl_getgroups,
3432 [Define as rpl_getgroups if getgroups doesn't work right.])
3434 test -n "$GETGROUPS_LIB" && LIBS="$GETGROUPS_LIB $LIBS"
3441 AC_DEFUN([jm_SYS_PROC_UPTIME],
3442 [ dnl Require AC_PROG_CC to see if we're cross compiling.
3443 AC_REQUIRE([AC_PROG_CC])
3444 AC_CACHE_CHECK([for /proc/uptime], jm_cv_have_proc_uptime,
3445 [jm_cv_have_proc_uptime=no
3446 test -f /proc/uptime \
3447 && test "$cross_compiling" = no \
3448 && cat < /proc/uptime >/dev/null 2>/dev/null \
3449 && jm_cv_have_proc_uptime=yes])
3450 if test $jm_cv_have_proc_uptime = yes; then
3451 AC_DEFINE(HAVE_PROC_UPTIME, 1,
3452 [ Define if your system has the /proc/uptime special file.])
3458 # See if we need to emulate a missing ftruncate function using fcntl or chsize.
3460 AC_DEFUN([jm_FUNC_FTRUNCATE],
3462 AC_CHECK_FUNCS(ftruncate, , [ftruncate_missing=yes])
3464 if test "$ftruncate_missing" = yes; then
3465 AC_CHECK_HEADERS([unistd.h])
3466 AC_CHECK_FUNCS([chsize])
3467 AC_LIBOBJ(ftruncate)
3473 dnl From Volker Borchert.
3474 dnl Determine whether rename works for source paths with a trailing slash.
3475 dnl The rename from SunOS 4.1.1_U1 doesn't.
3477 dnl If it doesn't, then define RENAME_TRAILING_SLASH_BUG and arrange
3478 dnl to compile the wrapper function.
3481 AC_DEFUN([vb_FUNC_RENAME],
3483 AC_CACHE_CHECK([whether rename is broken],
3484 vb_cv_func_rename_trailing_slash_bug,
3486 rm -rf conftest.d1 conftest.d2
3487 mkdir conftest.d1 ||
3488 AC_MSG_ERROR([cannot create temporary directory])
3494 exit (rename ("conftest.d1/", "conftest.d2") ? 1 : 0);
3497 vb_cv_func_rename_trailing_slash_bug=no,
3498 vb_cv_func_rename_trailing_slash_bug=yes,
3499 dnl When crosscompiling, assume rename is broken.
3500 vb_cv_func_rename_trailing_slash_bug=yes)
3502 rm -rf conftest.d1 conftest.d2
3504 if test $vb_cv_func_rename_trailing_slash_bug = yes; then
3506 AC_DEFINE(RENAME_TRAILING_SLASH_BUG, 1,
3507 [Define if rename does not work for source paths with a trailing slash,
3508 like the one from SunOS 4.1.1_U1.])
3514 # On some systems (e.g., HPUX-10.20, SunOS4.1.4, solaris2.5.1), mkstemp has the
3515 # silly limit that it can create no more than 26 files from a given template.
3516 # Other systems lack mkstemp altogether. On either type of system, arrange
3517 # to use the replacement function.
3518 AC_DEFUN([UTILS_FUNC_MKSTEMP],
3520 AC_REPLACE_FUNCS(mkstemp)
3521 if test $ac_cv_func_mkstemp = no; then
3522 utils_cv_func_mkstemp_limitations=yes
3524 AC_CACHE_CHECK([for mkstemp limitations],
3525 utils_cv_func_mkstemp_limitations,
3528 # include <stdlib.h>
3532 for (i = 0; i < 30; i++)
3534 char template[] = "conftestXXXXXX";
3535 int fd = mkstemp (template);
3543 utils_cv_func_mkstemp_limitations=no,
3544 utils_cv_func_mkstemp_limitations=yes,
3545 utils_cv_func_mkstemp_limitations=yes
3551 if test $utils_cv_func_mkstemp_limitations = yes; then
3554 AC_DEFINE(mkstemp, rpl_mkstemp,
3555 [Define to rpl_mkstemp if the replacement function should be used.])
3561 dnl From Jim Meyering.
3563 dnl See if gettimeofday clobbers the static buffer that localtime uses
3564 dnl for it's return value. The gettimeofday function from Mac OS X 10.0.4,
3565 dnl i.e. Darwin 1.3.7 has this problem.
3567 dnl If it does, then arrange to use gettimeofday and localtime only via
3568 dnl the wrapper functions that work around the problem.
3570 AC_DEFUN([AC_FUNC_GETTIMEOFDAY_CLOBBER],
3572 AC_REQUIRE([AC_HEADER_TIME])
3573 AC_CHECK_HEADERS(string.h stdlib.h)
3574 AC_CACHE_CHECK([whether gettimeofday clobbers localtime buffer],
3575 jm_cv_func_gettimeofday_clobber,
3579 # include <string.h>
3582 #if TIME_WITH_SYS_TIME
3583 # include <sys/time.h>
3586 # if HAVE_SYS_TIME_H
3587 # include <sys/time.h>
3594 # include <stdlib.h>
3604 lt = localtime (&t);
3606 gettimeofday (&tv, NULL);
3607 if (memcmp (lt, &saved_lt, sizeof (struct tm)) != 0)
3613 jm_cv_func_gettimeofday_clobber=no,
3614 jm_cv_func_gettimeofday_clobber=yes,
3615 dnl When crosscompiling, assume it is broken.
3616 jm_cv_func_gettimeofday_clobber=yes)
3618 if test $jm_cv_func_gettimeofday_clobber = yes; then
3619 AC_LIBOBJ(gettimeofday)
3620 AC_DEFINE(localtime, rpl_localtime,
3621 [Define to rpl_localtime if the replacement function should be used.])
3622 AC_DEFINE(gettimeofday, rpl_gettimeofday,
3623 [Define to rpl_gettimeofday if the replacement function should be used.])
3624 AC_DEFINE(GETTIMEOFDAY_CLOBBERS_LOCALTIME_BUFFER, 1,
3625 [Define if gettimeofday clobbers localtime's static buffer.])
3631 dnl From Jim Meyering
3632 dnl Replace the utime function on systems that need it.
3636 AC_DEFUN([jm_FUNC_UTIME],
3638 AC_CHECK_HEADERS(utime.h)
3639 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_UTIMBUF])
3640 AC_REQUIRE([AC_FUNC_UTIME_NULL])
3642 if test $ac_cv_func_utime_null = no; then
3644 AC_REPLACE_FUNCS(utime)
3650 dnl Shamelessly cloned from acspecific.m4's AC_FUNC_UTIME_NULL,
3651 dnl then do case-insensitive s/utime/utimes/.
3653 AC_DEFUN([jm_FUNC_UTIMES_NULL],
3654 [AC_CACHE_CHECK(whether utimes accepts a null argument, ac_cv_func_utimes_null,
3655 [rm -f conftest.data; > conftest.data
3657 /* In case stat has been defined to rpl_stat, undef it here. */
3659 #include <sys/types.h>
3660 #include <sys/stat.h>
3663 exit(!(stat ("conftest.data", &s) == 0
3664 && utimes("conftest.data", (long *)0) == 0
3665 && stat("conftest.data", &t) == 0
3666 && t.st_mtime >= s.st_mtime
3667 && t.st_mtime - s.st_mtime < 120));
3669 ac_cv_func_utimes_null=yes,
3670 ac_cv_func_utimes_null=no,
3671 ac_cv_func_utimes_null=no)
3672 rm -f core core.* *.core])
3674 if test $ac_cv_func_utimes_null = yes; then
3675 AC_DEFINE(HAVE_UTIMES_NULL, 1,
3676 [Define if utimes accepts a null argument])
3683 dnl See if there's a working, system-supplied version of the getline function.
3684 dnl We can't just do AC_REPLACE_FUNCS(getline) because some systems
3685 dnl have a function by that name in -linet that doesn't have anything
3686 dnl to do with the function we need.
3687 AC_DEFUN([AM_FUNC_GETLINE],
3689 am_getline_needs_run_time_check=no
3690 AC_CHECK_FUNC(getline,
3691 dnl Found it in some library. Verify that it works.
3692 am_getline_needs_run_time_check=yes,
3693 am_cv_func_working_getline=no)
3694 if test $am_getline_needs_run_time_check = yes; then
3695 AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline,
3696 [echo fooN |tr -d '\012'|tr N '\012' > conftest.data
3699 # include <sys/types.h>
3700 # include <string.h>
3702 { /* Based on a test program from Karl Heuer. */
3706 FILE *in = fopen ("./conftest.data", "r");
3709 len = getline (&line, &siz, in);
3710 exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1);
3712 ], am_cv_func_working_getline=yes dnl The library version works.
3713 , am_cv_func_working_getline=no dnl The library version does NOT work.
3714 , am_cv_func_working_getline=no dnl We're cross compiling.
3718 if test $am_cv_func_working_getline = no; then
3724 # Determine approximately how many files may be open simultaneously
3725 # in one process. This is approximate, since while running this test,
3726 # the configure script already has a few files open.
3729 AC_DEFUN([UTILS_SYS_OPEN_MAX],
3731 AC_CACHE_CHECK([determine how many files may be open simultaneously],
3732 utils_cv_sys_open_max,
3734 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3741 FILE *result = fopen ("conftest.omax", "w");
3743 /* Impose an arbitrary limit, in case some system has no
3744 effective limit on the number of simultaneously open files. */
3747 FILE *s = fopen ("conftest.op", "w");
3752 fprintf (result, "%d\n", i);
3753 exit (fclose (result) == EOF);
3756 [utils_cv_sys_open_max=`cat conftest.omax`],
3757 [utils_cv_sys_open_max='internal error in open-max.m4'],
3758 [utils_cv_sys_open_max='cross compiling run-test in open-max.m4'])])
3760 AC_DEFINE_UNQUOTED([UTILS_OPEN_MAX],
3761 $utils_cv_sys_open_max,
3762 [the maximum number of simultaneously open files per process])
3765 # codeset.m4 serial AM1 (gettext-0.10.40)
3766 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
3767 dnl This file is free software, distributed under the terms of the GNU
3768 dnl General Public License. As a special exception to the GNU General
3769 dnl Public License, this file may be distributed as part of a program
3770 dnl that contains a configuration script generated by Autoconf, under
3771 dnl the same distribution terms as the rest of that program.
3773 dnl From Bruno Haible.
3775 AC_DEFUN([AM_LANGINFO_CODESET],
3777 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
3778 [AC_TRY_LINK([#include <langinfo.h>],
3779 [char* cs = nl_langinfo(CODESET);],
3780 am_cv_langinfo_codeset=yes,
3781 am_cv_langinfo_codeset=no)
3783 if test $am_cv_langinfo_codeset = yes; then
3784 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
3785 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
3789 # glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
3790 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
3791 dnl This file is free software, distributed under the terms of the GNU
3792 dnl General Public License. As a special exception to the GNU General
3793 dnl Public License, this file may be distributed as part of a program
3794 dnl that contains a configuration script generated by Autoconf, under
3795 dnl the same distribution terms as the rest of that program.
3797 # Test for the GNU C Library, version 2.1 or newer.
3798 # From Bruno Haible.
3800 AC_DEFUN([jm_GLIBC21],
3802 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
3803 ac_cv_gnu_library_2_1,
3804 [AC_EGREP_CPP([Lucky GNU user],
3806 #include <features.h>
3807 #ifdef __GNU_LIBRARY__
3808 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
3813 ac_cv_gnu_library_2_1=yes,
3814 ac_cv_gnu_library_2_1=no)
3818 GLIBC21="$ac_cv_gnu_library_2_1"
3822 # iconv.m4 serial AM4 (gettext-0.11.3)
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_ICONV_LINKFLAGS_BODY],
3834 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
3835 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
3836 AC_REQUIRE([AC_LIB_RPATH])
3838 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
3840 AC_LIB_LINKFLAGS_BODY([iconv])
3843 AC_DEFUN([AM_ICONV_LINK],
3845 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
3846 dnl those with the standalone portable GNU libiconv installed).
3848 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
3850 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
3852 dnl Add $INCICONV to CPPFLAGS before performing the following checks,
3853 dnl because if the user has installed libiconv and not disabled its use
3854 dnl via --without-libiconv-prefix, he wants to use it. The first
3855 dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
3856 am_save_CPPFLAGS="$CPPFLAGS"
3857 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
3859 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
3860 am_cv_func_iconv="no, consider installing GNU libiconv"
3862 AC_TRY_LINK([#include <stdlib.h>
3863 #include <iconv.h>],
3864 [iconv_t cd = iconv_open("","");
3865 iconv(cd,NULL,NULL,NULL,NULL);
3867 am_cv_func_iconv=yes)
3868 if test "$am_cv_func_iconv" != yes; then
3869 am_save_LIBS="$LIBS"
3870 LIBS="$LIBS $LIBICONV"
3871 AC_TRY_LINK([#include <stdlib.h>
3872 #include <iconv.h>],
3873 [iconv_t cd = iconv_open("","");
3874 iconv(cd,NULL,NULL,NULL,NULL);
3877 am_cv_func_iconv=yes)
3878 LIBS="$am_save_LIBS"
3881 if test "$am_cv_func_iconv" = yes; then
3882 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
3884 if test "$am_cv_lib_iconv" = yes; then
3885 AC_MSG_CHECKING([how to link with libiconv])
3886 AC_MSG_RESULT([$LIBICONV])
3888 dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
3890 CPPFLAGS="$am_save_CPPFLAGS"
3895 AC_SUBST(LTLIBICONV)
3898 AC_DEFUN([AM_ICONV],
3901 if test "$am_cv_func_iconv" = yes; then
3902 AC_MSG_CHECKING([for iconv declaration])
3903 AC_CACHE_VAL(am_cv_proto_iconv, [
3911 #if defined(__STDC__) || defined(__cplusplus)
3912 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
3916 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
3917 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);"])
3918 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
3919 AC_MSG_RESULT([$]{ac_t:-
3920 }[$]am_cv_proto_iconv)
3921 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
3922 [Define as const if the declaration of iconv() needs const.])
3926 # lib-prefix.m4 serial 1 (gettext-0.11)
3927 dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
3928 dnl This file is free software, distributed under the terms of the GNU
3929 dnl General Public License. As a special exception to the GNU General
3930 dnl Public License, this file may be distributed as part of a program
3931 dnl that contains a configuration script generated by Autoconf, under
3932 dnl the same distribution terms as the rest of that program.
3934 dnl From Bruno Haible.
3936 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
3937 dnl to access previously installed libraries. The basic assumption is that
3938 dnl a user will want packages to use other packages he previously installed
3939 dnl with the same --prefix option.
3940 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
3941 dnl libraries, but is otherwise very convenient.
3942 AC_DEFUN([AC_LIB_PREFIX],
3944 AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
3945 AC_REQUIRE([AC_PROG_CC])
3946 AC_REQUIRE([AC_CANONICAL_HOST])
3947 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
3948 dnl By default, look in $includedir and $libdir.
3950 AC_LIB_WITH_FINAL_PREFIX([
3951 eval additional_includedir=\"$includedir\"
3952 eval additional_libdir=\"$libdir\"
3954 AC_ARG_WITH([lib-prefix],
3955 [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
3956 --without-lib-prefix don't search for libraries in includedir and libdir],
3958 if test "X$withval" = "Xno"; then
3961 if test "X$withval" = "X"; then
3962 AC_LIB_WITH_FINAL_PREFIX([
3963 eval additional_includedir=\"$includedir\"
3964 eval additional_libdir=\"$libdir\"
3967 additional_includedir="$withval/include"
3968 additional_libdir="$withval/lib"
3972 if test $use_additional = yes; then
3973 dnl Potentially add $additional_includedir to $CPPFLAGS.
3974 dnl But don't add it
3975 dnl 1. if it's the standard /usr/include,
3976 dnl 2. if it's already present in $CPPFLAGS,
3977 dnl 3. if it's /usr/local/include and we are using GCC on Linux,
3978 dnl 4. if it doesn't exist as a directory.
3979 if test "X$additional_includedir" != "X/usr/include"; then
3981 for x in $CPPFLAGS; do
3982 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3983 if test "X$x" = "X-I$additional_includedir"; then
3988 if test -z "$haveit"; then
3989 if test "X$additional_includedir" = "X/usr/local/include"; then
3990 if test -n "$GCC"; then
3992 linux*) haveit=yes;;
3996 if test -z "$haveit"; then
3997 if test -d "$additional_includedir"; then
3998 dnl Really add $additional_includedir to $CPPFLAGS.
3999 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
4004 dnl Potentially add $additional_libdir to $LDFLAGS.
4005 dnl But don't add it
4006 dnl 1. if it's the standard /usr/lib,
4007 dnl 2. if it's already present in $LDFLAGS,
4008 dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
4009 dnl 4. if it doesn't exist as a directory.
4010 if test "X$additional_libdir" != "X/usr/lib"; then
4012 for x in $LDFLAGS; do
4013 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
4014 if test "X$x" = "X-L$additional_libdir"; then
4019 if test -z "$haveit"; then
4020 if test "X$additional_libdir" = "X/usr/local/lib"; then
4021 if test -n "$GCC"; then
4023 linux*) haveit=yes;;
4027 if test -z "$haveit"; then
4028 if test -d "$additional_libdir"; then
4029 dnl Really add $additional_libdir to $LDFLAGS.
4030 LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
4038 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
4039 dnl acl_final_exec_prefix, containing the values to which $prefix and
4040 dnl $exec_prefix will expand at the end of the configure script.
4041 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
4043 dnl Unfortunately, prefix and exec_prefix get only finally determined
4044 dnl at the end of configure.
4045 if test "X$prefix" = "XNONE"; then
4046 acl_final_prefix="$ac_default_prefix"
4048 acl_final_prefix="$prefix"
4050 if test "X$exec_prefix" = "XNONE"; then
4051 acl_final_exec_prefix='${prefix}'
4053 acl_final_exec_prefix="$exec_prefix"
4055 acl_save_prefix="$prefix"
4056 prefix="$acl_final_prefix"
4057 eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
4058 prefix="$acl_save_prefix"
4061 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
4062 dnl variables prefix and exec_prefix bound to the values they will have
4063 dnl at the end of the configure script.
4064 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
4066 acl_save_prefix="$prefix"
4067 prefix="$acl_final_prefix"
4068 acl_save_exec_prefix="$exec_prefix"
4069 exec_prefix="$acl_final_exec_prefix"
4071 exec_prefix="$acl_save_exec_prefix"
4072 prefix="$acl_save_prefix"
4075 # lib-link.m4 serial 3 (gettext-0.11.3)
4076 dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
4077 dnl This file is free software, distributed under the terms of the GNU
4078 dnl General Public License. As a special exception to the GNU General
4079 dnl Public License, this file may be distributed as part of a program
4080 dnl that contains a configuration script generated by Autoconf, under
4081 dnl the same distribution terms as the rest of that program.
4083 dnl From Bruno Haible.
4085 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
4086 dnl the libraries corresponding to explicit and implicit dependencies.
4087 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
4088 dnl augments the CPPFLAGS variable.
4089 AC_DEFUN([AC_LIB_LINKFLAGS],
4091 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
4092 AC_REQUIRE([AC_LIB_RPATH])
4093 define([Name],[translit([$1],[./-], [___])])
4094 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
4095 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
4096 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
4097 AC_LIB_LINKFLAGS_BODY([$1], [$2])
4098 ac_cv_lib[]Name[]_libs="$LIB[]NAME"
4099 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
4100 ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
4102 LIB[]NAME="$ac_cv_lib[]Name[]_libs"
4103 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
4104 INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
4105 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
4107 AC_SUBST([LTLIB]NAME)
4108 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
4109 dnl results of this search when this library appears as a dependency.
4115 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
4116 dnl searches for libname and the libraries corresponding to explicit and
4117 dnl implicit dependencies, together with the specified include files and
4118 dnl the ability to compile and link the specified testcode. If found, it
4119 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
4120 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
4121 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
4122 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
4123 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
4125 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
4126 AC_REQUIRE([AC_LIB_RPATH])
4127 define([Name],[translit([$1],[./-], [___])])
4128 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
4129 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
4131 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
4133 AC_LIB_LINKFLAGS_BODY([$1], [$2])
4135 dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
4136 dnl because if the user has installed lib[]Name and not disabled its use
4137 dnl via --without-lib[]Name-prefix, he wants to use it.
4138 ac_save_CPPFLAGS="$CPPFLAGS"
4139 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
4141 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
4142 ac_save_LIBS="$LIBS"
4143 LIBS="$LIBS $LIB[]NAME"
4144 AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
4145 LIBS="$ac_save_LIBS"
4147 if test "$ac_cv_lib[]Name" = yes; then
4149 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
4150 AC_MSG_CHECKING([how to link with lib[]$1])
4151 AC_MSG_RESULT([$LIB[]NAME])
4154 dnl If $LIB[]NAME didn't lead to a usable library, we don't need
4155 dnl $INC[]NAME either.
4156 CPPFLAGS="$ac_save_CPPFLAGS"
4160 AC_SUBST([HAVE_LIB]NAME)
4162 AC_SUBST([LTLIB]NAME)
4167 dnl Determine the platform dependent parameters needed to use rpath:
4168 dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
4169 dnl hardcode_direct, hardcode_minus_L,
4170 dnl sys_lib_search_path_spec, sys_lib_dlsearch_path_spec.
4171 AC_DEFUN([AC_LIB_RPATH],
4173 AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
4174 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
4175 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
4176 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
4177 AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
4178 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
4179 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
4185 libext="$acl_cv_libext"
4186 shlibext="$acl_cv_shlibext"
4187 hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
4188 hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
4189 hardcode_direct="$acl_cv_hardcode_direct"
4190 hardcode_minus_L="$acl_cv_hardcode_minus_L"
4191 sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec"
4192 sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec"
4193 dnl Determine whether the user wants rpath handling at all.
4194 AC_ARG_ENABLE(rpath,
4195 [ --disable-rpath do not hardcode runtime library paths],
4196 :, enable_rpath=yes)
4199 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
4200 dnl the libraries corresponding to explicit and implicit dependencies.
4201 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
4202 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
4204 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
4205 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
4206 dnl By default, look in $includedir and $libdir.
4208 AC_LIB_WITH_FINAL_PREFIX([
4209 eval additional_includedir=\"$includedir\"
4210 eval additional_libdir=\"$libdir\"
4212 AC_ARG_WITH([lib$1-prefix],
4213 [ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
4214 --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
4216 if test "X$withval" = "Xno"; then
4219 if test "X$withval" = "X"; then
4220 AC_LIB_WITH_FINAL_PREFIX([
4221 eval additional_includedir=\"$includedir\"
4222 eval additional_libdir=\"$libdir\"
4225 additional_includedir="$withval/include"
4226 additional_libdir="$withval/lib"
4230 dnl Search the library and its dependencies in $additional_libdir and
4231 dnl $LDFLAGS. Using breadth-first-seach.
4237 names_already_handled=
4238 names_next_round='$1 $2'
4239 while test -n "$names_next_round"; do
4240 names_this_round="$names_next_round"
4242 for name in $names_this_round; do
4244 for n in $names_already_handled; do
4245 if test "$n" = "$name"; then
4250 if test -z "$already_handled"; then
4251 names_already_handled="$names_already_handled $name"
4252 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
4253 dnl or AC_LIB_HAVE_LINKFLAGS call.
4254 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
4255 eval value=\"\$HAVE_LIB$uppername\"
4256 if test -n "$value"; then
4257 if test "$value" = yes; then
4258 eval value=\"\$LIB$uppername\"
4259 test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
4260 eval value=\"\$LTLIB$uppername\"
4261 test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
4263 dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
4264 dnl that this library doesn't exist. So just drop it.
4268 dnl Search the library lib$name in $additional_libdir and $LDFLAGS
4269 dnl and the already constructed $LIBNAME/$LTLIBNAME.
4274 if test $use_additional = yes; then
4275 if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
4276 found_dir="$additional_libdir"
4277 found_so="$additional_libdir/lib$name.$shlibext"
4278 if test -f "$additional_libdir/lib$name.la"; then
4279 found_la="$additional_libdir/lib$name.la"
4282 if test -f "$additional_libdir/lib$name.$libext"; then
4283 found_dir="$additional_libdir"
4284 found_a="$additional_libdir/lib$name.$libext"
4285 if test -f "$additional_libdir/lib$name.la"; then
4286 found_la="$additional_libdir/lib$name.la"
4291 if test "X$found_dir" = "X"; then
4292 for x in $LDFLAGS $LTLIB[]NAME; do
4293 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
4296 dir=`echo "X$x" | sed -e 's/^X-L//'`
4297 if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
4299 found_so="$dir/lib$name.$shlibext"
4300 if test -f "$dir/lib$name.la"; then
4301 found_la="$dir/lib$name.la"
4304 if test -f "$dir/lib$name.$libext"; then
4306 found_a="$dir/lib$name.$libext"
4307 if test -f "$dir/lib$name.la"; then
4308 found_la="$dir/lib$name.la"
4314 if test "X$found_dir" != "X"; then
4319 if test "X$found_dir" != "X"; then
4320 dnl Found the library.
4321 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
4322 if test "X$found_so" != "X"; then
4323 dnl Linking with a shared library. We attempt to hardcode its
4324 dnl directory into the executable's runpath, unless it's the
4325 dnl standard /usr/lib.
4326 if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
4327 dnl No hardcoding is needed.
4328 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
4330 dnl Use an explicit option to hardcode DIR into the resulting
4332 dnl Potentially add DIR to ltrpathdirs.
4333 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
4335 for x in $ltrpathdirs; do
4336 if test "X$x" = "X$found_dir"; then
4341 if test -z "$haveit"; then
4342 ltrpathdirs="$ltrpathdirs $found_dir"
4344 dnl The hardcoding into $LIBNAME is system dependent.
4345 if test "$hardcode_direct" = yes; then
4346 dnl Using DIR/libNAME.so during linking hardcodes DIR into the
4347 dnl resulting binary.
4348 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
4350 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
4351 dnl Use an explicit option to hardcode DIR into the resulting
4353 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
4354 dnl Potentially add DIR to rpathdirs.
4355 dnl The rpathdirs will be appended to $LIBNAME at the end.
4357 for x in $rpathdirs; do
4358 if test "X$x" = "X$found_dir"; then
4363 if test -z "$haveit"; then
4364 rpathdirs="$rpathdirs $found_dir"
4367 dnl Rely on "-L$found_dir".
4368 dnl But don't add it if it's already contained in the LDFLAGS
4369 dnl or the already constructed $LIBNAME
4371 for x in $LDFLAGS $LIB[]NAME; do
4372 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
4373 if test "X$x" = "X-L$found_dir"; then
4378 if test -z "$haveit"; then
4379 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
4381 if test "$hardcode_minus_L" != no; then
4382 dnl FIXME: Not sure whether we should use
4383 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
4385 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
4387 dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
4388 dnl here, because this doesn't fit in flags passed to the
4389 dnl compiler. So give up. No hardcoding. This affects only
4390 dnl very old systems.
4391 dnl FIXME: Not sure whether we should use
4392 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
4394 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
4400 if test "X$found_a" != "X"; then
4401 dnl Linking with a static library.
4402 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
4404 dnl We shouldn't come here, but anyway it's good to have a
4406 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
4409 dnl Assume the include files are nearby.
4410 additional_includedir=
4411 case "$found_dir" in
4413 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
4414 additional_includedir="$basedir/include"
4417 if test "X$additional_includedir" != "X"; then
4418 dnl Potentially add $additional_includedir to $INCNAME.
4419 dnl But don't add it
4420 dnl 1. if it's the standard /usr/include,
4421 dnl 2. if it's /usr/local/include and we are using GCC on Linux,
4422 dnl 3. if it's already present in $CPPFLAGS or the already
4423 dnl constructed $INCNAME,
4424 dnl 4. if it doesn't exist as a directory.
4425 if test "X$additional_includedir" != "X/usr/include"; then
4427 if test "X$additional_includedir" = "X/usr/local/include"; then
4428 if test -n "$GCC"; then
4430 linux*) haveit=yes;;
4434 if test -z "$haveit"; then
4435 for x in $CPPFLAGS $INC[]NAME; do
4436 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
4437 if test "X$x" = "X-I$additional_includedir"; then
4442 if test -z "$haveit"; then
4443 if test -d "$additional_includedir"; then
4444 dnl Really add $additional_includedir to $INCNAME.
4445 INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
4451 dnl Look for dependencies.
4452 if test -n "$found_la"; then
4453 dnl Read the .la file. It defines the variables
4454 dnl dlname, library_names, old_library, dependency_libs, current,
4455 dnl age, revision, installed, dlopen, dlpreopen, libdir.
4456 save_libdir="$libdir"
4458 */* | *\\*) . "$found_la" ;;
4459 *) . "./$found_la" ;;
4461 libdir="$save_libdir"
4462 dnl We use only dependency_libs.
4463 for dep in $dependency_libs; do
4466 additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
4467 dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
4468 dnl But don't add it
4469 dnl 1. if it's the standard /usr/lib,
4470 dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
4471 dnl 3. if it's already present in $LDFLAGS or the already
4472 dnl constructed $LIBNAME,
4473 dnl 4. if it doesn't exist as a directory.
4474 if test "X$additional_libdir" != "X/usr/lib"; then
4476 if test "X$additional_libdir" = "X/usr/local/lib"; then
4477 if test -n "$GCC"; then
4479 linux*) haveit=yes;;
4483 if test -z "$haveit"; then
4485 for x in $LDFLAGS $LIB[]NAME; do
4486 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
4487 if test "X$x" = "X-L$additional_libdir"; then
4492 if test -z "$haveit"; then
4493 if test -d "$additional_libdir"; then
4494 dnl Really add $additional_libdir to $LIBNAME.
4495 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
4499 for x in $LDFLAGS $LTLIB[]NAME; do
4500 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
4501 if test "X$x" = "X-L$additional_libdir"; then
4506 if test -z "$haveit"; then
4507 if test -d "$additional_libdir"; then
4508 dnl Really add $additional_libdir to $LTLIBNAME.
4509 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
4516 dir=`echo "X$dep" | sed -e 's/^X-R//'`
4517 if test "$enable_rpath" != no; then
4518 dnl Potentially add DIR to rpathdirs.
4519 dnl The rpathdirs will be appended to $LIBNAME at the end.
4521 for x in $rpathdirs; do
4522 if test "X$x" = "X$dir"; then
4527 if test -z "$haveit"; then
4528 rpathdirs="$rpathdirs $dir"
4530 dnl Potentially add DIR to ltrpathdirs.
4531 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
4533 for x in $ltrpathdirs; do
4534 if test "X$x" = "X$dir"; then
4539 if test -z "$haveit"; then
4540 ltrpathdirs="$ltrpathdirs $dir"
4545 dnl Handle this in the next round.
4546 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
4549 dnl Handle this in the next round. Throw away the .la's
4550 dnl directory; it is already contained in a preceding -L
4552 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
4555 dnl Most likely an immediate library name.
4556 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
4557 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
4563 dnl Didn't find the library; assume it is in the system directories
4564 dnl known to the linker and runtime loader. (All the system
4565 dnl directories known to the linker should also be known to the
4566 dnl runtime loader, otherwise the system is severely misconfigured.)
4567 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
4568 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
4574 if test "X$rpathdirs" != "X"; then
4575 if test -n "$hardcode_libdir_separator"; then
4576 dnl Weird platform: only the last -rpath option counts, the user must
4577 dnl pass all path elements in one option. We can arrange that for a
4578 dnl single library, but not when more than one $LIBNAMEs are used.
4580 for found_dir in $rpathdirs; do
4581 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
4583 dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
4584 acl_save_libdir="$libdir"
4586 eval flag=\"$hardcode_libdir_flag_spec\"
4587 libdir="$acl_save_libdir"
4588 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
4590 dnl The -rpath options are cumulative.
4591 for found_dir in $rpathdirs; do
4592 acl_save_libdir="$libdir"
4594 eval flag=\"$hardcode_libdir_flag_spec\"
4595 libdir="$acl_save_libdir"
4596 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
4600 if test "X$ltrpathdirs" != "X"; then
4601 dnl When using libtool, the option that works for both libraries and
4602 dnl executables is -R. The -R options are cumulative.
4603 for found_dir in $ltrpathdirs; do
4604 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
4609 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
4610 dnl unless already present in VAR.
4611 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
4612 dnl contains two or three consecutive elements that belong together.
4613 AC_DEFUN([AC_LIB_APPENDTOVAR],
4615 for element in [$2]; do
4618 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
4619 if test "X$x" = "X$element"; then
4624 if test -z "$haveit"; then
4625 [$1]="${[$1]}${[$1]:+ }$element"
4630 # lib-ld.m4 serial 1 (gettext-0.11)
4631 dnl Copyright (C) 1996-2002 Free Software Foundation, Inc.
4632 dnl This file is free software, distributed under the terms of the GNU
4633 dnl General Public License. As a special exception to the GNU General
4634 dnl Public License, this file may be distributed as part of a program
4635 dnl that contains a configuration script generated by Autoconf, under
4636 dnl the same distribution terms as the rest of that program.
4638 dnl Subroutines of libtool.m4,
4639 dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
4640 dnl with libtool.m4.
4642 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
4643 AC_DEFUN([AC_LIB_PROG_LD_GNU],
4644 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
4645 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
4646 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
4647 acl_cv_prog_gnu_ld=yes
4649 acl_cv_prog_gnu_ld=no
4651 with_gnu_ld=$acl_cv_prog_gnu_ld
4654 dnl From libtool-1.4. Sets the variable LD.
4655 AC_DEFUN([AC_LIB_PROG_LD],
4656 [AC_ARG_WITH(gnu-ld,
4657 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
4658 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
4659 AC_REQUIRE([AC_PROG_CC])dnl
4660 AC_REQUIRE([AC_CANONICAL_HOST])dnl
4662 if test "$GCC" = yes; then
4663 # Check if gcc -print-prog-name=ld gives a path.
4664 AC_MSG_CHECKING([for ld used by GCC])
4667 # gcc leaves a trailing carriage return which upsets mingw
4668 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
4670 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
4673 # Accept absolute paths.
4674 [[\\/]* | [A-Za-z]:[\\/]*)]
4675 [re_direlt='/[^/][^/]*/\.\./']
4676 # Canonicalize the path of ld
4677 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
4678 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
4679 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
4681 test -z "$LD" && LD="$ac_prog"
4684 # If it fails, then pretend we aren't using GCC.
4688 # If it is relative, then search for the first ld in PATH.
4692 elif test "$with_gnu_ld" = yes; then
4693 AC_MSG_CHECKING([for GNU ld])
4695 AC_MSG_CHECKING([for non-GNU ld])
4697 AC_CACHE_VAL(acl_cv_path_LD,
4698 [if test -z "$LD"; then
4699 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
4700 for ac_dir in $PATH; do
4701 test -z "$ac_dir" && ac_dir=.
4702 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
4703 acl_cv_path_LD="$ac_dir/$ac_prog"
4704 # Check to see if the program is GNU ld. I'd rather use --version,
4705 # but apparently some GNU ld's only accept -v.
4706 # Break only if it was the GNU/non-GNU ld that we prefer.
4707 if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
4708 test "$with_gnu_ld" != no && break
4710 test "$with_gnu_ld" != yes && break
4716 acl_cv_path_LD="$LD" # Let the user override the test with a path.
4718 LD="$acl_cv_path_LD"
4719 if test -n "$LD"; then
4724 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
4730 dnl From J. David Anglin.
4732 dnl HPUX and other systems can't unlink shared text that is being executed.
4734 AC_DEFUN([jm_FUNC_UNLINK_BUSY_TEXT],
4736 AC_CACHE_CHECK([whether a running program can be unlinked],
4737 jm_cv_func_unlink_busy_text,
4746 exit (unlink (argv[0]));
4749 jm_cv_func_unlink_busy_text=yes,
4750 jm_cv_func_unlink_busy_text=no,
4751 jm_cv_func_unlink_busy_text=no
4756 if test $jm_cv_func_unlink_busy_text = no; then
4757 INSTALL=$ac_install_sh
4763 dnl From Jim Meyering.
4765 dnl This is not pretty. I've just taken the autoconf code and wrapped
4766 dnl it in an AC_DEFUN.
4769 # jm_LIST_MOUNTED_FILESYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
4770 AC_DEFUN([jm_LIST_MOUNTED_FILESYSTEMS],
4772 AC_CHECK_FUNCS(listmntent getmntinfo)
4773 AC_CHECK_HEADERS(mntent.h sys/param.h sys/ucred.h sys/mount.h sys/fs_types.h)
4774 getfsstat_includes="\
4775 $ac_includes_default
4776 #if HAVE_SYS_PARAM_H
4777 # include <sys/param.h> /* needed by powerpc-apple-darwin1.3.7 */
4779 #if HAVE_SYS_UCRED_H
4780 # include <sys/ucred.h> /* needed by powerpc-apple-darwin1.3.7 */
4782 #if HAVE_SYS_MOUNT_H
4783 # include <sys/mount.h>
4785 #if HAVE_SYS_FS_TYPES_H
4786 # include <sys/fs_types.h> /* needed by powerpc-apple-darwin1.3.7 */
4789 AC_CHECK_MEMBERS([struct fsstat.f_fstypename],,,[$getfsstat_includes])
4791 # Determine how to get the list of mounted filesystems.
4794 # If the getmntent function is available but not in the standard library,
4795 # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
4798 # This test must precede the ones for getmntent because Unicos-9 is
4799 # reported to have the getmntent function, but its support is incompatible
4800 # with other getmntent implementations.
4802 # NOTE: Normally, I wouldn't use a check for system type as I've done for
4803 # `CRAY' below since that goes against the whole autoconf philosophy. But
4804 # I think there is too great a chance that some non-Cray system has a
4805 # function named listmntent to risk the false positive.
4807 if test -z "$ac_list_mounted_fs"; then
4809 AC_MSG_CHECKING([for listmntent of Cray/Unicos-9])
4810 AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent,
4811 [fu_cv_sys_mounted_cray_listmntent=no
4816 ], [test $ac_cv_func_listmntent = yes \
4817 && fu_cv_sys_mounted_cray_listmntent=yes]
4821 AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent)
4822 if test $fu_cv_sys_mounted_cray_listmntent = yes; then
4823 ac_list_mounted_fs=found
4824 AC_DEFINE(MOUNTED_LISTMNTENT, 1,
4825 [Define if there is a function named listmntent that can be used to
4826 list all mounted filesystems. (UNICOS)])
4830 if test $ac_cv_func_getmntent = yes; then
4832 # This system has the getmntent function.
4833 # Determine whether it's the one-argument variant or the two-argument one.
4835 if test -z "$ac_list_mounted_fs"; then
4836 # 4.3BSD, SunOS, HP-UX, Dynix, Irix
4837 AC_MSG_CHECKING([for one-argument getmntent function])
4838 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
4840 /* SunOS 4.1.x /usr/include/mntent.h needs this for FILE */
4844 #if !defined MOUNTED
4845 # if defined _PATH_MOUNTED /* GNU libc */
4846 # define MOUNTED _PATH_MOUNTED
4848 # if defined MNT_MNTTAB /* HP-UX. */
4849 # define MOUNTED MNT_MNTTAB
4851 # if defined MNTTABNAME /* Dynix. */
4852 # define MOUNTED MNTTABNAME
4856 [ struct mntent *mnt = 0; char *table = MOUNTED; ],
4857 fu_cv_sys_mounted_getmntent1=yes,
4858 fu_cv_sys_mounted_getmntent1=no)])
4859 AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
4860 if test $fu_cv_sys_mounted_getmntent1 = yes; then
4861 ac_list_mounted_fs=found
4862 AC_DEFINE(MOUNTED_GETMNTENT1, 1,
4863 [Define if there is a function named getmntent for reading the list
4864 of mounted filesystems, and that function takes a single argument.
4865 (4.3BSD, SunOS, HP-UX, Dynix, Irix)])
4869 if test -z "$ac_list_mounted_fs"; then
4871 AC_MSG_CHECKING([for two-argument getmntent function])
4872 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
4873 [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
4874 fu_cv_sys_mounted_getmntent2=yes,
4875 fu_cv_sys_mounted_getmntent2=no)])
4876 AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2)
4877 if test $fu_cv_sys_mounted_getmntent2 = yes; then
4878 ac_list_mounted_fs=found
4879 AC_DEFINE(MOUNTED_GETMNTENT2, 1,
4880 [Define if there is a function named getmntent for reading the list of
4881 mounted filesystems, and that function takes two arguments. (SVR4)])
4887 if test -z "$ac_list_mounted_fs"; then
4888 # DEC Alpha running OSF/1, and Apple Darwin 1.3.
4889 # powerpc-apple-darwin1.3.7 needs sys/param.h sys/ucred.h sys/fs_types.h
4891 AC_MSG_CHECKING([for getfsstat function])
4892 AC_CACHE_VAL(fu_cv_sys_mounted_getfsstat,
4894 #include <sys/types.h>
4895 #if HAVE_STRUCT_FSSTAT_F_FSTYPENAME
4896 # define FS_TYPE(Ent) ((Ent).f_fstypename)
4898 # define FS_TYPE(Ent) mnt_names[(Ent).f_type]
4900 ]$getfsstat_includes
4902 [struct statfs *stats;
4903 int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT);
4904 char *t = FS_TYPE (*stats); ],
4905 fu_cv_sys_mounted_getfsstat=yes,
4906 fu_cv_sys_mounted_getfsstat=no)])
4907 AC_MSG_RESULT($fu_cv_sys_mounted_getfsstat)
4908 if test $fu_cv_sys_mounted_getfsstat = yes; then
4909 ac_list_mounted_fs=found
4910 AC_DEFINE(MOUNTED_GETFSSTAT, 1,
4911 [Define if there is a function named getfsstat for reading the
4912 list of mounted filesystems. (DEC Alpha running OSF/1)])
4916 if test -z "$ac_list_mounted_fs"; then
4918 AC_MSG_CHECKING([for mntctl function and struct vmount])
4919 AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
4920 [AC_TRY_CPP([#include <fshelp.h>],
4921 fu_cv_sys_mounted_vmount=yes,
4922 fu_cv_sys_mounted_vmount=no)])
4923 AC_MSG_RESULT($fu_cv_sys_mounted_vmount)
4924 if test $fu_cv_sys_mounted_vmount = yes; then
4925 ac_list_mounted_fs=found
4926 AC_DEFINE(MOUNTED_VMOUNT, 1,
4927 [Define if there is a function named mntctl that can be used to read
4928 the list of mounted filesystems, and there is a system header file
4929 that declares `struct vmount.' (AIX)])
4933 if test -z "$ac_list_mounted_fs"; then
4935 AC_MSG_CHECKING([for FIXME existence of three headers])
4936 AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
4938 #include <sys/statfs.h>
4939 #include <sys/fstyp.h>
4940 #include <mnttab.h>],
4941 fu_cv_sys_mounted_fread_fstyp=yes,
4942 fu_cv_sys_mounted_fread_fstyp=no)])
4943 AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp)
4944 if test $fu_cv_sys_mounted_fread_fstyp = yes; then
4945 ac_list_mounted_fs=found
4946 AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
4947 [Define if (like SVR2) there is no specific function for reading the
4948 list of mounted filesystems, and your system has these header files:
4949 <sys/fstyp.h> and <sys/statfs.h>. (SVR3)])
4953 if test -z "$ac_list_mounted_fs"; then
4954 # 4.4BSD and DEC OSF/1.
4955 AC_MSG_CHECKING([for getmntinfo function])
4956 AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
4958 test "$ac_cv_func_getmntinfo" = yes \
4959 && fu_cv_sys_mounted_getmntinfo=yes \
4960 || fu_cv_sys_mounted_getmntinfo=no
4962 AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
4963 if test $fu_cv_sys_mounted_getmntinfo = yes; then
4964 ac_list_mounted_fs=found
4965 AC_DEFINE(MOUNTED_GETMNTINFO, 1,
4966 [Define if there is a function named getmntinfo for reading the
4967 list of mounted filesystems. (4.4BSD, Darwin)])
4971 if test -z "$ac_list_mounted_fs"; then
4973 AC_MSG_CHECKING([for getmnt function])
4974 AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
4976 #include <sys/fs_types.h>
4977 #include <sys/mount.h>],
4978 fu_cv_sys_mounted_getmnt=yes,
4979 fu_cv_sys_mounted_getmnt=no)])
4980 AC_MSG_RESULT($fu_cv_sys_mounted_getmnt)
4981 if test $fu_cv_sys_mounted_getmnt = yes; then
4982 ac_list_mounted_fs=found
4983 AC_DEFINE(MOUNTED_GETMNT, 1,
4984 [Define if there is a function named getmnt for reading the list of
4985 mounted filesystems. (Ultrix)])
4989 if test -z "$ac_list_mounted_fs"; then
4991 AC_CHECK_FUNCS(next_dev fs_stat_dev)
4992 AC_CHECK_HEADERS(fs_info.h)
4993 AC_MSG_CHECKING([for BEOS mounted file system support functions])
4994 if test $ac_cv_header_fs_info_h = yes \
4995 && test $ac_cv_func_next_dev = yes \
4996 && test $ac_cv_func_fs_stat_dev = yes; then
5001 AC_MSG_RESULT($fu_result)
5002 if test $fu_result = yes; then
5003 ac_list_mounted_fs=found
5004 AC_DEFINE(MOUNTED_FS_STAT_DEV, 1,
5005 [Define if there are functions named next_dev and fs_stat_dev for
5006 reading the list of mounted filesystems. (BeOS)])
5010 if test -z "$ac_list_mounted_fs"; then
5012 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
5013 AC_CACHE_VAL(fu_cv_sys_mounted_fread,
5014 [AC_TRY_CPP([#include <mnttab.h>],
5015 fu_cv_sys_mounted_fread=yes,
5016 fu_cv_sys_mounted_fread=no)])
5017 AC_MSG_RESULT($fu_cv_sys_mounted_fread)
5018 if test $fu_cv_sys_mounted_fread = yes; then
5019 ac_list_mounted_fs=found
5020 AC_DEFINE(MOUNTED_FREAD, 1,
5021 [Define if there is no specific function for reading the list of
5022 mounted filesystems. fread will be used to read /etc/mnttab. (SVR2) ])
5026 if test -z "$ac_list_mounted_fs"; then
5027 AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
5028 # FIXME -- no need to abort building the whole package
5029 # Can't build mountlist.c or anything that needs its functions
5032 AS_IF([test $ac_list_mounted_fs = found], [$1], [$2])
5038 dnl From Jim Meyering.
5040 dnl See if struct statfs has the f_fstypename member.
5041 dnl If so, define HAVE_F_FSTYPENAME_IN_STATFS.
5044 AC_DEFUN([jm_FSTYPENAME],
5046 AC_CACHE_CHECK([for f_fstypename in struct statfs],
5047 fu_cv_sys_f_fstypename_in_statfs,
5051 #include <sys/param.h>
5052 #include <sys/types.h>
5053 #include <sys/mount.h>
5055 [struct statfs s; int i = sizeof s.f_fstypename;],
5056 fu_cv_sys_f_fstypename_in_statfs=yes,
5057 fu_cv_sys_f_fstypename_in_statfs=no
5062 if test $fu_cv_sys_f_fstypename_in_statfs = yes; then
5063 AC_DEFINE(HAVE_F_FSTYPENAME_IN_STATFS, 1,
5064 [Define if struct statfs has the f_fstypename member.])
5071 # From fileutils/configure.in
5073 # Try to determine how a program can obtain filesystem usage information.
5074 # If successful, define the appropriate symbol (see fsusage.c) and
5075 # execute ACTION-IF-FOUND. Otherwise, execute ACTION-IF-NOT-FOUND.
5077 # jm_FILE_SYSTEM_USAGE([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
5079 AC_DEFUN([jm_FILE_SYSTEM_USAGE],
5082 echo "checking how to get filesystem space usage..."
5085 # Perform only the link test since it seems there are no variants of the
5086 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
5087 # because that got a false positive on SCO OSR5. Adding the declaration
5088 # of a `struct statvfs' causes this test to fail (as it should) on such
5089 # systems. That system is reported to work fine with STAT_STATFS4 which
5090 # is what it gets when this test fails.
5091 if test $ac_fsusage_space = no; then
5093 AC_CACHE_CHECK([for statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
5094 [AC_TRY_LINK([#include <sys/types.h>
5095 #include <sys/statvfs.h>],
5096 [struct statvfs fsd; statvfs (0, &fsd);],
5097 fu_cv_sys_stat_statvfs=yes,
5098 fu_cv_sys_stat_statvfs=no)])
5099 if test $fu_cv_sys_stat_statvfs = yes; then
5100 ac_fsusage_space=yes
5101 AC_DEFINE(STAT_STATVFS, 1,
5102 [ Define if there is a function named statvfs. (SVR4)])
5106 if test $ac_fsusage_space = no; then
5107 # DEC Alpha running OSF/1
5108 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
5109 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
5111 #include <sys/param.h>
5112 #include <sys/types.h>
5113 #include <sys/mount.h>
5118 exit (statfs (".", &fsd, sizeof (struct statfs)));
5120 fu_cv_sys_stat_statfs3_osf1=yes,
5121 fu_cv_sys_stat_statfs3_osf1=no,
5122 fu_cv_sys_stat_statfs3_osf1=no)])
5123 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
5124 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
5125 ac_fsusage_space=yes
5126 AC_DEFINE(STAT_STATFS3_OSF1, 1,
5127 [ Define if statfs takes 3 args. (DEC Alpha running OSF/1)])
5131 if test $ac_fsusage_space = no; then
5133 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
5134 member (AIX, 4.3BSD)])
5135 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
5137 #ifdef HAVE_SYS_PARAM_H
5138 #include <sys/param.h>
5140 #ifdef HAVE_SYS_MOUNT_H
5141 #include <sys/mount.h>
5143 #ifdef HAVE_SYS_VFS_H
5144 #include <sys/vfs.h>
5150 exit (statfs (".", &fsd));
5152 fu_cv_sys_stat_statfs2_bsize=yes,
5153 fu_cv_sys_stat_statfs2_bsize=no,
5154 fu_cv_sys_stat_statfs2_bsize=no)])
5155 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
5156 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
5157 ac_fsusage_space=yes
5158 AC_DEFINE(STAT_STATFS2_BSIZE, 1,
5159 [ Define if statfs takes 2 args and struct statfs has a field named f_bsize.
5160 (4.3BSD, SunOS 4, HP-UX, AIX PS/2)])
5164 if test $ac_fsusage_space = no; then
5166 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
5167 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
5168 [AC_TRY_RUN([#include <sys/types.h>
5169 #include <sys/statfs.h>
5173 exit (statfs (".", &fsd, sizeof fsd, 0));
5175 fu_cv_sys_stat_statfs4=yes,
5176 fu_cv_sys_stat_statfs4=no,
5177 fu_cv_sys_stat_statfs4=no)])
5178 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
5179 if test $fu_cv_sys_stat_statfs4 = yes; then
5180 ac_fsusage_space=yes
5181 AC_DEFINE(STAT_STATFS4, 1,
5182 [ Define if statfs takes 4 args. (SVR3, Dynix, Irix, Dolphin)])
5186 if test $ac_fsusage_space = no; then
5188 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
5189 member (4.4BSD and NetBSD)])
5190 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
5191 [AC_TRY_RUN([#include <sys/types.h>
5192 #ifdef HAVE_SYS_PARAM_H
5193 #include <sys/param.h>
5195 #ifdef HAVE_SYS_MOUNT_H
5196 #include <sys/mount.h>
5202 exit (statfs (".", &fsd));
5204 fu_cv_sys_stat_statfs2_fsize=yes,
5205 fu_cv_sys_stat_statfs2_fsize=no,
5206 fu_cv_sys_stat_statfs2_fsize=no)])
5207 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
5208 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
5209 ac_fsusage_space=yes
5210 AC_DEFINE(STAT_STATFS2_FSIZE, 1,
5211 [ Define if statfs takes 2 args and struct statfs has a field named f_fsize.
5216 if test $ac_fsusage_space = no; then
5218 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
5219 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
5220 [AC_TRY_RUN([#include <sys/types.h>
5221 #ifdef HAVE_SYS_PARAM_H
5222 #include <sys/param.h>
5224 #ifdef HAVE_SYS_MOUNT_H
5225 #include <sys/mount.h>
5227 #ifdef HAVE_SYS_FS_TYPES_H
5228 #include <sys/fs_types.h>
5233 /* Ultrix's statfs returns 1 for success,
5234 0 for not mounted, -1 for failure. */
5235 exit (statfs (".", &fsd) != 1);
5237 fu_cv_sys_stat_fs_data=yes,
5238 fu_cv_sys_stat_fs_data=no,
5239 fu_cv_sys_stat_fs_data=no)])
5240 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
5241 if test $fu_cv_sys_stat_fs_data = yes; then
5242 ac_fsusage_space=yes
5243 AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
5244 [ Define if statfs takes 2 args and the second argument has
5245 type struct fs_data. (Ultrix)])
5249 if test $ac_fsusage_space = no; then
5251 AC_TRY_CPP([#include <sys/filsys.h>
5253 AC_DEFINE(STAT_READ_FILSYS, 1,
5254 [Define if there is no specific function for reading filesystems usage
5255 information and you have the <sys/filsys.h> header file. (SVR2)])
5256 ac_fsusage_space=yes)
5259 AS_IF([test $ac_fsusage_space = yes], [$1], [$2])
5265 # Define some macros required for proper operation of code in lib/*.c
5266 # on MSDOS/Windows systems.
5268 # From Jim Meyering.
5270 AC_DEFUN([jm_AC_DOS],
5272 AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos],
5275 [#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__
5276 neither MSDOS nor Windows
5278 [ac_cv_win_or_dos=yes],
5279 [ac_cv_win_or_dos=no])
5282 if test x"$ac_cv_win_or_dos" = xyes; then
5283 ac_fs_accepts_drive_letter_prefix=1
5284 ac_fs_backslash_is_file_name_separator=1
5286 ac_fs_accepts_drive_letter_prefix=0
5287 ac_fs_backslash_is_file_name_separator=0
5290 AH_VERBATIM(FILESYSTEM_PREFIX_LEN,
5291 [#if FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
5292 # define FILESYSTEM_PREFIX_LEN(Filename) \
5293 ((Filename)[0] && (Filename)[1] == ':' ? 2 : 0)
5295 # define FILESYSTEM_PREFIX_LEN(Filename) 0
5298 AC_DEFINE_UNQUOTED([FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
5299 $ac_fs_accepts_drive_letter_prefix,
5300 [Define on systems for which file names may have a so-called
5301 `drive letter' prefix, define this to compute the length of that
5302 prefix, including the colon.])
5304 AH_VERBATIM(ISSLASH,
5305 [#if FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
5306 # define ISSLASH(C) ((C) == '/' || (C) == '\\')
5308 # define ISSLASH(C) ((C) == '/')
5311 AC_DEFINE_UNQUOTED([FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR],
5312 $ac_fs_backslash_is_file_name_separator,
5313 [Define if the backslash character may also serve as a file name
5314 component separator.])
5318 AC_DEFUN([AC_FUNC_CANONICALIZE_FILE_NAME],
5320 AC_REQUIRE([AC_HEADER_STDC])
5321 AC_CHECK_HEADERS(string.h sys/param.h stddef.h)
5322 AC_CHECK_FUNCS(resolvepath)
5323 AC_REQUIRE([AC_HEADER_STAT])
5325 # This would simply be AC_REPLACE_FUNC([canonicalize_file_name])
5326 # if the function name weren't so long. Besides, I would rather
5327 # not have underscores in file names.
5328 AC_CHECK_FUNC([canonicalize_file_name], , [AC_LIBOBJ(canonicalize)])
5333 dnl From Paul Eggert.
5335 # Define ST_MTIM_NSEC to be the nanoseconds member of struct stat's st_mtim,
5338 AC_DEFUN([AC_STRUCT_ST_MTIM_NSEC],
5339 [AC_CACHE_CHECK([for nanoseconds member of struct stat.st_mtim],
5340 ac_cv_struct_st_mtim_nsec,
5341 [ac_save_CPPFLAGS="$CPPFLAGS"
5342 ac_cv_struct_st_mtim_nsec=no
5343 # tv_nsec -- the usual case
5344 # _tv_nsec -- Solaris 2.6, if
5345 # (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1
5346 # && !defined __EXTENSIONS__)
5347 # st__tim.tv_nsec -- UnixWare 2.1.2
5348 for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do
5349 CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val"
5350 AC_TRY_COMPILE([#include <sys/types.h>
5351 #include <sys/stat.h>], [struct stat s; s.st_mtim.ST_MTIM_NSEC;],
5352 [ac_cv_struct_st_mtim_nsec=$ac_val; break])
5354 CPPFLAGS="$ac_save_CPPFLAGS"])
5356 if test $ac_cv_struct_st_mtim_nsec != no; then
5357 AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec,
5358 [Define to be the nanoseconds member of struct stat's st_mtim,
5366 # Define HAVE_ST_DM_MODE if struct stat has an st_dm_mode member.
5368 AC_DEFUN([AC_STRUCT_ST_DM_MODE],
5369 [AC_CACHE_CHECK([for st_dm_mode in struct stat], ac_cv_struct_st_dm_mode,
5370 [AC_TRY_COMPILE([#include <sys/types.h>
5371 #include <sys/stat.h>], [struct stat s; s.st_dm_mode;],
5372 ac_cv_struct_st_dm_mode=yes,
5373 ac_cv_struct_st_dm_mode=no)])
5375 if test $ac_cv_struct_st_dm_mode = yes; then
5376 AC_DEFINE(HAVE_ST_DM_MODE, 1,
5377 [Define if struct stat has an st_dm_mode member. ])
5384 dnl From Jim Meyering
5386 dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
5387 dnl in time.h or sys/time.h.
5389 AC_DEFUN([jm_CHECK_TYPE_STRUCT_TIMESPEC],
5391 AC_REQUIRE([AC_HEADER_TIME])
5392 AC_CACHE_CHECK([for struct timespec], fu_cv_sys_struct_timespec,
5395 # if TIME_WITH_SYS_TIME
5396 # include <sys/time.h>
5399 # if HAVE_SYS_TIME_H
5400 # include <sys/time.h>
5406 [static struct timespec x; x.tv_sec = x.tv_nsec;],
5407 fu_cv_sys_struct_timespec=yes,
5408 fu_cv_sys_struct_timespec=no)
5411 if test $fu_cv_sys_struct_timespec = yes; then
5412 AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
5413 [Define if struct timespec is declared in <time.h>. ])
5418 dnl From Jim Meyering and Paul Eggert.
5419 AC_DEFUN([jm_HEADER_TIOCGWINSZ_IN_TERMIOS_H],
5420 [AC_REQUIRE([AC_SYS_POSIX_TERMIOS])
5421 AC_CACHE_CHECK([whether use of TIOCGWINSZ requires termios.h],
5422 jm_cv_sys_tiocgwinsz_needs_termios_h,
5423 [jm_cv_sys_tiocgwinsz_needs_termios_h=no
5425 if test $ac_cv_sys_posix_termios = yes; then
5427 [#include <sys/types.h>
5428 # include <termios.h>
5432 ], jm_cv_sys_tiocgwinsz_needs_termios_h=yes)
5437 AC_DEFUN([jm_WINSIZE_IN_PTEM],
5438 [AC_REQUIRE([AC_SYS_POSIX_TERMIOS])
5439 AC_CACHE_CHECK([whether use of struct winsize requires sys/ptem.h],
5440 jm_cv_sys_struct_winsize_needs_sys_ptem_h,
5441 [jm_cv_sys_struct_winsize_needs_sys_ptem_h=yes
5442 if test $ac_cv_sys_posix_termios = yes; then
5443 AC_TRY_COMPILE([#include <termios.h>]
5444 [struct winsize x;],
5445 [jm_cv_sys_struct_winsize_needs_sys_ptem_h=no])
5447 if test $jm_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then
5448 AC_TRY_COMPILE([#include <sys/ptem.h>],
5449 [struct winsize x;],
5450 [], [jm_cv_sys_struct_winsize_needs_sys_ptem_h=no])
5452 if test $jm_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then
5453 AC_DEFINE([WINSIZE_IN_PTEM], 1,
5454 [Define if sys/ptem.h is required for struct winsize.])
5457 # Determine whether this system has infrastructure for obtaining the boot time.
5459 # GNULIB_BOOT_TIME([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
5460 * ----------------------------------------------------------
5461 AC_DEFUN([GNULIB_BOOT_TIME],
5463 AC_CHECK_FUNCS(sysctl)
5464 AC_CHECK_HEADERS(sys/sysctl.h)
5466 [whether we can get the system boot time],
5467 [gnulib_cv_have_boot_time],
5471 [AC_INCLUDES_DEFAULT
5472 #if HAVE_SYSCTL && HAVE_SYS_SYSCTL_H
5473 # include <sys/param.h> /* needed for OpenBSD 3.0 */
5474 # include <sys/sysctl.h>
5483 #if defined BOOT_TIME || (defined CTL_KERN && defined KERN_BOOTTIME)
5484 /* your system *does* have the infrastructure to determine boot time */
5486 please_tell_us_how_to_determine_boot_time_on_your_system
5489 gnulib_cv_have_boot_time=yes,
5490 gnulib_cv_have_boot_time=no)
5492 AS_IF([test $gnulib_cv_have_boot_time = yes], [$1], [$2])
5497 AC_DEFUN([jm_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL],
5498 [AC_REQUIRE([jm_HEADER_TIOCGWINSZ_IN_TERMIOS_H])
5499 AC_CACHE_CHECK([whether use of TIOCGWINSZ requires sys/ioctl.h],
5500 jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h,
5501 [jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h=no
5503 if test $jm_cv_sys_tiocgwinsz_needs_termios_h = no; then
5505 [#include <sys/types.h>
5506 # include <sys/ioctl.h>
5510 ], jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes)
5513 if test $jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h = yes; then
5514 AC_DEFINE(GWINSZ_IN_SYS_IOCTL, 1,
5515 [Define if your system defines TIOCGWINSZ in sys/ioctl.h.])
5521 dnl Misc lib-related macros for fileutils, sh-utils, textutils.
5523 AC_DEFUN([jm_LIB_CHECK],
5526 # Check for libypsec.a on Dolphin M88K machines.
5527 AC_CHECK_LIB(ypsec, main)
5529 # m88k running dgux 5.4 needs this
5530 AC_CHECK_LIB(ldgc, main)
5532 # Some programs need to link with -lm. printf does if it uses
5533 # lib/strtod.c which uses pow. And seq uses the math functions,
5534 # floor, modf, rint. And factor uses sqrt. And sleep uses fesetround.
5536 # Save a copy of $LIBS and add $FLOOR_LIBM before these tests
5537 # Check for these math functions used by seq.
5538 ac_su_saved_lib="$LIBS"
5540 AC_CHECK_FUNCS(floor modf rint)
5541 LIBS="$ac_su_saved_lib"
5544 AC_CHECK_FUNCS(sqrt)
5545 if test $ac_cv_func_sqrt = no; then
5546 AC_CHECK_LIB(m, sqrt, [SQRT_LIBM=-lm])
5549 AC_SUBST(FESETROUND_LIBM)
5550 AC_CHECK_FUNCS(fesetround)
5551 if test $ac_cv_func_fesetround = no; then
5552 AC_CHECK_LIB(m, fesetround, [FESETROUND_LIBM=-lm])
5555 # The -lsun library is required for YP support on Irix-4.0.5 systems.
5556 # m88k/svr3 DolphinOS systems using YP need -lypsec for id.
5557 AC_SEARCH_LIBS(yp_match, [sun ypsec])
5559 # SysV needs -lsec, older versions of Linux need -lshadow for
5560 # shadow passwords. UnixWare 7 needs -lgen.
5561 AC_SEARCH_LIBS(getspnam, [shadow sec gen])
5563 AC_CHECK_HEADERS(shadow.h)
5565 # Requirements for su.c.
5567 $ac_includes_default
5569 # include <shadow.h>
5572 AC_CHECK_MEMBERS([struct spwd.sp_pwdp],,,[$shadow_includes])
5573 AC_CHECK_FUNCS(getspnam)
5575 # SCO-ODT-3.0 is reported to need -lufc for crypt.
5576 # NetBSD needs -lcrypt for crypt.
5577 ac_su_saved_lib="$LIBS"
5578 AC_SEARCH_LIBS(crypt, [ufc crypt], [LIB_CRYPT="$ac_cv_search_crypt"])
5579 LIBS="$ac_su_saved_lib"
5583 # gettext.m4 serial 17 (gettext-0.11.5)
5584 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
5585 dnl This file is free software, distributed under the terms of the GNU
5586 dnl General Public License. As a special exception to the GNU General
5587 dnl Public License, this file may be distributed as part of a program
5588 dnl that contains a configuration script generated by Autoconf, under
5589 dnl the same distribution terms as the rest of that program.
5591 dnl This file can can be used in projects which are not available under
5592 dnl the GNU General Public License or the GNU Library General Public
5593 dnl License but which still want to provide support for the GNU gettext
5595 dnl Please note that the actual code of the GNU gettext library is covered
5596 dnl by the GNU Library General Public License, and the rest of the GNU
5597 dnl gettext package package is covered by the GNU General Public License.
5598 dnl They are *not* in the public domain.
5601 dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
5602 dnl Bruno Haible <haible@clisp.cons.org>, 2000-2002.
5604 dnl Macro to add for using GNU gettext.
5606 dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
5607 dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
5608 dnl default (if it is not specified or empty) is 'no-libtool'.
5609 dnl INTLSYMBOL should be 'external' for packages with no intl directory,
5610 dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory.
5611 dnl If INTLSYMBOL is 'use-libtool', then a libtool library
5612 dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
5613 dnl depending on --{enable,disable}-{shared,static} and on the presence of
5614 dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
5615 dnl $(top_builddir)/intl/libintl.a will be created.
5616 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
5617 dnl implementations (in libc or libintl) without the ngettext() function
5618 dnl will be ignored. If NEEDSYMBOL is specified and is
5619 dnl 'need-formatstring-macros', then GNU gettext implementations that don't
5620 dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
5621 dnl INTLDIR is used to find the intl libraries. If empty,
5622 dnl the value `$(top_builddir)/intl/' is used.
5624 dnl The result of the configuration is one of three cases:
5625 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
5627 dnl Catalog format: GNU --> install in $(datadir)
5628 dnl Catalog extension: .mo after installation, .gmo in source tree
5629 dnl 2) GNU gettext has been found in the system's C library.
5630 dnl Catalog format: GNU --> install in $(datadir)
5631 dnl Catalog extension: .mo after installation, .gmo in source tree
5632 dnl 3) No internationalization, always use English msgid.
5633 dnl Catalog format: none
5634 dnl Catalog extension: none
5635 dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
5636 dnl The use of .gmo is historical (it was needed to avoid overwriting the
5637 dnl GNU format catalogs when building on a platform with an X/Open gettext),
5638 dnl but we keep it in order not to force irrelevant filename changes on the
5641 AC_DEFUN([AM_GNU_GETTEXT],
5643 dnl Argument checking.
5644 ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
5645 [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
5647 ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
5648 [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
5650 define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
5651 define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
5653 AC_REQUIRE([AM_PO_SUBDIRS])dnl
5654 ifelse(gt_included_intl, yes, [
5655 AC_REQUIRE([AM_INTL_SUBDIR])dnl
5658 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
5659 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
5660 AC_REQUIRE([AC_LIB_RPATH])
5662 dnl Sometimes libintl requires libiconv, so first search for libiconv.
5663 dnl Ideally we would do this search only after the
5664 dnl if test "$USE_NLS" = "yes"; then
5665 dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then
5666 dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
5667 dnl the configure script would need to contain the same shell code
5668 dnl again, outside any 'if'. There are two solutions:
5669 dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
5670 dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
5671 dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
5672 dnl documented, we avoid it.
5673 ifelse(gt_included_intl, yes, , [
5674 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
5677 AC_MSG_CHECKING([whether NLS is requested])
5678 dnl Default is enabled NLS
5680 [ --disable-nls do not use Native Language Support],
5681 USE_NLS=$enableval, USE_NLS=yes)
5682 AC_MSG_RESULT($USE_NLS)
5685 ifelse(gt_included_intl, yes, [
5686 BUILD_INCLUDED_LIBINTL=no
5687 USE_INCLUDED_LIBINTL=no
5693 dnl If we use NLS figure out what method
5694 if test "$USE_NLS" = "yes"; then
5695 gt_use_preinstalled_gnugettext=no
5696 ifelse(gt_included_intl, yes, [
5697 AC_MSG_CHECKING([whether included gettext is requested])
5698 AC_ARG_WITH(included-gettext,
5699 [ --with-included-gettext use the GNU gettext library included here],
5700 nls_cv_force_use_gnu_gettext=$withval,
5701 nls_cv_force_use_gnu_gettext=no)
5702 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
5704 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
5705 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
5707 dnl User does not insist on using GNU NLS library. Figure out what
5708 dnl to use. If GNU gettext is available we use this. Else we have
5709 dnl to fall back to GNU NLS library.
5711 dnl Add a version number to the cache macros.
5712 define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
5713 define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
5714 define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
5716 AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
5717 [AC_TRY_LINK([#include <libintl.h>
5718 ]ifelse([$2], [need-formatstring-macros],
5719 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
5720 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
5723 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
5725 ], [])[extern int _nl_msg_cat_cntr;
5726 extern int *_nl_domain_bindings;],
5727 [bindtextdomain ("", "");
5728 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
5729 gt_cv_func_gnugettext_libc=yes,
5730 gt_cv_func_gnugettext_libc=no)])
5732 if test "$gt_cv_func_gnugettext_libc" != "yes"; then
5733 dnl Sometimes libintl requires libiconv, so first search for libiconv.
5734 ifelse(gt_included_intl, yes, , [
5737 dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
5738 dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
5739 dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
5740 dnl even if libiconv doesn't exist.
5741 AC_LIB_LINKFLAGS_BODY([intl])
5742 AC_CACHE_CHECK([for GNU gettext in libintl],
5743 gt_cv_func_gnugettext_libintl,
5744 [gt_save_CPPFLAGS="$CPPFLAGS"
5745 CPPFLAGS="$CPPFLAGS $INCINTL"
5746 gt_save_LIBS="$LIBS"
5747 LIBS="$LIBS $LIBINTL"
5748 dnl Now see whether libintl exists and does not depend on libiconv.
5749 AC_TRY_LINK([#include <libintl.h>
5750 ]ifelse([$2], [need-formatstring-macros],
5751 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
5752 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
5755 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
5757 ], [])[extern int _nl_msg_cat_cntr;
5762 const char *_nl_expand_alias ();],
5763 [bindtextdomain ("", "");
5764 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
5765 gt_cv_func_gnugettext_libintl=yes,
5766 gt_cv_func_gnugettext_libintl=no)
5767 dnl Now see whether libintl exists and depends on libiconv.
5768 if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
5769 LIBS="$LIBS $LIBICONV"
5770 AC_TRY_LINK([#include <libintl.h>
5771 ]ifelse([$2], [need-formatstring-macros],
5772 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
5773 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
5776 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
5778 ], [])[extern int _nl_msg_cat_cntr;
5783 const char *_nl_expand_alias ();],
5784 [bindtextdomain ("", "");
5785 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
5786 [LIBINTL="$LIBINTL $LIBICONV"
5787 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
5788 gt_cv_func_gnugettext_libintl=yes
5791 CPPFLAGS="$gt_save_CPPFLAGS"
5792 LIBS="$gt_save_LIBS"])
5795 dnl If an already present or preinstalled GNU gettext() is found,
5796 dnl use it. But if this macro is used in GNU gettext, and GNU
5797 dnl gettext is already preinstalled in libintl, we update this
5798 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
5799 if test "$gt_cv_func_gnugettext_libc" = "yes" \
5800 || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
5801 && test "$PACKAGE" != gettext; }; then
5802 gt_use_preinstalled_gnugettext=yes
5804 dnl Reset the values set by searching for libintl.
5810 ifelse(gt_included_intl, yes, [
5811 if test "$gt_use_preinstalled_gnugettext" != "yes"; then
5812 dnl GNU gettext is not found in the C library.
5813 dnl Fall back on included GNU gettext library.
5814 nls_cv_use_gnu_gettext=yes
5818 if test "$nls_cv_use_gnu_gettext" = "yes"; then
5819 dnl Mark actions used to generate GNU NLS library.
5820 INTLOBJS="\$(GETTOBJS)"
5821 BUILD_INCLUDED_LIBINTL=yes
5822 USE_INCLUDED_LIBINTL=yes
5823 LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
5824 LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
5825 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
5828 if test "$gt_use_preinstalled_gnugettext" = "yes" \
5829 || test "$nls_cv_use_gnu_gettext" = "yes"; then
5830 dnl Mark actions to use GNU gettext tools.
5835 if test "$gt_use_preinstalled_gnugettext" = "yes" \
5836 || test "$nls_cv_use_gnu_gettext" = "yes"; then
5837 AC_DEFINE(ENABLE_NLS, 1,
5838 [Define to 1 if translation of program messages to the user's native language
5845 if test "$USE_NLS" = "yes"; then
5847 if test "$gt_use_preinstalled_gnugettext" = "yes"; then
5848 if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
5849 AC_MSG_CHECKING([how to link with libintl])
5850 AC_MSG_RESULT([$LIBINTL])
5851 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
5854 dnl For backward compatibility. Some packages may be using this.
5855 AC_DEFINE(HAVE_GETTEXT, 1,
5856 [Define if the GNU gettext() function is already present or preinstalled.])
5857 AC_DEFINE(HAVE_DCGETTEXT, 1,
5858 [Define if the GNU dcgettext() function is already present or preinstalled.])
5861 dnl We need to process the po/ directory.
5865 ifelse(gt_included_intl, yes, [
5866 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
5867 dnl to 'yes' because some of the testsuite requires it.
5868 if test "$PACKAGE" = gettext; then
5869 BUILD_INCLUDED_LIBINTL=yes
5872 dnl Make all variables we use known to autoconf.
5873 AC_SUBST(BUILD_INCLUDED_LIBINTL)
5874 AC_SUBST(USE_INCLUDED_LIBINTL)
5878 dnl For backward compatibility. Some configure.ins may be using this.
5880 nls_cv_header_libgt=
5882 dnl For backward compatibility. Some Makefiles may be using this.
5884 AC_SUBST(DATADIRNAME)
5886 dnl For backward compatibility. Some Makefiles may be using this.
5888 AC_SUBST(INSTOBJEXT)
5890 dnl For backward compatibility. Some Makefiles may be using this.
5894 dnl Enable libtool support if the surrounding package wishes it.
5895 INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
5896 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
5899 dnl For backward compatibility. Some Makefiles may be using this.
5903 dnl Make all documented variables known to autoconf.
5910 dnl Checks for all prerequisites of the po subdirectory,
5911 dnl except for USE_NLS.
5912 AC_DEFUN([AM_PO_SUBDIRS],
5914 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
5915 AC_REQUIRE([AC_PROG_INSTALL])dnl
5916 AC_REQUIRE([AM_MKINSTALLDIRS])dnl
5918 dnl Perform the following tests also if --disable-nls has been given,
5919 dnl because they are needed for "make dist" to work.
5921 dnl Search for GNU msgfmt in the PATH.
5922 dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
5923 dnl The second test excludes FreeBSD msgfmt.
5924 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
5925 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
5926 (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
5928 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
5930 dnl Search for GNU xgettext 0.11 or newer in the PATH.
5931 dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
5932 dnl The second test excludes FreeBSD xgettext.
5933 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
5934 [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
5935 (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)],
5937 dnl Remove leftover from FreeBSD xgettext call.
5940 dnl Search for GNU msgmerge 0.11 or newer in the PATH.
5941 AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
5942 [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
5944 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
5945 dnl Test whether we really found GNU msgfmt.
5946 if test "$GMSGFMT" != ":"; then
5947 dnl If it is no GNU msgfmt we define it as : so that the
5948 dnl Makefiles still can work.
5949 if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
5950 (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
5953 GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
5955 [found $GMSGFMT program is not GNU msgfmt; ignore it])
5960 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
5961 dnl Test whether we really found GNU xgettext.
5962 if test "$XGETTEXT" != ":"; then
5963 dnl If it is no GNU xgettext we define it as : so that the
5964 dnl Makefiles still can work.
5965 if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
5966 (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
5970 [found xgettext program is not GNU xgettext; ignore it])
5973 dnl Remove leftover from FreeBSD xgettext call.
5977 AC_OUTPUT_COMMANDS([
5978 for ac_file in $CONFIG_FILES; do
5979 # Support "outfile[:infile[:infile...]]"
5981 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
5983 # PO directories have a Makefile.in generated from Makefile.in.in.
5984 case "$ac_file" in */Makefile.in)
5985 # Adjust a relative srcdir.
5986 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
5987 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
5988 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
5989 # In autoconf-2.13 it is called $ac_given_srcdir.
5990 # In autoconf-2.50 it is called $srcdir.
5991 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
5992 case "$ac_given_srcdir" in
5993 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
5994 /*) top_srcdir="$ac_given_srcdir" ;;
5995 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
5997 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
5998 rm -f "$ac_dir/POTFILES"
5999 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
6000 cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
6001 # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
6002 # on $ac_dir but don't depend on user-specified configuration
6004 if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
6005 # The LINGUAS file contains the set of available languages.
6006 if test -n "$ALL_LINGUAS"; then
6007 test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
6009 ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
6010 # Hide the ALL_LINGUAS assigment from automake.
6011 eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
6013 case "$ac_given_srcdir" in
6015 *) srcdirpre='$(srcdir)/' ;;
6021 for lang in $ALL_LINGUAS; do
6022 POFILES="$POFILES $srcdirpre$lang.po"
6023 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
6024 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
6025 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
6027 # CATALOGS depends on both $ac_dir and the user's LINGUAS
6028 # environment variable.
6030 if test -n "$ALL_LINGUAS"; then
6031 for presentlang in $ALL_LINGUAS; do
6033 if test "%UNSET%" != "$LINGUAS"; then
6034 desiredlanguages="$LINGUAS"
6036 desiredlanguages="$ALL_LINGUAS"
6038 for desiredlang in $desiredlanguages; do
6039 # Use the presentlang catalog if desiredlang is
6040 # a. equal to presentlang, or
6041 # b. a variant of presentlang (because in this case,
6042 # presentlang can be used as a fallback for messages
6043 # which are not translated in the desiredlang catalog).
6044 case "$desiredlang" in
6045 "$presentlang"*) useit=yes;;
6048 if test $useit = yes; then
6049 INST_LINGUAS="$INST_LINGUAS $presentlang"
6054 if test -n "$INST_LINGUAS"; then
6055 for lang in $INST_LINGUAS; do
6056 CATALOGS="$CATALOGS $lang.gmo"
6059 test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
6060 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"
6061 for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
6062 if test -f "$f"; then
6064 *.orig | *.bak | *~) ;;
6065 *) cat "$f" >> "$ac_dir/Makefile" ;;
6073 [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
6074 # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
6076 eval 'ALL_LINGUAS''="$ALL_LINGUAS"'
6077 # Capture the value of LINGUAS because we need it to compute CATALOGS.
6078 LINGUAS="${LINGUAS-%UNSET%}"
6083 dnl Checks for all prerequisites of the intl subdirectory,
6084 dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
6085 dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
6086 AC_DEFUN([AM_INTL_SUBDIR],
6088 AC_REQUIRE([AC_PROG_INSTALL])dnl
6089 AC_REQUIRE([AM_MKINSTALLDIRS])dnl
6090 AC_REQUIRE([AC_PROG_CC])dnl
6091 AC_REQUIRE([AC_CANONICAL_HOST])dnl
6092 AC_REQUIRE([AC_PROG_RANLIB])dnl
6093 AC_REQUIRE([AC_ISC_POSIX])dnl
6094 AC_REQUIRE([AC_HEADER_STDC])dnl
6095 AC_REQUIRE([AC_C_CONST])dnl
6096 AC_REQUIRE([AC_C_INLINE])dnl
6097 AC_REQUIRE([AC_TYPE_OFF_T])dnl
6098 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
6099 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
6100 AC_REQUIRE([AC_FUNC_MMAP])dnl
6101 AC_REQUIRE([jm_GLIBC21])dnl
6102 AC_REQUIRE([gt_INTDIV0])dnl
6103 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
6104 AC_REQUIRE([gt_INTTYPES_PRI])dnl
6106 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
6107 stdlib.h string.h unistd.h sys/param.h])
6108 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
6109 geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \
6110 strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
6114 if test $ac_cv_header_locale_h = yes; then
6118 dnl intl/plural.c is generated from intl/plural.y. It requires bison,
6119 dnl because plural.y uses bison specific features. It requires at least
6120 dnl bison-1.26 because earlier versions generate a plural.c that doesn't
6122 dnl bison is only needed for the maintainer (who touches plural.y). But in
6123 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
6124 dnl the rule in general Makefile. Now, some people carelessly touch the
6125 dnl files or have a broken "make" program, hence the plural.c rule will
6126 dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
6127 dnl present or too old.
6128 AC_CHECK_PROGS([INTLBISON], [bison])
6129 if test -z "$INTLBISON"; then
6132 dnl Found it, now check the version.
6133 AC_MSG_CHECKING([version of bison])
6134 changequote(<<,>>)dnl
6135 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
6136 case $ac_prog_version in
6137 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
6138 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
6140 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
6141 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
6143 AC_MSG_RESULT([$ac_prog_version])
6145 if test $ac_verc_fail = yes; then
6151 AC_DEFUN([AM_MKINSTALLDIRS],
6153 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
6154 dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
6155 dnl Try to locate is.
6157 if test -n "$ac_aux_dir"; then
6158 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
6160 if test -z "$MKINSTALLDIRS"; then
6161 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
6163 AC_SUBST(MKINSTALLDIRS)
6167 dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
6168 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
6170 # progtest.m4 serial 2 (gettext-0.10.40)
6171 dnl Copyright (C) 1996-2002 Free Software Foundation, Inc.
6172 dnl This file is free software, distributed under the terms of the GNU
6173 dnl General Public License. As a special exception to the GNU General
6174 dnl Public License, this file may be distributed as part of a program
6175 dnl that contains a configuration script generated by Autoconf, under
6176 dnl the same distribution terms as the rest of that program.
6178 dnl This file can can be used in projects which are not available under
6179 dnl the GNU General Public License or the GNU Library General Public
6180 dnl License but which still want to provide support for the GNU gettext
6182 dnl Please note that the actual code of the GNU gettext library is covered
6183 dnl by the GNU Library General Public License, and the rest of the GNU
6184 dnl gettext package package is covered by the GNU General Public License.
6185 dnl They are *not* in the public domain.
6188 dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
6190 # Search path for a program which passes the given test.
6192 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
6193 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
6194 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
6195 [# Extract the first word of "$2", so it can be a program name with args.
6196 set dummy $2; ac_word=[$]2
6197 AC_MSG_CHECKING([for $ac_word])
6198 AC_CACHE_VAL(ac_cv_path_$1,
6201 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
6204 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
6205 for ac_dir in ifelse([$5], , $PATH, [$5]); do
6206 test -z "$ac_dir" && ac_dir=.
6207 if test -f $ac_dir/$ac_word; then
6209 ac_cv_path_$1="$ac_dir/$ac_word"
6215 dnl If no 4th arg is given, leave the cache variable unset,
6216 dnl so AC_PATH_PROGS will keep looking.
6217 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
6222 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
6223 AC_MSG_RESULT([$]$1)
6230 # intdiv0.m4 serial 1 (gettext-0.11.3)
6231 dnl Copyright (C) 2002 Free Software Foundation, Inc.
6232 dnl This file is free software, distributed under the terms of the GNU
6233 dnl General Public License. As a special exception to the GNU General
6234 dnl Public License, this file may be distributed as part of a program
6235 dnl that contains a configuration script generated by Autoconf, under
6236 dnl the same distribution terms as the rest of that program.
6238 dnl From Bruno Haible.
6240 AC_DEFUN([gt_INTDIV0],
6242 AC_REQUIRE([AC_PROG_CC])dnl
6243 AC_REQUIRE([AC_CANONICAL_HOST])dnl
6245 AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
6246 gt_cv_int_divbyzero_sigfpe,
6254 sigfpe_handler (int sig)
6256 sigfpe_handler (sig) int sig;
6259 /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
6260 exit (sig != SIGFPE);
6270 signal (SIGFPE, sigfpe_handler);
6271 /* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */
6272 #if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
6273 signal (SIGTRAP, sigfpe_handler);
6275 /* Linux/SPARC yields signal SIGILL. */
6276 #if defined (__sparc__) && defined (__linux__)
6277 signal (SIGILL, sigfpe_handler);
6284 ], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
6286 # Guess based on the CPU.
6288 alpha* | i[34567]86 | m68k | s390*)
6289 gt_cv_int_divbyzero_sigfpe="guessing yes";;
6291 gt_cv_int_divbyzero_sigfpe="guessing no";;
6295 case "$gt_cv_int_divbyzero_sigfpe" in
6299 AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
6300 [Define if integer division by zero raises signal SIGFPE.])
6303 # lcmessage.m4 serial 3 (gettext-0.11.3)
6304 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
6305 dnl This file is free software, distributed under the terms of the GNU
6306 dnl General Public License. As a special exception to the GNU General
6307 dnl Public License, this file may be distributed as part of a program
6308 dnl that contains a configuration script generated by Autoconf, under
6309 dnl the same distribution terms as the rest of that program.
6311 dnl This file can can be used in projects which are not available under
6312 dnl the GNU General Public License or the GNU Library General Public
6313 dnl License but which still want to provide support for the GNU gettext
6315 dnl Please note that the actual code of the GNU gettext library is covered
6316 dnl by the GNU Library General Public License, and the rest of the GNU
6317 dnl gettext package package is covered by the GNU General Public License.
6318 dnl They are *not* in the public domain.
6321 dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
6323 # Check whether LC_MESSAGES is available in <locale.h>.
6325 AC_DEFUN([AM_LC_MESSAGES],
6327 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
6328 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
6329 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
6330 if test $am_cv_val_LC_MESSAGES = yes; then
6331 AC_DEFINE(HAVE_LC_MESSAGES, 1,
6332 [Define if your <locale.h> file defines LC_MESSAGES.])