1 dnl aclocal.m4 generated automatically by aclocal 1.4a
3 dnl Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
13 # Like AC_CONFIG_HEADER, but automatically create stamp file.
17 # When config.status generates a header, we must update the stamp-h file.
18 # This file resides in the same directory as the config header
19 # that is generated. We must strip everything past the first ":",
20 # and everything past the last "/".
24 AC_DEFUN([AM_CONFIG_HEADER],
25 [AC_CONFIG_HEADER([$1])
27 ifelse(patsubst([$1], [[^ ]], []),
29 [test -z "$CONFIG_HEADERS" || echo timestamp >dnl
30 patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),
33 case " $CONFIG_HEADERS " in
35 echo timestamp > `echo $am_file | sed 's%:.*%%;s%[^/]*$%%'`stamp-h$am_indx
38 am_indx=\`expr \$am_indx + 1\`
42 # Do all the work for Automake. This macro actually does too much --
43 # some checks are only needed if your package does certain things.
44 # But this isn't really a big deal.
50 # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
51 # -----------------------------------------------------------
52 # If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED.
53 # The purpose of this macro is to provide the user with a means to
54 # check macros which are provided without letting her know how the
55 # information is coded.
56 # If this macro is not defined by Autoconf, define it here.
57 ifdef([AC_PROVIDE_IFELSE],
59 [define([AC_PROVIDE_IFELSE],
60 [ifdef([AC_PROVIDE_$1],
64 # AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE])
65 # ----------------------------------------------
66 AC_DEFUN([AM_INIT_AUTOMAKE],
67 [dnl We require 2.13 because we rely on SHELL being computed by configure.
68 AC_REQUIRE([AC_PROG_INSTALL])dnl
69 # test to see if srcdir already configured
70 if test "`CDPATH=: && cd $srcdir && pwd`" != "`pwd`" &&
71 test -f $srcdir/config.status; then
72 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
75 # Define the identity of the package.
81 [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
82 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])
84 # Some tools Automake needs.
85 AC_REQUIRE([AM_SANITY_CHECK])dnl
86 AC_REQUIRE([AC_ARG_PROGRAM])dnl
87 AM_MISSING_PROG(ACLOCAL, aclocal)
88 AM_MISSING_PROG(AUTOCONF, autoconf)
89 AM_MISSING_PROG(AUTOMAKE, automake)
90 AM_MISSING_PROG(AUTOHEADER, autoheader)
91 AM_MISSING_PROG(MAKEINFO, makeinfo)
92 AM_MISSING_PROG(AMTAR, tar)
94 # We need awk for the "check" target. The system "awk" is bad on
96 AC_REQUIRE([AC_PROG_AWK])dnl
97 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
98 AC_REQUIRE([AM_DEP_TRACK])dnl
99 AC_REQUIRE([AM_SET_DEPDIR])dnl
100 AC_PROVIDE_IFELSE([AC_PROG_CC],
101 [AM_DEPENDENCIES(CC)],
102 [define([AC_PROG_CC],
103 defn([AC_PROG_CC])[AM_DEPENDENCIES(CC)])])dnl
104 AC_PROVIDE_IFELSE([AC_PROG_CXX],
105 [AM_DEPENDENCIES(CXX)],
106 [define([AC_PROG_CXX],
107 defn([AC_PROG_CXX])[AM_DEPENDENCIES(CXX)])])dnl
111 # Check to make sure that the build environment is sane.
114 AC_DEFUN([AM_SANITY_CHECK],
115 [AC_MSG_CHECKING([whether build environment is sane])
118 echo timestamp > conftestfile
119 # Do `set' in a subshell so we don't clobber the current shell's
120 # arguments. Must try -L first in case configure is actually a
121 # symlink; some systems play weird games with the mod time of symlinks
122 # (eg FreeBSD returns the mod time of the symlink's containing
125 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
126 if test "[$]*" = "X"; then
128 set X `ls -t $srcdir/configure conftestfile`
130 if test "[$]*" != "X $srcdir/configure conftestfile" \
131 && test "[$]*" != "X conftestfile $srcdir/configure"; then
133 # If neither matched, then we have a broken ls. This can happen
134 # if, for instance, CONFIG_SHELL is bash and it inherits a
135 # broken ls alias from the environment. This has actually
136 # happened. Such a system could not be considered "sane".
137 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
138 alias in your environment])
141 test "[$]2" = conftestfile
147 AC_MSG_ERROR([newly created file is older than distributed files!
148 Check your system clock])
153 # AM_MISSING_PROG(NAME, PROGRAM)
154 AC_DEFUN([AM_MISSING_PROG], [
155 AC_REQUIRE([AM_MISSING_HAS_RUN])
156 $1=${$1-"${am_missing_run}$2"}
159 # Like AM_MISSING_PROG, but only looks for install-sh.
160 # AM_MISSING_INSTALL_SH()
161 AC_DEFUN([AM_MISSING_INSTALL_SH], [
162 AC_REQUIRE([AM_MISSING_HAS_RUN])
163 if test -z "$install_sh"; then
164 install_sh="$ac_aux_dir/install-sh"
165 test -f "$install_sh" || install_sh="$ac_aux_dir/install.sh"
166 test -f "$install_sh" || install_sh="${am_missing_run}${ac_auxdir}/install-sh"
167 dnl FIXME: an evil hack: we remove the SHELL invocation from
168 dnl install_sh because automake adds it back in. Sigh.
169 install_sh="`echo $install_sh | sed -e 's/\${SHELL}//'`"
171 AC_SUBST(install_sh)])
173 # AM_MISSING_HAS_RUN.
174 # Define MISSING if not defined so far and test if it supports --run.
175 # If it does, set am_missing_run to use it, otherwise, to nothing.
176 AC_DEFUN([AM_MISSING_HAS_RUN], [
177 test x"${MISSING+set}" = xset || \
178 MISSING="\${SHELL} `CDPATH=: && cd $ac_aux_dir && pwd`/missing"
179 # Use eval to expand $SHELL
180 if eval "$MISSING --run :"; then
181 am_missing_run="$MISSING --run "
185 AC_MSG_WARN([${am_backtick}missing' script is too old or missing])
189 # See how the compiler implements dependency checking.
191 # AM_DEPENDENCIES(NAME)
192 # NAME is "CC", "CXX" or "OBJC".
194 # We try a few techniques and use that to set a single cache variable.
196 AC_DEFUN([AM_DEPENDENCIES],[
197 AC_REQUIRE([AM_SET_DEPDIR])
198 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])
200 AC_REQUIRE([AC_PROG_CC])
201 AC_REQUIRE([AC_PROG_CPP])
203 depcpp="$CPP"],[$1],CXX,[
204 AC_REQUIRE([AC_PROG_CXX])
205 AC_REQUIRE([AC_PROG_CXXCPP])
207 depcpp="$CXXCPP"],[$1],OBJC,[
208 am_cv_OBJC_dependencies_compiler_type=gcc],[
209 AC_REQUIRE([AC_PROG_][$1])
212 AC_MSG_CHECKING([dependency style of $depcc])
213 AC_CACHE_VAL(am_cv_[$1]_dependencies_compiler_type,[
214 if test -z "$AMDEP"; then
215 echo '#include "conftest.h"' > conftest.c
216 echo 'int i;' > conftest.h
218 am_cv_[$1]_dependencies_compiler_type=none
219 for depmode in `sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < "$am_depcomp"`; do
222 # after this tag, mechanisms are not by side-effect, so they'll
223 # only be used when explicitly requested
224 if test "x$enable_dependency_tracking" = xyes; then
232 # We check with `-c' and `-o' for the sake of the "dashmstdout"
233 # mode. It turns out that the SunPro C++ compiler does not properly
234 # handle `-M -o', and we need to detect this.
235 if depmode="$depmode" \
236 source=conftest.c object=conftest.o \
237 depfile=conftest.Po tmpdepfile=conftest.TPo \
238 $SHELL $am_depcomp $depcc -c conftest.c -o conftest.o 2>/dev/null &&
239 grep conftest.h conftest.Po > /dev/null 2>&1; then
240 am_cv_[$1]_dependencies_compiler_type="$depmode"
247 am_cv_[$1]_dependencies_compiler_type=none
250 AC_MSG_RESULT($am_cv_[$1]_dependencies_compiler_type)
251 [$1]DEPMODE="depmode=$am_cv_[$1]_dependencies_compiler_type"
252 AC_SUBST([$1]DEPMODE)
255 # Choose a directory name for dependency files.
256 # This macro is AC_REQUIREd in AM_DEPENDENCIES
258 AC_DEFUN([AM_SET_DEPDIR],[
259 if test -d .deps || mkdir .deps 2> /dev/null || test -d .deps; then
267 AC_DEFUN([AM_DEP_TRACK],[
268 AC_ARG_ENABLE(dependency-tracking,
269 [ --disable-dependency-tracking Speeds up one-time builds
270 --enable-dependency-tracking Do not reject slow dependency extractors])
271 if test "x$enable_dependency_tracking" = xno; then
274 am_depcomp="$ac_aux_dir/depcomp"
275 if test ! -f "$am_depcomp"; then
282 if test -z "$AMDEP"; then
287 pushdef([subst], defn([AC_SUBST]))
288 subst(AMDEPBACKSLASH)
292 # Generate code to set up dependency tracking.
293 # This macro should only be invoked once -- use via AC_REQUIRE.
295 # AM_OUTPUT_DEPENDENCY_COMMANDS
298 # This code is only required when automatic dependency tracking
299 # is enabled. FIXME. This creates each `.P' file that we will
300 # need in order to bootstrap the dependency handling code.
301 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],[
303 test x"$AMDEP" != x"" ||
304 for mf in $CONFIG_FILES; do
306 Makefile) dirpart=.;;
307 */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;;
310 grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
311 # Extract the definition of DEP_FILES from the Makefile without
313 DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
314 test -z "$DEPDIR" && continue
315 # When using ansi2knr, U may be empty or an underscore; expand it
316 U=`sed -n -e '/^U = / s///p' < "$mf"`
317 test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
318 # We invoke sed twice because it is the simplest approach to
319 # changing $(DEPDIR) to its actual value in the expansion.
320 for file in `sed -n -e '
321 /^DEP_FILES = .*\\\\$/ {
330 /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
331 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
332 # Make sure the directory exists.
333 test -f "$dirpart/$file" && continue
334 fdir=`echo "$file" | sed -e 's|/[^/]*$||'`
335 $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1
336 # echo "creating $dirpart/$file"
337 echo '# dummy' > "$dirpart/$file"
341 ac_aux_dir="$ac_aux_dir"])])
344 dnl This test replaces the one in autoconf.
345 dnl Currently this macro should have the same name as the autoconf macro
346 dnl because gettext's gettext.m4 (distributed in the automake package)
347 dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader
348 dnl give these diagnostics:
349 dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
350 dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
352 undefine([AC_ISC_POSIX])
353 AC_DEFUN(AC_ISC_POSIX,
355 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
356 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
363 AC_DEFUN([AM_C_PROTOTYPES],
364 [AC_REQUIRE([AM_PROG_CC_STDC])
365 AC_REQUIRE([AC_PROG_CPP])
366 AC_MSG_CHECKING([for function prototypes])
367 if test "$am_cv_prog_cc_stdc" != no; then
369 AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
373 U=_ ANSI2KNR=./ansi2knr
374 # Ensure some checks needed by ansi2knr itself.
376 AC_CHECK_HEADERS(string.h)
379 AC_SUBST(ANSI2KNR)dnl
385 # @defmac AC_PROG_CC_STDC
386 # @maindex PROG_CC_STDC
388 # If the C compiler in not in ANSI C mode by default, try to add an option
389 # to output variable @code{CC} to make it so. This macro tries various
390 # options that select ANSI C on some system or another. It considers the
391 # compiler to be in ANSI C mode if it handles function prototypes correctly.
393 # If you use this macro, you should check after calling it whether the C
394 # compiler has been set to accept ANSI C; if not, the shell variable
395 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
396 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
397 # program @code{ansi2knr}, which comes with Ghostscript.
400 AC_DEFUN([AM_PROG_CC_STDC],
401 [AC_REQUIRE([AC_PROG_CC])
402 AC_BEFORE([$0], [AC_C_INLINE])
403 AC_BEFORE([$0], [AC_C_CONST])
404 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
405 dnl a magic option to avoid problems with ANSI preprocessor commands
407 dnl FIXME: can't do this because then AC_AIX won't work due to a
408 dnl circular dependency.
409 dnl AC_BEFORE([$0], [AC_PROG_CPP])
410 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
411 AC_CACHE_VAL(am_cv_prog_cc_stdc,
412 [am_cv_prog_cc_stdc=no
414 # Don't try gcc -ansi; that turns off useful extensions and
415 # breaks some systems' header files.
417 # Ultrix and OSF/1 -std1
418 # HP-UX 10.20 and later -Ae
419 # HP-UX older versions -Aa -D_HPUX_SOURCE
420 # SVR4 -Xc -D__EXTENSIONS__
421 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
423 CC="$ac_save_CC $ac_arg"
427 #include <sys/types.h>
428 #include <sys/stat.h>
429 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
430 struct buf { int x; };
431 FILE * (*rcsopen) (struct buf *, struct stat *, int);
432 static char *e (p, i)
438 static char *f (char * (*g) (char **, int), char **p, ...)
443 s = g (p, va_arg (v,int));
447 int test (int i, double x);
448 struct s1 {int (*f) (int a);};
449 struct s2 {int (*f) (double a);};
450 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
454 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
456 [am_cv_prog_cc_stdc="$ac_arg"; break])
460 if test -z "$am_cv_prog_cc_stdc"; then
461 AC_MSG_RESULT([none needed])
463 AC_MSG_RESULT($am_cv_prog_cc_stdc)
465 case "x$am_cv_prog_cc_stdc" in
467 *) CC="$CC $am_cv_prog_cc_stdc" ;;
473 dnl By default, many hosts won't let programs access large files;
474 dnl one must use special compiler options to get large-file access to work.
475 dnl For more details about this brain damage please see:
476 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
478 dnl Written by Paul Eggert <eggert@twinsun.com>.
480 dnl Internal subroutine of AC_SYS_LARGEFILE.
481 dnl AC_SYS_LARGEFILE_FLAGS(FLAGSNAME)
482 AC_DEFUN(AC_SYS_LARGEFILE_FLAGS,
483 [AC_CACHE_CHECK([for $1 value to request large file support],
484 ac_cv_sys_largefile_$1,
485 [if ($GETCONF LFS_$1) >conftest.1 2>conftest.2 && test ! -s conftest.2
487 ac_cv_sys_largefile_$1=`cat conftest.1`
489 ac_cv_sys_largefile_$1=no
492 # HP-UX 10.20 requires -D__STDC_EXT__ with gcc 2.95.1.
493 [ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)]
494 if test "$GCC" = yes; then
495 ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__
498 # IRIX 6.2 and later require cc -n32.
499 [ irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)]
500 if test "$GCC" != yes; then
501 ac_cv_sys_largefile_CFLAGS=-n32
504 if test "$ac_cv_sys_largefile_CFLAGS" != no; then
506 CC="$CC $ac_cv_sys_largefile_CFLAGS"
507 AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
513 dnl Internal subroutine of AC_SYS_LARGEFILE.
514 dnl AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL)
515 AC_DEFUN(AC_SYS_LARGEFILE_SPACE_APPEND,
525 dnl Internal subroutine of AC_SYS_LARGEFILE.
526 dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
527 AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE,
528 [AC_CACHE_CHECK([for $1], $2,
531 for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
536 $2=`expr " $ac_flag" : '[[^=]]*=\(.*\)'` ;;
540 if test "[$]$2" != no; then
541 AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
544 AC_DEFUN(AC_SYS_LARGEFILE,
545 [AC_REQUIRE([AC_CANONICAL_HOST])
546 AC_ARG_ENABLE(largefile,
547 [ --disable-largefile omit support for large files])
548 if test "$enable_largefile" != no; then
549 AC_CHECK_TOOL(GETCONF, getconf)
550 AC_SYS_LARGEFILE_FLAGS(CFLAGS)
551 AC_SYS_LARGEFILE_FLAGS(LDFLAGS)
552 AC_SYS_LARGEFILE_FLAGS(LIBS)
554 for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
557 -D_FILE_OFFSET_BITS=*) ;;
558 -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
559 -D_LARGE_FILES | -D_LARGE_FILES=*) ;;
561 AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
563 AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
566 AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
567 AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
568 AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
569 ac_cv_sys_file_offset_bits,
570 [Number of bits in a file offset, on hosts where this is settable.],
572 # HP-UX 10.20 and later
573 [ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)]
574 ac_cv_sys_file_offset_bits=64 ;;
576 AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
577 ac_cv_sys_largefile_source,
578 [Define to make fseeko etc. visible, on some hosts.],
580 # HP-UX 10.20 and later
581 [ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)]
582 ac_cv_sys_largefile_source=1 ;;
584 AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
585 ac_cv_sys_large_files,
586 [Define for large files, on AIX-style hosts.],
589 [ aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)]
590 ac_cv_sys_large_files=1 ;;
595 #serial 13, with several lines deleted for fileutils.
597 dnl Misc type-related macros for fileutils, sh-utils, textutils.
603 GNU_PACKAGE="GNU $PACKAGE"
604 AC_DEFINE_UNQUOTED(GNU_PACKAGE, "$GNU_PACKAGE",
605 [The concatenation of the strings `GNU ', and PACKAGE.])
606 AC_SUBST(GNU_PACKAGE)
608 AC_SUBST(OPTIONAL_BIN_PROGS)
609 AC_SUBST(OPTIONAL_BIN_ZCRIPTS)
613 dnl This macro actually runs replacement code. See isc-posix.m4.
614 AC_REQUIRE([AC_ISC_POSIX])dnl
653 jm_INCLUDED_REGEX([lib/regex.c])
655 AC_REQUIRE([jm_ASSERT])
656 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
657 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE])
658 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_INO])
659 AC_REQUIRE([jm_CHECK_DECLS])
661 AC_REQUIRE([jm_PREREQ])
663 AC_REQUIRE([jm_FUNC_MKTIME])
664 AC_REQUIRE([jm_FUNC_LSTAT])
665 AC_REQUIRE([jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
666 AC_REQUIRE([jm_FUNC_STAT])
667 AC_REQUIRE([jm_FUNC_REALLOC])
668 AC_REQUIRE([jm_FUNC_MALLOC])
669 AC_REQUIRE([jm_FUNC_STRERROR_R])
670 AC_REQUIRE([jm_FUNC_READDIR])
671 AC_REQUIRE([jm_FUNC_MEMCMP])
672 AC_REQUIRE([jm_FUNC_GLIBC_UNLOCKED_IO])
673 AC_REQUIRE([kd_FUNC_FNMATCH_CASE_RPL])
675 AC_REQUIRE([jm_AC_PREREQ_XSTRTOUMAX])
676 AC_REQUIRE([jm_AC_FUNC_LINK_FOLLOWS_SYMLINK])
677 AC_REQUIRE([AM_FUNC_ERROR_AT_LINE])
678 AC_REQUIRE([jm_FUNC_GNU_STRFTIME])
679 AC_REQUIRE([jm_FUNC_MKTIME])
681 AC_REQUIRE([AC_FUNC_VPRINTF])
682 AC_REQUIRE([AC_FUNC_ALLOCA])
684 AC_REPLACE_FUNCS(strncasecmp)
685 AC_REPLACE_FUNCS(stpcpy strstr strtol strtoul)
686 AC_REPLACE_FUNCS(memcmp rpmatch)
688 dnl used by e.g. intl/*domain.c and lib/canon-host.c
689 AC_REPLACE_FUNCS(strdup)
691 AC_REPLACE_FUNCS(memcpy memset)
692 AC_CHECK_FUNCS(getpagesize)
694 # By default, argmatch should fail calling usage (1).
695 AC_DEFINE(ARGMATCH_DIE, [usage (1)],
696 [Define to the function xargmatch calls on failures.])
697 AC_DEFINE(ARGMATCH_DIE_DECL, [extern void usage ()],
698 [Define to the declaration of the xargmatch failure function.])
700 dnl Used to define SETVBUF in sys2.h.
701 dnl This evokes the following warning from autoconf:
702 dnl ...: warning: AC_TRY_RUN called without default to allow cross compiling
703 AC_FUNC_SETVBUF_REVERSED
705 # used by sleep and shred
706 # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
707 # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
708 AC_SEARCH_LIBS(clock_gettime, [rt posix4])
709 AC_CHECK_FUNCS(clock_gettime)
710 AC_CHECK_FUNCS(gettimeofday)
712 AC_CHECK_FUNCS(getdelim)
714 AC_REQUIRE([AC_FUNC_CLOSEDIR_VOID])
747 if test $am_cv_func_working_getline != yes; then
748 AC_CHECK_FUNCS(getdelim)
751 # These tests are for df.
756 AC_DEFUN(jm_CHECK_ALL_TYPES,
758 dnl Checks for typedefs, structures, and compiler characteristics.
759 AC_REQUIRE([AC_C_BIGENDIAN])
760 AC_REQUIRE([AC_PROG_CC_STDC])
761 AC_REQUIRE([AC_C_CONST])
762 AC_REQUIRE([AC_C_VOLATILE])
763 AC_REQUIRE([AC_C_INLINE])
764 AC_REQUIRE([AC_C_LONG_DOUBLE])
766 AC_REQUIRE([AC_HEADER_DIRENT])
767 AC_REQUIRE([AC_HEADER_STDC])
768 AC_CHECK_MEMBERS((struct stat.st_blksize),,,[$ac_includes_default
769 #include <sys/stat.h>
771 AC_REQUIRE([AC_STRUCT_ST_BLOCKS])
773 AC_REQUIRE([AC_STRUCT_TM])
774 AC_REQUIRE([AC_STRUCT_TIMEZONE])
775 AC_REQUIRE([AC_HEADER_STAT])
776 AC_REQUIRE([AC_STRUCT_ST_MTIM_NSEC])
777 AC_REQUIRE([AC_STRUCT_ST_DM_MODE])
778 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_TIMESPEC])
780 AC_REQUIRE([AC_TYPE_GETGROUPS])
781 AC_REQUIRE([AC_TYPE_MODE_T])
782 AC_REQUIRE([AC_TYPE_OFF_T])
783 AC_REQUIRE([AC_TYPE_PID_T])
784 AC_REQUIRE([AC_TYPE_SIGNAL])
785 AC_REQUIRE([AC_TYPE_SIZE_T])
786 AC_REQUIRE([AC_TYPE_UID_T])
787 AC_CHECK_TYPE(ino_t, unsigned long)
789 dnl This relies on the fact that autoconf 2.14a's implementation of
790 dnl AC_CHECK_TYPE checks includes unistd.h.
791 AC_CHECK_TYPE(ssize_t, int)
793 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
794 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
796 AC_REQUIRE([AC_HEADER_MAJOR])
797 AC_REQUIRE([AC_HEADER_DIRENT])
803 dnl Initially derived from code in GNU grep.
804 dnl Mostly written by Jim Meyering.
806 dnl Usage: jm_INCLUDED_REGEX([lib/regex.c])
808 AC_DEFUN(jm_INCLUDED_REGEX,
810 dnl Even packages that don't use regex.c can use this macro.
811 dnl Of course, for them it doesn't do anything.
813 # Assume we'll default to using the included regex.c.
814 ac_use_included_regex=yes
816 # However, if the system regex support is good enough that it passes the
817 # the following run test, then default to *not* using the included regex.c.
818 # If cross compiling, assume the test would fail and use the included
819 # regex.c. The first failing regular expression is from `Spencer ere
820 # test #75' in grep-2.3.
821 AC_CACHE_CHECK([for working re_compile_pattern],
822 jm_cv_func_working_re_compile_pattern,
829 static struct re_pattern_buffer regex;
831 re_set_syntax (RE_SYNTAX_POSIX_EGREP);
832 /* Add this third left square bracket, [, to balance the
833 three right ones below. Otherwise autoconf-2.14 chokes. */
834 s = re_compile_pattern ("a[[:]:]]b\n", 9, ®ex);
835 /* This should fail with _Invalid character class name_ error. */
839 /* This should succeed, but doesn't for e.g. glibc-2.1.3. */
840 s = re_compile_pattern ("{1", 2, ®ex);
845 jm_cv_func_working_re_compile_pattern=yes,
846 jm_cv_func_working_re_compile_pattern=no,
847 dnl When crosscompiling, assume it's broken.
848 jm_cv_func_working_re_compile_pattern=no))
849 if test $jm_cv_func_working_re_compile_pattern = yes; then
850 ac_use_included_regex=no
853 test -n "$1" || AC_MSG_ERROR([missing argument])
858 AC_ARG_WITH(included-regex,
859 [ --without-included-regex don't compile regex; this is the default on
860 systems with version 2 of the GNU C library
861 (use with caution on other system)],
862 jm_with_regex=$withval,
863 jm_with_regex=$ac_use_included_regex)
864 if test "$jm_with_regex" = yes; then
866 LIBOBJS="$LIBOBJS regex.$ac_objext"
874 dnl based on code from Eleftherios Gkioulekas
878 AC_MSG_CHECKING(whether to enable assertions)
879 AC_ARG_ENABLE(assert,
880 [ --disable-assert turn off assertions],
882 AC_DEFINE(NDEBUG,1,[Define to 1 if assertions should be disabled.]) ],
883 [ AC_MSG_RESULT(yes) ]
889 dnl From Paul Eggert.
891 # Define HAVE_INTTYPES_H if <inttypes.h> exists,
892 # doesn't clash with <sys/types.h>, and declares uintmax_t.
894 AC_DEFUN(jm_AC_HEADER_INTTYPES_H,
896 AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
898 [#include <sys/types.h>
899 #include <inttypes.h>],
900 [uintmax_t i = (uintmax_t) -1;],
901 jm_ac_cv_header_inttypes_h=yes,
902 jm_ac_cv_header_inttypes_h=no)])
903 if test $jm_ac_cv_header_inttypes_h = yes; then
904 AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
905 [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
906 and declares uintmax_t. ])
912 dnl From Jim Meyering.
914 dnl Check whether struct dirent has a member named d_type.
917 AC_DEFUN(jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE,
918 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
919 AC_CACHE_CHECK([for d_type member in directory struct],
920 jm_cv_struct_dirent_d_type,
923 #include <sys/types.h>
926 #else /* not HAVE_DIRENT_H */
927 # define dirent direct
928 # ifdef HAVE_SYS_NDIR_H
929 # include <sys/ndir.h>
930 # endif /* HAVE_SYS_NDIR_H */
931 # ifdef HAVE_SYS_DIR_H
932 # include <sys/dir.h>
933 # endif /* HAVE_SYS_DIR_H */
936 # endif /* HAVE_NDIR_H */
937 #endif /* HAVE_DIRENT_H */
939 [struct dirent dp; dp.d_type = 0;],
941 jm_cv_struct_dirent_d_type=yes,
942 jm_cv_struct_dirent_d_type=no)
945 if test $jm_cv_struct_dirent_d_type = yes; then
946 AC_DEFINE(D_TYPE_IN_DIRENT, 1,
947 [Define if there is a member named d_type in the struct describing
955 dnl From Jim Meyering.
957 dnl Check whether struct dirent has a member named d_ino.
960 AC_DEFUN(jm_CHECK_TYPE_STRUCT_DIRENT_D_INO,
961 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
962 AC_CACHE_CHECK([for d_ino member in directory struct],
963 jm_cv_struct_dirent_d_ino,
966 #include <sys/types.h>
969 #else /* not HAVE_DIRENT_H */
970 # define dirent direct
971 # ifdef HAVE_SYS_NDIR_H
972 # include <sys/ndir.h>
973 # endif /* HAVE_SYS_NDIR_H */
974 # ifdef HAVE_SYS_DIR_H
975 # include <sys/dir.h>
976 # endif /* HAVE_SYS_DIR_H */
979 # endif /* HAVE_NDIR_H */
980 #endif /* HAVE_DIRENT_H */
982 [struct dirent dp; dp.d_ino = 0;],
984 jm_cv_struct_dirent_d_ino=yes,
985 jm_cv_struct_dirent_d_ino=no)
988 if test $jm_cv_struct_dirent_d_ino = yes; then
989 AC_DEFINE(D_INO_IN_DIRENT, 1,
990 [Define if there is a member named d_ino in the struct describing
996 #serial 9, except remove memchr and nanosleep as findutils doesn't need them
998 dnl This is just a wrapper function to encapsulate this kludge.
999 dnl Putting it in a separate file like this helps share it between
1000 dnl different packages.
1001 AC_DEFUN(jm_CHECK_DECLS,
1003 AC_REQUIRE([_jm_DECL_HEADERS])
1004 AC_REQUIRE([AC_HEADER_TIME])
1008 # if !STDC_HEADERS && HAVE_MEMORY_H
1009 # include <memory.h>
1011 # include <string.h>
1014 # include <strings.h>
1018 # include <stdlib.h>
1021 # include <unistd.h>
1024 #include <sys/types.h>
1025 #if TIME_WITH_SYS_TIME
1026 # include <sys/time.h>
1029 # if HAVE_SYS_TIME_H
1030 # include <sys/time.h>
1049 ttyname), , , $headers)
1052 dnl FIXME: when autoconf has support for it.
1053 dnl This is a little helper so we can require these header checks.
1054 AC_DEFUN(_jm_DECL_HEADERS,
1056 AC_REQUIRE([AC_HEADER_STDC])
1057 AC_CHECK_HEADERS(memory.h string.h strings.h stdlib.h unistd.h sys/time.h)
1062 dnl These are the prerequisite macros for files in the lib/
1063 dnl directories of the fileutils, sh-utils, and textutils packages.
1068 jm_PREREQ_CANON_HOST
1075 AC_DEFUN(jm_PREREQ_ADDEXT,
1078 AC_SYS_LONG_FILE_NAMES
1079 AC_CHECK_FUNCS(pathconf)
1080 AC_CHECK_HEADERS(limits.h string.h unistd.h)
1083 AC_DEFUN(jm_PREREQ_CANON_HOST,
1085 dnl Add any libraries as early as possible.
1086 dnl In particular, inet_ntoa needs -lnsl at least on Solaris5.5.1,
1087 dnl so we have to add -lnsl to LIBS before checking for that function.
1088 AC_SEARCH_LIBS(gethostbyname, [inet nsl])
1090 dnl These come from -lnsl on Solaris5.5.1.
1091 AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
1093 AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
1094 AC_CHECK_HEADERS(unistd.h string.h netdb.h sys/socket.h \
1095 netinet/in.h arpa/inet.h)
1098 AC_DEFUN(jm_PREREQ_QUOTEARG,
1100 AC_CHECK_FUNCS(isascii iswprint mbrtowc)
1101 AC_CHECK_HEADERS(limits.h stdlib.h string.h wchar.h wctype.h)
1108 AC_DEFUN(jm_PREREQ_READUTMP,
1111 AC_CHECK_HEADERS(string.h utmpx.h sys/param.h)
1112 AC_CHECK_FUNCS(utmpname)
1113 AC_CHECK_FUNCS(utmpxname)
1117 $ac_includes_default
1124 AC_CHECK_MEMBERS((struct utmpx.ut_user),,,[$utmp_includes])
1125 AC_CHECK_MEMBERS((struct utmp.ut_user),,,[$utmp_includes])
1126 AC_CHECK_MEMBERS((struct utmpx.ut_name),,,[$utmp_includes])
1127 AC_CHECK_MEMBERS((struct utmp.ut_name),,,[$utmp_includes])
1130 AC_DEFUN(jm_PREREQ_REGEX,
1132 dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it.
1133 dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary
1135 AC_CHECK_FUNCS(bzero bcopy isascii btowc)
1136 AC_CHECK_HEADERS(alloca.h libintl.h wctype.h wchar.h)
1143 dnl FIXME: put these prerequisite-only *.m4 files in a separate
1144 dnl directory -- otherwise, they'll conflict with existing files.
1146 dnl These are the prerequisite macros for GNU's error.c file.
1147 AC_DEFUN(jm_PREREQ_ERROR,
1149 AC_CHECK_FUNCS(strerror strerror_r vprintf doprnt)
1155 dnl From Paul Eggert.
1157 AC_DEFUN(AC_C_BACKSLASH_A,
1159 AC_CACHE_CHECK([whether backslash-a works in strings], ac_cv_c_backslash_a,
1165 char buf['\a' == 'a' ? -1 : 1];
1167 return buf[0] != "\a"[0];
1169 ac_cv_c_backslash_a=yes,
1170 ac_cv_c_backslash_a=no)])
1171 if test $ac_cv_c_backslash_a = yes; then
1172 AC_DEFINE(HAVE_C_BACKSLASH_A, 1,
1173 [Define if backslash-a works in C strings.])
1181 # Some versions of BeOS define mbstate_t to be an incomplete type,
1182 # so you can't declare an object of that type.
1183 # Check for this incompatibility with Standard C.
1185 AC_DEFUN(AC_MBSTATE_T_OBJECT,
1186 [AC_CACHE_CHECK([for mbstate_t object type], ac_cv_type_mbstate_t_object,
1187 [AC_TRY_COMPILE([#include <wchar.h>],
1188 [mbstate_t x; return sizeof x;],
1189 ac_cv_type_mbstate_t_object=yes,
1190 ac_cv_type_mbstate_t_object=no)])
1191 if test $ac_cv_type_mbstate_t_object = yes; then
1192 AC_DEFINE(HAVE_MBSTATE_T_OBJECT, 1,
1193 [Define if mbstate_t is an object type.])
1198 dnl From Jim Meyering.
1199 dnl A wrapper around AC_FUNC_MKTIME.
1201 AC_DEFUN(jm_FUNC_MKTIME,
1202 [AC_REQUIRE([AC_FUNC_MKTIME])dnl
1204 dnl mktime.c uses localtime_r if it exists. Check for it.
1205 AC_CHECK_FUNCS(localtime_r)
1207 if test $ac_cv_func_working_mktime = no; then
1208 AC_DEFINE_UNQUOTED(mktime, rpl_mktime,
1209 [Define to rpl_mktime if the replacement function should be used.])
1215 dnl From Jim Meyering.
1216 dnl Determine whether lstat has the bug that it succeeds when given the
1217 dnl zero-length file name argument. The lstat from SunOS4.1.4 and the Hurd
1218 dnl (as of 1998-11-01) do this.
1220 dnl If it does, then define HAVE_LSTAT_EMPTY_STRING_BUG and arrange to
1221 dnl compile the wrapper function.
1224 AC_DEFUN(jm_FUNC_LSTAT,
1226 AC_CACHE_CHECK([whether lstat accepts an empty string],
1227 jm_cv_func_lstat_empty_string_bug,
1229 # include <sys/types.h>
1230 # include <sys/stat.h>
1236 exit (lstat ("", &sbuf) ? 1 : 0);
1239 jm_cv_func_lstat_empty_string_bug=yes,
1240 jm_cv_func_lstat_empty_string_bug=no,
1241 dnl When crosscompiling, assume lstat is broken.
1242 jm_cv_func_lstat_empty_string_bug=yes)
1244 if test $jm_cv_func_lstat_empty_string_bug = yes; then
1246 LIBOBJS="$LIBOBJS lstat.$ac_objext"
1247 AC_DEFINE_UNQUOTED(HAVE_LSTAT_EMPTY_STRING_BUG, 1,
1248 [Define if lstat has the bug that it succeeds when given the zero-length
1249 file name argument. The lstat from SunOS4.1.4 and the Hurd as of 1998-11-01)
1256 dnl From Jim Meyering.
1259 AC_DEFUN(jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK,
1262 [whether lstat dereferences a symlink specified with a trailing slash],
1263 jm_cv_func_lstat_dereferences_slashed_symlink,
1265 rm -f conftest.sym conftest.file
1267 if ln -s conftest.file conftest.sym; then
1269 # include <sys/types.h>
1270 # include <sys/stat.h>
1276 /* Linux will dereference the symlink and fail.
1277 That is better in the sense that it means we will not
1278 have to compile and use the lstat wrapper. */
1279 exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1);
1282 jm_cv_func_lstat_dereferences_slashed_symlink=yes,
1283 jm_cv_func_lstat_dereferences_slashed_symlink=no,
1284 dnl When crosscompiling, be pessimistic so we will end up using the
1285 dnl replacement version of lstat that checkes for trailing slashes
1286 dnl and calls lstat a second time when necessary.
1287 jm_cv_func_lstat_dereferences_slashed_symlink=no
1290 # If the `ln -s' command failed, then we probably don't even
1291 # have an lstat function.
1292 jm_cv_func_lstat_dereferences_slashed_symlink=no
1296 test $jm_cv_func_lstat_dereferences_slashed_symlink = yes \
1299 AC_DEFINE_UNQUOTED(LSTAT_FOLLOWS_SLASHED_SYMLINK, $zero_one,
1300 [Define if lstat dereferences a symlink specified with a trailing slash])
1302 if test $jm_cv_func_lstat_dereferences_slashed_symlink = no; then
1304 # Append lstat.o if it's not already in $LIBOBJS.
1306 *lstat.$ac_objext*) ;;
1307 *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;;
1314 dnl From Jim Meyering.
1315 dnl Determine whether stat has the bug that it succeeds when given the
1316 dnl zero-length file name argument. The stat from SunOS4.1.4 and the Hurd
1317 dnl (as of 1998-11-01) do this.
1319 dnl If it does, then define HAVE_STAT_EMPTY_STRING_BUG and arrange to
1320 dnl compile the wrapper function.
1323 AC_DEFUN(jm_FUNC_STAT,
1325 AC_CACHE_CHECK([whether stat accepts an empty string],
1326 jm_cv_func_stat_empty_string_bug,
1328 # include <sys/types.h>
1329 # include <sys/stat.h>
1335 exit (stat ("", &sbuf) ? 1 : 0);
1338 jm_cv_func_stat_empty_string_bug=yes,
1339 jm_cv_func_stat_empty_string_bug=no,
1340 dnl When crosscompiling, assume stat is broken.
1341 jm_cv_func_stat_empty_string_bug=yes)
1343 if test $jm_cv_func_stat_empty_string_bug = yes; then
1345 LIBOBJS="$LIBOBJS stat.$ac_objext"
1346 AC_DEFINE_UNQUOTED(HAVE_STAT_EMPTY_STRING_BUG, 1,
1347 [Define if stat has the bug that it succeeds when given the zero-length
1348 file name argument. The stat from SunOS4.1.4 and the Hurd as of 1998-11-01)
1355 dnl From Jim Meyering.
1356 dnl Determine whether realloc works when both arguments are 0.
1357 dnl If it doesn't, arrange to use the replacement function.
1360 AC_DEFUN(jm_FUNC_REALLOC,
1362 dnl xmalloc.c requires that this symbol be defined so it doesn't
1363 dnl mistakenly use a broken realloc -- as it might if this test were omitted.
1364 AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_REALLOC_CHECK, 1,
1365 [Define if the realloc check has been performed. ])
1367 AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc,
1373 exit (realloc (0, 0) ? 0 : 1);
1376 jm_cv_func_working_realloc=yes,
1377 jm_cv_func_working_realloc=no,
1378 dnl When crosscompiling, assume realloc is broken.
1379 jm_cv_func_working_realloc=no)
1381 if test $jm_cv_func_working_realloc = no; then
1383 LIBOBJS="$LIBOBJS realloc.$ac_objext"
1384 AC_DEFINE_UNQUOTED(realloc, rpl_realloc,
1385 [Define to rpl_realloc if the replacement function should be used.])
1391 dnl From Jim Meyering.
1392 dnl Determine whether malloc accepts 0 as its argument.
1393 dnl If it doesn't, arrange to use the replacement function.
1396 AC_DEFUN(jm_FUNC_MALLOC,
1398 dnl xmalloc.c requires that this symbol be defined so it doesn't
1399 dnl mistakenly use a broken malloc -- as it might if this test were omitted.
1400 AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_MALLOC_CHECK, 1,
1401 [Define if the malloc check has been performed. ])
1403 AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc,
1409 exit (malloc (0) ? 0 : 1);
1412 jm_cv_func_working_malloc=yes,
1413 jm_cv_func_working_malloc=no,
1414 dnl When crosscompiling, assume malloc is broken.
1415 jm_cv_func_working_malloc=no)
1417 if test $jm_cv_func_working_malloc = no; then
1419 LIBOBJS="$LIBOBJS malloc.$ac_objext"
1420 AC_DEFINE_UNQUOTED(malloc, rpl_malloc,
1421 [Define to rpl_malloc if the replacement function should be used.])
1427 dnl From Jim Meyering.
1428 dnl Determine whether the strerror_r implementation is one of
1429 dnl the broken ones that returns `int' rather than `char*'.
1430 dnl Actually, this tests only whether it returns a scalar
1431 dnl or an array, but that should be enough.
1432 dnl On at least DEC UNIX 4.0[A-D] and HP-UX B.10.20, strerror_r
1433 dnl returns `int'. This is used by lib/error.c.
1435 AC_DEFUN(jm_FUNC_STRERROR_R,
1438 AC_CHECK_FUNCS([strerror_r])
1439 if test $ac_cv_func_strerror_r = yes; then
1440 AC_CHECK_HEADERS(string.h)
1441 AC_CACHE_CHECK([for working strerror_r],
1442 jm_cv_func_working_strerror_r,
1448 # include <string.h>
1452 int buf; /* avoiding square brackets makes this easier */
1453 char x = *strerror_r (0, buf, sizeof buf);
1455 jm_cv_func_working_strerror_r=yes,
1456 jm_cv_func_working_strerror_r=no
1458 if test $jm_cv_func_working_strerror_r = yes; then
1459 AC_DEFINE_UNQUOTED(HAVE_WORKING_STRERROR_R, 1,
1460 [Define to 1 if strerror_r returns a string.])
1468 dnl SunOS's readdir is broken in such a way that rm.c has to add extra code
1469 dnl to test whether a NULL return value really means there are no more files
1470 dnl in the directory.
1472 dnl Detect the problem by creating a directory containing 300 files (254 not
1473 dnl counting . and .. is the minimum) and see if a loop doing `readdir; unlink'
1474 dnl removes all of them.
1476 dnl Define HAVE_WORKING_READDIR if readdir does *not* have this problem.
1478 dnl Written by Jim Meyering.
1480 AC_DEFUN(jm_FUNC_READDIR,
1482 AC_REQUIRE([AC_HEADER_DIRENT])
1483 AC_CHECK_HEADERS(string.h)
1484 AC_CACHE_CHECK([for working readdir], jm_cv_func_working_readdir,
1486 # Arrange for deletion of the temporary directory this test creates, in
1487 # case the test itself fails to delete everything -- as happens on Sunos.
1488 ac_clean_files="$ac_clean_files conf-dir"
1491 [# include <stdio.h>
1492 # include <sys/types.h>
1494 # include <string.h>
1497 # ifdef HAVE_DIRENT_H
1498 # include <dirent.h>
1499 # define NLENGTH(direct) (strlen((direct)->d_name))
1500 # else /* not HAVE_DIRENT_H */
1501 # define dirent direct
1502 # define NLENGTH(direct) ((direct)->d_namlen)
1503 # ifdef HAVE_SYS_NDIR_H
1504 # include <sys/ndir.h>
1505 # endif /* HAVE_SYS_NDIR_H */
1506 # ifdef HAVE_SYS_DIR_H
1507 # include <sys/dir.h>
1508 # endif /* HAVE_SYS_DIR_H */
1511 # endif /* HAVE_NDIR_H */
1512 # endif /* HAVE_DIRENT_H */
1514 # define DOT_OR_DOTDOT(Basename) \
1515 (Basename[0] == '.' && (Basename[1] == '\0' \
1516 || (Basename[1] == '.' && Basename[2] == '\0')))
1519 create_300_file_dir (const char *dir)
1523 if (mkdir (dir, 0700))
1528 for (i = 0; i < 300; i++)
1533 sprintf (file_name, "%03d", i);
1534 out = fopen (file_name, "w");
1537 if (fclose (out) == EOF)
1546 remove_dir (const char *dir)
1553 dirp = opendir (".");
1559 struct dirent *dp = readdir (dirp);
1563 if (DOT_OR_DOTDOT (dp->d_name))
1566 if (unlink (dp->d_name))
1581 const char *dir = "conf-dir";
1582 create_300_file_dir (dir);
1586 jm_cv_func_working_readdir=yes,
1587 jm_cv_func_working_readdir=no,
1588 jm_cv_func_working_readdir=no)])
1590 if test $jm_cv_func_working_readdir = yes; then
1591 AC_DEFINE_UNQUOTED(HAVE_WORKING_READDIR, 1,
1592 [Define if readdir is found to work properly in some unusual cases. ])
1598 dnl A replacement for autoconf's AC_FUNC_MEMCMP that detects
1599 dnl the losing memcmp on some x86 Next systems.
1600 AC_DEFUN(jm_AC_FUNC_MEMCMP,
1601 [AC_CACHE_CHECK([for working memcmp], jm_cv_func_memcmp_working,
1606 /* Some versions of memcmp are not 8-bit clean. */
1607 char c0 = 0x40, c1 = 0x80, c2 = 0x81;
1608 if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
1611 /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
1612 or more and with at least one buffer not starting on a 4-byte boundary.
1613 William Lewis provided this test program. */
1618 for (i = 0; i < 4; i++)
1622 strcpy (a, "--------01111111");
1623 strcpy (b, "--------10000000");
1624 if (memcmp (a, b, 16) >= 0)
1630 jm_cv_func_memcmp_working=yes,
1631 jm_cv_func_memcmp_working=no,
1632 jm_cv_func_memcmp_working=no)])
1633 test $jm_cv_func_memcmp_working = no \
1634 && LIBOBJS="$LIBOBJS memcmp.$ac_objext"
1635 AC_SUBST(LIBOBJS)dnl
1638 AC_DEFUN(jm_FUNC_MEMCMP,
1639 [AC_REQUIRE([jm_AC_FUNC_MEMCMP])dnl
1640 if test $jm_cv_func_memcmp_working = no; then
1641 AC_DEFINE_UNQUOTED(memcmp, rpl_memcmp,
1642 [Define to rpl_memcmp if the replacement function should be used.])
1648 dnl From Jim Meyering.
1650 dnl See if the glibc *_unlocked I/O macros are available.
1651 dnl Use only those *_unlocked macros that are declared.
1654 AC_DEFUN(jm_FUNC_GLIBC_UNLOCKED_IO,
1656 io_functions='clearerr_unlocked feof_unlocked ferror_unlocked
1657 fflush_unlocked fputc_unlocked fread_unlocked fwrite_unlocked
1658 getc_unlocked getchar_unlocked putc_unlocked putchar_unlocked'
1659 for jm_io_func in $io_functions; do
1660 # Check for the existence of each function only if its declared.
1661 # Otherwise, we'd get the Solaris5.5.1 functions that are not
1662 # declared, and that have been removed from Solaris5.6. The resulting
1663 # 5.5.1 binaries would not run on 5.6 due to shared library differences.
1664 AC_CHECK_DECLS(($jm_io_func),
1667 [#include <stdio.h>])
1668 if test $jm_declared = yes; then
1669 AC_CHECK_FUNCS($jm_io_func)
1677 dnl Determine whether to add fnmatch.o to LIBOBJS and to
1678 dnl define fnmatch to rpl_fnmatch.
1683 # We look for fnmatch.h to avoid that the test fails in C++.
1684 AC_DEFUN(kd_FUNC_FNMATCH_CASE,
1685 [AC_CHECK_HEADERS(fnmatch.h)
1686 AC_CACHE_CHECK(for working fnmatch with case folding, ac_cv_func_fnmatch_works,
1687 # Some versions of Solaris or SCO have a broken fnmatch function.
1688 # So we run a test program. If we are cross-compiling, take no chance.
1689 # Also want FNM_CASEFOLD
1690 # Thanks to John Oleynick and Franc,ois Pinard for this test.
1695 # include <fnmatch.h>
1701 exit (fnmatch ("A*", "abc", FNM_CASEFOLD) != 0);
1703 ac_cv_func_fnmatch_works=yes, ac_cv_func_fnmatch_works=no,
1704 ac_cv_func_fnmatch_works=no)])
1705 if test $ac_cv_func_fnmatch_works = yes; then
1706 AC_DEFINE(HAVE_FNMATCH, 1,
1707 [Define if your system has a working `fnmatch' function with case folding.])
1712 AC_DEFUN(kd_FUNC_FNMATCH_CASE_RPL,
1714 AC_REQUIRE([AM_GLIBC])
1715 kd_FUNC_FNMATCH_CASE
1716 if test $ac_cv_func_fnmatch_works = no \
1717 && test $ac_cv_gnu_library = no; then
1719 LIBOBJS="$LIBOBJS fnmatch.$ac_objext"
1720 AC_DEFINE_UNQUOTED(fnmatch, rpl_fnmatch,
1721 [Define to rpl_fnmatch if the replacement function should be used.])
1727 dnl From Gordon Matzigkeit.
1728 dnl Test for the GNU C Library.
1729 dnl FIXME: this should migrate into libit.
1733 AC_CACHE_CHECK(whether we are using the GNU C Library,
1735 [AC_EGREP_CPP([Thanks for using GNU],
1737 #include <features.h>
1738 #ifdef __GNU_LIBRARY__
1739 Thanks for using GNU
1742 ac_cv_gnu_library=yes,
1743 ac_cv_gnu_library=no)
1746 AC_CACHE_CHECK(for version 2 of the GNU C Library,
1748 [AC_EGREP_CPP([Thanks for using GNU too],
1750 #include <features.h>
1752 Thanks for using GNU too
1755 ac_cv_glibc=yes, ac_cv_glibc=no)
1764 AC_CHECKING(for AFS)
1766 && AC_DEFINE(AFS, 1, [Define if you have the Andrew File System.])
1771 # autoconf tests required for use of xstrtoumax.c
1773 AC_DEFUN(jm_AC_PREREQ_XSTRTOUMAX,
1775 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
1776 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
1777 AC_CHECK_HEADERS(stdlib.h)
1779 AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro],
1780 jm_cv_func_strtoumax_macro,
1781 AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include <inttypes.h>
1783 inttypes_h_defines_strtoumax
1785 jm_cv_func_strtoumax_macro=yes,
1786 jm_cv_func_strtoumax_macro=no))
1788 if test "$jm_cv_func_strtoumax_macro" != yes; then
1789 AC_REPLACE_FUNCS(strtoumax)
1792 dnl We don't need (and can't compile) the replacement strtoull
1793 dnl unless the type `unsigned long long' exists.
1794 dnl Also, only the replacement strtoumax invokes strtoull,
1795 dnl so we need the replacement strtoull only if strtoumax does not exist.
1796 case "$ac_cv_type_unsigned_long_long,$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in
1798 AC_REPLACE_FUNCS(strtoull)
1806 dnl From Paul Eggert.
1808 AC_DEFUN(jm_AC_TYPE_UNSIGNED_LONG_LONG,
1810 AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
1811 [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
1812 [unsigned long long ullmax = (unsigned long long) -1;
1813 return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
1814 ac_cv_type_unsigned_long_long=yes,
1815 ac_cv_type_unsigned_long_long=no)])
1816 if test $ac_cv_type_unsigned_long_long = yes; then
1817 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
1818 [Define if you have the unsigned long long type.])
1823 dnl Run a program to determine whether whether link(2) follows symlinks.
1824 dnl Set LINK_FOLLOWS_SYMLINKS accordingly.
1826 AC_DEFUN(jm_AC_FUNC_LINK_FOLLOWS_SYMLINK,
1828 AC_CACHE_CHECK([whether link(2) follows symlinks],
1829 jm_ac_cv_func_link_follows_symlink,
1831 dnl poor-man's AC_REQUIRE: FIXME: repair this once autoconf-3 provides
1832 dnl the appropriate framework.
1833 test -z "$ac_cv_header_unistd_h" \
1834 && AC_CHECK_HEADERS(unistd.h)
1836 # Create a regular file.
1837 echo > conftest.file
1840 # include <sys/types.h>
1841 # include <sys/stat.h>
1842 # ifdef HAVE_UNISTD_H
1843 # include <unistd.h>
1846 # define SAME_INODE(Stat_buf_1, Stat_buf_2) \
1847 ((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
1848 && (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)
1853 const char *file = "conftest.file";
1854 const char *sym = "conftest.sym";
1855 const char *hard = "conftest.hard";
1856 struct stat sb_file, sb_hard;
1858 /* Create a symlink to the regular file. */
1859 if (symlink (file, sym))
1862 /* Create a hard link to that symlink. */
1863 if (link (sym, hard))
1866 if (lstat (hard, &sb_hard))
1868 if (lstat (file, &sb_file))
1871 /* If the dev/inode of hard and file are the same, then
1872 the link call followed the symlink. */
1873 return SAME_INODE (sb_hard, sb_file) ? 0 : 1;
1876 jm_ac_cv_func_link_follows_symlink=yes,
1877 jm_ac_cv_func_link_follows_symlink=no,
1878 jm_ac_cv_func_link_follows_symlink=yes dnl We're cross compiling.
1881 if test $jm_ac_cv_func_link_follows_symlink = yes; then
1882 AC_DEFINE(LINK_FOLLOWS_SYMLINKS, 1,
1883 [Define if `link(2)' dereferences symbolic links.])
1887 # From Jim Meyering. Use this if you use the GNU error.[ch].
1888 # FIXME: Migrate into libit
1890 AC_DEFUN([AM_FUNC_ERROR_AT_LINE],
1891 [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
1892 [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
1893 am_cv_lib_error_at_line=yes,
1894 am_cv_lib_error_at_line=no)])
1895 if test $am_cv_lib_error_at_line = no; then
1896 LIBOBJS="$LIBOBJS error.$ac_objext"
1898 AC_SUBST(LIBOBJS)dnl
1903 dnl This macro is intended to be used solely in this file.
1904 dnl These are the prerequisite macros for GNU's strftime.c replacement.
1905 AC_DEFUN(_jm_STRFTIME_PREREQS,
1907 dnl strftime.c uses localtime_r if it exists. Check for it.
1908 AC_CHECK_FUNCS(localtime_r)
1910 AC_CHECK_HEADERS(limits.h)
1911 AC_CHECK_FUNCS(bcopy tzset mempcpy memcpy memset)
1913 # This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE.
1916 AC_CHECK_FUNCS(mblen mbrlen)
1918 AC_CHECK_MEMBER(struct tm.tm_gmtoff,
1919 [AC_DEFINE(HAVE_TM_GMTOFF, 1,
1920 [Define if struct tm has the tm_gmtoff member.])],
1922 [#include <time.h>])
1925 dnl Determine if the strftime function has all the features of the GNU one.
1927 dnl From Jim Meyering.
1929 AC_DEFUN(jm_FUNC_GNU_STRFTIME,
1930 [AC_REQUIRE([AC_HEADER_TIME])dnl
1932 _jm_STRFTIME_PREREQS
1934 AC_REQUIRE([AC_C_CONST])dnl
1935 AC_REQUIRE([AC_HEADER_STDC])dnl
1936 AC_CHECK_HEADERS(sys/time.h)
1937 AC_CACHE_CHECK([for working GNU strftime], jm_cv_func_working_gnu_strftime,
1938 [# Set TZ to GMT0 to make strftime give consistent results during the test.
1939 ac_save_TZ="${TZ-GMT0}"
1943 [ /* Ulrich Drepper provided parts of the test program. */
1945 # include <stdlib.h>
1948 #if TIME_WITH_SYS_TIME
1949 # include <sys/time.h>
1952 # if HAVE_SYS_TIME_H
1953 # include <sys/time.h>
1960 compare (const char *fmt, const struct tm *tm, const char *expected)
1963 strftime (buf, 99, fmt, tm);
1964 if (strcmp (buf, expected))
1966 #ifdef SHOW_FAILURES
1967 printf ("fmt: \"%s\", expected \"%s\", got \"%s\"\n",
1968 fmt, expected, buf);
1980 time_t t = 738367; /* Fri Jan 9 13:06:07 1970 */
1984 #define CMP(Fmt, Expected) n_fail += compare ((Fmt), tm, (Expected))
1986 CMP ("%-m", "1"); /* GNU */
1987 CMP ("%A", "Friday");
1988 CMP ("%^A", "FRIDAY"); /* The ^ is a GNU extension. */
1989 CMP ("%B", "January");
1990 CMP ("%^B", "JANUARY");
1991 CMP ("%C", "19"); /* POSIX.2 */
1992 CMP ("%D", "01/09/70"); /* POSIX.2 */
1993 CMP ("%F", "1970-01-09");
1994 CMP ("%G", "1970"); /* GNU */
1999 CMP ("%R", "13:06"); /* POSIX.2 */
2001 CMP ("%T", "13:06:07"); /* POSIX.2 */
2005 CMP ("%X", "13:06:07");
2008 CMP ("%_m", " 1"); /* GNU */
2013 CMP ("%c", "Fri Jan 9 13:06:07 1970");
2014 CMP ("%^c", "FRI JAN 9 13:06:07 1970");
2016 CMP ("%e", " 9"); /* POSIX.2 */
2017 CMP ("%g", "70"); /* GNU */
2018 CMP ("%h", "Jan"); /* POSIX.2 */
2021 CMP ("%k", "13"); /* GNU */
2022 CMP ("%l", " 1"); /* GNU */
2024 CMP ("%n", "\n"); /* POSIX.2 */
2026 CMP ("%r", "01:06:07 PM"); /* POSIX.2 */
2027 CMP ("%s", "738367"); /* GNU */
2028 CMP ("%t", "\t"); /* POSIX.2 */
2029 CMP ("%u", "5"); /* POSIX.2 */
2031 CMP ("%x", "01/09/70");
2033 CMP ("%z", "+0000"); /* GNU */
2035 exit (n_fail ? 1 : 0);
2037 jm_cv_func_working_gnu_strftime=yes,
2038 jm_cv_func_working_gnu_strftime=no,
2039 dnl When crosscompiling, assume strftime is missing or broken.
2040 jm_cv_func_working_gnu_strftime=no)
2041 dnl If TZ wasn't set before, this sets it to GMT0. No real harm done.
2044 if test $jm_cv_func_working_gnu_strftime = no; then
2046 LIBOBJS="$LIBOBJS strftime.$ac_objext"
2047 AC_DEFINE_UNQUOTED(strftime, gnu_strftime,
2048 [Define to gnu_strftime if the replacement function should be used.])
2052 AC_DEFUN(jm_FUNC_STRFTIME,
2054 _jm_STRFTIME_PREREQS
2055 AC_REPLACE_FUNCS(strftime)
2060 dnl See if there's a working, system-supplied version of the getline function.
2061 dnl We can't just do AC_REPLACE_FUNCS(getline) because some systems
2062 dnl have a function by that name in -linet that doesn't have anything
2063 dnl to do with the function we need.
2064 AC_DEFUN(AM_FUNC_GETLINE,
2066 am_getline_needs_run_time_check=no
2067 AC_CHECK_FUNC(getline,
2068 dnl Found it in some library. Verify that it works.
2069 am_getline_needs_run_time_check=yes,
2070 am_cv_func_working_getline=no)
2071 if test $am_getline_needs_run_time_check = yes; then
2072 AC_CHECK_HEADERS(string.h)
2073 AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline,
2074 [echo fooN |tr -d '\012'|tr N '\012' > conftest.data
2077 # include <sys/types.h>
2079 # include <string.h>
2082 { /* Based on a test program from Karl Heuer. */
2086 FILE *in = fopen ("./conftest.data", "r");
2089 len = getline (&line, &siz, in);
2090 exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1);
2092 ], am_cv_func_working_getline=yes dnl The library version works.
2093 , am_cv_func_working_getline=no dnl The library version does NOT work.
2094 , am_cv_func_working_getline=no dnl We're cross compiling.
2098 if test $am_cv_func_working_getline = yes; then
2099 AC_DEFINE(HAVE_GETLINE, 1,
2100 [Define if you have the GETLINE function.])dnl
2106 dnl From Jim Meyering.
2108 dnl See if struct statfs has the f_fstypename member.
2109 dnl If so, define HAVE_F_FSTYPENAME_IN_STATFS.
2112 AC_DEFUN(jm_FSTYPENAME,
2114 AC_CACHE_CHECK([for f_fstypename in struct statfs],
2115 fu_cv_sys_f_fstypename_in_statfs,
2119 #include <sys/param.h>
2120 #include <sys/types.h>
2121 #include <sys/mount.h>
2123 [struct statfs s; int i = sizeof s.f_fstypename;],
2124 fu_cv_sys_f_fstypename_in_statfs=yes,
2125 fu_cv_sys_f_fstypename_in_statfs=no
2130 if test $fu_cv_sys_f_fstypename_in_statfs = yes; then
2131 AC_DEFINE_UNQUOTED(HAVE_F_FSTYPENAME_IN_STATFS, 1,
2132 [Define if struct statfs has the f_fstypename member.])
2139 dnl From Paul Eggert.
2141 # Define ST_MTIM_NSEC to be the nanoseconds member of struct stat's st_mtim,
2144 AC_DEFUN(AC_STRUCT_ST_MTIM_NSEC,
2145 [AC_CACHE_CHECK([for nanoseconds member of struct stat.st_mtim],
2146 ac_cv_struct_st_mtim_nsec,
2147 [ac_save_CPPFLAGS="$CPPFLAGS"
2148 ac_cv_struct_st_mtim_nsec=no
2149 # tv_nsec -- the usual case
2150 # _tv_nsec -- Solaris 2.6, if
2151 # (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1
2152 # && !defined __EXTENSIONS__)
2153 # st__tim.tv_nsec -- UnixWare 2.1.2
2154 for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do
2155 CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val"
2156 AC_TRY_COMPILE([#include <sys/types.h>
2157 #include <sys/stat.h>], [struct stat s; s.st_mtim.ST_MTIM_NSEC;],
2158 [ac_cv_struct_st_mtim_nsec=$ac_val; break])
2160 CPPFLAGS="$ac_save_CPPFLAGS"])
2162 if test $ac_cv_struct_st_mtim_nsec != no; then
2163 AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec,
2164 [Define to be the nanoseconds member of struct stat's st_mtim,
2172 # Define HAVE_ST_DM_MODE if struct stat has an st_dm_mode member.
2174 AC_DEFUN(AC_STRUCT_ST_DM_MODE,
2175 [AC_CACHE_CHECK([for st_dm_mode in struct stat], ac_cv_struct_st_dm_mode,
2176 [AC_TRY_COMPILE([#include <sys/types.h>
2177 #include <sys/stat.h>], [struct stat s; s.st_dm_mode;],
2178 ac_cv_struct_st_dm_mode=yes,
2179 ac_cv_struct_st_dm_mode=no)])
2181 if test $ac_cv_struct_st_dm_mode = yes; then
2182 AC_DEFINE_UNQUOTED(HAVE_ST_DM_MODE, 1,
2183 [Define if struct stat has an st_dm_mode member. ])
2190 dnl From Jim Meyering
2192 dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
2193 dnl in time.h or sys/time.h.
2195 AC_DEFUN(jm_CHECK_TYPE_STRUCT_TIMESPEC,
2197 AC_REQUIRE([AC_HEADER_TIME])
2198 AC_CACHE_CHECK([for struct timespec], fu_cv_sys_struct_timespec,
2201 # if TIME_WITH_SYS_TIME
2202 # include <sys/time.h>
2205 # if HAVE_SYS_TIME_H
2206 # include <sys/time.h>
2212 [static struct timespec x; x.tv_sec = x.tv_nsec;],
2213 fu_cv_sys_struct_timespec=yes,
2214 fu_cv_sys_struct_timespec=no)
2217 if test $fu_cv_sys_struct_timespec = yes; then
2218 AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMESPEC, 1,
2219 [Define if struct timespec is declared in <time.h>. ])
2225 dnl From Paul Eggert.
2229 # Define uintmax_t to `unsigned long' or `unsigned long long'
2230 # if <inttypes.h> does not exist.
2232 AC_DEFUN(jm_AC_TYPE_UINTMAX_T,
2234 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
2235 if test $jm_ac_cv_header_inttypes_h = no; then
2236 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
2237 test $ac_cv_type_unsigned_long_long = yes \
2238 && ac_type='unsigned long long' \
2239 || ac_type='unsigned long'
2240 AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
2241 [ Define to unsigned long or unsigned long long
2242 if <inttypes.h> doesn't define.])
2246 # Macro to add for using GNU gettext.
2247 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2249 # This file can be copied and used freely without restrictions. It can
2250 # be used in projects which are not available under the GNU Public License
2251 # but which still want to provide support for the GNU gettext functionality.
2252 # Please note that the actual code is *not* freely available.
2256 AC_PREREQ(2.13) dnl Minimum Autoconf version required.
2258 AC_DEFUN(AM_WITH_NLS,
2259 [AC_MSG_CHECKING([whether NLS is requested])
2260 dnl Default is enabled NLS
2262 [ --disable-nls do not use Native Language Support],
2263 USE_NLS=$enableval, USE_NLS=yes)
2264 AC_MSG_RESULT($USE_NLS)
2267 USE_INCLUDED_LIBINTL=no
2269 dnl If we use NLS figure out what method
2270 if test "$USE_NLS" = "yes"; then
2271 AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested.])
2272 AC_MSG_CHECKING([whether included gettext is requested])
2273 AC_ARG_WITH(included-gettext,
2274 [ --with-included-gettext use the GNU gettext library included here],
2275 nls_cv_force_use_gnu_gettext=$withval,
2276 nls_cv_force_use_gnu_gettext=no)
2277 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
2279 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
2280 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
2281 dnl User does not insist on using GNU NLS library. Figure out what
2282 dnl to use. If gettext or catgets are available (in this order) we
2283 dnl use this. Else we have to fall back to GNU NLS library.
2284 dnl catgets is only used if permitted by option --with-catgets.
2286 nls_cv_header_libgt=
2289 AC_CHECK_HEADER(libintl.h,
2290 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
2291 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
2292 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
2294 if test "$gt_cv_func_gettext_libc" != "yes"; then
2295 AC_CHECK_LIB(intl, bindtextdomain,
2296 [AC_CHECK_LIB(intl, gettext)])
2299 if test "$gt_cv_func_gettext_libc" = "yes" \
2300 || test "$ac_cv_lib_intl_gettext" = "yes"; then
2301 AC_DEFINE(HAVE_GETTEXT, 1,
2302 [Define to 1 if you have gettext and don't want to use GNU gettext.])
2303 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2304 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
2305 if test "$MSGFMT" != "no"; then
2306 AC_CHECK_FUNCS(dcgettext)
2307 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2308 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2309 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2310 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
2311 return _nl_msg_cat_cntr],
2321 if test "$CATOBJEXT" = "NONE"; then
2322 AC_MSG_CHECKING([whether catgets can be used])
2323 AC_ARG_WITH(catgets,
2324 [ --with-catgets use catgets functions if available],
2325 nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
2326 AC_MSG_RESULT($nls_cv_use_catgets)
2328 if test "$nls_cv_use_catgets" = "yes"; then
2329 dnl No gettext in C library. Try catgets next.
2330 AC_CHECK_LIB(i, main)
2331 AC_CHECK_FUNC(catgets,
2332 [AC_DEFINE(HAVE_CATGETS, 1,
2333 [Define as 1 if you have catgets and don't want to use GNU gettext.])
2334 INTLOBJS="\$(CATOBJS)"
2335 AC_PATH_PROG(GENCAT, gencat, no)dnl
2336 if test "$GENCAT" != "no"; then
2337 AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
2338 if test "$GMSGFMT" = "no"; then
2339 AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
2340 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
2342 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2343 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2344 USE_INCLUDED_LIBINTL=yes
2348 INTLDEPS='$(top_builddir)/intl/libintl.a'
2350 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
2351 nls_cv_header_intl=intl/libintl.h
2352 nls_cv_header_libgt=intl/libgettext.h
2357 if test "$CATOBJEXT" = "NONE"; then
2358 dnl Neither gettext nor catgets in included in the C library.
2359 dnl Fall back on GNU gettext library.
2360 nls_cv_use_gnu_gettext=yes
2364 if test "$nls_cv_use_gnu_gettext" = "yes"; then
2365 dnl Mark actions used to generate GNU NLS library.
2366 INTLOBJS="\$(GETTOBJS)"
2367 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2368 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
2369 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2370 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2371 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2373 USE_INCLUDED_LIBINTL=yes
2377 INTLDEPS='$(top_builddir)/intl/libintl.a'
2379 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
2380 nls_cv_header_intl=intl/libintl.h
2381 nls_cv_header_libgt=intl/libgettext.h
2384 dnl Test whether we really found GNU xgettext.
2385 if test "$XGETTEXT" != ":"; then
2386 dnl If it is no GNU xgettext we define it as : so that the
2387 dnl Makefiles still can work.
2388 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
2392 [found xgettext program is not GNU xgettext; ignore it])
2397 # We need to process the po/ directory.
2401 nls_cv_header_intl=intl/libintl.h
2402 nls_cv_header_libgt=intl/libgettext.h
2404 if test -z "$nls_cv_header_intl"; then
2405 # Clean out junk possibly left behind by a previous configuration.
2406 rm -f intl/libintl.h
2408 AC_CONFIG_LINKS($nls_cv_header_intl:$nls_cv_header_libgt)
2410 [case "$CONFIG_FILES" in *po/Makefile.in*)
2411 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
2415 # If this is used in GNU gettext we have to set USE_NLS to `yes'
2416 # because some of the sources are only built for this goal.
2417 if test "$PACKAGE" = gettext; then
2419 USE_INCLUDED_LIBINTL=yes
2422 dnl These rules are solely for the distribution goal. While doing this
2423 dnl we only have to keep exactly one list of the available catalogs
2424 dnl in configure.in.
2425 for lang in $ALL_LINGUAS; do
2426 GMOFILES="$GMOFILES $lang.gmo"
2427 POFILES="$POFILES $lang.po"
2430 dnl Make all variables we use known to autoconf.
2431 AC_SUBST(USE_INCLUDED_LIBINTL)
2434 AC_SUBST(DATADIRNAME)
2436 AC_SUBST(INSTOBJEXT)
2444 AC_DEFUN(AM_GNU_GETTEXT,
2445 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
2446 AC_REQUIRE([AC_PROG_CC])dnl
2447 AC_REQUIRE([AC_PROG_RANLIB])dnl
2448 AC_REQUIRE([AC_ISC_POSIX])dnl
2449 AC_REQUIRE([AC_HEADER_STDC])dnl
2450 AC_REQUIRE([AC_C_CONST])dnl
2451 AC_REQUIRE([AC_C_INLINE])dnl
2452 AC_REQUIRE([AC_TYPE_OFF_T])dnl
2453 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
2454 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
2455 AC_REQUIRE([AC_FUNC_MMAP])dnl
2457 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
2458 unistd.h sys/param.h])
2459 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
2460 strdup __argz_count __argz_stringify __argz_next])
2462 if test "${ac_cv_func_stpcpy+set}" != "set"; then
2463 AC_CHECK_FUNCS(stpcpy)
2465 if test "${ac_cv_func_stpcpy}" = "yes"; then
2466 AC_DEFINE(HAVE_STPCPY, 1, [Define to 1 if you have the stpcpy function.])
2472 if test "x$CATOBJEXT" != "x"; then
2473 if test "x$ALL_LINGUAS" = "x"; then
2476 AC_MSG_CHECKING(for catalogs to be installed)
2478 for lang in ${LINGUAS=$ALL_LINGUAS}; do
2479 case "$ALL_LINGUAS" in
2480 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
2483 LINGUAS=$NEW_LINGUAS
2484 AC_MSG_RESULT($LINGUAS)
2487 dnl Construct list of names of catalog files to be constructed.
2488 if test -n "$LINGUAS"; then
2489 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
2493 dnl The reference to <locale.h> in the installed <libintl.h> file
2494 dnl must be resolved because we cannot expect the users of this
2495 dnl to define HAVE_LOCALE_H.
2496 if test $ac_cv_header_locale_h = yes; then
2497 INCLUDE_LOCALE_H="#include <locale.h>"
2500 /* The system does not provide the header <locale.h>. Take care yourself. */"
2502 AC_SUBST(INCLUDE_LOCALE_H)
2504 dnl Determine which catalog format we have (if any is needed)
2505 dnl For now we know about two different formats:
2506 dnl Linux libc-5 and the normal X/Open format
2507 test -d intl || mkdir intl
2508 if test "$CATOBJEXT" = ".cat"; then
2509 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
2511 dnl Transform the SED scripts while copying because some dumb SEDs
2512 dnl cannot handle comments.
2513 sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
2515 dnl po2tbl.sed is always needed.
2516 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
2517 $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
2519 dnl In the intl/Makefile.in we have a special dependency which makes
2520 dnl only sense for gettext. We comment this out for non-gettext
2522 if test "$PACKAGE" = "gettext"; then
2532 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
2533 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
2534 dnl Try to locate is.
2536 if test -n "$ac_aux_dir"; then
2537 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
2539 if test -z "$MKINSTALLDIRS"; then
2540 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
2542 AC_SUBST(MKINSTALLDIRS)
2544 dnl *** For now the libtool support in intl/Makefile is not for real.
2548 dnl Generate list of files to be processed by xgettext which will
2549 dnl be included in po/Makefile.
2550 test -d po || mkdir po
2553 posrcprefix="../" ;;
2555 posrcprefix="$srcdir/" ;;
2557 posrcprefix="../$srcdir/" ;;
2560 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
2561 < $srcdir/po/POTFILES.in > po/POTFILES
2564 # Search path for a program which passes the given test.
2565 # Ulrich Drepper <drepper@cygnus.com>, 1996.
2567 # This file can be copied and used freely without restrictions. It can
2568 # be used in projects which are not available under the GNU Public License
2569 # but which still want to provide support for the GNU gettext functionality.
2570 # Please note that the actual code is *not* freely available.
2574 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
2575 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
2576 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
2577 [# Extract the first word of "$2", so it can be a program name with args.
2578 set dummy $2; ac_word=[$]2
2579 AC_MSG_CHECKING([for $ac_word])
2580 AC_CACHE_VAL(ac_cv_path_$1,
2583 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
2586 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
2587 for ac_dir in ifelse([$5], , $PATH, [$5]); do
2588 test -z "$ac_dir" && ac_dir=.
2589 if test -f $ac_dir/$ac_word; then
2591 ac_cv_path_$1="$ac_dir/$ac_word"
2597 dnl If no 4th arg is given, leave the cache variable unset,
2598 dnl so AC_PATH_PROGS will keep looking.
2599 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
2604 if test -n "[$]$1"; then
2605 AC_MSG_RESULT([$]$1)
2612 # Check whether LC_MESSAGES is available in <locale.h>.
2613 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2615 # This file can be copied and used freely without restrictions. It can
2616 # be used in projects which are not available under the GNU Public License
2617 # but which still want to provide support for the GNU gettext functionality.
2618 # Please note that the actual code is *not* freely available.
2622 AC_PREREQ(2.13) dnl Minimum Autoconf version required.
2624 AC_DEFUN(AM_LC_MESSAGES,
2625 [if test $ac_cv_header_locale_h = yes; then
2626 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
2627 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2628 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
2629 if test $am_cv_val_LC_MESSAGES = yes; then
2630 AC_DEFINE(HAVE_LC_MESSAGES, 1,
2631 [Define if your locale.h file contains LC_MESSAGES.])