1 # aclocal.m4 generated automatically by aclocal 1.4d
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], [m4_pattern_allow([AM_CFLAGS])])
95 ifdef([m4_pattern_allow], [m4_pattern_allow([AM_CPPFLAGS])])
96 ifdef([m4_pattern_allow], [m4_pattern_allow([AM_CXXFLAGS])])
97 ifdef([m4_pattern_allow], [m4_pattern_allow([AM_OBJCFLAGS])])
98 ifdef([m4_pattern_allow], [m4_pattern_allow([AM_FFLAGS])])
99 ifdef([m4_pattern_allow], [m4_pattern_allow([AM_RFLAGS])])
100 ifdef([m4_pattern_allow], [m4_pattern_allow([AM_GCJFLAGS])])
102 # Some tools Automake needs.
103 AC_REQUIRE([AM_SANITY_CHECK])dnl
104 AC_REQUIRE([AC_ARG_PROGRAM])dnl
105 AM_MISSING_PROG(ACLOCAL, aclocal)
106 AM_MISSING_PROG(AUTOCONF, autoconf)
107 AM_MISSING_PROG(AUTOMAKE, automake)
108 AM_MISSING_PROG(AUTOHEADER, autoheader)
109 AM_MISSING_PROG(MAKEINFO, makeinfo)
110 AM_MISSING_PROG(AMTAR, tar)
111 AM_MISSING_INSTALL_SH
112 # We need awk for the "check" target. The system "awk" is bad on
114 AC_REQUIRE([AC_PROG_AWK])dnl
115 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
116 AC_REQUIRE([AM_DEP_TRACK])dnl
117 AC_REQUIRE([AM_SET_DEPDIR])dnl
118 AC_PROVIDE_IFELSE([AC_PROG_][CC],
119 [AM_DEPENDENCIES(CC)],
120 [define([AC_PROG_][CC],
121 defn([AC_PROG_][CC])[AM_DEPENDENCIES(CC)])])dnl
122 AC_PROVIDE_IFELSE([AC_PROG_][CXX],
123 [AM_DEPENDENCIES(CXX)],
124 [define([AC_PROG_][CXX],
125 defn([AC_PROG_][CXX])[AM_DEPENDENCIES(CXX)])])dnl
129 # Check to make sure that the build environment is sane.
136 AC_DEFUN([AM_SANITY_CHECK],
137 [AC_MSG_CHECKING([whether build environment is sane])
140 echo timestamp > conftest.file
141 # Do `set' in a subshell so we don't clobber the current shell's
142 # arguments. Must try -L first in case configure is actually a
143 # symlink; some systems play weird games with the mod time of symlinks
144 # (eg FreeBSD returns the mod time of the symlink's containing
147 set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
148 if test "$[*]" = "X"; then
150 set X `ls -t $srcdir/configure conftest.file`
152 if test "$[*]" != "X $srcdir/configure conftest.file" \
153 && test "$[*]" != "X conftest.file $srcdir/configure"; then
155 # If neither matched, then we have a broken ls. This can happen
156 # if, for instance, CONFIG_SHELL is bash and it inherits a
157 # broken ls alias from the environment. This has actually
158 # happened. Such a system could not be considered "sane".
159 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
160 alias in your environment])
163 test "$[2]" = conftest.file
169 AC_MSG_ERROR([newly created file is older than distributed files!
170 Check your system clock])
178 # AM_MISSING_PROG(NAME, PROGRAM)
179 # ------------------------------
180 AC_DEFUN([AM_MISSING_PROG],
181 [AC_REQUIRE([AM_MISSING_HAS_RUN])
182 $1=${$1-"${am_missing_run}$2"}
186 # AM_MISSING_INSTALL_SH
187 # ---------------------
188 # Like AM_MISSING_PROG, but only looks for install-sh.
189 AC_DEFUN([AM_MISSING_INSTALL_SH],
190 [AC_REQUIRE([AM_MISSING_HAS_RUN])
191 if test -z "$install_sh"; then
192 for install_sh in "$ac_aux_dir/install-sh" \
193 "$ac_aux_dir/install.sh" \
194 "${am_missing_run}${ac_auxdir}/install-sh";
196 test -f "$install_sh" && break
198 # FIXME: an evil hack: we remove the SHELL invocation from
199 # install_sh because automake adds it back in. Sigh.
200 install_sh=`echo $install_sh | sed -e 's/\${SHELL}//'`
202 AC_SUBST(install_sh)])
207 # Define MISSING if not defined so far and test if it supports --run.
208 # If it does, set am_missing_run to use it, otherwise, to nothing.
209 AC_DEFUN([AM_MISSING_HAS_RUN],
210 [test x"${MISSING+set}" = xset ||
211 MISSING="\${SHELL} `CDPATH=:; cd $ac_aux_dir && pwd`/missing"
212 # Use eval to expand $SHELL
213 if eval "$MISSING --run :"; then
214 am_missing_run="$MISSING --run "
218 AC_MSG_WARN([${am_backtick}missing' script is too old or missing])
224 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
225 # written in clear, in which case automake, when reading aclocal.m4,
226 # will think it sees a *use*, and therefore will trigger all it's
227 # C support machinery. Also note that it means that autoscan, seeing
228 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
230 # AM_DEPENDENCIES(NAME)
231 # ---------------------
232 # See how the compiler implements dependency checking.
233 # NAME is "CC", "CXX" or "OBJC".
234 # We try a few techniques and use that to set a single cache variable.
235 AC_DEFUN([AM_DEPENDENCIES],
236 [AC_REQUIRE([AM_SET_DEPDIR])dnl
237 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
239 [AC_REQUIRE([AC_PROG_][CC])dnl
240 AC_REQUIRE([AC_PROG_][CPP])
243 [$1], CXX, [AC_REQUIRE([AC_PROG_][CXX])dnl
244 AC_REQUIRE([AC_PROG_][CXXCPP])
247 [$1], OBJC, [am_cv_OBJC_dependencies_compiler_type=gcc],
248 [AC_REQUIRE([AC_PROG_][$1])dnl
252 AC_REQUIRE([AM_MAKE_INCLUDE])
254 AC_CACHE_CHECK([dependency style of $depcc],
255 [am_cv_$1_dependencies_compiler_type],
256 [if test -z "$AMDEP"; then
257 # We make a subdir and do the tests there. Otherwise we can end up
258 # making bogus files that we don't know about and never remove. For
259 # instance it was reported that on HP-UX the gcc test will end up
260 # making a dummy file named `D' -- because `-MD' means `put the output
263 # Copy depcomp to subdir because otherwise we won't find it if we're
264 # using a relative directory.
265 cp "$am_depcomp" confdir
268 am_cv_$1_dependencies_compiler_type=none
269 for depmode in `sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < "./depcomp"`; do
270 # We need to recreate these files for each test, as the compiler may
271 # overwrite some of them when testing with obscure command lines.
272 # This happens at least with the AIX C compiler.
273 echo '#include "conftest.h"' > conftest.c
274 echo 'int i;' > conftest.h
278 # after this tag, mechanisms are not by side-effect, so they'll
279 # only be used when explicitly requested
280 if test "x$enable_dependency_tracking" = xyes; then
288 # We check with `-c' and `-o' for the sake of the "dashmstdout"
289 # mode. It turns out that the SunPro C++ compiler does not properly
290 # handle `-M -o', and we need to detect this.
291 if depmode="$depmode" \
292 source=conftest.c object=conftest.o \
293 depfile=conftest.Po tmpdepfile=conftest.TPo \
294 $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
295 grep conftest.h conftest.Po > /dev/null 2>&1; then
296 am_cv_$1_dependencies_compiler_type="$depmode"
304 am_cv_$1_dependencies_compiler_type=none
307 $1DEPMODE="depmode=$am_cv_$1_dependencies_compiler_type"
308 AC_SUBST([$1DEPMODE])
314 # Choose a directory name for dependency files.
315 # This macro is AC_REQUIREd in AM_DEPENDENCIES
316 AC_DEFUN([AM_SET_DEPDIR],
317 [if test -d .deps || mkdir .deps 2> /dev/null || test -d .deps; then
319 # We redirect because .deps might already exist and be populated.
320 # In this situation we don't want to see an error.
321 rmdir .deps > /dev/null 2>&1
331 AC_DEFUN([AM_DEP_TRACK],
332 [AC_ARG_ENABLE(dependency-tracking,
333 [ --disable-dependency-tracking Speeds up one-time builds
334 --enable-dependency-tracking Do not reject slow dependency extractors])
335 if test "x$enable_dependency_tracking" = xno; then
338 am_depcomp="$ac_aux_dir/depcomp"
339 if test ! -f "$am_depcomp"; then
346 if test -z "$AMDEP"; then
351 pushdef([subst], defn([AC_SUBST]))
352 subst(AMDEPBACKSLASH)
356 # Generate code to set up dependency tracking.
357 # This macro should only be invoked once -- use via AC_REQUIRE.
359 # AM_OUTPUT_DEPENDENCY_COMMANDS
362 # This code is only required when automatic dependency tracking
363 # is enabled. FIXME. This creates each `.P' file that we will
364 # need in order to bootstrap the dependency handling code.
365 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],[
367 test x"$AMDEP" != x"" ||
368 for mf in $CONFIG_FILES; do
370 Makefile) dirpart=.;;
371 */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;;
374 grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
375 # Extract the definition of DEP_FILES from the Makefile without
377 DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
378 test -z "$DEPDIR" && continue
379 # When using ansi2knr, U may be empty or an underscore; expand it
380 U=`sed -n -e '/^U = / s///p' < "$mf"`
381 test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
382 # We invoke sed twice because it is the simplest approach to
383 # changing $(DEPDIR) to its actual value in the expansion.
384 for file in `sed -n -e '
385 /^DEP_FILES = .*\\\\$/ {
394 /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
395 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
396 # Make sure the directory exists.
397 test -f "$dirpart/$file" && continue
398 fdir=`echo "$file" | sed -e 's|/[^/]*$||'`
399 $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1
400 # echo "creating $dirpart/$file"
401 echo '# dummy' > "$dirpart/$file"
405 ac_aux_dir="$ac_aux_dir"])])
409 # Check to see how make treats includes.
410 AC_DEFUN([AM_MAKE_INCLUDE],
411 [am_make=${MAKE-make}
412 # BSD make uses .include
413 cat > confinc << 'END'
417 # If we don't find an include directive, just comment out the code.
418 AC_MSG_CHECKING([for style of include used by $am_make])
420 for am_inc in include .include; do
421 echo "$am_inc confinc" > confmf
422 if test "`$am_make -f confmf 2> /dev/null`" = "done"; then
427 AC_SUBST(_am_include)
428 AC_MSG_RESULT($_am_include)
433 dnl This test replaces the one in autoconf.
434 dnl Currently this macro should have the same name as the autoconf macro
435 dnl because gettext's gettext.m4 (distributed in the automake package)
436 dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader
437 dnl give these diagnostics:
438 dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
439 dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
441 undefine([AC_ISC_POSIX])
442 AC_DEFUN(AC_ISC_POSIX,
444 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
445 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
452 AC_DEFUN([AM_C_PROTOTYPES],
453 [AC_REQUIRE([AM_PROG_CC_STDC])
454 AC_REQUIRE([AC_PROG_CPP])
455 AC_MSG_CHECKING([for function prototypes])
456 if test "$am_cv_prog_cc_stdc" != no; then
458 AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
462 U=_ ANSI2KNR=./ansi2knr
464 # Ensure some checks needed by ansi2knr itself.
466 AC_CHECK_HEADERS(string.h)
468 AC_SUBST(ANSI2KNR)dnl
474 # @defmac AC_PROG_CC_STDC
475 # @maindex PROG_CC_STDC
477 # If the C compiler in not in ANSI C mode by default, try to add an option
478 # to output variable @code{CC} to make it so. This macro tries various
479 # options that select ANSI C on some system or another. It considers the
480 # compiler to be in ANSI C mode if it handles function prototypes correctly.
482 # If you use this macro, you should check after calling it whether the C
483 # compiler has been set to accept ANSI C; if not, the shell variable
484 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
485 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
486 # program @code{ansi2knr}, which comes with Ghostscript.
489 AC_DEFUN([AM_PROG_CC_STDC],
490 [AC_REQUIRE([AC_PROG_CC])
491 AC_BEFORE([$0], [AC_C_INLINE])
492 AC_BEFORE([$0], [AC_C_CONST])
493 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
494 dnl a magic option to avoid problems with ANSI preprocessor commands
496 dnl FIXME: can't do this because then AC_AIX won't work due to a
497 dnl circular dependency.
498 dnl AC_BEFORE([$0], [AC_PROG_CPP])
499 AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
500 AC_CACHE_VAL(am_cv_prog_cc_stdc,
501 [am_cv_prog_cc_stdc=no
503 # Don't try gcc -ansi; that turns off useful extensions and
504 # breaks some systems' header files.
506 # Ultrix and OSF/1 -std1
507 # HP-UX 10.20 and later -Ae
508 # HP-UX older versions -Aa -D_HPUX_SOURCE
509 # SVR4 -Xc -D__EXTENSIONS__
510 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
512 CC="$ac_save_CC $ac_arg"
516 #include <sys/types.h>
517 #include <sys/stat.h>
518 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
519 struct buf { int x; };
520 FILE * (*rcsopen) (struct buf *, struct stat *, int);
521 static char *e (p, i)
527 static char *f (char * (*g) (char **, int), char **p, ...)
532 s = g (p, va_arg (v,int));
536 int test (int i, double x);
537 struct s1 {int (*f) (int a);};
538 struct s2 {int (*f) (double a);};
539 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
543 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
545 [am_cv_prog_cc_stdc="$ac_arg"; break])
549 if test -z "$am_cv_prog_cc_stdc"; then
550 AC_MSG_RESULT([none needed])
552 AC_MSG_RESULT([$am_cv_prog_cc_stdc])
554 case "x$am_cv_prog_cc_stdc" in
556 *) CC="$CC $am_cv_prog_cc_stdc" ;;
560 #serial 13, with several lines deleted for fileutils.
562 dnl Misc type-related macros for fileutils, sh-utils, textutils.
568 GNU_PACKAGE="GNU $PACKAGE"
569 AC_DEFINE_UNQUOTED(GNU_PACKAGE, "$GNU_PACKAGE",
570 [The concatenation of the strings `GNU ', and PACKAGE.])
571 AC_SUBST(GNU_PACKAGE)
573 AC_SUBST(OPTIONAL_BIN_PROGS)
574 AC_SUBST(OPTIONAL_BIN_ZCRIPTS)
578 dnl This macro actually runs replacement code. See isc-posix.m4.
579 AC_REQUIRE([AC_ISC_POSIX])dnl
618 jm_INCLUDED_REGEX([lib/regex.c])
620 AC_REQUIRE([jm_ASSERT])
621 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
622 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE])
623 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_INO])
624 AC_REQUIRE([jm_CHECK_DECLS])
626 AC_REQUIRE([jm_PREREQ])
628 AC_REQUIRE([jm_FUNC_MKTIME])
629 AC_REQUIRE([jm_FUNC_LSTAT])
630 AC_REQUIRE([jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
631 AC_REQUIRE([jm_FUNC_STAT])
632 AC_REQUIRE([jm_FUNC_REALLOC])
633 AC_REQUIRE([jm_FUNC_MALLOC])
634 AC_REQUIRE([AC_FUNC_STRERROR_R])
635 AC_REQUIRE([jm_FUNC_READDIR])
636 AC_REQUIRE([jm_FUNC_MEMCMP])
637 AC_REQUIRE([jm_FUNC_GLIBC_UNLOCKED_IO])
638 AC_REQUIRE([kd_FUNC_FNMATCH_CASE_RPL])
640 AC_REQUIRE([jm_AC_PREREQ_XSTRTOUMAX])
641 AC_REQUIRE([jm_AC_FUNC_LINK_FOLLOWS_SYMLINK])
642 AC_REQUIRE([AM_FUNC_ERROR_AT_LINE])
643 AC_REQUIRE([jm_FUNC_GNU_STRFTIME])
644 AC_REQUIRE([jm_FUNC_MKTIME])
646 AC_REQUIRE([AC_FUNC_VPRINTF])
647 AC_REQUIRE([AC_FUNC_ALLOCA])
649 AC_REPLACE_FUNCS(strncasecmp)
650 AC_REPLACE_FUNCS(stpcpy strstr strtol strtoul)
651 AC_REPLACE_FUNCS(memcmp rpmatch)
653 dnl used by e.g. intl/*domain.c and lib/canon-host.c
654 AC_REPLACE_FUNCS(strdup)
656 AC_REPLACE_FUNCS(memcpy memset)
657 AC_CHECK_FUNCS(getpagesize)
659 # By default, argmatch should fail calling usage (1).
660 AC_DEFINE(ARGMATCH_DIE, [usage (1)],
661 [Define to the function xargmatch calls on failures.])
662 AC_DEFINE(ARGMATCH_DIE_DECL, [extern void usage ()],
663 [Define to the declaration of the xargmatch failure function.])
665 dnl Used to define SETVBUF in sys2.h.
666 dnl This evokes the following warning from autoconf:
667 dnl ...: warning: AC_TRY_RUN called without default to allow cross compiling
668 AC_FUNC_SETVBUF_REVERSED
670 AC_CHECK_FUNCS(getdelim)
672 AC_REQUIRE([AC_FUNC_CLOSEDIR_VOID])
704 if test $am_cv_func_working_getline != yes; then
705 AC_CHECK_FUNCS(getdelim)
711 # These tests are for df.
716 AC_DEFUN(jm_CHECK_ALL_TYPES,
718 dnl Checks for typedefs, structures, and compiler characteristics.
719 AC_REQUIRE([AC_C_BIGENDIAN])
720 AC_REQUIRE([AC_PROG_CC_STDC])
721 AC_REQUIRE([AC_C_CONST])
722 AC_REQUIRE([AC_C_VOLATILE])
723 AC_REQUIRE([AC_C_INLINE])
724 AC_REQUIRE([AC_C_LONG_DOUBLE])
726 AC_REQUIRE([AC_HEADER_DIRENT])
727 AC_REQUIRE([AC_HEADER_STDC])
728 AC_CHECK_MEMBERS([struct stat.st_blksize],,,[$ac_includes_default
729 #include <sys/stat.h>
731 AC_REQUIRE([AC_STRUCT_ST_BLOCKS])
733 AC_REQUIRE([AC_STRUCT_TM])
734 AC_REQUIRE([AC_STRUCT_TIMEZONE])
735 AC_REQUIRE([AC_HEADER_STAT])
736 AC_REQUIRE([AC_STRUCT_ST_MTIM_NSEC])
737 AC_REQUIRE([AC_STRUCT_ST_DM_MODE])
738 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_TIMESPEC])
740 AC_REQUIRE([AC_TYPE_GETGROUPS])
741 AC_REQUIRE([AC_TYPE_MODE_T])
742 AC_REQUIRE([AC_TYPE_OFF_T])
743 AC_REQUIRE([AC_TYPE_PID_T])
744 AC_REQUIRE([AC_TYPE_SIGNAL])
745 AC_REQUIRE([AC_TYPE_SIZE_T])
746 AC_REQUIRE([AC_TYPE_UID_T])
747 AC_CHECK_TYPE(ino_t, unsigned long)
749 dnl This relies on the fact that autoconf 2.14a's implementation of
750 dnl AC_CHECK_TYPE checks includes unistd.h.
751 AC_CHECK_TYPE(ssize_t, int)
753 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
754 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
756 AC_REQUIRE([AC_HEADER_MAJOR])
757 AC_REQUIRE([AC_HEADER_DIRENT])
763 dnl Initially derived from code in GNU grep.
764 dnl Mostly written by Jim Meyering.
766 dnl Usage: jm_INCLUDED_REGEX([lib/regex.c])
768 AC_DEFUN(jm_INCLUDED_REGEX,
770 dnl Even packages that don't use regex.c can use this macro.
771 dnl Of course, for them it doesn't do anything.
773 # Assume we'll default to using the included regex.c.
774 ac_use_included_regex=yes
776 # However, if the system regex support is good enough that it passes the
777 # the following run test, then default to *not* using the included regex.c.
778 # If cross compiling, assume the test would fail and use the included
779 # regex.c. The first failing regular expression is from `Spencer ere
780 # test #75' in grep-2.3.
781 AC_CACHE_CHECK([for working re_compile_pattern],
782 jm_cv_func_working_re_compile_pattern,
789 static struct re_pattern_buffer regex;
791 re_set_syntax (RE_SYNTAX_POSIX_EGREP);
792 /* Add this third left square bracket, [, to balance the
793 three right ones below. Otherwise autoconf-2.14 chokes. */
794 s = re_compile_pattern ("a[[:]:]]b\n", 9, ®ex);
795 /* This should fail with _Invalid character class name_ error. */
799 /* This should succeed, but doesn't for e.g. glibc-2.1.3. */
800 s = re_compile_pattern ("{1", 2, ®ex);
805 jm_cv_func_working_re_compile_pattern=yes,
806 jm_cv_func_working_re_compile_pattern=no,
807 dnl When crosscompiling, assume it's broken.
808 jm_cv_func_working_re_compile_pattern=no))
809 if test $jm_cv_func_working_re_compile_pattern = yes; then
810 ac_use_included_regex=no
813 test -n "$1" || AC_MSG_ERROR([missing argument])
818 AC_ARG_WITH(included-regex,
819 [ --without-included-regex don't compile regex; this is the default on
820 systems with version 2 of the GNU C library
821 (use with caution on other system)],
822 jm_with_regex=$withval,
823 jm_with_regex=$ac_use_included_regex)
824 if test "$jm_with_regex" = yes; then
826 LIBOBJS="$LIBOBJS regex.$ac_objext"
834 dnl based on code from Eleftherios Gkioulekas
838 AC_MSG_CHECKING(whether to enable assertions)
839 AC_ARG_ENABLE(assert,
840 [ --disable-assert turn off assertions],
842 AC_DEFINE(NDEBUG,1,[Define to 1 if assertions should be disabled.]) ],
843 [ AC_MSG_RESULT(yes) ]
849 dnl From Paul Eggert.
851 # Define HAVE_INTTYPES_H if <inttypes.h> exists,
852 # doesn't clash with <sys/types.h>, and declares uintmax_t.
854 AC_DEFUN(jm_AC_HEADER_INTTYPES_H,
856 AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
858 [#include <sys/types.h>
859 #include <inttypes.h>],
860 [uintmax_t i = (uintmax_t) -1;],
861 jm_ac_cv_header_inttypes_h=yes,
862 jm_ac_cv_header_inttypes_h=no)])
863 if test $jm_ac_cv_header_inttypes_h = yes; then
864 AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
865 [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
866 and declares uintmax_t. ])
872 dnl From Jim Meyering.
874 dnl Check whether struct dirent has a member named d_type.
877 AC_DEFUN(jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE,
878 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
879 AC_CACHE_CHECK([for d_type member in directory struct],
880 jm_cv_struct_dirent_d_type,
883 #include <sys/types.h>
886 #else /* not HAVE_DIRENT_H */
887 # define dirent direct
888 # ifdef HAVE_SYS_NDIR_H
889 # include <sys/ndir.h>
890 # endif /* HAVE_SYS_NDIR_H */
891 # ifdef HAVE_SYS_DIR_H
892 # include <sys/dir.h>
893 # endif /* HAVE_SYS_DIR_H */
896 # endif /* HAVE_NDIR_H */
897 #endif /* HAVE_DIRENT_H */
899 [struct dirent dp; dp.d_type = 0;],
901 jm_cv_struct_dirent_d_type=yes,
902 jm_cv_struct_dirent_d_type=no)
905 if test $jm_cv_struct_dirent_d_type = yes; then
906 AC_DEFINE(D_TYPE_IN_DIRENT, 1,
907 [Define if there is a member named d_type in the struct describing
915 dnl From Jim Meyering.
917 dnl Check whether struct dirent has a member named d_ino.
920 AC_DEFUN(jm_CHECK_TYPE_STRUCT_DIRENT_D_INO,
921 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
922 AC_CACHE_CHECK([for d_ino member in directory struct],
923 jm_cv_struct_dirent_d_ino,
926 #include <sys/types.h>
929 #else /* not HAVE_DIRENT_H */
930 # define dirent direct
931 # ifdef HAVE_SYS_NDIR_H
932 # include <sys/ndir.h>
933 # endif /* HAVE_SYS_NDIR_H */
934 # ifdef HAVE_SYS_DIR_H
935 # include <sys/dir.h>
936 # endif /* HAVE_SYS_DIR_H */
939 # endif /* HAVE_NDIR_H */
940 #endif /* HAVE_DIRENT_H */
942 [struct dirent dp; dp.d_ino = 0;],
944 jm_cv_struct_dirent_d_ino=yes,
945 jm_cv_struct_dirent_d_ino=no)
948 if test $jm_cv_struct_dirent_d_ino = yes; then
949 AC_DEFINE(D_INO_IN_DIRENT, 1,
950 [Define if there is a member named d_ino in the struct describing
958 dnl This is just a wrapper function to encapsulate this kludge.
959 dnl Putting it in a separate file like this helps share it between
960 dnl different packages.
961 AC_DEFUN(jm_CHECK_DECLS,
963 AC_REQUIRE([_jm_DECL_HEADERS])
964 AC_REQUIRE([AC_HEADER_TIME])
968 # if !STDC_HEADERS && HAVE_MEMORY_H
974 # include <strings.h>
984 #include <sys/types.h>
985 #if TIME_WITH_SYS_TIME
986 # include <sys/time.h>
990 # include <sys/time.h>
1021 ttyname], , , $headers)
1024 dnl FIXME: when autoconf has support for it.
1025 dnl This is a little helper so we can require these header checks.
1026 AC_DEFUN(_jm_DECL_HEADERS,
1028 AC_REQUIRE([AC_HEADER_STDC])
1029 AC_CHECK_HEADERS(memory.h string.h strings.h stdlib.h unistd.h sys/time.h \
1035 dnl These are the prerequisite macros for files in the lib/
1036 dnl directories of the fileutils, sh-utils, and textutils packages.
1041 jm_PREREQ_CANON_HOST
1048 AC_DEFUN(jm_PREREQ_ADDEXT,
1051 AC_SYS_LONG_FILE_NAMES
1052 AC_CHECK_FUNCS(pathconf)
1053 AC_CHECK_HEADERS(limits.h string.h unistd.h)
1056 AC_DEFUN(jm_PREREQ_CANON_HOST,
1058 dnl Add any libraries as early as possible.
1059 dnl In particular, inet_ntoa needs -lnsl at least on Solaris5.5.1,
1060 dnl so we have to add -lnsl to LIBS before checking for that function.
1061 AC_SEARCH_LIBS(gethostbyname, [inet nsl])
1063 dnl These come from -lnsl on Solaris5.5.1.
1064 AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
1066 AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
1067 AC_CHECK_HEADERS(unistd.h string.h netdb.h sys/socket.h \
1068 netinet/in.h arpa/inet.h)
1071 AC_DEFUN(jm_PREREQ_QUOTEARG,
1073 AC_CHECK_FUNCS(isascii iswprint mbrtowc)
1074 AC_CHECK_HEADERS(limits.h stdlib.h string.h wchar.h wctype.h)
1081 AC_DEFUN(jm_PREREQ_READUTMP,
1084 AC_CHECK_HEADERS(string.h utmpx.h sys/param.h)
1085 AC_CHECK_FUNCS(utmpname)
1086 AC_CHECK_FUNCS(utmpxname)
1090 $ac_includes_default
1097 AC_CHECK_MEMBERS([struct utmpx.ut_user],,,[$utmp_includes])
1098 AC_CHECK_MEMBERS([struct utmp.ut_user],,,[$utmp_includes])
1099 AC_CHECK_MEMBERS([struct utmpx.ut_name],,,[$utmp_includes])
1100 AC_CHECK_MEMBERS([struct utmp.ut_name],,,[$utmp_includes])
1103 AC_DEFUN(jm_PREREQ_REGEX,
1105 dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it.
1106 dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary
1108 AC_CHECK_FUNCS(bzero bcopy isascii btowc)
1109 AC_CHECK_HEADERS(alloca.h libintl.h wctype.h wchar.h)
1116 dnl FIXME: put these prerequisite-only *.m4 files in a separate
1117 dnl directory -- otherwise, they'll conflict with existing files.
1119 dnl These are the prerequisite macros for GNU's error.c file.
1120 AC_DEFUN(jm_PREREQ_ERROR,
1122 AC_CHECK_FUNCS(strerror strerror_r vprintf doprnt)
1128 dnl From Paul Eggert.
1130 AC_DEFUN(AC_C_BACKSLASH_A,
1132 AC_CACHE_CHECK([whether backslash-a works in strings], ac_cv_c_backslash_a,
1138 char buf['\a' == 'a' ? -1 : 1];
1140 return buf[0] != "\a"[0];
1142 ac_cv_c_backslash_a=yes,
1143 ac_cv_c_backslash_a=no)])
1144 if test $ac_cv_c_backslash_a = yes; then
1145 AC_DEFINE(HAVE_C_BACKSLASH_A, 1,
1146 [Define if backslash-a works in C strings.])
1154 # Some versions of BeOS define mbstate_t to be an incomplete type,
1155 # so you can't declare an object of that type.
1156 # Check for this incompatibility with Standard C.
1158 AC_DEFUN(AC_MBSTATE_T_OBJECT,
1159 [AC_CACHE_CHECK([for mbstate_t object type], ac_cv_type_mbstate_t_object,
1160 [AC_TRY_COMPILE([#include <wchar.h>],
1161 [mbstate_t x; return sizeof x;],
1162 ac_cv_type_mbstate_t_object=yes,
1163 ac_cv_type_mbstate_t_object=no)])
1164 if test $ac_cv_type_mbstate_t_object = yes; then
1165 AC_DEFINE(HAVE_MBSTATE_T_OBJECT, 1,
1166 [Define if mbstate_t is an object type.])
1171 dnl From Jim Meyering.
1172 dnl A wrapper around AC_FUNC_MKTIME.
1174 AC_DEFUN(jm_FUNC_MKTIME,
1175 [AC_REQUIRE([AC_FUNC_MKTIME])dnl
1177 dnl mktime.c uses localtime_r if it exists. Check for it.
1178 AC_CHECK_FUNCS(localtime_r)
1180 if test $ac_cv_func_working_mktime = no; then
1181 AC_DEFINE_UNQUOTED(mktime, rpl_mktime,
1182 [Define to rpl_mktime if the replacement function should be used.])
1188 dnl From Jim Meyering.
1189 dnl Determine whether lstat has the bug that it succeeds when given the
1190 dnl zero-length file name argument. The lstat from SunOS4.1.4 and the Hurd
1191 dnl (as of 1998-11-01) do this.
1193 dnl If it does, then define HAVE_LSTAT_EMPTY_STRING_BUG and arrange to
1194 dnl compile the wrapper function.
1197 AC_DEFUN(jm_FUNC_LSTAT,
1199 AC_CACHE_CHECK([whether lstat accepts an empty string],
1200 jm_cv_func_lstat_empty_string_bug,
1202 # include <sys/types.h>
1203 # include <sys/stat.h>
1209 exit (lstat ("", &sbuf) ? 1 : 0);
1212 jm_cv_func_lstat_empty_string_bug=yes,
1213 jm_cv_func_lstat_empty_string_bug=no,
1214 dnl When crosscompiling, assume lstat is broken.
1215 jm_cv_func_lstat_empty_string_bug=yes)
1217 if test $jm_cv_func_lstat_empty_string_bug = yes; then
1219 LIBOBJS="$LIBOBJS lstat.$ac_objext"
1220 AC_DEFINE_UNQUOTED(HAVE_LSTAT_EMPTY_STRING_BUG, 1,
1221 [Define if lstat has the bug that it succeeds when given the zero-length
1222 file name argument. The lstat from SunOS4.1.4 and the Hurd as of 1998-11-01)
1229 dnl From Jim Meyering.
1232 AC_DEFUN(jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK,
1235 [whether lstat dereferences a symlink specified with a trailing slash],
1236 jm_cv_func_lstat_dereferences_slashed_symlink,
1238 rm -f conftest.sym conftest.file
1240 if ln -s conftest.file conftest.sym; then
1242 # include <sys/types.h>
1243 # include <sys/stat.h>
1249 /* Linux will dereference the symlink and fail.
1250 That is better in the sense that it means we will not
1251 have to compile and use the lstat wrapper. */
1252 exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1);
1255 jm_cv_func_lstat_dereferences_slashed_symlink=yes,
1256 jm_cv_func_lstat_dereferences_slashed_symlink=no,
1257 dnl When crosscompiling, be pessimistic so we will end up using the
1258 dnl replacement version of lstat that checkes for trailing slashes
1259 dnl and calls lstat a second time when necessary.
1260 jm_cv_func_lstat_dereferences_slashed_symlink=no
1263 # If the `ln -s' command failed, then we probably don't even
1264 # have an lstat function.
1265 jm_cv_func_lstat_dereferences_slashed_symlink=no
1269 test $jm_cv_func_lstat_dereferences_slashed_symlink = yes \
1272 AC_DEFINE_UNQUOTED(LSTAT_FOLLOWS_SLASHED_SYMLINK, $zero_one,
1273 [Define if lstat dereferences a symlink specified with a trailing slash])
1275 if test $jm_cv_func_lstat_dereferences_slashed_symlink = no; then
1277 # Append lstat.o if it's not already in $LIBOBJS.
1279 *lstat.$ac_objext*) ;;
1280 *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;;
1287 dnl From Jim Meyering.
1288 dnl Determine whether stat has the bug that it succeeds when given the
1289 dnl zero-length file name argument. The stat from SunOS4.1.4 and the Hurd
1290 dnl (as of 1998-11-01) do this.
1292 dnl If it does, then define HAVE_STAT_EMPTY_STRING_BUG and arrange to
1293 dnl compile the wrapper function.
1296 AC_DEFUN(jm_FUNC_STAT,
1298 AC_CACHE_CHECK([whether stat accepts an empty string],
1299 jm_cv_func_stat_empty_string_bug,
1301 # include <sys/types.h>
1302 # include <sys/stat.h>
1308 exit (stat ("", &sbuf) ? 1 : 0);
1311 jm_cv_func_stat_empty_string_bug=yes,
1312 jm_cv_func_stat_empty_string_bug=no,
1313 dnl When crosscompiling, assume stat is broken.
1314 jm_cv_func_stat_empty_string_bug=yes)
1316 if test $jm_cv_func_stat_empty_string_bug = yes; then
1318 LIBOBJS="$LIBOBJS stat.$ac_objext"
1319 AC_DEFINE_UNQUOTED(HAVE_STAT_EMPTY_STRING_BUG, 1,
1320 [Define if stat has the bug that it succeeds when given the zero-length
1321 file name argument. The stat from SunOS4.1.4 and the Hurd as of 1998-11-01)
1328 dnl From Jim Meyering.
1329 dnl Determine whether realloc works when both arguments are 0.
1330 dnl If it doesn't, arrange to use the replacement function.
1333 AC_DEFUN(jm_FUNC_REALLOC,
1335 dnl xmalloc.c requires that this symbol be defined so it doesn't
1336 dnl mistakenly use a broken realloc -- as it might if this test were omitted.
1337 AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_REALLOC_CHECK, 1,
1338 [Define if the realloc check has been performed. ])
1340 AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc,
1346 exit (realloc (0, 0) ? 0 : 1);
1349 jm_cv_func_working_realloc=yes,
1350 jm_cv_func_working_realloc=no,
1351 dnl When crosscompiling, assume realloc is broken.
1352 jm_cv_func_working_realloc=no)
1354 if test $jm_cv_func_working_realloc = no; then
1356 LIBOBJS="$LIBOBJS realloc.$ac_objext"
1357 AC_DEFINE_UNQUOTED(realloc, rpl_realloc,
1358 [Define to rpl_realloc if the replacement function should be used.])
1364 dnl From Jim Meyering.
1365 dnl Determine whether malloc accepts 0 as its argument.
1366 dnl If it doesn't, arrange to use the replacement function.
1369 AC_DEFUN(jm_FUNC_MALLOC,
1371 dnl xmalloc.c requires that this symbol be defined so it doesn't
1372 dnl mistakenly use a broken malloc -- as it might if this test were omitted.
1373 AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_MALLOC_CHECK, 1,
1374 [Define if the malloc check has been performed. ])
1376 AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc,
1382 exit (malloc (0) ? 0 : 1);
1385 jm_cv_func_working_malloc=yes,
1386 jm_cv_func_working_malloc=no,
1387 dnl When crosscompiling, assume malloc is broken.
1388 jm_cv_func_working_malloc=no)
1390 if test $jm_cv_func_working_malloc = no; then
1392 LIBOBJS="$LIBOBJS malloc.$ac_objext"
1393 AC_DEFINE_UNQUOTED(malloc, rpl_malloc,
1394 [Define to rpl_malloc if the replacement function should be used.])
1400 dnl SunOS's readdir is broken in such a way that rm.c has to add extra code
1401 dnl to test whether a NULL return value really means there are no more files
1402 dnl in the directory.
1404 dnl Detect the problem by creating a directory containing 300 files (254 not
1405 dnl counting . and .. is the minimum) and see if a loop doing `readdir; unlink'
1406 dnl removes all of them.
1408 dnl Define HAVE_WORKING_READDIR if readdir does *not* have this problem.
1410 dnl Written by Jim Meyering.
1412 AC_DEFUN(jm_FUNC_READDIR,
1414 AC_REQUIRE([AC_HEADER_DIRENT])
1415 AC_CHECK_HEADERS(string.h)
1416 AC_CACHE_CHECK([for working readdir], jm_cv_func_working_readdir,
1418 # Arrange for deletion of the temporary directory this test creates, in
1419 # case the test itself fails to delete everything -- as happens on Sunos.
1420 ac_clean_files="$ac_clean_files conf-dir"
1423 [# include <stdio.h>
1424 # include <sys/types.h>
1426 # include <string.h>
1429 # ifdef HAVE_DIRENT_H
1430 # include <dirent.h>
1431 # define NLENGTH(direct) (strlen((direct)->d_name))
1432 # else /* not HAVE_DIRENT_H */
1433 # define dirent direct
1434 # define NLENGTH(direct) ((direct)->d_namlen)
1435 # ifdef HAVE_SYS_NDIR_H
1436 # include <sys/ndir.h>
1437 # endif /* HAVE_SYS_NDIR_H */
1438 # ifdef HAVE_SYS_DIR_H
1439 # include <sys/dir.h>
1440 # endif /* HAVE_SYS_DIR_H */
1443 # endif /* HAVE_NDIR_H */
1444 # endif /* HAVE_DIRENT_H */
1446 # define DOT_OR_DOTDOT(Basename) \
1447 (Basename[0] == '.' && (Basename[1] == '\0' \
1448 || (Basename[1] == '.' && Basename[2] == '\0')))
1451 create_300_file_dir (const char *dir)
1455 if (mkdir (dir, 0700))
1460 for (i = 0; i < 300; i++)
1465 sprintf (file_name, "%03d", i);
1466 out = fopen (file_name, "w");
1469 if (fclose (out) == EOF)
1478 remove_dir (const char *dir)
1485 dirp = opendir (".");
1491 struct dirent *dp = readdir (dirp);
1495 if (DOT_OR_DOTDOT (dp->d_name))
1498 if (unlink (dp->d_name))
1513 const char *dir = "conf-dir";
1514 create_300_file_dir (dir);
1518 jm_cv_func_working_readdir=yes,
1519 jm_cv_func_working_readdir=no,
1520 jm_cv_func_working_readdir=no)])
1522 if test $jm_cv_func_working_readdir = yes; then
1523 AC_DEFINE_UNQUOTED(HAVE_WORKING_READDIR, 1,
1524 [Define if readdir is found to work properly in some unusual cases. ])
1530 dnl A replacement for autoconf's AC_FUNC_MEMCMP that detects
1531 dnl the losing memcmp on some x86 Next systems.
1532 AC_DEFUN(jm_AC_FUNC_MEMCMP,
1533 [AC_CACHE_CHECK([for working memcmp], jm_cv_func_memcmp_working,
1538 /* Some versions of memcmp are not 8-bit clean. */
1539 char c0 = 0x40, c1 = 0x80, c2 = 0x81;
1540 if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
1543 /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
1544 or more and with at least one buffer not starting on a 4-byte boundary.
1545 William Lewis provided this test program. */
1550 for (i = 0; i < 4; i++)
1554 strcpy (a, "--------01111111");
1555 strcpy (b, "--------10000000");
1556 if (memcmp (a, b, 16) >= 0)
1562 jm_cv_func_memcmp_working=yes,
1563 jm_cv_func_memcmp_working=no,
1564 jm_cv_func_memcmp_working=no)])
1565 test $jm_cv_func_memcmp_working = no \
1566 && LIBOBJS="$LIBOBJS memcmp.$ac_objext"
1567 AC_SUBST(LIBOBJS)dnl
1570 AC_DEFUN(jm_FUNC_MEMCMP,
1571 [AC_REQUIRE([jm_AC_FUNC_MEMCMP])dnl
1572 if test $jm_cv_func_memcmp_working = no; then
1573 AC_DEFINE_UNQUOTED(memcmp, rpl_memcmp,
1574 [Define to rpl_memcmp if the replacement function should be used.])
1580 dnl From Jim Meyering.
1582 dnl See if the glibc *_unlocked I/O macros are available.
1583 dnl Use only those *_unlocked macros that are declared.
1586 AC_DEFUN(jm_FUNC_GLIBC_UNLOCKED_IO,
1588 # Kludge (not executed) to make autoheader do the right thing.
1590 AC_CHECK_DECLS([clearerr_unlocked, feof_unlocked, ferror_unlocked,
1591 fflush_unlocked, fputc_unlocked, fread_unlocked, fwrite_unlocked,
1592 getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked])
1595 io_functions='clearerr_unlocked feof_unlocked ferror_unlocked
1596 fflush_unlocked fputc_unlocked fread_unlocked fwrite_unlocked
1597 getc_unlocked getchar_unlocked putc_unlocked putchar_unlocked'
1598 for jm_io_func in $io_functions; do
1599 # Check for the existence of each function only if its declared.
1600 # Otherwise, we'd get the Solaris5.5.1 functions that are not
1601 # declared, and that have been removed from Solaris5.6. The resulting
1602 # 5.5.1 binaries would not run on 5.6 due to shared library differences.
1603 AC_CHECK_DECLS([$jm_io_func],
1606 [#include <stdio.h>])
1607 if test $jm_declared = yes; then
1608 AC_CHECK_FUNCS($jm_io_func)
1616 dnl Determine whether to add fnmatch.o to LIBOBJS and to
1617 dnl define fnmatch to rpl_fnmatch.
1622 # We look for fnmatch.h to avoid that the test fails in C++.
1623 AC_DEFUN(kd_FUNC_FNMATCH_CASE,
1624 [AC_CHECK_HEADERS(fnmatch.h)
1625 AC_CACHE_CHECK(for working fnmatch with case folding, ac_cv_func_fnmatch_works,
1626 # Some versions of Solaris or SCO have a broken fnmatch function.
1627 # So we run a test program. If we are cross-compiling, take no chance.
1628 # Also want FNM_CASEFOLD
1629 # Thanks to John Oleynick and Franc,ois Pinard for this test.
1634 # include <fnmatch.h>
1640 exit (fnmatch ("A*", "abc", FNM_CASEFOLD) != 0);
1642 ac_cv_func_fnmatch_works=yes, ac_cv_func_fnmatch_works=no,
1643 ac_cv_func_fnmatch_works=no)])
1644 if test $ac_cv_func_fnmatch_works = yes; then
1645 AC_DEFINE(HAVE_FNMATCH, 1,
1646 [Define if your system has a working `fnmatch' function with case folding.])
1651 AC_DEFUN(kd_FUNC_FNMATCH_CASE_RPL,
1653 AC_REQUIRE([AM_GLIBC])
1654 kd_FUNC_FNMATCH_CASE
1655 if test $ac_cv_func_fnmatch_works = no \
1656 && test $ac_cv_gnu_library = no; then
1658 LIBOBJS="$LIBOBJS fnmatch.$ac_objext"
1659 AC_DEFINE_UNQUOTED(fnmatch, rpl_fnmatch,
1660 [Define to rpl_fnmatch if the replacement function should be used.])
1666 dnl From Gordon Matzigkeit.
1667 dnl Test for the GNU C Library.
1668 dnl FIXME: this should migrate into libit.
1672 AC_CACHE_CHECK(whether we are using the GNU C Library,
1674 [AC_EGREP_CPP([Thanks for using GNU],
1676 #include <features.h>
1677 #ifdef __GNU_LIBRARY__
1678 Thanks for using GNU
1681 ac_cv_gnu_library=yes,
1682 ac_cv_gnu_library=no)
1685 AC_CACHE_CHECK(for version 2 of the GNU C Library,
1687 [AC_EGREP_CPP([Thanks for using GNU too],
1689 #include <features.h>
1691 Thanks for using GNU too
1694 ac_cv_glibc=yes, ac_cv_glibc=no)
1703 AC_MSG_CHECKING(for AFS)
1704 if test -d /afs; then
1705 AC_DEFINE(AFS, 1, [Define if you have the Andrew File System.])
1710 AC_MSG_RESULT($ac_result)
1715 # autoconf tests required for use of xstrtoumax.c
1717 AC_DEFUN(jm_AC_PREREQ_XSTRTOUMAX,
1719 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
1720 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
1721 AC_CHECK_HEADERS(stdlib.h)
1723 AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro],
1724 jm_cv_func_strtoumax_macro,
1725 AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include <inttypes.h>
1727 inttypes_h_defines_strtoumax
1729 jm_cv_func_strtoumax_macro=yes,
1730 jm_cv_func_strtoumax_macro=no))
1732 if test "$jm_cv_func_strtoumax_macro" != yes; then
1733 AC_REPLACE_FUNCS(strtoumax)
1736 dnl We don't need (and can't compile) the replacement strtoull
1737 dnl unless the type `unsigned long long' exists.
1738 dnl Also, only the replacement strtoumax invokes strtoull,
1739 dnl so we need the replacement strtoull only if strtoumax does not exist.
1740 case "$ac_cv_type_unsigned_long_long,$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in
1742 AC_REPLACE_FUNCS(strtoull)
1750 dnl From Paul Eggert.
1752 AC_DEFUN(jm_AC_TYPE_UNSIGNED_LONG_LONG,
1754 AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
1755 [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
1756 [unsigned long long ullmax = (unsigned long long) -1;
1757 return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
1758 ac_cv_type_unsigned_long_long=yes,
1759 ac_cv_type_unsigned_long_long=no)])
1760 if test $ac_cv_type_unsigned_long_long = yes; then
1761 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
1762 [Define if you have the unsigned long long type.])
1767 dnl Run a program to determine whether whether link(2) follows symlinks.
1768 dnl Set LINK_FOLLOWS_SYMLINKS accordingly.
1770 AC_DEFUN(jm_AC_FUNC_LINK_FOLLOWS_SYMLINK,
1772 AC_CACHE_CHECK([whether link(2) follows symlinks],
1773 jm_ac_cv_func_link_follows_symlink,
1775 dnl poor-man's AC_REQUIRE: FIXME: repair this once autoconf-3 provides
1776 dnl the appropriate framework.
1777 test -z "$ac_cv_header_unistd_h" \
1778 && AC_CHECK_HEADERS(unistd.h)
1780 # Create a regular file.
1781 echo > conftest.file
1784 # include <sys/types.h>
1785 # include <sys/stat.h>
1786 # ifdef HAVE_UNISTD_H
1787 # include <unistd.h>
1790 # define SAME_INODE(Stat_buf_1, Stat_buf_2) \
1791 ((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
1792 && (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)
1797 const char *file = "conftest.file";
1798 const char *sym = "conftest.sym";
1799 const char *hard = "conftest.hard";
1800 struct stat sb_file, sb_hard;
1802 /* Create a symlink to the regular file. */
1803 if (symlink (file, sym))
1806 /* Create a hard link to that symlink. */
1807 if (link (sym, hard))
1810 if (lstat (hard, &sb_hard))
1812 if (lstat (file, &sb_file))
1815 /* If the dev/inode of hard and file are the same, then
1816 the link call followed the symlink. */
1817 return SAME_INODE (sb_hard, sb_file) ? 0 : 1;
1820 jm_ac_cv_func_link_follows_symlink=yes,
1821 jm_ac_cv_func_link_follows_symlink=no,
1822 jm_ac_cv_func_link_follows_symlink=yes dnl We're cross compiling.
1825 if test $jm_ac_cv_func_link_follows_symlink = yes; then
1826 AC_DEFINE(LINK_FOLLOWS_SYMLINKS, 1,
1827 [Define if `link(2)' dereferences symbolic links.])
1831 # From Jim Meyering. Use this if you use the GNU error.[ch].
1832 # FIXME: Migrate into libit
1834 AC_DEFUN([AM_FUNC_ERROR_AT_LINE],
1835 [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
1836 [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
1837 am_cv_lib_error_at_line=yes,
1838 am_cv_lib_error_at_line=no)])
1839 if test $am_cv_lib_error_at_line = no; then
1840 LIBOBJS="$LIBOBJS error.$ac_objext"
1842 AC_SUBST(LIBOBJS)dnl
1847 dnl This macro is intended to be used solely in this file.
1848 dnl These are the prerequisite macros for GNU's strftime.c replacement.
1849 AC_DEFUN(_jm_STRFTIME_PREREQS,
1851 dnl strftime.c uses localtime_r if it exists. Check for it.
1852 AC_CHECK_FUNCS(localtime_r)
1854 AC_CHECK_HEADERS(limits.h)
1855 AC_CHECK_FUNCS(bcopy tzset mempcpy memcpy memset)
1857 # This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE.
1860 AC_CHECK_FUNCS(mblen mbrlen)
1862 AC_CHECK_MEMBER(struct tm.tm_gmtoff,
1863 [AC_DEFINE(HAVE_TM_GMTOFF, 1,
1864 [Define if struct tm has the tm_gmtoff member.])],
1866 [#include <time.h>])
1869 dnl Determine if the strftime function has all the features of the GNU one.
1871 dnl From Jim Meyering.
1873 AC_DEFUN(jm_FUNC_GNU_STRFTIME,
1874 [AC_REQUIRE([AC_HEADER_TIME])dnl
1876 _jm_STRFTIME_PREREQS
1878 AC_REQUIRE([AC_C_CONST])dnl
1879 AC_REQUIRE([AC_HEADER_STDC])dnl
1880 AC_CHECK_HEADERS(sys/time.h)
1881 AC_CACHE_CHECK([for working GNU strftime], jm_cv_func_working_gnu_strftime,
1882 [# Set TZ to GMT0 to make strftime give consistent results during the test.
1883 ac_save_TZ="${TZ-GMT0}"
1887 [ /* Ulrich Drepper provided parts of the test program. */
1889 # include <stdlib.h>
1892 #if TIME_WITH_SYS_TIME
1893 # include <sys/time.h>
1896 # if HAVE_SYS_TIME_H
1897 # include <sys/time.h>
1904 compare (const char *fmt, const struct tm *tm, const char *expected)
1907 strftime (buf, 99, fmt, tm);
1908 if (strcmp (buf, expected))
1910 #ifdef SHOW_FAILURES
1911 printf ("fmt: \"%s\", expected \"%s\", got \"%s\"\n",
1912 fmt, expected, buf);
1924 time_t t = 738367; /* Fri Jan 9 13:06:07 1970 */
1928 #define CMP(Fmt, Expected) n_fail += compare ((Fmt), tm, (Expected))
1930 CMP ("%-m", "1"); /* GNU */
1931 CMP ("%A", "Friday");
1932 CMP ("%^A", "FRIDAY"); /* The ^ is a GNU extension. */
1933 CMP ("%B", "January");
1934 CMP ("%^B", "JANUARY");
1935 CMP ("%C", "19"); /* POSIX.2 */
1936 CMP ("%D", "01/09/70"); /* POSIX.2 */
1937 CMP ("%F", "1970-01-09");
1938 CMP ("%G", "1970"); /* GNU */
1943 CMP ("%R", "13:06"); /* POSIX.2 */
1945 CMP ("%T", "13:06:07"); /* POSIX.2 */
1949 CMP ("%X", "13:06:07");
1952 CMP ("%_m", " 1"); /* GNU */
1957 CMP ("%c", "Fri Jan 9 13:06:07 1970");
1958 CMP ("%^c", "FRI JAN 9 13:06:07 1970");
1960 CMP ("%e", " 9"); /* POSIX.2 */
1961 CMP ("%g", "70"); /* GNU */
1962 CMP ("%h", "Jan"); /* POSIX.2 */
1965 CMP ("%k", "13"); /* GNU */
1966 CMP ("%l", " 1"); /* GNU */
1968 CMP ("%n", "\n"); /* POSIX.2 */
1970 CMP ("%r", "01:06:07 PM"); /* POSIX.2 */
1971 CMP ("%s", "738367"); /* GNU */
1972 CMP ("%t", "\t"); /* POSIX.2 */
1973 CMP ("%u", "5"); /* POSIX.2 */
1975 CMP ("%x", "01/09/70");
1977 CMP ("%z", "+0000"); /* GNU */
1979 exit (n_fail ? 1 : 0);
1981 jm_cv_func_working_gnu_strftime=yes,
1982 jm_cv_func_working_gnu_strftime=no,
1983 dnl When crosscompiling, assume strftime is missing or broken.
1984 jm_cv_func_working_gnu_strftime=no)
1985 dnl If TZ wasn't set before, this sets it to GMT0. No real harm done.
1988 if test $jm_cv_func_working_gnu_strftime = no; then
1990 LIBOBJS="$LIBOBJS strftime.$ac_objext"
1991 AC_DEFINE_UNQUOTED(strftime, gnu_strftime,
1992 [Define to gnu_strftime if the replacement function should be used.])
1996 AC_DEFUN(jm_FUNC_STRFTIME,
1998 _jm_STRFTIME_PREREQS
1999 AC_REPLACE_FUNCS(strftime)
2004 dnl See if there's a working, system-supplied version of the getline function.
2005 dnl We can't just do AC_REPLACE_FUNCS(getline) because some systems
2006 dnl have a function by that name in -linet that doesn't have anything
2007 dnl to do with the function we need.
2008 AC_DEFUN(AM_FUNC_GETLINE,
2010 am_getline_needs_run_time_check=no
2011 AC_CHECK_FUNC(getline,
2012 dnl Found it in some library. Verify that it works.
2013 am_getline_needs_run_time_check=yes,
2014 am_cv_func_working_getline=no)
2015 if test $am_getline_needs_run_time_check = yes; then
2016 AC_CHECK_HEADERS(string.h)
2017 AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline,
2018 [echo fooN |tr -d '\012'|tr N '\012' > conftest.data
2021 # include <sys/types.h>
2023 # include <string.h>
2032 getstr(&path, &n, stream, terminator, offset);
2036 { /* Based on a test program from Karl Heuer. */
2040 FILE *in = fopen ("./conftest.data", "r");
2043 len = getline (&line, &siz, in);
2044 nread = getstr (&path, &pathsize, fp, '\0', count);
2046 exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1);
2048 ], am_cv_func_working_getline=yes dnl The library version works.
2049 , am_cv_func_working_getline=no dnl The library version does NOT work.
2050 , am_cv_func_working_getline=no dnl We're cross compiling.
2054 if test $am_cv_func_working_getline = no; then
2061 # Test for the GNU C Library, version 2.1 or newer.
2062 # From Bruno Haible.
2064 AC_DEFUN(jm_GLIBC21,
2066 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
2067 ac_cv_gnu_library_2_1,
2068 [AC_EGREP_CPP([Lucky GNU user],
2070 #include <features.h>
2071 #ifdef __GNU_LIBRARY__
2072 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
2077 ac_cv_gnu_library_2_1=yes,
2078 ac_cv_gnu_library_2_1=no)
2082 GLIBC21="$ac_cv_gnu_library_2_1"
2088 dnl From Bruno Haible.
2092 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
2093 dnl those with the standalone portable libiconv installed).
2094 AC_CACHE_CHECK(for iconv, jm_cv_func_iconv, [
2095 jm_cv_func_iconv="no, consider installing libiconv"
2097 AC_TRY_LINK([#include <stdlib.h>
2098 #include <iconv.h>],
2099 [iconv_t cd = iconv_open("","");
2100 iconv(cd,NULL,NULL,NULL,NULL);
2102 jm_cv_func_iconv=yes)
2103 if test "$jm_cv_func_iconv" != yes; then
2104 jm_save_LIBS="$LIBS"
2105 LIBS="$LIBS -liconv"
2106 AC_TRY_LINK([#include <stdlib.h>
2107 #include <iconv.h>],
2108 [iconv_t cd = iconv_open("","");
2109 iconv(cd,NULL,NULL,NULL,NULL);
2112 jm_cv_func_iconv=yes)
2113 LIBS="$jm_save_LIBS"
2116 if test "$jm_cv_func_iconv" = yes; then
2117 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
2120 if test "$jm_cv_lib_iconv" = yes; then
2128 dnl From Jim Meyering.
2130 dnl See if struct statfs has the f_fstypename member.
2131 dnl If so, define HAVE_F_FSTYPENAME_IN_STATFS.
2134 AC_DEFUN(jm_FSTYPENAME,
2136 AC_CACHE_CHECK([for f_fstypename in struct statfs],
2137 fu_cv_sys_f_fstypename_in_statfs,
2141 #include <sys/param.h>
2142 #include <sys/types.h>
2143 #include <sys/mount.h>
2145 [struct statfs s; int i = sizeof s.f_fstypename;],
2146 fu_cv_sys_f_fstypename_in_statfs=yes,
2147 fu_cv_sys_f_fstypename_in_statfs=no
2152 if test $fu_cv_sys_f_fstypename_in_statfs = yes; then
2153 AC_DEFINE_UNQUOTED(HAVE_F_FSTYPENAME_IN_STATFS, 1,
2154 [Define if struct statfs has the f_fstypename member.])
2161 dnl From Paul Eggert.
2163 # Define ST_MTIM_NSEC to be the nanoseconds member of struct stat's st_mtim,
2166 AC_DEFUN(AC_STRUCT_ST_MTIM_NSEC,
2167 [AC_CACHE_CHECK([for nanoseconds member of struct stat.st_mtim],
2168 ac_cv_struct_st_mtim_nsec,
2169 [ac_save_CPPFLAGS="$CPPFLAGS"
2170 ac_cv_struct_st_mtim_nsec=no
2171 # tv_nsec -- the usual case
2172 # _tv_nsec -- Solaris 2.6, if
2173 # (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1
2174 # && !defined __EXTENSIONS__)
2175 # st__tim.tv_nsec -- UnixWare 2.1.2
2176 for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do
2177 CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val"
2178 AC_TRY_COMPILE([#include <sys/types.h>
2179 #include <sys/stat.h>], [struct stat s; s.st_mtim.ST_MTIM_NSEC;],
2180 [ac_cv_struct_st_mtim_nsec=$ac_val; break])
2182 CPPFLAGS="$ac_save_CPPFLAGS"])
2184 if test $ac_cv_struct_st_mtim_nsec != no; then
2185 AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec,
2186 [Define to be the nanoseconds member of struct stat's st_mtim,
2194 # Define HAVE_ST_DM_MODE if struct stat has an st_dm_mode member.
2196 AC_DEFUN(AC_STRUCT_ST_DM_MODE,
2197 [AC_CACHE_CHECK([for st_dm_mode in struct stat], ac_cv_struct_st_dm_mode,
2198 [AC_TRY_COMPILE([#include <sys/types.h>
2199 #include <sys/stat.h>], [struct stat s; s.st_dm_mode;],
2200 ac_cv_struct_st_dm_mode=yes,
2201 ac_cv_struct_st_dm_mode=no)])
2203 if test $ac_cv_struct_st_dm_mode = yes; then
2204 AC_DEFINE_UNQUOTED(HAVE_ST_DM_MODE, 1,
2205 [Define if struct stat has an st_dm_mode member. ])
2212 dnl From Jim Meyering
2214 dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
2215 dnl in time.h or sys/time.h.
2217 AC_DEFUN(jm_CHECK_TYPE_STRUCT_TIMESPEC,
2219 AC_REQUIRE([AC_HEADER_TIME])
2220 AC_CACHE_CHECK([for struct timespec], fu_cv_sys_struct_timespec,
2223 # if TIME_WITH_SYS_TIME
2224 # include <sys/time.h>
2227 # if HAVE_SYS_TIME_H
2228 # include <sys/time.h>
2234 [static struct timespec x; x.tv_sec = x.tv_nsec;],
2235 fu_cv_sys_struct_timespec=yes,
2236 fu_cv_sys_struct_timespec=no)
2239 if test $fu_cv_sys_struct_timespec = yes; then
2240 AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMESPEC, 1,
2241 [Define if struct timespec is declared in <time.h>. ])
2247 dnl From Paul Eggert.
2251 # Define uintmax_t to `unsigned long' or `unsigned long long'
2252 # if <inttypes.h> does not exist.
2254 AC_DEFUN(jm_AC_TYPE_UINTMAX_T,
2256 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
2257 if test $jm_ac_cv_header_inttypes_h = no; then
2258 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
2259 test $ac_cv_type_unsigned_long_long = yes \
2260 && ac_type='unsigned long long' \
2261 || ac_type='unsigned long'
2262 AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
2263 [ Define to unsigned long or unsigned long long
2264 if <inttypes.h> doesn't define.])
2268 # Macro to add for using GNU gettext.
2269 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2271 # This file can be copied and used freely without restrictions. It can
2272 # be used in projects which are not available under the GNU Public License
2273 # but which still want to provide support for the GNU gettext functionality.
2274 # Please note that the actual code is *not* freely available.
2278 AC_PREREQ(2.13) dnl Minimum Autoconf version required.
2280 AC_DEFUN(AM_WITH_NLS,
2281 [AC_MSG_CHECKING([whether NLS is requested])
2282 dnl Default is enabled NLS
2284 [ --disable-nls do not use Native Language Support],
2285 USE_NLS=$enableval, USE_NLS=yes)
2286 AC_MSG_RESULT($USE_NLS)
2289 USE_INCLUDED_LIBINTL=no
2291 dnl If we use NLS figure out what method
2292 if test "$USE_NLS" = "yes"; then
2293 AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested.])
2294 AC_MSG_CHECKING([whether included gettext is requested])
2295 AC_ARG_WITH(included-gettext,
2296 [ --with-included-gettext use the GNU gettext library included here],
2297 nls_cv_force_use_gnu_gettext=$withval,
2298 nls_cv_force_use_gnu_gettext=no)
2299 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
2301 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
2302 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
2303 dnl User does not insist on using GNU NLS library. Figure out what
2304 dnl to use. If gettext or catgets are available (in this order) we
2305 dnl use this. Else we have to fall back to GNU NLS library.
2306 dnl catgets is only used if permitted by option --with-catgets.
2308 nls_cv_header_libgt=
2311 AC_CHECK_HEADER(libintl.h,
2312 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
2313 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
2314 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
2316 if test "$gt_cv_func_gettext_libc" != "yes"; then
2317 AC_CHECK_LIB(intl, bindtextdomain,
2318 [AC_CHECK_LIB(intl, gettext)])
2321 if test "$gt_cv_func_gettext_libc" = "yes" \
2322 || test "$ac_cv_lib_intl_gettext" = "yes"; then
2323 AC_DEFINE(HAVE_GETTEXT, 1,
2324 [Define to 1 if you have gettext and don't want to use GNU gettext.])
2325 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2326 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
2327 if test "$MSGFMT" != "no"; then
2328 AC_CHECK_FUNCS(dcgettext)
2329 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2330 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2331 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2332 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
2333 return _nl_msg_cat_cntr],
2343 if test "$CATOBJEXT" = "NONE"; then
2344 AC_MSG_CHECKING([whether catgets can be used])
2345 AC_ARG_WITH(catgets,
2346 [ --with-catgets use catgets functions if available],
2347 nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
2348 AC_MSG_RESULT($nls_cv_use_catgets)
2350 if test "$nls_cv_use_catgets" = "yes"; then
2351 dnl No gettext in C library. Try catgets next.
2352 AC_CHECK_LIB(i, main)
2353 AC_CHECK_FUNC(catgets,
2354 [AC_DEFINE(HAVE_CATGETS, 1,
2355 [Define as 1 if you have catgets and don't want to use GNU gettext.])
2356 INTLOBJS="\$(CATOBJS)"
2357 AC_PATH_PROG(GENCAT, gencat, no)dnl
2358 if test "$GENCAT" != "no"; then
2359 AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
2360 if test "$GMSGFMT" = "no"; then
2361 AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
2362 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
2364 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2365 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2366 USE_INCLUDED_LIBINTL=yes
2370 INTLDEPS='$(top_builddir)/intl/libintl.a'
2372 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
2373 nls_cv_header_intl=intl/libintl.h
2374 nls_cv_header_libgt=intl/libgettext.h
2379 if test "$CATOBJEXT" = "NONE"; then
2380 dnl Neither gettext nor catgets in included in the C library.
2381 dnl Fall back on GNU gettext library.
2382 nls_cv_use_gnu_gettext=yes
2386 if test "$nls_cv_use_gnu_gettext" = "yes"; then
2387 dnl Mark actions used to generate GNU NLS library.
2388 INTLOBJS="\$(GETTOBJS)"
2389 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2390 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
2391 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2392 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2393 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2395 USE_INCLUDED_LIBINTL=yes
2399 INTLDEPS='$(top_builddir)/intl/libintl.a'
2401 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
2402 nls_cv_header_intl=intl/libintl.h
2403 nls_cv_header_libgt=intl/libgettext.h
2406 dnl Test whether we really found GNU xgettext.
2407 if test "$XGETTEXT" != ":"; then
2408 dnl If it is no GNU xgettext we define it as : so that the
2409 dnl Makefiles still can work.
2410 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
2414 [found xgettext program is not GNU xgettext; ignore it])
2419 # We need to process the po/ directory.
2423 nls_cv_header_intl=intl/libintl.h
2424 nls_cv_header_libgt=intl/libgettext.h
2426 if test -z "$nls_cv_header_intl"; then
2427 # Clean out junk possibly left behind by a previous configuration.
2428 rm -f intl/libintl.h
2430 AC_CONFIG_LINKS($nls_cv_header_intl:$nls_cv_header_libgt)
2432 [case "$CONFIG_FILES" in *po/Makefile.in*)
2433 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
2437 # If this is used in GNU gettext we have to set USE_NLS to `yes'
2438 # because some of the sources are only built for this goal.
2439 if test "$PACKAGE" = gettext; then
2441 USE_INCLUDED_LIBINTL=yes
2444 dnl These rules are solely for the distribution goal. While doing this
2445 dnl we only have to keep exactly one list of the available catalogs
2446 dnl in configure.in.
2447 for lang in $ALL_LINGUAS; do
2448 GMOFILES="$GMOFILES $lang.gmo"
2449 POFILES="$POFILES $lang.po"
2452 dnl Make all variables we use known to autoconf.
2453 AC_SUBST(USE_INCLUDED_LIBINTL)
2456 AC_SUBST(DATADIRNAME)
2458 AC_SUBST(INSTOBJEXT)
2466 AC_DEFUN(AM_GNU_GETTEXT,
2467 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
2468 AC_REQUIRE([AC_PROG_CC])dnl
2469 AC_REQUIRE([AC_PROG_RANLIB])dnl
2470 AC_REQUIRE([AC_ISC_POSIX])dnl
2471 AC_REQUIRE([AC_HEADER_STDC])dnl
2472 AC_REQUIRE([AC_C_CONST])dnl
2473 AC_REQUIRE([AC_C_INLINE])dnl
2474 AC_REQUIRE([AC_TYPE_OFF_T])dnl
2475 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
2476 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
2477 AC_REQUIRE([AC_FUNC_MMAP])dnl
2479 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
2480 unistd.h sys/param.h])
2481 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
2482 strdup __argz_count __argz_stringify __argz_next])
2484 if test "${ac_cv_func_stpcpy+set}" != "set"; then
2485 AC_CHECK_FUNCS(stpcpy)
2487 if test "${ac_cv_func_stpcpy}" = "yes"; then
2488 AC_DEFINE(HAVE_STPCPY, 1, [Define to 1 if you have the stpcpy function.])
2494 if test "x$CATOBJEXT" != "x"; then
2495 if test "x$ALL_LINGUAS" = "x"; then
2498 AC_MSG_CHECKING(for catalogs to be installed)
2500 for lang in ${LINGUAS=$ALL_LINGUAS}; do
2501 case "$ALL_LINGUAS" in
2502 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
2505 LINGUAS=$NEW_LINGUAS
2506 AC_MSG_RESULT($LINGUAS)
2509 dnl Construct list of names of catalog files to be constructed.
2510 if test -n "$LINGUAS"; then
2511 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
2515 dnl The reference to <locale.h> in the installed <libintl.h> file
2516 dnl must be resolved because we cannot expect the users of this
2517 dnl to define HAVE_LOCALE_H.
2518 if test $ac_cv_header_locale_h = yes; then
2519 INCLUDE_LOCALE_H="#include <locale.h>"
2522 /* The system does not provide the header <locale.h>. Take care yourself. */"
2524 AC_SUBST(INCLUDE_LOCALE_H)
2526 dnl Determine which catalog format we have (if any is needed)
2527 dnl For now we know about two different formats:
2528 dnl Linux libc-5 and the normal X/Open format
2529 test -d intl || mkdir intl
2530 if test "$CATOBJEXT" = ".cat"; then
2531 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
2533 dnl Transform the SED scripts while copying because some dumb SEDs
2534 dnl cannot handle comments.
2535 sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
2537 dnl po2tbl.sed is always needed.
2538 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
2539 $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
2541 dnl In the intl/Makefile.in we have a special dependency which makes
2542 dnl only sense for gettext. We comment this out for non-gettext
2544 if test "$PACKAGE" = "gettext"; then
2554 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
2555 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
2556 dnl Try to locate is.
2558 if test -n "$ac_aux_dir"; then
2559 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
2561 if test -z "$MKINSTALLDIRS"; then
2562 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
2564 AC_SUBST(MKINSTALLDIRS)
2566 dnl *** For now the libtool support in intl/Makefile is not for real.
2570 dnl Generate list of files to be processed by xgettext which will
2571 dnl be included in po/Makefile.
2572 test -d po || mkdir po
2575 posrcprefix="../" ;;
2577 posrcprefix="$srcdir/" ;;
2579 posrcprefix="../$srcdir/" ;;
2582 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
2583 < $srcdir/po/POTFILES.in > po/POTFILES
2586 # Search path for a program which passes the given test.
2587 # Ulrich Drepper <drepper@cygnus.com>, 1996.
2589 # This file can be copied and used freely without restrictions. It can
2590 # be used in projects which are not available under the GNU Public License
2591 # but which still want to provide support for the GNU gettext functionality.
2592 # Please note that the actual code is *not* freely available.
2596 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
2597 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
2598 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
2599 [# Extract the first word of "$2", so it can be a program name with args.
2600 set dummy $2; ac_word=[$]2
2601 AC_MSG_CHECKING([for $ac_word])
2602 AC_CACHE_VAL(ac_cv_path_$1,
2605 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
2608 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
2609 for ac_dir in ifelse([$5], , $PATH, [$5]); do
2610 test -z "$ac_dir" && ac_dir=.
2611 if test -f $ac_dir/$ac_word; then
2613 ac_cv_path_$1="$ac_dir/$ac_word"
2619 dnl If no 4th arg is given, leave the cache variable unset,
2620 dnl so AC_PATH_PROGS will keep looking.
2621 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
2626 if test -n "[$]$1"; then
2627 AC_MSG_RESULT([$]$1)
2634 # Check whether LC_MESSAGES is available in <locale.h>.
2635 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2637 # This file can be copied and used freely without restrictions. It can
2638 # be used in projects which are not available under the GNU Public License
2639 # but which still want to provide support for the GNU gettext functionality.
2640 # Please note that the actual code is *not* freely available.
2644 AC_PREREQ(2.13) dnl Minimum Autoconf version required.
2646 AC_DEFUN(AM_LC_MESSAGES,
2647 [if test $ac_cv_header_locale_h = yes; then
2648 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
2649 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2650 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
2651 if test $am_cv_val_LC_MESSAGES = yes; then
2652 AC_DEFINE(HAVE_LC_MESSAGES, 1,
2653 [Define if your locale.h file contains LC_MESSAGES.])