1 # aclocal.m4 generated automatically by aclocal 1.4f
3 # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
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 # Like AC_CONFIG_HEADER, but automatically create stamp file.
18 # When config.status generates a header, we must update the stamp-h file.
19 # This file resides in the same directory as the config header
20 # that is generated. We must strip everything past the first ":",
21 # and everything past the last "/".
25 AC_DEFUN([AM_CONFIG_HEADER],
26 [AC_CONFIG_HEADER([$1])
28 ifelse(patsubst([$1], [[^ ]], []),
30 [test -z "$CONFIG_HEADERS" || echo timestamp >dnl
31 patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),
34 case " $CONFIG_HEADERS " in
36 echo timestamp > `echo $am_file | sed 's%:.*%%;s%[^/]*$%%'`stamp-h$am_indx
39 am_indx=\`expr \$am_indx + 1\`
43 # Do all the work for Automake. This macro actually does too much --
44 # some checks are only needed if your package does certain things.
45 # But this isn't really a big deal.
49 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
50 # written in clear, in which case automake, when reading aclocal.m4,
51 # will think it sees a *use*, and therefore will trigger all it's
52 # C support machinery. Also note that it means that autoscan, seeing
53 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
56 # We require 2.13 because we rely on SHELL being computed by configure.
59 # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
60 # -----------------------------------------------------------
61 # If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED.
62 # The purpose of this macro is to provide the user with a means to
63 # check macros which are provided without letting her know how the
64 # information is coded.
65 # If this macro is not defined by Autoconf, define it here.
66 ifdef([AC_PROVIDE_IFELSE],
68 [define([AC_PROVIDE_IFELSE],
69 [ifdef([AC_PROVIDE_$1],
73 # AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE])
74 # ----------------------------------------------
75 AC_DEFUN([AM_INIT_AUTOMAKE],
76 [AC_REQUIRE([AC_PROG_INSTALL])dnl
77 # test to see if srcdir already configured
78 if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" &&
79 test -f $srcdir/config.status; then
80 AC_MSG_ERROR([source directory already configured; run \"make distclean\" there first])
83 # Define the identity of the package.
89 [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
90 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])
92 # Autoconf 2.50 wants to disallow AM_ names. We explicitly allow
93 # the ones we care about.
94 ifdef([m4_pattern_allow],
95 [m4_pattern_allow([^AM_(C|CPP|CXX|OBJC|F|R|GCJ)FLAGS])])dnl
97 # Some tools Automake needs.
98 AC_REQUIRE([AM_SANITY_CHECK])dnl
99 AC_REQUIRE([AC_ARG_PROGRAM])dnl
100 AM_MISSING_PROG(ACLOCAL, aclocal)
101 AM_MISSING_PROG(AUTOCONF, autoconf)
102 AM_MISSING_PROG(AUTOMAKE, automake)
103 AM_MISSING_PROG(AUTOHEADER, autoheader)
104 AM_MISSING_PROG(MAKEINFO, makeinfo)
105 AM_MISSING_PROG(AMTAR, tar)
106 AM_MISSING_INSTALL_SH
107 AM_PROG_INSTALL_STRIP
108 # We need awk for the "check" target. The system "awk" is bad on
110 AC_REQUIRE([AC_PROG_AWK])dnl
111 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
112 AC_REQUIRE([AM_DEP_TRACK])dnl
113 AC_REQUIRE([AM_SET_DEPDIR])dnl
114 AC_PROVIDE_IFELSE([AC_PROG_][CC],
115 [AM_DEPENDENCIES(CC)],
116 [define([AC_PROG_][CC],
117 defn([AC_PROG_][CC])[AM_DEPENDENCIES(CC)])])dnl
118 AC_PROVIDE_IFELSE([AC_PROG_][CXX],
119 [AM_DEPENDENCIES(CXX)],
120 [define([AC_PROG_][CXX],
121 defn([AC_PROG_][CXX])[AM_DEPENDENCIES(CXX)])])dnl
125 # Check to make sure that the build environment is sane.
132 AC_DEFUN([AM_SANITY_CHECK],
133 [AC_MSG_CHECKING([whether build environment is sane])
136 echo timestamp > conftest.file
137 # Do `set' in a subshell so we don't clobber the current shell's
138 # arguments. Must try -L first in case configure is actually a
139 # symlink; some systems play weird games with the mod time of symlinks
140 # (eg FreeBSD returns the mod time of the symlink's containing
143 set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
144 if test "$[*]" = "X"; then
146 set X `ls -t $srcdir/configure conftest.file`
149 if test "$[*]" != "X $srcdir/configure conftest.file" \
150 && test "$[*]" != "X conftest.file $srcdir/configure"; then
152 # If neither matched, then we have a broken ls. This can happen
153 # if, for instance, CONFIG_SHELL is bash and it inherits a
154 # broken ls alias from the environment. This has actually
155 # happened. Such a system could not be considered "sane".
156 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
157 alias in your environment])
160 test "$[2]" = conftest.file
166 AC_MSG_ERROR([newly created file is older than distributed files!
167 Check your system clock])
174 # AM_MISSING_PROG(NAME, PROGRAM)
175 # ------------------------------
176 AC_DEFUN([AM_MISSING_PROG],
177 [AC_REQUIRE([AM_MISSING_HAS_RUN])
178 $1=${$1-"${am_missing_run}$2"}
182 # AM_MISSING_INSTALL_SH
183 # ---------------------
184 # Like AM_MISSING_PROG, but only looks for install-sh.
185 AC_DEFUN([AM_MISSING_INSTALL_SH],
186 [AC_REQUIRE([AM_MISSING_HAS_RUN])
187 if test -z "$install_sh"; then
188 for install_sh in "$ac_aux_dir/install-sh" \
189 "$ac_aux_dir/install.sh" \
190 "${am_missing_run}${ac_auxdir}/install-sh";
192 test -f "$install_sh" && break
194 # FIXME: an evil hack: we remove the SHELL invocation from
195 # install_sh because automake adds it back in. Sigh.
196 install_sh=`echo $install_sh | sed -e 's/\${SHELL}//'`
198 AC_SUBST(install_sh)])
203 # Define MISSING if not defined so far and test if it supports --run.
204 # If it does, set am_missing_run to use it, otherwise, to nothing.
205 AC_DEFUN([AM_MISSING_HAS_RUN],
206 [test x"${MISSING+set}" = xset ||
207 MISSING="\${SHELL} `CDPATH=:; cd $ac_aux_dir && pwd`/missing"
208 # Use eval to expand $SHELL
209 if eval "$MISSING --run true"; then
210 am_missing_run="$MISSING --run "
214 AC_MSG_WARN([${am_backtick}missing' script is too old or missing])
220 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
221 # $ac_aux_dir to ${srcdir}/foo. In other projects, it is set to `.'.
222 # Of course, Automake must honor this variable whenever it call a tool
223 # from the auxiliary directory. The problem is that $srcdir (hence
224 # $ac_aux_dir) can be either an absolute path or a path relative to
225 # $top_srcdir or absolute, this depends on how configure is run. This
226 # is pretty anoying since it makes $ac_aux_dir quite unusable in
227 # subdirectories: on the top source directory, any form will work
228 # fine, but in subdirectories relative pat needs to be adapted.
229 # - calling $top_srcidr/$ac_aux_dir/missing would success if $srcdir is
230 # relative, but fail if $srcdir is absolute
231 # - conversly, calling $ax_aux_dir/missing would fail if $srcdir is
232 # absolute, and success on relative paths.
234 # Consequently, we define and use $am_aux_dir, the "always absolute"
235 # version of $ac_aux_dir.
237 AC_DEFUN([AM_AUX_DIR_EXPAND], [
238 # expand $ac_aux_dir to an absolute path
239 am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd`
242 # One issue with vendor `install' (even GNU) is that you can't
243 # specify the program used to strip binaries. This is especially
244 # annoying in cross-compiling environments, where the build's strip
245 # is unlikely to handle the host's binaries.
246 # Fortunately install-sh will honor a STRIPPROG variable, so we
247 # always use install-sh in `make install-strip', and initialize
248 # STRIPPROG with the value of the STRIP variable (set by the user).
249 AC_DEFUN([AM_PROG_INSTALL_STRIP],
250 [AC_REQUIRE([AM_MISSING_INSTALL_SH])dnl
251 _am_dirpart="`echo $install_sh | sed -e 's,//*[[^/]]*$,,'`"
252 INSTALL_STRIP_PROGRAM="\${SHELL} \`CDPATH=: && cd $_am_dirpart && pwd\`/install-sh -c -s"
253 AC_SUBST([INSTALL_STRIP_PROGRAM])])
257 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
258 # written in clear, in which case automake, when reading aclocal.m4,
259 # will think it sees a *use*, and therefore will trigger all it's
260 # C support machinery. Also note that it means that autoscan, seeing
261 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
263 # AM_DEPENDENCIES(NAME)
264 # ---------------------
265 # See how the compiler implements dependency checking.
266 # NAME is "CC", "CXX" or "OBJC".
267 # We try a few techniques and use that to set a single cache variable.
268 AC_DEFUN([AM_DEPENDENCIES],
269 [AC_REQUIRE([AM_SET_DEPDIR])dnl
270 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
273 [AC_REQUIRE([AC_PROG_][CC])dnl
274 AC_REQUIRE([AC_PROG_][CPP])
277 [$1], CXX, [AC_REQUIRE([AC_PROG_][CXX])dnl
278 AC_REQUIRE([AC_PROG_][CXXCPP])
281 [$1], OBJC, [am_compiler_list='gcc3 gcc'
284 [$1], GCJ, [am_compiler_list='gcc3 gcc'
287 [AC_REQUIRE([AC_PROG_][$1])dnl
291 AC_REQUIRE([AM_MAKE_INCLUDE])
292 AC_REQUIRE([AM_DEP_TRACK])
294 AC_CACHE_CHECK([dependency style of $depcc],
295 [am_cv_$1_dependencies_compiler_type],
296 [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
297 # We make a subdir and do the tests there. Otherwise we can end up
298 # making bogus files that we don't know about and never remove. For
299 # instance it was reported that on HP-UX the gcc test will end up
300 # making a dummy file named `D' -- because `-MD' means `put the output
303 # Copy depcomp to subdir because otherwise we won't find it if we're
304 # using a relative directory.
305 cp "$am_depcomp" confdir
308 am_cv_$1_dependencies_compiler_type=none
309 if test "$am_compiler_list" = ""; then
310 am_compiler_list="`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`"
312 for depmode in $am_compiler_list; do
313 # We need to recreate these files for each test, as the compiler may
314 # overwrite some of them when testing with obscure command lines.
315 # This happens at least with the AIX C compiler.
316 echo '#include "conftest.h"' > conftest.c
317 echo 'int i;' > conftest.h
321 # after this tag, mechanisms are not by side-effect, so they'll
322 # only be used when explicitly requested
323 if test "x$enable_dependency_tracking" = xyes; then
331 # We check with `-c' and `-o' for the sake of the "dashmstdout"
332 # mode. It turns out that the SunPro C++ compiler does not properly
333 # handle `-M -o', and we need to detect this.
334 if depmode="$depmode" \
335 source=conftest.c object=conftest.o \
336 depfile=conftest.Po tmpdepfile=conftest.TPo \
337 $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
338 grep conftest.h conftest.Po > /dev/null 2>&1; then
339 am_cv_$1_dependencies_compiler_type="$depmode"
347 am_cv_$1_dependencies_compiler_type=none
350 $1DEPMODE="depmode=$am_cv_$1_dependencies_compiler_type"
351 AC_SUBST([$1DEPMODE])
357 # Choose a directory name for dependency files.
358 # This macro is AC_REQUIREd in AM_DEPENDENCIES
359 AC_DEFUN([AM_SET_DEPDIR],
360 [if test -d .deps || mkdir .deps 2> /dev/null || test -d .deps; then
362 # We redirect because .deps might already exist and be populated.
363 # In this situation we don't want to see an error.
364 rmdir .deps > /dev/null 2>&1
374 AC_DEFUN([AM_DEP_TRACK],
375 [AC_ARG_ENABLE(dependency-tracking,
376 [ --disable-dependency-tracking Speeds up one-time builds
377 --enable-dependency-tracking Do not reject slow dependency extractors])
378 if test "x$enable_dependency_tracking" != xno; then
379 am_depcomp="$ac_aux_dir/depcomp"
382 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
383 pushdef([subst], defn([AC_SUBST]))
384 subst(AMDEPBACKSLASH)
388 # Generate code to set up dependency tracking.
389 # This macro should only be invoked once -- use via AC_REQUIRE.
391 # AM_OUTPUT_DEPENDENCY_COMMANDS
394 # This code is only required when automatic dependency tracking
395 # is enabled. FIXME. This creates each `.P' file that we will
396 # need in order to bootstrap the dependency handling code.
397 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],[
399 test x"$AMDEP_TRUE" != x"" ||
400 for mf in $CONFIG_FILES; do
402 Makefile) dirpart=.;;
403 */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;;
406 grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
407 # Extract the definition of DEP_FILES from the Makefile without
409 DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
410 test -z "$DEPDIR" && continue
411 # When using ansi2knr, U may be empty or an underscore; expand it
412 U=`sed -n -e '/^U = / s///p' < "$mf"`
413 test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
414 # We invoke sed twice because it is the simplest approach to
415 # changing $(DEPDIR) to its actual value in the expansion.
416 for file in `sed -n -e '
417 /^DEP_FILES = .*\\\\$/ {
426 /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
427 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
428 # Make sure the directory exists.
429 test -f "$dirpart/$file" && continue
430 fdir=`echo "$file" | sed -e 's|/[^/]*$||'`
431 $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1
432 # echo "creating $dirpart/$file"
433 echo '# dummy' > "$dirpart/$file"
436 ], [AMDEP_TRUE="$AMDEP_TRUE"
437 ac_aux_dir="$ac_aux_dir"])])
441 # Check to see how make treats includes.
442 AC_DEFUN([AM_MAKE_INCLUDE],
443 [am_make=${MAKE-make}
444 cat > confinc << 'END'
448 # If we don't find an include directive, just comment out the code.
449 AC_MSG_CHECKING([for style of include used by $am_make])
453 # First try GNU make style include.
454 echo "include confinc" > confmf
455 # We grep out `Entering directory' and `Leaving directory'
456 # messages which can occur if `w' ends up in MAKEFLAGS.
457 # In particular we don't look at `^make:' because GNU make might
458 # be invoked under some other name (usually "gmake"), in which
459 # case it prints its new name instead of `make'.
460 if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then
465 # Now try BSD make style include.
466 if test "$_am_include" = "#"; then
467 echo '.include "confinc"' > confmf
468 if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
474 AC_SUBST(_am_include)
476 AC_MSG_RESULT($_am_result)
482 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
483 # -------------------------------------
484 # Define a conditional.
486 # FIXME: Once using 2.50, use this:
487 # m4_match([$1], [^TRUE\|FALSE$], [AC_FATAL([$0: invalid condition: $1])])dnl
488 AC_DEFUN([AM_CONDITIONAL],
489 [ifelse([$1], [TRUE],
490 [errprint(__file__:__line__: [$0: invalid condition: $1
493 ifelse([$1], [FALSE],
494 [errprint(__file__:__line__: [$0: invalid condition: $1
508 dnl This test replaces the one in autoconf.
509 dnl Currently this macro should have the same name as the autoconf macro
510 dnl because gettext's gettext.m4 (distributed in the automake package)
511 dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader
512 dnl give these diagnostics:
513 dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
514 dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
516 undefine([AC_ISC_POSIX])
517 AC_DEFUN(AC_ISC_POSIX,
519 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
520 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
527 AC_DEFUN([AM_C_PROTOTYPES],
528 [AC_REQUIRE([AM_PROG_CC_STDC])
529 AC_REQUIRE([AC_PROG_CPP])
530 AC_MSG_CHECKING([for function prototypes])
531 if test "$am_cv_prog_cc_stdc" != no; then
533 AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
537 U=_ ANSI2KNR=./ansi2knr
539 # Ensure some checks needed by ansi2knr itself.
541 AC_CHECK_HEADERS(string.h)
543 AC_SUBST(ANSI2KNR)dnl
549 # @defmac AC_PROG_CC_STDC
550 # @maindex PROG_CC_STDC
552 # If the C compiler in not in ANSI C mode by default, try to add an option
553 # to output variable @code{CC} to make it so. This macro tries various
554 # options that select ANSI C on some system or another. It considers the
555 # compiler to be in ANSI C mode if it handles function prototypes correctly.
557 # If you use this macro, you should check after calling it whether the C
558 # compiler has been set to accept ANSI C; if not, the shell variable
559 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
560 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
561 # program @code{ansi2knr}, which comes with Ghostscript.
564 AC_DEFUN([AM_PROG_CC_STDC],
565 [AC_REQUIRE([AC_PROG_CC])
566 AC_BEFORE([$0], [AC_C_INLINE])
567 AC_BEFORE([$0], [AC_C_CONST])
568 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
569 dnl a magic option to avoid problems with ANSI preprocessor commands
571 dnl FIXME: can't do this because then AC_AIX won't work due to a
572 dnl circular dependency.
573 dnl AC_BEFORE([$0], [AC_PROG_CPP])
574 AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
575 AC_CACHE_VAL(am_cv_prog_cc_stdc,
576 [am_cv_prog_cc_stdc=no
578 # Don't try gcc -ansi; that turns off useful extensions and
579 # breaks some systems' header files.
581 # Ultrix and OSF/1 -std1
582 # HP-UX 10.20 and later -Ae
583 # HP-UX older versions -Aa -D_HPUX_SOURCE
584 # SVR4 -Xc -D__EXTENSIONS__
585 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
587 CC="$ac_save_CC $ac_arg"
591 #include <sys/types.h>
592 #include <sys/stat.h>
593 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
594 struct buf { int x; };
595 FILE * (*rcsopen) (struct buf *, struct stat *, int);
596 static char *e (p, i)
602 static char *f (char * (*g) (char **, int), char **p, ...)
607 s = g (p, va_arg (v,int));
611 int test (int i, double x);
612 struct s1 {int (*f) (int a);};
613 struct s2 {int (*f) (double a);};
614 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
618 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
620 [am_cv_prog_cc_stdc="$ac_arg"; break])
624 if test -z "$am_cv_prog_cc_stdc"; then
625 AC_MSG_RESULT([none needed])
627 AC_MSG_RESULT([$am_cv_prog_cc_stdc])
629 case "x$am_cv_prog_cc_stdc" in
631 *) CC="$CC $am_cv_prog_cc_stdc" ;;
635 #serial 13, with several lines deleted for fileutils.
637 dnl Misc type-related macros for fileutils, sh-utils, textutils.
643 GNU_PACKAGE="GNU $PACKAGE"
644 AC_DEFINE_UNQUOTED(GNU_PACKAGE, "$GNU_PACKAGE",
645 [The concatenation of the strings `GNU ', and PACKAGE.])
646 AC_SUBST(GNU_PACKAGE)
648 AC_SUBST(OPTIONAL_BIN_PROGS)
649 AC_SUBST(OPTIONAL_BIN_ZCRIPTS)
653 dnl This macro actually runs replacement code. See isc-posix.m4.
654 AC_REQUIRE([AC_ISC_POSIX])dnl
693 jm_INCLUDED_REGEX([lib/regex.c])
695 AC_REQUIRE([jm_ASSERT])
696 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
697 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE])
698 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_INO])
699 AC_REQUIRE([jm_CHECK_DECLS])
701 AC_REQUIRE([jm_PREREQ])
703 AC_REQUIRE([jm_FUNC_MKTIME])
704 AC_REQUIRE([jm_FUNC_LSTAT])
705 AC_REQUIRE([jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
706 AC_REQUIRE([jm_FUNC_STAT])
707 AC_REQUIRE([jm_FUNC_REALLOC])
708 AC_REQUIRE([jm_FUNC_MALLOC])
709 AC_REQUIRE([AC_FUNC_STRERROR_R])
710 AC_REQUIRE([jm_FUNC_READDIR])
711 AC_REQUIRE([jm_FUNC_MEMCMP])
712 AC_REQUIRE([jm_FUNC_GLIBC_UNLOCKED_IO])
713 AC_REQUIRE([kd_FUNC_FNMATCH_CASE_RPL])
715 AC_REQUIRE([jm_AC_PREREQ_XSTRTOUMAX])
716 AC_REQUIRE([jm_AC_FUNC_LINK_FOLLOWS_SYMLINK])
717 AC_REQUIRE([AM_FUNC_ERROR_AT_LINE])
718 AC_REQUIRE([jm_FUNC_GNU_STRFTIME])
719 AC_REQUIRE([jm_FUNC_MKTIME])
721 AC_REQUIRE([AC_FUNC_VPRINTF])
722 AC_REQUIRE([AC_FUNC_ALLOCA])
724 AC_REPLACE_FUNCS(strncasecmp)
725 AC_REPLACE_FUNCS(stpcpy strstr strtol strtoul)
726 AC_REPLACE_FUNCS(memcmp rpmatch)
728 dnl used by e.g. intl/*domain.c and lib/canon-host.c
729 AC_REPLACE_FUNCS(strdup)
731 AC_REPLACE_FUNCS(memcpy memset)
732 AC_CHECK_FUNCS(getpagesize)
734 # By default, argmatch should fail calling usage (1).
735 AC_DEFINE(ARGMATCH_DIE, [usage (1)],
736 [Define to the function xargmatch calls on failures.])
737 AC_DEFINE(ARGMATCH_DIE_DECL, [extern void usage ()],
738 [Define to the declaration of the xargmatch failure function.])
740 dnl Used to define SETVBUF in sys2.h.
741 dnl This evokes the following warning from autoconf:
742 dnl ...: warning: AC_TRY_RUN called without default to allow cross compiling
743 AC_FUNC_SETVBUF_REVERSED
745 AC_CHECK_FUNCS(getdelim)
747 AC_REQUIRE([AC_FUNC_CLOSEDIR_VOID])
779 if test $am_cv_func_working_getline != yes; then
780 AC_CHECK_FUNCS(getdelim)
786 # These tests are for df.
791 AC_DEFUN(jm_CHECK_ALL_TYPES,
793 dnl Checks for typedefs, structures, and compiler characteristics.
794 AC_REQUIRE([AC_C_BIGENDIAN])
795 AC_REQUIRE([AC_PROG_CC_STDC])
796 AC_REQUIRE([AC_C_CONST])
797 AC_REQUIRE([AC_C_VOLATILE])
798 AC_REQUIRE([AC_C_INLINE])
799 AC_REQUIRE([AC_C_LONG_DOUBLE])
801 AC_REQUIRE([AC_HEADER_DIRENT])
802 AC_REQUIRE([AC_HEADER_STDC])
803 AC_CHECK_MEMBERS([struct stat.st_blksize],,,[$ac_includes_default
804 #include <sys/stat.h>
806 AC_REQUIRE([AC_STRUCT_ST_BLOCKS])
808 AC_REQUIRE([AC_STRUCT_TM])
809 AC_REQUIRE([AC_STRUCT_TIMEZONE])
810 AC_REQUIRE([AC_HEADER_STAT])
811 AC_REQUIRE([AC_STRUCT_ST_MTIM_NSEC])
812 AC_REQUIRE([AC_STRUCT_ST_DM_MODE])
813 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_TIMESPEC])
815 AC_REQUIRE([AC_TYPE_GETGROUPS])
816 AC_REQUIRE([AC_TYPE_MODE_T])
817 AC_REQUIRE([AC_TYPE_OFF_T])
818 AC_REQUIRE([AC_TYPE_PID_T])
819 AC_REQUIRE([AC_TYPE_SIGNAL])
820 AC_REQUIRE([AC_TYPE_SIZE_T])
821 AC_REQUIRE([AC_TYPE_UID_T])
822 AC_CHECK_TYPE(ino_t, unsigned long)
824 dnl This relies on the fact that autoconf 2.14a's implementation of
825 dnl AC_CHECK_TYPE checks includes unistd.h.
826 AC_CHECK_TYPE(ssize_t, int)
828 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
829 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
831 AC_REQUIRE([AC_HEADER_MAJOR])
832 AC_REQUIRE([AC_HEADER_DIRENT])
838 dnl Initially derived from code in GNU grep.
839 dnl Mostly written by Jim Meyering.
841 dnl Usage: jm_INCLUDED_REGEX([lib/regex.c])
843 AC_DEFUN(jm_INCLUDED_REGEX,
845 dnl Even packages that don't use regex.c can use this macro.
846 dnl Of course, for them it doesn't do anything.
848 # Assume we'll default to using the included regex.c.
849 ac_use_included_regex=yes
851 # However, if the system regex support is good enough that it passes the
852 # the following run test, then default to *not* using the included regex.c.
853 # If cross compiling, assume the test would fail and use the included
854 # regex.c. The first failing regular expression is from `Spencer ere
855 # test #75' in grep-2.3.
856 AC_CACHE_CHECK([for working re_compile_pattern],
857 jm_cv_func_working_re_compile_pattern,
864 static struct re_pattern_buffer regex;
866 re_set_syntax (RE_SYNTAX_POSIX_EGREP);
867 /* Add this third left square bracket, [, to balance the
868 three right ones below. Otherwise autoconf-2.14 chokes. */
869 s = re_compile_pattern ("a[[:]:]]b\n", 9, ®ex);
870 /* This should fail with _Invalid character class name_ error. */
874 /* This should succeed, but doesn't for e.g. glibc-2.1.3. */
875 s = re_compile_pattern ("{1", 2, ®ex);
880 jm_cv_func_working_re_compile_pattern=yes,
881 jm_cv_func_working_re_compile_pattern=no,
882 dnl When crosscompiling, assume it's broken.
883 jm_cv_func_working_re_compile_pattern=no))
884 if test $jm_cv_func_working_re_compile_pattern = yes; then
885 ac_use_included_regex=no
888 test -n "$1" || AC_MSG_ERROR([missing argument])
893 AC_ARG_WITH(included-regex,
894 [ --without-included-regex don't compile regex; this is the default on
895 systems with version 2 of the GNU C library
896 (use with caution on other system)],
897 jm_with_regex=$withval,
898 jm_with_regex=$ac_use_included_regex)
899 if test "$jm_with_regex" = yes; then
901 LIBOBJS="$LIBOBJS regex.$ac_objext"
909 dnl based on code from Eleftherios Gkioulekas
913 AC_MSG_CHECKING(whether to enable assertions)
914 AC_ARG_ENABLE(assert,
915 [ --disable-assert turn off assertions],
917 AC_DEFINE(NDEBUG,1,[Define to 1 if assertions should be disabled.]) ],
918 [ AC_MSG_RESULT(yes) ]
924 dnl From Paul Eggert.
926 # Define HAVE_INTTYPES_H if <inttypes.h> exists,
927 # doesn't clash with <sys/types.h>, and declares uintmax_t.
929 AC_DEFUN(jm_AC_HEADER_INTTYPES_H,
931 AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
933 [#include <sys/types.h>
934 #include <inttypes.h>],
935 [uintmax_t i = (uintmax_t) -1;],
936 jm_ac_cv_header_inttypes_h=yes,
937 jm_ac_cv_header_inttypes_h=no)])
938 if test $jm_ac_cv_header_inttypes_h = yes; then
939 AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
940 [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
941 and declares uintmax_t. ])
947 dnl From Jim Meyering.
949 dnl Check whether struct dirent has a member named d_type.
952 AC_DEFUN(jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE,
953 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
954 AC_CACHE_CHECK([for d_type member in directory struct],
955 jm_cv_struct_dirent_d_type,
958 #include <sys/types.h>
961 #else /* not HAVE_DIRENT_H */
962 # define dirent direct
963 # ifdef HAVE_SYS_NDIR_H
964 # include <sys/ndir.h>
965 # endif /* HAVE_SYS_NDIR_H */
966 # ifdef HAVE_SYS_DIR_H
967 # include <sys/dir.h>
968 # endif /* HAVE_SYS_DIR_H */
971 # endif /* HAVE_NDIR_H */
972 #endif /* HAVE_DIRENT_H */
974 [struct dirent dp; dp.d_type = 0;],
976 jm_cv_struct_dirent_d_type=yes,
977 jm_cv_struct_dirent_d_type=no)
980 if test $jm_cv_struct_dirent_d_type = yes; then
981 AC_DEFINE(D_TYPE_IN_DIRENT, 1,
982 [Define if there is a member named d_type in the struct describing
990 dnl From Jim Meyering.
992 dnl Check whether struct dirent has a member named d_ino.
995 AC_DEFUN(jm_CHECK_TYPE_STRUCT_DIRENT_D_INO,
996 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
997 AC_CACHE_CHECK([for d_ino member in directory struct],
998 jm_cv_struct_dirent_d_ino,
1001 #include <sys/types.h>
1002 #ifdef HAVE_DIRENT_H
1003 # include <dirent.h>
1004 #else /* not HAVE_DIRENT_H */
1005 # define dirent direct
1006 # ifdef HAVE_SYS_NDIR_H
1007 # include <sys/ndir.h>
1008 # endif /* HAVE_SYS_NDIR_H */
1009 # ifdef HAVE_SYS_DIR_H
1010 # include <sys/dir.h>
1011 # endif /* HAVE_SYS_DIR_H */
1014 # endif /* HAVE_NDIR_H */
1015 #endif /* HAVE_DIRENT_H */
1017 [struct dirent dp; dp.d_ino = 0;],
1019 jm_cv_struct_dirent_d_ino=yes,
1020 jm_cv_struct_dirent_d_ino=no)
1023 if test $jm_cv_struct_dirent_d_ino = yes; then
1024 AC_DEFINE(D_INO_IN_DIRENT, 1,
1025 [Define if there is a member named d_ino in the struct describing
1026 directory headers.])
1033 dnl This is just a wrapper function to encapsulate this kludge.
1034 dnl Putting it in a separate file like this helps share it between
1035 dnl different packages.
1036 AC_DEFUN(jm_CHECK_DECLS,
1038 AC_REQUIRE([_jm_DECL_HEADERS])
1039 AC_REQUIRE([AC_HEADER_TIME])
1043 # if !STDC_HEADERS && HAVE_MEMORY_H
1044 # include <memory.h>
1046 # include <string.h>
1049 # include <strings.h>
1053 # include <stdlib.h>
1056 # include <unistd.h>
1059 #include <sys/types.h>
1060 #if TIME_WITH_SYS_TIME
1061 # include <sys/time.h>
1064 # if HAVE_SYS_TIME_H
1065 # include <sys/time.h>
1096 ttyname], , , $headers)
1099 dnl FIXME: when autoconf has support for it.
1100 dnl This is a little helper so we can require these header checks.
1101 AC_DEFUN(_jm_DECL_HEADERS,
1103 AC_REQUIRE([AC_HEADER_STDC])
1104 AC_CHECK_HEADERS(memory.h string.h strings.h stdlib.h unistd.h sys/time.h \
1110 dnl These are the prerequisite macros for files in the lib/
1111 dnl directories of the fileutils, sh-utils, and textutils packages.
1116 jm_PREREQ_CANON_HOST
1123 AC_DEFUN(jm_PREREQ_ADDEXT,
1126 AC_SYS_LONG_FILE_NAMES
1127 AC_CHECK_FUNCS(pathconf)
1128 AC_CHECK_HEADERS(limits.h string.h unistd.h)
1131 AC_DEFUN(jm_PREREQ_CANON_HOST,
1133 dnl Add any libraries as early as possible.
1134 dnl In particular, inet_ntoa needs -lnsl at least on Solaris5.5.1,
1135 dnl so we have to add -lnsl to LIBS before checking for that function.
1136 AC_SEARCH_LIBS(gethostbyname, [inet nsl])
1138 dnl These come from -lnsl on Solaris5.5.1.
1139 AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
1141 AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
1142 AC_CHECK_HEADERS(unistd.h string.h netdb.h sys/socket.h \
1143 netinet/in.h arpa/inet.h)
1146 AC_DEFUN(jm_PREREQ_QUOTEARG,
1148 AC_CHECK_FUNCS(isascii iswprint mbrtowc)
1149 AC_CHECK_HEADERS(limits.h stdlib.h string.h wchar.h wctype.h)
1156 AC_DEFUN(jm_PREREQ_READUTMP,
1159 AC_CHECK_HEADERS(string.h utmpx.h sys/param.h)
1160 AC_CHECK_FUNCS(utmpname)
1161 AC_CHECK_FUNCS(utmpxname)
1165 $ac_includes_default
1172 AC_CHECK_MEMBERS([struct utmpx.ut_user],,,[$utmp_includes])
1173 AC_CHECK_MEMBERS([struct utmp.ut_user],,,[$utmp_includes])
1174 AC_CHECK_MEMBERS([struct utmpx.ut_name],,,[$utmp_includes])
1175 AC_CHECK_MEMBERS([struct utmp.ut_name],,,[$utmp_includes])
1178 AC_DEFUN(jm_PREREQ_REGEX,
1180 dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it.
1181 dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary
1183 AC_CHECK_FUNCS(bzero bcopy isascii btowc)
1184 AC_CHECK_HEADERS(alloca.h libintl.h wctype.h wchar.h)
1191 dnl FIXME: put these prerequisite-only *.m4 files in a separate
1192 dnl directory -- otherwise, they'll conflict with existing files.
1194 dnl These are the prerequisite macros for GNU's error.c file.
1195 AC_DEFUN(jm_PREREQ_ERROR,
1197 AC_CHECK_FUNCS(strerror strerror_r vprintf doprnt)
1203 dnl From Paul Eggert.
1205 AC_DEFUN(AC_C_BACKSLASH_A,
1207 AC_CACHE_CHECK([whether backslash-a works in strings], ac_cv_c_backslash_a,
1213 char buf['\a' == 'a' ? -1 : 1];
1215 return buf[0] != "\a"[0];
1217 ac_cv_c_backslash_a=yes,
1218 ac_cv_c_backslash_a=no)])
1219 if test $ac_cv_c_backslash_a = yes; then
1220 AC_DEFINE(HAVE_C_BACKSLASH_A, 1,
1221 [Define if backslash-a works in C strings.])
1229 # Some versions of BeOS define mbstate_t to be an incomplete type,
1230 # so you can't declare an object of that type.
1231 # Check for this incompatibility with Standard C.
1233 AC_DEFUN(AC_MBSTATE_T_OBJECT,
1234 [AC_CACHE_CHECK([for mbstate_t object type], ac_cv_type_mbstate_t_object,
1235 [AC_TRY_COMPILE([#include <wchar.h>],
1236 [mbstate_t x; return sizeof x;],
1237 ac_cv_type_mbstate_t_object=yes,
1238 ac_cv_type_mbstate_t_object=no)])
1239 if test $ac_cv_type_mbstate_t_object = yes; then
1240 AC_DEFINE(HAVE_MBSTATE_T_OBJECT, 1,
1241 [Define if mbstate_t is an object type.])
1246 dnl From Jim Meyering.
1247 dnl A wrapper around AC_FUNC_MKTIME.
1249 AC_DEFUN(jm_FUNC_MKTIME,
1250 [AC_REQUIRE([AC_FUNC_MKTIME])dnl
1252 dnl mktime.c uses localtime_r if it exists. Check for it.
1253 AC_CHECK_FUNCS(localtime_r)
1255 if test $ac_cv_func_working_mktime = no; then
1256 AC_DEFINE_UNQUOTED(mktime, rpl_mktime,
1257 [Define to rpl_mktime if the replacement function should be used.])
1263 dnl From Jim Meyering.
1264 dnl Determine whether lstat has the bug that it succeeds when given the
1265 dnl zero-length file name argument. The lstat from SunOS4.1.4 and the Hurd
1266 dnl (as of 1998-11-01) do this.
1268 dnl If it does, then define HAVE_LSTAT_EMPTY_STRING_BUG and arrange to
1269 dnl compile the wrapper function.
1272 AC_DEFUN(jm_FUNC_LSTAT,
1274 AC_CACHE_CHECK([whether lstat accepts an empty string],
1275 jm_cv_func_lstat_empty_string_bug,
1277 # include <sys/types.h>
1278 # include <sys/stat.h>
1284 exit (lstat ("", &sbuf) ? 1 : 0);
1287 jm_cv_func_lstat_empty_string_bug=yes,
1288 jm_cv_func_lstat_empty_string_bug=no,
1289 dnl When crosscompiling, assume lstat is broken.
1290 jm_cv_func_lstat_empty_string_bug=yes)
1292 if test $jm_cv_func_lstat_empty_string_bug = yes; then
1294 LIBOBJS="$LIBOBJS lstat.$ac_objext"
1295 AC_DEFINE_UNQUOTED(HAVE_LSTAT_EMPTY_STRING_BUG, 1,
1296 [Define if lstat has the bug that it succeeds when given the zero-length
1297 file name argument. The lstat from SunOS4.1.4 and the Hurd as of 1998-11-01)
1304 dnl From Jim Meyering.
1307 AC_DEFUN(jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK,
1310 [whether lstat dereferences a symlink specified with a trailing slash],
1311 jm_cv_func_lstat_dereferences_slashed_symlink,
1313 rm -f conftest.sym conftest.file
1315 if ln -s conftest.file conftest.sym; then
1317 # include <sys/types.h>
1318 # include <sys/stat.h>
1324 /* Linux will dereference the symlink and fail.
1325 That is better in the sense that it means we will not
1326 have to compile and use the lstat wrapper. */
1327 exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1);
1330 jm_cv_func_lstat_dereferences_slashed_symlink=yes,
1331 jm_cv_func_lstat_dereferences_slashed_symlink=no,
1332 dnl When crosscompiling, be pessimistic so we will end up using the
1333 dnl replacement version of lstat that checkes for trailing slashes
1334 dnl and calls lstat a second time when necessary.
1335 jm_cv_func_lstat_dereferences_slashed_symlink=no
1338 # If the `ln -s' command failed, then we probably don't even
1339 # have an lstat function.
1340 jm_cv_func_lstat_dereferences_slashed_symlink=no
1344 test $jm_cv_func_lstat_dereferences_slashed_symlink = yes \
1347 AC_DEFINE_UNQUOTED(LSTAT_FOLLOWS_SLASHED_SYMLINK, $zero_one,
1348 [Define if lstat dereferences a symlink specified with a trailing slash])
1350 if test $jm_cv_func_lstat_dereferences_slashed_symlink = no; then
1352 # Append lstat.o if it's not already in $LIBOBJS.
1354 *lstat.$ac_objext*) ;;
1355 *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;;
1362 dnl From Jim Meyering.
1363 dnl Determine whether stat has the bug that it succeeds when given the
1364 dnl zero-length file name argument. The stat from SunOS4.1.4 and the Hurd
1365 dnl (as of 1998-11-01) do this.
1367 dnl If it does, then define HAVE_STAT_EMPTY_STRING_BUG and arrange to
1368 dnl compile the wrapper function.
1371 AC_DEFUN(jm_FUNC_STAT,
1373 AC_CACHE_CHECK([whether stat accepts an empty string],
1374 jm_cv_func_stat_empty_string_bug,
1376 # include <sys/types.h>
1377 # include <sys/stat.h>
1383 exit (stat ("", &sbuf) ? 1 : 0);
1386 jm_cv_func_stat_empty_string_bug=yes,
1387 jm_cv_func_stat_empty_string_bug=no,
1388 dnl When crosscompiling, assume stat is broken.
1389 jm_cv_func_stat_empty_string_bug=yes)
1391 if test $jm_cv_func_stat_empty_string_bug = yes; then
1393 LIBOBJS="$LIBOBJS stat.$ac_objext"
1394 AC_DEFINE_UNQUOTED(HAVE_STAT_EMPTY_STRING_BUG, 1,
1395 [Define if stat has the bug that it succeeds when given the zero-length
1396 file name argument. The stat from SunOS4.1.4 and the Hurd as of 1998-11-01)
1403 dnl From Jim Meyering.
1404 dnl Determine whether realloc works when both arguments are 0.
1405 dnl If it doesn't, arrange to use the replacement function.
1408 AC_DEFUN(jm_FUNC_REALLOC,
1410 dnl xmalloc.c requires that this symbol be defined so it doesn't
1411 dnl mistakenly use a broken realloc -- as it might if this test were omitted.
1412 AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_REALLOC_CHECK, 1,
1413 [Define if the realloc check has been performed. ])
1415 AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc,
1421 exit (realloc (0, 0) ? 0 : 1);
1424 jm_cv_func_working_realloc=yes,
1425 jm_cv_func_working_realloc=no,
1426 dnl When crosscompiling, assume realloc is broken.
1427 jm_cv_func_working_realloc=no)
1429 if test $jm_cv_func_working_realloc = no; then
1431 LIBOBJS="$LIBOBJS realloc.$ac_objext"
1432 AC_DEFINE_UNQUOTED(realloc, rpl_realloc,
1433 [Define to rpl_realloc if the replacement function should be used.])
1439 dnl From Jim Meyering.
1440 dnl Determine whether malloc accepts 0 as its argument.
1441 dnl If it doesn't, arrange to use the replacement function.
1444 AC_DEFUN(jm_FUNC_MALLOC,
1446 dnl xmalloc.c requires that this symbol be defined so it doesn't
1447 dnl mistakenly use a broken malloc -- as it might if this test were omitted.
1448 AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_MALLOC_CHECK, 1,
1449 [Define if the malloc check has been performed. ])
1451 AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc,
1457 exit (malloc (0) ? 0 : 1);
1460 jm_cv_func_working_malloc=yes,
1461 jm_cv_func_working_malloc=no,
1462 dnl When crosscompiling, assume malloc is broken.
1463 jm_cv_func_working_malloc=no)
1465 if test $jm_cv_func_working_malloc = no; then
1467 LIBOBJS="$LIBOBJS malloc.$ac_objext"
1468 AC_DEFINE_UNQUOTED(malloc, rpl_malloc,
1469 [Define to rpl_malloc if the replacement function should be used.])
1475 dnl SunOS's readdir is broken in such a way that rm.c has to add extra code
1476 dnl to test whether a NULL return value really means there are no more files
1477 dnl in the directory.
1479 dnl Detect the problem by creating a directory containing 300 files (254 not
1480 dnl counting . and .. is the minimum) and see if a loop doing `readdir; unlink'
1481 dnl removes all of them.
1483 dnl Define HAVE_WORKING_READDIR if readdir does *not* have this problem.
1485 dnl Written by Jim Meyering.
1487 AC_DEFUN(jm_FUNC_READDIR,
1489 AC_REQUIRE([AC_HEADER_DIRENT])
1490 AC_CHECK_HEADERS(string.h)
1491 AC_CACHE_CHECK([for working readdir], jm_cv_func_working_readdir,
1493 # Arrange for deletion of the temporary directory this test creates, in
1494 # case the test itself fails to delete everything -- as happens on Sunos.
1495 ac_clean_files="$ac_clean_files conf-dir"
1498 [# include <stdio.h>
1499 # include <sys/types.h>
1501 # include <string.h>
1504 # ifdef HAVE_DIRENT_H
1505 # include <dirent.h>
1506 # define NLENGTH(direct) (strlen((direct)->d_name))
1507 # else /* not HAVE_DIRENT_H */
1508 # define dirent direct
1509 # define NLENGTH(direct) ((direct)->d_namlen)
1510 # ifdef HAVE_SYS_NDIR_H
1511 # include <sys/ndir.h>
1512 # endif /* HAVE_SYS_NDIR_H */
1513 # ifdef HAVE_SYS_DIR_H
1514 # include <sys/dir.h>
1515 # endif /* HAVE_SYS_DIR_H */
1518 # endif /* HAVE_NDIR_H */
1519 # endif /* HAVE_DIRENT_H */
1521 # define DOT_OR_DOTDOT(Basename) \
1522 (Basename[0] == '.' && (Basename[1] == '\0' \
1523 || (Basename[1] == '.' && Basename[2] == '\0')))
1526 create_300_file_dir (const char *dir)
1530 if (mkdir (dir, 0700))
1535 for (i = 0; i < 300; i++)
1540 sprintf (file_name, "%03d", i);
1541 out = fopen (file_name, "w");
1544 if (fclose (out) == EOF)
1553 remove_dir (const char *dir)
1560 dirp = opendir (".");
1566 struct dirent *dp = readdir (dirp);
1570 if (DOT_OR_DOTDOT (dp->d_name))
1573 if (unlink (dp->d_name))
1588 const char *dir = "conf-dir";
1589 create_300_file_dir (dir);
1593 jm_cv_func_working_readdir=yes,
1594 jm_cv_func_working_readdir=no,
1595 jm_cv_func_working_readdir=no)])
1597 if test $jm_cv_func_working_readdir = yes; then
1598 AC_DEFINE_UNQUOTED(HAVE_WORKING_READDIR, 1,
1599 [Define if readdir is found to work properly in some unusual cases. ])
1605 dnl A replacement for autoconf's AC_FUNC_MEMCMP that detects
1606 dnl the losing memcmp on some x86 Next systems.
1607 AC_DEFUN(jm_AC_FUNC_MEMCMP,
1608 [AC_CACHE_CHECK([for working memcmp], jm_cv_func_memcmp_working,
1613 /* Some versions of memcmp are not 8-bit clean. */
1614 char c0 = 0x40, c1 = 0x80, c2 = 0x81;
1615 if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
1618 /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
1619 or more and with at least one buffer not starting on a 4-byte boundary.
1620 William Lewis provided this test program. */
1625 for (i = 0; i < 4; i++)
1629 strcpy (a, "--------01111111");
1630 strcpy (b, "--------10000000");
1631 if (memcmp (a, b, 16) >= 0)
1637 jm_cv_func_memcmp_working=yes,
1638 jm_cv_func_memcmp_working=no,
1639 jm_cv_func_memcmp_working=no)])
1640 test $jm_cv_func_memcmp_working = no \
1641 && LIBOBJS="$LIBOBJS memcmp.$ac_objext"
1642 AC_SUBST(LIBOBJS)dnl
1645 AC_DEFUN(jm_FUNC_MEMCMP,
1646 [AC_REQUIRE([jm_AC_FUNC_MEMCMP])dnl
1647 if test $jm_cv_func_memcmp_working = no; then
1648 AC_DEFINE_UNQUOTED(memcmp, rpl_memcmp,
1649 [Define to rpl_memcmp if the replacement function should be used.])
1655 dnl From Jim Meyering.
1657 dnl See if the glibc *_unlocked I/O macros are available.
1658 dnl Use only those *_unlocked macros that are declared.
1661 AC_DEFUN(jm_FUNC_GLIBC_UNLOCKED_IO,
1663 # Kludge (not executed) to make autoheader do the right thing.
1665 AC_CHECK_DECLS([clearerr_unlocked, feof_unlocked, ferror_unlocked,
1666 fflush_unlocked, fputc_unlocked, fread_unlocked, fwrite_unlocked,
1667 getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked])
1670 io_functions='clearerr_unlocked feof_unlocked ferror_unlocked
1671 fflush_unlocked fputc_unlocked fread_unlocked fwrite_unlocked
1672 getc_unlocked getchar_unlocked putc_unlocked putchar_unlocked'
1673 for jm_io_func in $io_functions; do
1674 # Check for the existence of each function only if its declared.
1675 # Otherwise, we'd get the Solaris5.5.1 functions that are not
1676 # declared, and that have been removed from Solaris5.6. The resulting
1677 # 5.5.1 binaries would not run on 5.6 due to shared library differences.
1678 AC_CHECK_DECLS([$jm_io_func],
1681 [#include <stdio.h>])
1682 if test $jm_declared = yes; then
1683 AC_CHECK_FUNCS($jm_io_func)
1691 dnl Determine whether to add fnmatch.o to LIBOBJS and to
1692 dnl define fnmatch to rpl_fnmatch.
1697 # We look for fnmatch.h to avoid that the test fails in C++.
1698 AC_DEFUN(kd_FUNC_FNMATCH_CASE,
1699 [AC_CHECK_HEADERS(fnmatch.h)
1700 AC_CACHE_CHECK(for working fnmatch with case folding, ac_cv_func_fnmatch_works,
1701 # Some versions of Solaris or SCO have a broken fnmatch function.
1702 # So we run a test program. If we are cross-compiling, take no chance.
1703 # Also want FNM_CASEFOLD
1704 # Thanks to John Oleynick and Franc,ois Pinard for this test.
1709 # include <fnmatch.h>
1715 exit (fnmatch ("A*", "abc", FNM_CASEFOLD) != 0);
1717 ac_cv_func_fnmatch_works=yes, ac_cv_func_fnmatch_works=no,
1718 ac_cv_func_fnmatch_works=no)])
1719 if test $ac_cv_func_fnmatch_works = yes; then
1720 AC_DEFINE(HAVE_FNMATCH, 1,
1721 [Define if your system has a working `fnmatch' function with case folding.])
1726 AC_DEFUN(kd_FUNC_FNMATCH_CASE_RPL,
1728 AC_REQUIRE([AM_GLIBC])
1729 kd_FUNC_FNMATCH_CASE
1730 if test $ac_cv_func_fnmatch_works = no \
1731 && test $ac_cv_gnu_library = no; then
1733 LIBOBJS="$LIBOBJS fnmatch.$ac_objext"
1734 AC_DEFINE_UNQUOTED(fnmatch, rpl_fnmatch,
1735 [Define to rpl_fnmatch if the replacement function should be used.])
1741 dnl From Gordon Matzigkeit.
1742 dnl Test for the GNU C Library.
1743 dnl FIXME: this should migrate into libit.
1747 AC_CACHE_CHECK(whether we are using the GNU C Library,
1749 [AC_EGREP_CPP([Thanks for using GNU],
1751 #include <features.h>
1752 #ifdef __GNU_LIBRARY__
1753 Thanks for using GNU
1756 ac_cv_gnu_library=yes,
1757 ac_cv_gnu_library=no)
1760 AC_CACHE_CHECK(for version 2 of the GNU C Library,
1762 [AC_EGREP_CPP([Thanks for using GNU too],
1764 #include <features.h>
1766 Thanks for using GNU too
1769 ac_cv_glibc=yes, ac_cv_glibc=no)
1778 AC_MSG_CHECKING(for AFS)
1779 if test -d /afs; then
1780 AC_DEFINE(AFS, 1, [Define if you have the Andrew File System.])
1785 AC_MSG_RESULT($ac_result)
1790 # autoconf tests required for use of xstrtoumax.c
1792 AC_DEFUN(jm_AC_PREREQ_XSTRTOUMAX,
1794 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
1795 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
1796 AC_CHECK_HEADERS(stdlib.h)
1798 AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro],
1799 jm_cv_func_strtoumax_macro,
1800 AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include <inttypes.h>
1802 inttypes_h_defines_strtoumax
1804 jm_cv_func_strtoumax_macro=yes,
1805 jm_cv_func_strtoumax_macro=no))
1807 if test "$jm_cv_func_strtoumax_macro" != yes; then
1808 AC_REPLACE_FUNCS(strtoumax)
1811 dnl We don't need (and can't compile) the replacement strtoull
1812 dnl unless the type `unsigned long long' exists.
1813 dnl Also, only the replacement strtoumax invokes strtoull,
1814 dnl so we need the replacement strtoull only if strtoumax does not exist.
1815 case "$ac_cv_type_unsigned_long_long,$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in
1817 AC_REPLACE_FUNCS(strtoull)
1825 dnl From Paul Eggert.
1827 AC_DEFUN(jm_AC_TYPE_UNSIGNED_LONG_LONG,
1829 AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
1830 [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
1831 [unsigned long long ullmax = (unsigned long long) -1;
1832 return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
1833 ac_cv_type_unsigned_long_long=yes,
1834 ac_cv_type_unsigned_long_long=no)])
1835 if test $ac_cv_type_unsigned_long_long = yes; then
1836 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
1837 [Define if you have the unsigned long long type.])
1842 dnl Run a program to determine whether whether link(2) follows symlinks.
1843 dnl Set LINK_FOLLOWS_SYMLINKS accordingly.
1845 AC_DEFUN(jm_AC_FUNC_LINK_FOLLOWS_SYMLINK,
1847 AC_CACHE_CHECK([whether link(2) follows symlinks],
1848 jm_ac_cv_func_link_follows_symlink,
1850 dnl poor-man's AC_REQUIRE: FIXME: repair this once autoconf-3 provides
1851 dnl the appropriate framework.
1852 test -z "$ac_cv_header_unistd_h" \
1853 && AC_CHECK_HEADERS(unistd.h)
1855 # Create a regular file.
1856 echo > conftest.file
1859 # include <sys/types.h>
1860 # include <sys/stat.h>
1861 # ifdef HAVE_UNISTD_H
1862 # include <unistd.h>
1865 # define SAME_INODE(Stat_buf_1, Stat_buf_2) \
1866 ((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
1867 && (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)
1872 const char *file = "conftest.file";
1873 const char *sym = "conftest.sym";
1874 const char *hard = "conftest.hard";
1875 struct stat sb_file, sb_hard;
1877 /* Create a symlink to the regular file. */
1878 if (symlink (file, sym))
1881 /* Create a hard link to that symlink. */
1882 if (link (sym, hard))
1885 if (lstat (hard, &sb_hard))
1887 if (lstat (file, &sb_file))
1890 /* If the dev/inode of hard and file are the same, then
1891 the link call followed the symlink. */
1892 return SAME_INODE (sb_hard, sb_file) ? 0 : 1;
1895 jm_ac_cv_func_link_follows_symlink=yes,
1896 jm_ac_cv_func_link_follows_symlink=no,
1897 jm_ac_cv_func_link_follows_symlink=yes dnl We're cross compiling.
1900 if test $jm_ac_cv_func_link_follows_symlink = yes; then
1901 AC_DEFINE(LINK_FOLLOWS_SYMLINKS, 1,
1902 [Define if `link(2)' dereferences symbolic links.])
1906 # From Jim Meyering. Use this if you use the GNU error.[ch].
1907 # FIXME: Migrate into libit
1909 AC_DEFUN([AM_FUNC_ERROR_AT_LINE],
1910 [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
1911 [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
1912 am_cv_lib_error_at_line=yes,
1913 am_cv_lib_error_at_line=no)])
1914 if test $am_cv_lib_error_at_line = no; then
1915 LIBOBJS="$LIBOBJS error.$ac_objext"
1917 AC_SUBST(LIBOBJS)dnl
1922 dnl This macro is intended to be used solely in this file.
1923 dnl These are the prerequisite macros for GNU's strftime.c replacement.
1924 AC_DEFUN(_jm_STRFTIME_PREREQS,
1926 dnl strftime.c uses localtime_r if it exists. Check for it.
1927 AC_CHECK_FUNCS(localtime_r)
1929 AC_CHECK_HEADERS(limits.h)
1930 AC_CHECK_FUNCS(bcopy tzset mempcpy memcpy memset)
1932 # This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE.
1935 AC_CHECK_FUNCS(mblen mbrlen)
1937 AC_CHECK_MEMBER(struct tm.tm_gmtoff,
1938 [AC_DEFINE(HAVE_TM_GMTOFF, 1,
1939 [Define if struct tm has the tm_gmtoff member.])],
1941 [#include <time.h>])
1944 dnl Determine if the strftime function has all the features of the GNU one.
1946 dnl From Jim Meyering.
1948 AC_DEFUN(jm_FUNC_GNU_STRFTIME,
1949 [AC_REQUIRE([AC_HEADER_TIME])dnl
1951 _jm_STRFTIME_PREREQS
1953 AC_REQUIRE([AC_C_CONST])dnl
1954 AC_REQUIRE([AC_HEADER_STDC])dnl
1955 AC_CHECK_HEADERS(sys/time.h)
1956 AC_CACHE_CHECK([for working GNU strftime], jm_cv_func_working_gnu_strftime,
1957 [# Set TZ to GMT0 to make strftime give consistent results during the test.
1958 ac_save_TZ="${TZ-GMT0}"
1962 [ /* Ulrich Drepper provided parts of the test program. */
1964 # include <stdlib.h>
1967 #if TIME_WITH_SYS_TIME
1968 # include <sys/time.h>
1971 # if HAVE_SYS_TIME_H
1972 # include <sys/time.h>
1979 compare (const char *fmt, const struct tm *tm, const char *expected)
1982 strftime (buf, 99, fmt, tm);
1983 if (strcmp (buf, expected))
1985 #ifdef SHOW_FAILURES
1986 printf ("fmt: \"%s\", expected \"%s\", got \"%s\"\n",
1987 fmt, expected, buf);
1999 time_t t = 738367; /* Fri Jan 9 13:06:07 1970 */
2003 #define CMP(Fmt, Expected) n_fail += compare ((Fmt), tm, (Expected))
2005 CMP ("%-m", "1"); /* GNU */
2006 CMP ("%A", "Friday");
2007 CMP ("%^A", "FRIDAY"); /* The ^ is a GNU extension. */
2008 CMP ("%B", "January");
2009 CMP ("%^B", "JANUARY");
2010 CMP ("%C", "19"); /* POSIX.2 */
2011 CMP ("%D", "01/09/70"); /* POSIX.2 */
2012 CMP ("%F", "1970-01-09");
2013 CMP ("%G", "1970"); /* GNU */
2018 CMP ("%R", "13:06"); /* POSIX.2 */
2020 CMP ("%T", "13:06:07"); /* POSIX.2 */
2024 CMP ("%X", "13:06:07");
2027 CMP ("%_m", " 1"); /* GNU */
2032 CMP ("%c", "Fri Jan 9 13:06:07 1970");
2033 CMP ("%^c", "FRI JAN 9 13:06:07 1970");
2035 CMP ("%e", " 9"); /* POSIX.2 */
2036 CMP ("%g", "70"); /* GNU */
2037 CMP ("%h", "Jan"); /* POSIX.2 */
2040 CMP ("%k", "13"); /* GNU */
2041 CMP ("%l", " 1"); /* GNU */
2043 CMP ("%n", "\n"); /* POSIX.2 */
2045 CMP ("%r", "01:06:07 PM"); /* POSIX.2 */
2046 CMP ("%s", "738367"); /* GNU */
2047 CMP ("%t", "\t"); /* POSIX.2 */
2048 CMP ("%u", "5"); /* POSIX.2 */
2050 CMP ("%x", "01/09/70");
2052 CMP ("%z", "+0000"); /* GNU */
2054 exit (n_fail ? 1 : 0);
2056 jm_cv_func_working_gnu_strftime=yes,
2057 jm_cv_func_working_gnu_strftime=no,
2058 dnl When crosscompiling, assume strftime is missing or broken.
2059 jm_cv_func_working_gnu_strftime=no)
2060 dnl If TZ wasn't set before, this sets it to GMT0. No real harm done.
2063 if test $jm_cv_func_working_gnu_strftime = no; then
2065 LIBOBJS="$LIBOBJS strftime.$ac_objext"
2066 AC_DEFINE_UNQUOTED(strftime, gnu_strftime,
2067 [Define to gnu_strftime if the replacement function should be used.])
2071 AC_DEFUN(jm_FUNC_STRFTIME,
2073 _jm_STRFTIME_PREREQS
2074 AC_REPLACE_FUNCS(strftime)
2079 dnl See if there's a working, system-supplied version of the getline function.
2080 dnl We can't just do AC_REPLACE_FUNCS(getline) because some systems
2081 dnl have a function by that name in -linet that doesn't have anything
2082 dnl to do with the function we need.
2083 AC_DEFUN(AM_FUNC_GETLINE,
2085 am_getline_needs_run_time_check=no
2086 AC_CHECK_FUNC(getline,
2087 dnl Found it in some library. Verify that it works.
2088 am_getline_needs_run_time_check=yes,
2089 am_cv_func_working_getline=no)
2090 if test $am_getline_needs_run_time_check = yes; then
2091 AC_CHECK_HEADERS(string.h)
2092 AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline,
2093 [echo fooN |tr -d '\012'|tr N '\012' > conftest.data
2096 # include <sys/types.h>
2098 # include <string.h>
2107 getstr(&path, &n, stream, terminator, offset);
2111 { /* Based on a test program from Karl Heuer. */
2115 FILE *in = fopen ("./conftest.data", "r");
2118 len = getline (&line, &siz, in);
2119 nread = getstr (&path, &pathsize, fp, '\0', count);
2121 exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1);
2123 ], am_cv_func_working_getline=yes dnl The library version works.
2124 , am_cv_func_working_getline=no dnl The library version does NOT work.
2125 , am_cv_func_working_getline=no dnl We're cross compiling.
2129 if test $am_cv_func_working_getline = no; then
2136 # Test for the GNU C Library, version 2.1 or newer.
2137 # From Bruno Haible.
2139 AC_DEFUN(jm_GLIBC21,
2141 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
2142 ac_cv_gnu_library_2_1,
2143 [AC_EGREP_CPP([Lucky GNU user],
2145 #include <features.h>
2146 #ifdef __GNU_LIBRARY__
2147 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
2152 ac_cv_gnu_library_2_1=yes,
2153 ac_cv_gnu_library_2_1=no)
2157 GLIBC21="$ac_cv_gnu_library_2_1"
2163 dnl From Bruno Haible.
2167 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
2168 dnl those with the standalone portable libiconv installed).
2169 AC_CACHE_CHECK(for iconv, jm_cv_func_iconv, [
2170 jm_cv_func_iconv="no, consider installing libiconv"
2172 AC_TRY_LINK([#include <stdlib.h>
2173 #include <iconv.h>],
2174 [iconv_t cd = iconv_open("","");
2175 iconv(cd,NULL,NULL,NULL,NULL);
2177 jm_cv_func_iconv=yes)
2178 if test "$jm_cv_func_iconv" != yes; then
2179 jm_save_LIBS="$LIBS"
2180 LIBS="$LIBS -liconv"
2181 AC_TRY_LINK([#include <stdlib.h>
2182 #include <iconv.h>],
2183 [iconv_t cd = iconv_open("","");
2184 iconv(cd,NULL,NULL,NULL,NULL);
2187 jm_cv_func_iconv=yes)
2188 LIBS="$jm_save_LIBS"
2191 if test "$jm_cv_func_iconv" = yes; then
2192 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
2195 if test "$jm_cv_lib_iconv" = yes; then
2203 dnl From Jim Meyering.
2205 dnl See if struct statfs has the f_fstypename member.
2206 dnl If so, define HAVE_F_FSTYPENAME_IN_STATFS.
2209 AC_DEFUN(jm_FSTYPENAME,
2211 AC_CACHE_CHECK([for f_fstypename in struct statfs],
2212 fu_cv_sys_f_fstypename_in_statfs,
2216 #include <sys/param.h>
2217 #include <sys/types.h>
2218 #include <sys/mount.h>
2220 [struct statfs s; int i = sizeof s.f_fstypename;],
2221 fu_cv_sys_f_fstypename_in_statfs=yes,
2222 fu_cv_sys_f_fstypename_in_statfs=no
2227 if test $fu_cv_sys_f_fstypename_in_statfs = yes; then
2228 AC_DEFINE_UNQUOTED(HAVE_F_FSTYPENAME_IN_STATFS, 1,
2229 [Define if struct statfs has the f_fstypename member.])
2236 dnl From Paul Eggert.
2238 # Define ST_MTIM_NSEC to be the nanoseconds member of struct stat's st_mtim,
2241 AC_DEFUN(AC_STRUCT_ST_MTIM_NSEC,
2242 [AC_CACHE_CHECK([for nanoseconds member of struct stat.st_mtim],
2243 ac_cv_struct_st_mtim_nsec,
2244 [ac_save_CPPFLAGS="$CPPFLAGS"
2245 ac_cv_struct_st_mtim_nsec=no
2246 # tv_nsec -- the usual case
2247 # _tv_nsec -- Solaris 2.6, if
2248 # (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1
2249 # && !defined __EXTENSIONS__)
2250 # st__tim.tv_nsec -- UnixWare 2.1.2
2251 for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do
2252 CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val"
2253 AC_TRY_COMPILE([#include <sys/types.h>
2254 #include <sys/stat.h>], [struct stat s; s.st_mtim.ST_MTIM_NSEC;],
2255 [ac_cv_struct_st_mtim_nsec=$ac_val; break])
2257 CPPFLAGS="$ac_save_CPPFLAGS"])
2259 if test $ac_cv_struct_st_mtim_nsec != no; then
2260 AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec,
2261 [Define to be the nanoseconds member of struct stat's st_mtim,
2269 # Define HAVE_ST_DM_MODE if struct stat has an st_dm_mode member.
2271 AC_DEFUN(AC_STRUCT_ST_DM_MODE,
2272 [AC_CACHE_CHECK([for st_dm_mode in struct stat], ac_cv_struct_st_dm_mode,
2273 [AC_TRY_COMPILE([#include <sys/types.h>
2274 #include <sys/stat.h>], [struct stat s; s.st_dm_mode;],
2275 ac_cv_struct_st_dm_mode=yes,
2276 ac_cv_struct_st_dm_mode=no)])
2278 if test $ac_cv_struct_st_dm_mode = yes; then
2279 AC_DEFINE_UNQUOTED(HAVE_ST_DM_MODE, 1,
2280 [Define if struct stat has an st_dm_mode member. ])
2287 dnl From Jim Meyering
2289 dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
2290 dnl in time.h or sys/time.h.
2292 AC_DEFUN(jm_CHECK_TYPE_STRUCT_TIMESPEC,
2294 AC_REQUIRE([AC_HEADER_TIME])
2295 AC_CACHE_CHECK([for struct timespec], fu_cv_sys_struct_timespec,
2298 # if TIME_WITH_SYS_TIME
2299 # include <sys/time.h>
2302 # if HAVE_SYS_TIME_H
2303 # include <sys/time.h>
2309 [static struct timespec x; x.tv_sec = x.tv_nsec;],
2310 fu_cv_sys_struct_timespec=yes,
2311 fu_cv_sys_struct_timespec=no)
2314 if test $fu_cv_sys_struct_timespec = yes; then
2315 AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMESPEC, 1,
2316 [Define if struct timespec is declared in <time.h>. ])
2322 dnl From Paul Eggert.
2326 # Define uintmax_t to `unsigned long' or `unsigned long long'
2327 # if <inttypes.h> does not exist.
2329 AC_DEFUN(jm_AC_TYPE_UINTMAX_T,
2331 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
2332 if test $jm_ac_cv_header_inttypes_h = no; then
2333 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
2334 test $ac_cv_type_unsigned_long_long = yes \
2335 && ac_type='unsigned long long' \
2336 || ac_type='unsigned long'
2337 AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
2338 [ Define to unsigned long or unsigned long long
2339 if <inttypes.h> doesn't define.])
2343 # Macro to add for using GNU gettext.
2344 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2346 # This file can be copied and used freely without restrictions. It can
2347 # be used in projects which are not available under the GNU Public License
2348 # but which still want to provide support for the GNU gettext functionality.
2349 # Please note that the actual code is *not* freely available.
2353 AC_PREREQ(2.13) dnl Minimum Autoconf version required.
2355 AC_DEFUN(AM_WITH_NLS,
2356 [AC_MSG_CHECKING([whether NLS is requested])
2357 dnl Default is enabled NLS
2359 [ --disable-nls do not use Native Language Support],
2360 USE_NLS=$enableval, USE_NLS=yes)
2361 AC_MSG_RESULT($USE_NLS)
2364 USE_INCLUDED_LIBINTL=no
2366 dnl If we use NLS figure out what method
2367 if test "$USE_NLS" = "yes"; then
2368 AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested.])
2369 AC_MSG_CHECKING([whether included gettext is requested])
2370 AC_ARG_WITH(included-gettext,
2371 [ --with-included-gettext use the GNU gettext library included here],
2372 nls_cv_force_use_gnu_gettext=$withval,
2373 nls_cv_force_use_gnu_gettext=no)
2374 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
2376 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
2377 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
2378 dnl User does not insist on using GNU NLS library. Figure out what
2379 dnl to use. If gettext or catgets are available (in this order) we
2380 dnl use this. Else we have to fall back to GNU NLS library.
2381 dnl catgets is only used if permitted by option --with-catgets.
2383 nls_cv_header_libgt=
2386 AC_CHECK_HEADER(libintl.h,
2387 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
2388 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
2389 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
2391 if test "$gt_cv_func_gettext_libc" != "yes"; then
2392 AC_CHECK_LIB(intl, bindtextdomain,
2393 [AC_CHECK_LIB(intl, gettext)])
2396 if test "$gt_cv_func_gettext_libc" = "yes" \
2397 || test "$ac_cv_lib_intl_gettext" = "yes"; then
2398 AC_DEFINE(HAVE_GETTEXT, 1,
2399 [Define to 1 if you have gettext and don't want to use GNU gettext.])
2400 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2401 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
2402 if test "$MSGFMT" != "no"; then
2403 AC_CHECK_FUNCS(dcgettext)
2404 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2405 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2406 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2407 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
2408 return _nl_msg_cat_cntr],
2418 if test "$CATOBJEXT" = "NONE"; then
2419 AC_MSG_CHECKING([whether catgets can be used])
2420 AC_ARG_WITH(catgets,
2421 [ --with-catgets use catgets functions if available],
2422 nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
2423 AC_MSG_RESULT($nls_cv_use_catgets)
2425 if test "$nls_cv_use_catgets" = "yes"; then
2426 dnl No gettext in C library. Try catgets next.
2427 AC_CHECK_LIB(i, main)
2428 AC_CHECK_FUNC(catgets,
2429 [AC_DEFINE(HAVE_CATGETS, 1,
2430 [Define as 1 if you have catgets and don't want to use GNU gettext.])
2431 INTLOBJS="\$(CATOBJS)"
2432 AC_PATH_PROG(GENCAT, gencat, no)dnl
2433 if test "$GENCAT" != "no"; then
2434 AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
2435 if test "$GMSGFMT" = "no"; then
2436 AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
2437 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
2439 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2440 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2441 USE_INCLUDED_LIBINTL=yes
2445 INTLDEPS='$(top_builddir)/intl/libintl.a'
2447 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
2448 nls_cv_header_intl=intl/libintl.h
2449 nls_cv_header_libgt=intl/libgettext.h
2454 if test "$CATOBJEXT" = "NONE"; then
2455 dnl Neither gettext nor catgets in included in the C library.
2456 dnl Fall back on GNU gettext library.
2457 nls_cv_use_gnu_gettext=yes
2461 if test "$nls_cv_use_gnu_gettext" = "yes"; then
2462 dnl Mark actions used to generate GNU NLS library.
2463 INTLOBJS="\$(GETTOBJS)"
2464 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2465 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
2466 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2467 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2468 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2470 USE_INCLUDED_LIBINTL=yes
2474 INTLDEPS='$(top_builddir)/intl/libintl.a'
2476 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
2477 nls_cv_header_intl=intl/libintl.h
2478 nls_cv_header_libgt=intl/libgettext.h
2481 dnl Test whether we really found GNU xgettext.
2482 if test "$XGETTEXT" != ":"; then
2483 dnl If it is no GNU xgettext we define it as : so that the
2484 dnl Makefiles still can work.
2485 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
2489 [found xgettext program is not GNU xgettext; ignore it])
2494 # We need to process the po/ directory.
2498 nls_cv_header_intl=intl/libintl.h
2499 nls_cv_header_libgt=intl/libgettext.h
2501 if test -z "$nls_cv_header_intl"; then
2502 # Clean out junk possibly left behind by a previous configuration.
2503 rm -f intl/libintl.h
2505 AC_CONFIG_LINKS($nls_cv_header_intl:$nls_cv_header_libgt)
2507 [case "$CONFIG_FILES" in *po/Makefile.in*)
2508 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
2512 # If this is used in GNU gettext we have to set USE_NLS to `yes'
2513 # because some of the sources are only built for this goal.
2514 if test "$PACKAGE" = gettext; then
2516 USE_INCLUDED_LIBINTL=yes
2519 dnl These rules are solely for the distribution goal. While doing this
2520 dnl we only have to keep exactly one list of the available catalogs
2521 dnl in configure.in.
2522 for lang in $ALL_LINGUAS; do
2523 GMOFILES="$GMOFILES $lang.gmo"
2524 POFILES="$POFILES $lang.po"
2527 dnl Make all variables we use known to autoconf.
2528 AC_SUBST(USE_INCLUDED_LIBINTL)
2531 AC_SUBST(DATADIRNAME)
2533 AC_SUBST(INSTOBJEXT)
2541 AC_DEFUN(AM_GNU_GETTEXT,
2542 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
2543 AC_REQUIRE([AC_PROG_CC])dnl
2544 AC_REQUIRE([AC_PROG_RANLIB])dnl
2545 AC_REQUIRE([AC_ISC_POSIX])dnl
2546 AC_REQUIRE([AC_HEADER_STDC])dnl
2547 AC_REQUIRE([AC_C_CONST])dnl
2548 AC_REQUIRE([AC_C_INLINE])dnl
2549 AC_REQUIRE([AC_TYPE_OFF_T])dnl
2550 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
2551 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
2552 AC_REQUIRE([AC_FUNC_MMAP])dnl
2554 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
2555 unistd.h sys/param.h])
2556 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
2557 strdup __argz_count __argz_stringify __argz_next])
2559 if test "${ac_cv_func_stpcpy+set}" != "set"; then
2560 AC_CHECK_FUNCS(stpcpy)
2562 if test "${ac_cv_func_stpcpy}" = "yes"; then
2563 AC_DEFINE(HAVE_STPCPY, 1, [Define to 1 if you have the stpcpy function.])
2569 if test "x$CATOBJEXT" != "x"; then
2570 if test "x$ALL_LINGUAS" = "x"; then
2573 AC_MSG_CHECKING(for catalogs to be installed)
2575 for lang in ${LINGUAS=$ALL_LINGUAS}; do
2576 case "$ALL_LINGUAS" in
2577 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
2580 LINGUAS=$NEW_LINGUAS
2581 AC_MSG_RESULT($LINGUAS)
2584 dnl Construct list of names of catalog files to be constructed.
2585 if test -n "$LINGUAS"; then
2586 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
2590 dnl The reference to <locale.h> in the installed <libintl.h> file
2591 dnl must be resolved because we cannot expect the users of this
2592 dnl to define HAVE_LOCALE_H.
2593 if test $ac_cv_header_locale_h = yes; then
2594 INCLUDE_LOCALE_H="#include <locale.h>"
2597 /* The system does not provide the header <locale.h>. Take care yourself. */"
2599 AC_SUBST(INCLUDE_LOCALE_H)
2601 dnl Determine which catalog format we have (if any is needed)
2602 dnl For now we know about two different formats:
2603 dnl Linux libc-5 and the normal X/Open format
2604 test -d intl || mkdir intl
2605 if test "$CATOBJEXT" = ".cat"; then
2606 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
2608 dnl Transform the SED scripts while copying because some dumb SEDs
2609 dnl cannot handle comments.
2610 sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
2612 dnl po2tbl.sed is always needed.
2613 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
2614 $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
2616 dnl In the intl/Makefile.in we have a special dependency which makes
2617 dnl only sense for gettext. We comment this out for non-gettext
2619 if test "$PACKAGE" = "gettext"; then
2629 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
2630 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
2631 dnl Try to locate is.
2633 if test -n "$ac_aux_dir"; then
2634 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
2636 if test -z "$MKINSTALLDIRS"; then
2637 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
2639 AC_SUBST(MKINSTALLDIRS)
2641 dnl *** For now the libtool support in intl/Makefile is not for real.
2645 dnl Generate list of files to be processed by xgettext which will
2646 dnl be included in po/Makefile.
2647 test -d po || mkdir po
2650 posrcprefix="../" ;;
2652 posrcprefix="$srcdir/" ;;
2654 posrcprefix="../$srcdir/" ;;
2657 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
2658 < $srcdir/po/POTFILES.in > po/POTFILES
2661 # Search path for a program which passes the given test.
2662 # Ulrich Drepper <drepper@cygnus.com>, 1996.
2664 # This file can be copied and used freely without restrictions. It can
2665 # be used in projects which are not available under the GNU Public License
2666 # but which still want to provide support for the GNU gettext functionality.
2667 # Please note that the actual code is *not* freely available.
2671 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
2672 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
2673 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
2674 [# Extract the first word of "$2", so it can be a program name with args.
2675 set dummy $2; ac_word=[$]2
2676 AC_MSG_CHECKING([for $ac_word])
2677 AC_CACHE_VAL(ac_cv_path_$1,
2680 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
2683 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
2684 for ac_dir in ifelse([$5], , $PATH, [$5]); do
2685 test -z "$ac_dir" && ac_dir=.
2686 if test -f $ac_dir/$ac_word; then
2688 ac_cv_path_$1="$ac_dir/$ac_word"
2694 dnl If no 4th arg is given, leave the cache variable unset,
2695 dnl so AC_PATH_PROGS will keep looking.
2696 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
2701 if test -n "[$]$1"; then
2702 AC_MSG_RESULT([$]$1)
2709 # Check whether LC_MESSAGES is available in <locale.h>.
2710 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2712 # This file can be copied and used freely without restrictions. It can
2713 # be used in projects which are not available under the GNU Public License
2714 # but which still want to provide support for the GNU gettext functionality.
2715 # Please note that the actual code is *not* freely available.
2719 AC_PREREQ(2.13) dnl Minimum Autoconf version required.
2721 AC_DEFUN(AM_LC_MESSAGES,
2722 [if test $ac_cv_header_locale_h = yes; then
2723 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
2724 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2725 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
2726 if test $am_cv_val_LC_MESSAGES = yes; then
2727 AC_DEFINE(HAVE_LC_MESSAGES, 1,
2728 [Define if your locale.h file contains LC_MESSAGES.])