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)
752 AC_DEFUN(jm_CHECK_ALL_TYPES,
754 dnl Checks for typedefs, structures, and compiler characteristics.
755 AC_REQUIRE([AC_C_BIGENDIAN])
756 AC_REQUIRE([AC_PROG_CC_STDC])
757 AC_REQUIRE([AC_C_CONST])
758 AC_REQUIRE([AC_C_VOLATILE])
759 AC_REQUIRE([AC_C_INLINE])
760 AC_REQUIRE([AC_C_LONG_DOUBLE])
762 AC_REQUIRE([AC_HEADER_DIRENT])
763 AC_REQUIRE([AC_HEADER_STDC])
764 AC_CHECK_MEMBERS((struct stat.st_blksize),,,[$ac_includes_default
765 #include <sys/stat.h>
767 AC_REQUIRE([AC_STRUCT_ST_BLOCKS])
769 AC_REQUIRE([AC_STRUCT_TM])
770 AC_REQUIRE([AC_STRUCT_TIMEZONE])
771 AC_REQUIRE([AC_HEADER_STAT])
772 AC_REQUIRE([AC_STRUCT_ST_MTIM_NSEC])
773 AC_REQUIRE([AC_STRUCT_ST_DM_MODE])
774 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_TIMESPEC])
776 AC_REQUIRE([AC_TYPE_GETGROUPS])
777 AC_REQUIRE([AC_TYPE_MODE_T])
778 AC_REQUIRE([AC_TYPE_OFF_T])
779 AC_REQUIRE([AC_TYPE_PID_T])
780 AC_REQUIRE([AC_TYPE_SIGNAL])
781 AC_REQUIRE([AC_TYPE_SIZE_T])
782 AC_REQUIRE([AC_TYPE_UID_T])
783 AC_CHECK_TYPE(ino_t, unsigned long)
785 dnl This relies on the fact that autoconf 2.14a's implementation of
786 dnl AC_CHECK_TYPE checks includes unistd.h.
787 AC_CHECK_TYPE(ssize_t, int)
789 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
790 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
792 AC_REQUIRE([AC_HEADER_MAJOR])
793 AC_REQUIRE([AC_HEADER_DIRENT])
799 dnl Initially derived from code in GNU grep.
800 dnl Mostly written by Jim Meyering.
802 dnl Usage: jm_INCLUDED_REGEX([lib/regex.c])
804 AC_DEFUN(jm_INCLUDED_REGEX,
806 dnl Even packages that don't use regex.c can use this macro.
807 dnl Of course, for them it doesn't do anything.
809 # Assume we'll default to using the included regex.c.
810 ac_use_included_regex=yes
812 # However, if the system regex support is good enough that it passes the
813 # the following run test, then default to *not* using the included regex.c.
814 # If cross compiling, assume the test would fail and use the included
815 # regex.c. The first failing regular expression is from `Spencer ere
816 # test #75' in grep-2.3.
817 AC_CACHE_CHECK([for working re_compile_pattern],
818 jm_cv_func_working_re_compile_pattern,
825 static struct re_pattern_buffer regex;
827 re_set_syntax (RE_SYNTAX_POSIX_EGREP);
828 /* Add this third left square bracket, [, to balance the
829 three right ones below. Otherwise autoconf-2.14 chokes. */
830 s = re_compile_pattern ("a[[:]:]]b\n", 9, ®ex);
831 /* This should fail with _Invalid character class name_ error. */
835 /* This should succeed, but doesn't for e.g. glibc-2.1.3. */
836 s = re_compile_pattern ("{1", 2, ®ex);
841 jm_cv_func_working_re_compile_pattern=yes,
842 jm_cv_func_working_re_compile_pattern=no,
843 dnl When crosscompiling, assume it's broken.
844 jm_cv_func_working_re_compile_pattern=no))
845 if test $jm_cv_func_working_re_compile_pattern = yes; then
846 ac_use_included_regex=no
849 test -n "$1" || AC_MSG_ERROR([missing argument])
854 AC_ARG_WITH(included-regex,
855 [ --without-included-regex don't compile regex; this is the default on
856 systems with version 2 of the GNU C library
857 (use with caution on other system)],
858 jm_with_regex=$withval,
859 jm_with_regex=$ac_use_included_regex)
860 if test "$jm_with_regex" = yes; then
862 LIBOBJS="$LIBOBJS regex.$ac_objext"
870 dnl based on code from Eleftherios Gkioulekas
874 AC_MSG_CHECKING(whether to enable assertions)
875 AC_ARG_ENABLE(assert,
876 [ --disable-assert turn off assertions],
878 AC_DEFINE(NDEBUG,1,[Define to 1 if assertions should be disabled.]) ],
879 [ AC_MSG_RESULT(yes) ]
885 dnl From Paul Eggert.
887 # Define HAVE_INTTYPES_H if <inttypes.h> exists,
888 # doesn't clash with <sys/types.h>, and declares uintmax_t.
890 AC_DEFUN(jm_AC_HEADER_INTTYPES_H,
892 AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
894 [#include <sys/types.h>
895 #include <inttypes.h>],
896 [uintmax_t i = (uintmax_t) -1;],
897 jm_ac_cv_header_inttypes_h=yes,
898 jm_ac_cv_header_inttypes_h=no)])
899 if test $jm_ac_cv_header_inttypes_h = yes; then
900 AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
901 [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
902 and declares uintmax_t. ])
908 dnl From Jim Meyering.
910 dnl Check whether struct dirent has a member named d_type.
913 AC_DEFUN(jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE,
914 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
915 AC_CACHE_CHECK([for d_type member in directory struct],
916 jm_cv_struct_dirent_d_type,
919 #include <sys/types.h>
922 #else /* not HAVE_DIRENT_H */
923 # define dirent direct
924 # ifdef HAVE_SYS_NDIR_H
925 # include <sys/ndir.h>
926 # endif /* HAVE_SYS_NDIR_H */
927 # ifdef HAVE_SYS_DIR_H
928 # include <sys/dir.h>
929 # endif /* HAVE_SYS_DIR_H */
932 # endif /* HAVE_NDIR_H */
933 #endif /* HAVE_DIRENT_H */
935 [struct dirent dp; dp.d_type = 0;],
937 jm_cv_struct_dirent_d_type=yes,
938 jm_cv_struct_dirent_d_type=no)
941 if test $jm_cv_struct_dirent_d_type = yes; then
942 AC_DEFINE(D_TYPE_IN_DIRENT, 1,
943 [Define if there is a member named d_type in the struct describing
951 dnl From Jim Meyering.
953 dnl Check whether struct dirent has a member named d_ino.
956 AC_DEFUN(jm_CHECK_TYPE_STRUCT_DIRENT_D_INO,
957 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
958 AC_CACHE_CHECK([for d_ino member in directory struct],
959 jm_cv_struct_dirent_d_ino,
962 #include <sys/types.h>
965 #else /* not HAVE_DIRENT_H */
966 # define dirent direct
967 # ifdef HAVE_SYS_NDIR_H
968 # include <sys/ndir.h>
969 # endif /* HAVE_SYS_NDIR_H */
970 # ifdef HAVE_SYS_DIR_H
971 # include <sys/dir.h>
972 # endif /* HAVE_SYS_DIR_H */
975 # endif /* HAVE_NDIR_H */
976 #endif /* HAVE_DIRENT_H */
978 [struct dirent dp; dp.d_ino = 0;],
980 jm_cv_struct_dirent_d_ino=yes,
981 jm_cv_struct_dirent_d_ino=no)
984 if test $jm_cv_struct_dirent_d_ino = yes; then
985 AC_DEFINE(D_INO_IN_DIRENT, 1,
986 [Define if there is a member named d_ino in the struct describing
992 #serial 9, except remove memchr and nanosleep as findutils doesn't need them
994 dnl This is just a wrapper function to encapsulate this kludge.
995 dnl Putting it in a separate file like this helps share it between
996 dnl different packages.
997 AC_DEFUN(jm_CHECK_DECLS,
999 AC_REQUIRE([_jm_DECL_HEADERS])
1000 AC_REQUIRE([AC_HEADER_TIME])
1004 # if !STDC_HEADERS && HAVE_MEMORY_H
1005 # include <memory.h>
1007 # include <string.h>
1010 # include <strings.h>
1014 # include <stdlib.h>
1017 # include <unistd.h>
1020 #include <sys/types.h>
1021 #if TIME_WITH_SYS_TIME
1022 # include <sys/time.h>
1025 # if HAVE_SYS_TIME_H
1026 # include <sys/time.h>
1045 ttyname), , , $headers)
1048 dnl FIXME: when autoconf has support for it.
1049 dnl This is a little helper so we can require these header checks.
1050 AC_DEFUN(_jm_DECL_HEADERS,
1052 AC_REQUIRE([AC_HEADER_STDC])
1053 AC_CHECK_HEADERS(memory.h string.h strings.h stdlib.h unistd.h sys/time.h)
1058 dnl These are the prerequisite macros for files in the lib/
1059 dnl directories of the fileutils, sh-utils, and textutils packages.
1064 jm_PREREQ_CANON_HOST
1071 AC_DEFUN(jm_PREREQ_ADDEXT,
1074 AC_SYS_LONG_FILE_NAMES
1075 AC_CHECK_FUNCS(pathconf)
1076 AC_CHECK_HEADERS(limits.h string.h unistd.h)
1079 AC_DEFUN(jm_PREREQ_CANON_HOST,
1081 dnl Add any libraries as early as possible.
1082 dnl In particular, inet_ntoa needs -lnsl at least on Solaris5.5.1,
1083 dnl so we have to add -lnsl to LIBS before checking for that function.
1084 AC_SEARCH_LIBS(gethostbyname, [inet nsl])
1086 dnl These come from -lnsl on Solaris5.5.1.
1087 AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
1089 AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
1090 AC_CHECK_HEADERS(unistd.h string.h netdb.h sys/socket.h \
1091 netinet/in.h arpa/inet.h)
1094 AC_DEFUN(jm_PREREQ_QUOTEARG,
1096 AC_CHECK_FUNCS(isascii iswprint mbrtowc)
1097 AC_CHECK_HEADERS(limits.h stdlib.h string.h wchar.h wctype.h)
1104 AC_DEFUN(jm_PREREQ_READUTMP,
1107 AC_CHECK_HEADERS(string.h utmpx.h sys/param.h)
1108 AC_CHECK_FUNCS(utmpname)
1109 AC_CHECK_FUNCS(utmpxname)
1113 $ac_includes_default
1120 AC_CHECK_MEMBERS((struct utmpx.ut_user),,,[$utmp_includes])
1121 AC_CHECK_MEMBERS((struct utmp.ut_user),,,[$utmp_includes])
1122 AC_CHECK_MEMBERS((struct utmpx.ut_name),,,[$utmp_includes])
1123 AC_CHECK_MEMBERS((struct utmp.ut_name),,,[$utmp_includes])
1126 AC_DEFUN(jm_PREREQ_REGEX,
1128 dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it.
1129 dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary
1131 AC_CHECK_FUNCS(bzero bcopy isascii btowc)
1132 AC_CHECK_HEADERS(alloca.h libintl.h wctype.h wchar.h)
1139 dnl FIXME: put these prerequisite-only *.m4 files in a separate
1140 dnl directory -- otherwise, they'll conflict with existing files.
1142 dnl These are the prerequisite macros for GNU's error.c file.
1143 AC_DEFUN(jm_PREREQ_ERROR,
1145 AC_CHECK_FUNCS(strerror strerror_r vprintf doprnt)
1151 dnl From Paul Eggert.
1153 AC_DEFUN(AC_C_BACKSLASH_A,
1155 AC_CACHE_CHECK([whether backslash-a works in strings], ac_cv_c_backslash_a,
1161 char buf['\a' == 'a' ? -1 : 1];
1163 return buf[0] != "\a"[0];
1165 ac_cv_c_backslash_a=yes,
1166 ac_cv_c_backslash_a=no)])
1167 if test $ac_cv_c_backslash_a = yes; then
1168 AC_DEFINE(HAVE_C_BACKSLASH_A, 1,
1169 [Define if backslash-a works in C strings.])
1177 # Some versions of BeOS define mbstate_t to be an incomplete type,
1178 # so you can't declare an object of that type.
1179 # Check for this incompatibility with Standard C.
1181 AC_DEFUN(AC_MBSTATE_T_OBJECT,
1182 [AC_CACHE_CHECK([for mbstate_t object type], ac_cv_type_mbstate_t_object,
1183 [AC_TRY_COMPILE([#include <wchar.h>],
1184 [mbstate_t x; return sizeof x;],
1185 ac_cv_type_mbstate_t_object=yes,
1186 ac_cv_type_mbstate_t_object=no)])
1187 if test $ac_cv_type_mbstate_t_object = yes; then
1188 AC_DEFINE(HAVE_MBSTATE_T_OBJECT, 1,
1189 [Define if mbstate_t is an object type.])
1194 dnl From Jim Meyering.
1195 dnl A wrapper around AC_FUNC_MKTIME.
1197 AC_DEFUN(jm_FUNC_MKTIME,
1198 [AC_REQUIRE([AC_FUNC_MKTIME])dnl
1200 dnl mktime.c uses localtime_r if it exists. Check for it.
1201 AC_CHECK_FUNCS(localtime_r)
1203 if test $ac_cv_func_working_mktime = no; then
1204 AC_DEFINE_UNQUOTED(mktime, rpl_mktime,
1205 [Define to rpl_mktime if the replacement function should be used.])
1211 dnl From Jim Meyering.
1212 dnl Determine whether lstat has the bug that it succeeds when given the
1213 dnl zero-length file name argument. The lstat from SunOS4.1.4 and the Hurd
1214 dnl (as of 1998-11-01) do this.
1216 dnl If it does, then define HAVE_LSTAT_EMPTY_STRING_BUG and arrange to
1217 dnl compile the wrapper function.
1220 AC_DEFUN(jm_FUNC_LSTAT,
1222 AC_CACHE_CHECK([whether lstat accepts an empty string],
1223 jm_cv_func_lstat_empty_string_bug,
1225 # include <sys/types.h>
1226 # include <sys/stat.h>
1232 exit (lstat ("", &sbuf) ? 1 : 0);
1235 jm_cv_func_lstat_empty_string_bug=yes,
1236 jm_cv_func_lstat_empty_string_bug=no,
1237 dnl When crosscompiling, assume lstat is broken.
1238 jm_cv_func_lstat_empty_string_bug=yes)
1240 if test $jm_cv_func_lstat_empty_string_bug = yes; then
1242 LIBOBJS="$LIBOBJS lstat.$ac_objext"
1243 AC_DEFINE_UNQUOTED(HAVE_LSTAT_EMPTY_STRING_BUG, 1,
1244 [Define if lstat has the bug that it succeeds when given the zero-length
1245 file name argument. The lstat from SunOS4.1.4 and the Hurd as of 1998-11-01)
1252 dnl From Jim Meyering.
1255 AC_DEFUN(jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK,
1258 [whether lstat dereferences a symlink specified with a trailing slash],
1259 jm_cv_func_lstat_dereferences_slashed_symlink,
1261 rm -f conftest.sym conftest.file
1263 if ln -s conftest.file conftest.sym; then
1265 # include <sys/types.h>
1266 # include <sys/stat.h>
1272 /* Linux will dereference the symlink and fail.
1273 That is better in the sense that it means we will not
1274 have to compile and use the lstat wrapper. */
1275 exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1);
1278 jm_cv_func_lstat_dereferences_slashed_symlink=yes,
1279 jm_cv_func_lstat_dereferences_slashed_symlink=no,
1280 dnl When crosscompiling, be pessimistic so we will end up using the
1281 dnl replacement version of lstat that checkes for trailing slashes
1282 dnl and calls lstat a second time when necessary.
1283 jm_cv_func_lstat_dereferences_slashed_symlink=no
1286 # If the `ln -s' command failed, then we probably don't even
1287 # have an lstat function.
1288 jm_cv_func_lstat_dereferences_slashed_symlink=no
1292 test $jm_cv_func_lstat_dereferences_slashed_symlink = yes \
1295 AC_DEFINE_UNQUOTED(LSTAT_FOLLOWS_SLASHED_SYMLINK, $zero_one,
1296 [Define if lstat dereferences a symlink specified with a trailing slash])
1298 if test $jm_cv_func_lstat_dereferences_slashed_symlink = no; then
1300 # Append lstat.o if it's not already in $LIBOBJS.
1302 *lstat.$ac_objext*) ;;
1303 *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;;
1310 dnl From Jim Meyering.
1311 dnl Determine whether stat has the bug that it succeeds when given the
1312 dnl zero-length file name argument. The stat from SunOS4.1.4 and the Hurd
1313 dnl (as of 1998-11-01) do this.
1315 dnl If it does, then define HAVE_STAT_EMPTY_STRING_BUG and arrange to
1316 dnl compile the wrapper function.
1319 AC_DEFUN(jm_FUNC_STAT,
1321 AC_CACHE_CHECK([whether stat accepts an empty string],
1322 jm_cv_func_stat_empty_string_bug,
1324 # include <sys/types.h>
1325 # include <sys/stat.h>
1331 exit (stat ("", &sbuf) ? 1 : 0);
1334 jm_cv_func_stat_empty_string_bug=yes,
1335 jm_cv_func_stat_empty_string_bug=no,
1336 dnl When crosscompiling, assume stat is broken.
1337 jm_cv_func_stat_empty_string_bug=yes)
1339 if test $jm_cv_func_stat_empty_string_bug = yes; then
1341 LIBOBJS="$LIBOBJS stat.$ac_objext"
1342 AC_DEFINE_UNQUOTED(HAVE_STAT_EMPTY_STRING_BUG, 1,
1343 [Define if stat has the bug that it succeeds when given the zero-length
1344 file name argument. The stat from SunOS4.1.4 and the Hurd as of 1998-11-01)
1351 dnl From Jim Meyering.
1352 dnl Determine whether realloc works when both arguments are 0.
1353 dnl If it doesn't, arrange to use the replacement function.
1356 AC_DEFUN(jm_FUNC_REALLOC,
1358 dnl xmalloc.c requires that this symbol be defined so it doesn't
1359 dnl mistakenly use a broken realloc -- as it might if this test were omitted.
1360 AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_REALLOC_CHECK, 1,
1361 [Define if the realloc check has been performed. ])
1363 AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc,
1369 exit (realloc (0, 0) ? 0 : 1);
1372 jm_cv_func_working_realloc=yes,
1373 jm_cv_func_working_realloc=no,
1374 dnl When crosscompiling, assume realloc is broken.
1375 jm_cv_func_working_realloc=no)
1377 if test $jm_cv_func_working_realloc = no; then
1379 LIBOBJS="$LIBOBJS realloc.$ac_objext"
1380 AC_DEFINE_UNQUOTED(realloc, rpl_realloc,
1381 [Define to rpl_realloc if the replacement function should be used.])
1387 dnl From Jim Meyering.
1388 dnl Determine whether malloc accepts 0 as its argument.
1389 dnl If it doesn't, arrange to use the replacement function.
1392 AC_DEFUN(jm_FUNC_MALLOC,
1394 dnl xmalloc.c requires that this symbol be defined so it doesn't
1395 dnl mistakenly use a broken malloc -- as it might if this test were omitted.
1396 AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_MALLOC_CHECK, 1,
1397 [Define if the malloc check has been performed. ])
1399 AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc,
1405 exit (malloc (0) ? 0 : 1);
1408 jm_cv_func_working_malloc=yes,
1409 jm_cv_func_working_malloc=no,
1410 dnl When crosscompiling, assume malloc is broken.
1411 jm_cv_func_working_malloc=no)
1413 if test $jm_cv_func_working_malloc = no; then
1415 LIBOBJS="$LIBOBJS malloc.$ac_objext"
1416 AC_DEFINE_UNQUOTED(malloc, rpl_malloc,
1417 [Define to rpl_malloc if the replacement function should be used.])
1423 dnl From Jim Meyering.
1424 dnl Determine whether the strerror_r implementation is one of
1425 dnl the broken ones that returns `int' rather than `char*'.
1426 dnl Actually, this tests only whether it returns a scalar
1427 dnl or an array, but that should be enough.
1428 dnl On at least DEC UNIX 4.0[A-D] and HP-UX B.10.20, strerror_r
1429 dnl returns `int'. This is used by lib/error.c.
1431 AC_DEFUN(jm_FUNC_STRERROR_R,
1434 AC_CHECK_FUNCS([strerror_r])
1435 if test $ac_cv_func_strerror_r = yes; then
1436 AC_CHECK_HEADERS(string.h)
1437 AC_CACHE_CHECK([for working strerror_r],
1438 jm_cv_func_working_strerror_r,
1444 # include <string.h>
1448 int buf; /* avoiding square brackets makes this easier */
1449 char x = *strerror_r (0, buf, sizeof buf);
1451 jm_cv_func_working_strerror_r=yes,
1452 jm_cv_func_working_strerror_r=no
1454 if test $jm_cv_func_working_strerror_r = yes; then
1455 AC_DEFINE_UNQUOTED(HAVE_WORKING_STRERROR_R, 1,
1456 [Define to 1 if strerror_r returns a string.])
1464 dnl SunOS's readdir is broken in such a way that rm.c has to add extra code
1465 dnl to test whether a NULL return value really means there are no more files
1466 dnl in the directory.
1468 dnl Detect the problem by creating a directory containing 300 files (254 not
1469 dnl counting . and .. is the minimum) and see if a loop doing `readdir; unlink'
1470 dnl removes all of them.
1472 dnl Define HAVE_WORKING_READDIR if readdir does *not* have this problem.
1474 dnl Written by Jim Meyering.
1476 AC_DEFUN(jm_FUNC_READDIR,
1478 AC_REQUIRE([AC_HEADER_DIRENT])
1479 AC_CHECK_HEADERS(string.h)
1480 AC_CACHE_CHECK([for working readdir], jm_cv_func_working_readdir,
1482 # Arrange for deletion of the temporary directory this test creates, in
1483 # case the test itself fails to delete everything -- as happens on Sunos.
1484 ac_clean_files="$ac_clean_files conf-dir"
1487 [# include <stdio.h>
1488 # include <sys/types.h>
1490 # include <string.h>
1493 # ifdef HAVE_DIRENT_H
1494 # include <dirent.h>
1495 # define NLENGTH(direct) (strlen((direct)->d_name))
1496 # else /* not HAVE_DIRENT_H */
1497 # define dirent direct
1498 # define NLENGTH(direct) ((direct)->d_namlen)
1499 # ifdef HAVE_SYS_NDIR_H
1500 # include <sys/ndir.h>
1501 # endif /* HAVE_SYS_NDIR_H */
1502 # ifdef HAVE_SYS_DIR_H
1503 # include <sys/dir.h>
1504 # endif /* HAVE_SYS_DIR_H */
1507 # endif /* HAVE_NDIR_H */
1508 # endif /* HAVE_DIRENT_H */
1510 # define DOT_OR_DOTDOT(Basename) \
1511 (Basename[0] == '.' && (Basename[1] == '\0' \
1512 || (Basename[1] == '.' && Basename[2] == '\0')))
1515 create_300_file_dir (const char *dir)
1519 if (mkdir (dir, 0700))
1524 for (i = 0; i < 300; i++)
1529 sprintf (file_name, "%03d", i);
1530 out = fopen (file_name, "w");
1533 if (fclose (out) == EOF)
1542 remove_dir (const char *dir)
1549 dirp = opendir (".");
1555 struct dirent *dp = readdir (dirp);
1559 if (DOT_OR_DOTDOT (dp->d_name))
1562 if (unlink (dp->d_name))
1577 const char *dir = "conf-dir";
1578 create_300_file_dir (dir);
1582 jm_cv_func_working_readdir=yes,
1583 jm_cv_func_working_readdir=no,
1584 jm_cv_func_working_readdir=no)])
1586 if test $jm_cv_func_working_readdir = yes; then
1587 AC_DEFINE_UNQUOTED(HAVE_WORKING_READDIR, 1,
1588 [Define if readdir is found to work properly in some unusual cases. ])
1594 dnl A replacement for autoconf's AC_FUNC_MEMCMP that detects
1595 dnl the losing memcmp on some x86 Next systems.
1596 AC_DEFUN(jm_AC_FUNC_MEMCMP,
1597 [AC_CACHE_CHECK([for working memcmp], jm_cv_func_memcmp_working,
1602 /* Some versions of memcmp are not 8-bit clean. */
1603 char c0 = 0x40, c1 = 0x80, c2 = 0x81;
1604 if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
1607 /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
1608 or more and with at least one buffer not starting on a 4-byte boundary.
1609 William Lewis provided this test program. */
1614 for (i = 0; i < 4; i++)
1618 strcpy (a, "--------01111111");
1619 strcpy (b, "--------10000000");
1620 if (memcmp (a, b, 16) >= 0)
1626 jm_cv_func_memcmp_working=yes,
1627 jm_cv_func_memcmp_working=no,
1628 jm_cv_func_memcmp_working=no)])
1629 test $jm_cv_func_memcmp_working = no \
1630 && LIBOBJS="$LIBOBJS memcmp.$ac_objext"
1631 AC_SUBST(LIBOBJS)dnl
1634 AC_DEFUN(jm_FUNC_MEMCMP,
1635 [AC_REQUIRE([jm_AC_FUNC_MEMCMP])dnl
1636 if test $jm_cv_func_memcmp_working = no; then
1637 AC_DEFINE_UNQUOTED(memcmp, rpl_memcmp,
1638 [Define to rpl_memcmp if the replacement function should be used.])
1644 dnl From Jim Meyering.
1646 dnl See if the glibc *_unlocked I/O macros are available.
1647 dnl Use only those *_unlocked macros that are declared.
1650 AC_DEFUN(jm_FUNC_GLIBC_UNLOCKED_IO,
1652 io_functions='clearerr_unlocked feof_unlocked ferror_unlocked
1653 fflush_unlocked fputc_unlocked fread_unlocked fwrite_unlocked
1654 getc_unlocked getchar_unlocked putc_unlocked putchar_unlocked'
1655 for jm_io_func in $io_functions; do
1656 # Check for the existence of each function only if its declared.
1657 # Otherwise, we'd get the Solaris5.5.1 functions that are not
1658 # declared, and that have been removed from Solaris5.6. The resulting
1659 # 5.5.1 binaries would not run on 5.6 due to shared library differences.
1660 AC_CHECK_DECLS(($jm_io_func),
1663 [#include <stdio.h>])
1664 if test $jm_declared = yes; then
1665 AC_CHECK_FUNCS($jm_io_func)
1673 dnl Determine whether to add fnmatch.o to LIBOBJS and to
1674 dnl define fnmatch to rpl_fnmatch.
1679 # We look for fnmatch.h to avoid that the test fails in C++.
1680 AC_DEFUN(kd_FUNC_FNMATCH_CASE,
1681 [AC_CHECK_HEADERS(fnmatch.h)
1682 AC_CACHE_CHECK(for working fnmatch with case folding, ac_cv_func_fnmatch_works,
1683 # Some versions of Solaris or SCO have a broken fnmatch function.
1684 # So we run a test program. If we are cross-compiling, take no chance.
1685 # Also want FNM_CASEFOLD
1686 # Thanks to John Oleynick and Franc,ois Pinard for this test.
1691 # include <fnmatch.h>
1697 exit (fnmatch ("A*", "abc", FNM_CASEFOLD) != 0);
1699 ac_cv_func_fnmatch_works=yes, ac_cv_func_fnmatch_works=no,
1700 ac_cv_func_fnmatch_works=no)])
1701 if test $ac_cv_func_fnmatch_works = yes; then
1702 AC_DEFINE(HAVE_FNMATCH, 1,
1703 [Define if your system has a working `fnmatch' function with case folding.])
1708 AC_DEFUN(kd_FUNC_FNMATCH_CASE_RPL,
1710 AC_REQUIRE([AM_GLIBC])
1711 kd_FUNC_FNMATCH_CASE
1712 if test $ac_cv_func_fnmatch_works = no \
1713 && test $ac_cv_gnu_library = no; then
1715 LIBOBJS="$LIBOBJS fnmatch.$ac_objext"
1716 AC_DEFINE_UNQUOTED(fnmatch, rpl_fnmatch,
1717 [Define to rpl_fnmatch if the replacement function should be used.])
1723 dnl From Gordon Matzigkeit.
1724 dnl Test for the GNU C Library.
1725 dnl FIXME: this should migrate into libit.
1729 AC_CACHE_CHECK(whether we are using the GNU C Library,
1731 [AC_EGREP_CPP([Thanks for using GNU],
1733 #include <features.h>
1734 #ifdef __GNU_LIBRARY__
1735 Thanks for using GNU
1738 ac_cv_gnu_library=yes,
1739 ac_cv_gnu_library=no)
1742 AC_CACHE_CHECK(for version 2 of the GNU C Library,
1744 [AC_EGREP_CPP([Thanks for using GNU too],
1746 #include <features.h>
1748 Thanks for using GNU too
1751 ac_cv_glibc=yes, ac_cv_glibc=no)
1760 AC_CHECKING(for AFS)
1762 && AC_DEFINE(AFS, 1, [Define if you have the Andrew File System.])
1767 # autoconf tests required for use of xstrtoumax.c
1769 AC_DEFUN(jm_AC_PREREQ_XSTRTOUMAX,
1771 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
1772 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
1773 AC_CHECK_HEADERS(stdlib.h)
1775 AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro],
1776 jm_cv_func_strtoumax_macro,
1777 AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include <inttypes.h>
1779 inttypes_h_defines_strtoumax
1781 jm_cv_func_strtoumax_macro=yes,
1782 jm_cv_func_strtoumax_macro=no))
1784 if test "$jm_cv_func_strtoumax_macro" != yes; then
1785 AC_REPLACE_FUNCS(strtoumax)
1788 dnl We don't need (and can't compile) the replacement strtoull
1789 dnl unless the type `unsigned long long' exists.
1790 dnl Also, only the replacement strtoumax invokes strtoull,
1791 dnl so we need the replacement strtoull only if strtoumax does not exist.
1792 case "$ac_cv_type_unsigned_long_long,$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in
1794 AC_REPLACE_FUNCS(strtoull)
1802 dnl From Paul Eggert.
1804 AC_DEFUN(jm_AC_TYPE_UNSIGNED_LONG_LONG,
1806 AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
1807 [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
1808 [unsigned long long ullmax = (unsigned long long) -1;
1809 return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
1810 ac_cv_type_unsigned_long_long=yes,
1811 ac_cv_type_unsigned_long_long=no)])
1812 if test $ac_cv_type_unsigned_long_long = yes; then
1813 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
1814 [Define if you have the unsigned long long type.])
1819 dnl Run a program to determine whether whether link(2) follows symlinks.
1820 dnl Set LINK_FOLLOWS_SYMLINKS accordingly.
1822 AC_DEFUN(jm_AC_FUNC_LINK_FOLLOWS_SYMLINK,
1824 AC_CACHE_CHECK([whether link(2) follows symlinks],
1825 jm_ac_cv_func_link_follows_symlink,
1827 dnl poor-man's AC_REQUIRE: FIXME: repair this once autoconf-3 provides
1828 dnl the appropriate framework.
1829 test -z "$ac_cv_header_unistd_h" \
1830 && AC_CHECK_HEADERS(unistd.h)
1832 # Create a regular file.
1833 echo > conftest.file
1836 # include <sys/types.h>
1837 # include <sys/stat.h>
1838 # ifdef HAVE_UNISTD_H
1839 # include <unistd.h>
1842 # define SAME_INODE(Stat_buf_1, Stat_buf_2) \
1843 ((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
1844 && (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)
1849 const char *file = "conftest.file";
1850 const char *sym = "conftest.sym";
1851 const char *hard = "conftest.hard";
1852 struct stat sb_file, sb_hard;
1854 /* Create a symlink to the regular file. */
1855 if (symlink (file, sym))
1858 /* Create a hard link to that symlink. */
1859 if (link (sym, hard))
1862 if (lstat (hard, &sb_hard))
1864 if (lstat (file, &sb_file))
1867 /* If the dev/inode of hard and file are the same, then
1868 the link call followed the symlink. */
1869 return SAME_INODE (sb_hard, sb_file) ? 0 : 1;
1872 jm_ac_cv_func_link_follows_symlink=yes,
1873 jm_ac_cv_func_link_follows_symlink=no,
1874 jm_ac_cv_func_link_follows_symlink=yes dnl We're cross compiling.
1877 if test $jm_ac_cv_func_link_follows_symlink = yes; then
1878 AC_DEFINE(LINK_FOLLOWS_SYMLINKS, 1,
1879 [Define if `link(2)' dereferences symbolic links.])
1883 # From Jim Meyering. Use this if you use the GNU error.[ch].
1884 # FIXME: Migrate into libit
1886 AC_DEFUN([AM_FUNC_ERROR_AT_LINE],
1887 [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
1888 [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
1889 am_cv_lib_error_at_line=yes,
1890 am_cv_lib_error_at_line=no)])
1891 if test $am_cv_lib_error_at_line = no; then
1892 LIBOBJS="$LIBOBJS error.$ac_objext"
1894 AC_SUBST(LIBOBJS)dnl
1899 dnl This macro is intended to be used solely in this file.
1900 dnl These are the prerequisite macros for GNU's strftime.c replacement.
1901 AC_DEFUN(_jm_STRFTIME_PREREQS,
1903 dnl strftime.c uses localtime_r if it exists. Check for it.
1904 AC_CHECK_FUNCS(localtime_r)
1906 AC_CHECK_HEADERS(limits.h)
1907 AC_CHECK_FUNCS(bcopy tzset mempcpy memcpy memset)
1909 # This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE.
1912 AC_CHECK_FUNCS(mblen mbrlen)
1914 AC_CHECK_MEMBER(struct tm.tm_gmtoff,
1915 [AC_DEFINE(HAVE_TM_GMTOFF, 1,
1916 [Define if struct tm has the tm_gmtoff member.])],
1918 [#include <time.h>])
1921 dnl Determine if the strftime function has all the features of the GNU one.
1923 dnl From Jim Meyering.
1925 AC_DEFUN(jm_FUNC_GNU_STRFTIME,
1926 [AC_REQUIRE([AC_HEADER_TIME])dnl
1928 _jm_STRFTIME_PREREQS
1930 AC_REQUIRE([AC_C_CONST])dnl
1931 AC_REQUIRE([AC_HEADER_STDC])dnl
1932 AC_CHECK_HEADERS(sys/time.h)
1933 AC_CACHE_CHECK([for working GNU strftime], jm_cv_func_working_gnu_strftime,
1934 [# Set TZ to GMT0 to make strftime give consistent results during the test.
1935 ac_save_TZ="${TZ-GMT0}"
1939 [ /* Ulrich Drepper provided parts of the test program. */
1941 # include <stdlib.h>
1944 #if TIME_WITH_SYS_TIME
1945 # include <sys/time.h>
1948 # if HAVE_SYS_TIME_H
1949 # include <sys/time.h>
1956 compare (const char *fmt, const struct tm *tm, const char *expected)
1959 strftime (buf, 99, fmt, tm);
1960 if (strcmp (buf, expected))
1962 #ifdef SHOW_FAILURES
1963 printf ("fmt: \"%s\", expected \"%s\", got \"%s\"\n",
1964 fmt, expected, buf);
1976 time_t t = 738367; /* Fri Jan 9 13:06:07 1970 */
1980 #define CMP(Fmt, Expected) n_fail += compare ((Fmt), tm, (Expected))
1982 CMP ("%-m", "1"); /* GNU */
1983 CMP ("%A", "Friday");
1984 CMP ("%^A", "FRIDAY"); /* The ^ is a GNU extension. */
1985 CMP ("%B", "January");
1986 CMP ("%^B", "JANUARY");
1987 CMP ("%C", "19"); /* POSIX.2 */
1988 CMP ("%D", "01/09/70"); /* POSIX.2 */
1989 CMP ("%F", "1970-01-09");
1990 CMP ("%G", "1970"); /* GNU */
1995 CMP ("%R", "13:06"); /* POSIX.2 */
1997 CMP ("%T", "13:06:07"); /* POSIX.2 */
2001 CMP ("%X", "13:06:07");
2004 CMP ("%_m", " 1"); /* GNU */
2009 CMP ("%c", "Fri Jan 9 13:06:07 1970");
2010 CMP ("%^c", "FRI JAN 9 13:06:07 1970");
2012 CMP ("%e", " 9"); /* POSIX.2 */
2013 CMP ("%g", "70"); /* GNU */
2014 CMP ("%h", "Jan"); /* POSIX.2 */
2017 CMP ("%k", "13"); /* GNU */
2018 CMP ("%l", " 1"); /* GNU */
2020 CMP ("%n", "\n"); /* POSIX.2 */
2022 CMP ("%r", "01:06:07 PM"); /* POSIX.2 */
2023 CMP ("%s", "738367"); /* GNU */
2024 CMP ("%t", "\t"); /* POSIX.2 */
2025 CMP ("%u", "5"); /* POSIX.2 */
2027 CMP ("%x", "01/09/70");
2029 CMP ("%z", "+0000"); /* GNU */
2031 exit (n_fail ? 1 : 0);
2033 jm_cv_func_working_gnu_strftime=yes,
2034 jm_cv_func_working_gnu_strftime=no,
2035 dnl When crosscompiling, assume strftime is missing or broken.
2036 jm_cv_func_working_gnu_strftime=no)
2037 dnl If TZ wasn't set before, this sets it to GMT0. No real harm done.
2040 if test $jm_cv_func_working_gnu_strftime = no; then
2042 LIBOBJS="$LIBOBJS strftime.$ac_objext"
2043 AC_DEFINE_UNQUOTED(strftime, gnu_strftime,
2044 [Define to gnu_strftime if the replacement function should be used.])
2048 AC_DEFUN(jm_FUNC_STRFTIME,
2050 _jm_STRFTIME_PREREQS
2051 AC_REPLACE_FUNCS(strftime)
2056 dnl See if there's a working, system-supplied version of the getline function.
2057 dnl We can't just do AC_REPLACE_FUNCS(getline) because some systems
2058 dnl have a function by that name in -linet that doesn't have anything
2059 dnl to do with the function we need.
2060 AC_DEFUN(AM_FUNC_GETLINE,
2062 am_getline_needs_run_time_check=no
2063 AC_CHECK_FUNC(getline,
2064 dnl Found it in some library. Verify that it works.
2065 am_getline_needs_run_time_check=yes,
2066 am_cv_func_working_getline=no)
2067 if test $am_getline_needs_run_time_check = yes; then
2068 AC_CHECK_HEADERS(string.h)
2069 AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline,
2070 [echo fooN |tr -d '\012'|tr N '\012' > conftest.data
2073 # include <sys/types.h>
2075 # include <string.h>
2078 { /* Based on a test program from Karl Heuer. */
2082 FILE *in = fopen ("./conftest.data", "r");
2085 len = getline (&line, &siz, in);
2086 exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1);
2088 ], am_cv_func_working_getline=yes dnl The library version works.
2089 , am_cv_func_working_getline=no dnl The library version does NOT work.
2090 , am_cv_func_working_getline=no dnl We're cross compiling.
2094 if test $am_cv_func_working_getline = yes; then
2095 AC_DEFINE(HAVE_GETLINE, 1,
2096 [Define if you have the GETLINE function.])dnl
2102 dnl From Paul Eggert.
2104 # Define ST_MTIM_NSEC to be the nanoseconds member of struct stat's st_mtim,
2107 AC_DEFUN(AC_STRUCT_ST_MTIM_NSEC,
2108 [AC_CACHE_CHECK([for nanoseconds member of struct stat.st_mtim],
2109 ac_cv_struct_st_mtim_nsec,
2110 [ac_save_CPPFLAGS="$CPPFLAGS"
2111 ac_cv_struct_st_mtim_nsec=no
2112 # tv_nsec -- the usual case
2113 # _tv_nsec -- Solaris 2.6, if
2114 # (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1
2115 # && !defined __EXTENSIONS__)
2116 # st__tim.tv_nsec -- UnixWare 2.1.2
2117 for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do
2118 CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val"
2119 AC_TRY_COMPILE([#include <sys/types.h>
2120 #include <sys/stat.h>], [struct stat s; s.st_mtim.ST_MTIM_NSEC;],
2121 [ac_cv_struct_st_mtim_nsec=$ac_val; break])
2123 CPPFLAGS="$ac_save_CPPFLAGS"])
2125 if test $ac_cv_struct_st_mtim_nsec != no; then
2126 AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec,
2127 [Define to be the nanoseconds member of struct stat's st_mtim,
2135 # Define HAVE_ST_DM_MODE if struct stat has an st_dm_mode member.
2137 AC_DEFUN(AC_STRUCT_ST_DM_MODE,
2138 [AC_CACHE_CHECK([for st_dm_mode in struct stat], ac_cv_struct_st_dm_mode,
2139 [AC_TRY_COMPILE([#include <sys/types.h>
2140 #include <sys/stat.h>], [struct stat s; s.st_dm_mode;],
2141 ac_cv_struct_st_dm_mode=yes,
2142 ac_cv_struct_st_dm_mode=no)])
2144 if test $ac_cv_struct_st_dm_mode = yes; then
2145 AC_DEFINE_UNQUOTED(HAVE_ST_DM_MODE, 1,
2146 [Define if struct stat has an st_dm_mode member. ])
2153 dnl From Jim Meyering
2155 dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
2156 dnl in time.h or sys/time.h.
2158 AC_DEFUN(jm_CHECK_TYPE_STRUCT_TIMESPEC,
2160 AC_REQUIRE([AC_HEADER_TIME])
2161 AC_CACHE_CHECK([for struct timespec], fu_cv_sys_struct_timespec,
2164 # if TIME_WITH_SYS_TIME
2165 # include <sys/time.h>
2168 # if HAVE_SYS_TIME_H
2169 # include <sys/time.h>
2175 [static struct timespec x; x.tv_sec = x.tv_nsec;],
2176 fu_cv_sys_struct_timespec=yes,
2177 fu_cv_sys_struct_timespec=no)
2180 if test $fu_cv_sys_struct_timespec = yes; then
2181 AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMESPEC, 1,
2182 [Define if struct timespec is declared in <time.h>. ])
2188 dnl From Paul Eggert.
2192 # Define uintmax_t to `unsigned long' or `unsigned long long'
2193 # if <inttypes.h> does not exist.
2195 AC_DEFUN(jm_AC_TYPE_UINTMAX_T,
2197 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
2198 if test $jm_ac_cv_header_inttypes_h = no; then
2199 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
2200 test $ac_cv_type_unsigned_long_long = yes \
2201 && ac_type='unsigned long long' \
2202 || ac_type='unsigned long'
2203 AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
2204 [ Define to unsigned long or unsigned long long
2205 if <inttypes.h> doesn't define.])
2209 # Macro to add for using GNU gettext.
2210 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2212 # This file can be copied and used freely without restrictions. It can
2213 # be used in projects which are not available under the GNU Public License
2214 # but which still want to provide support for the GNU gettext functionality.
2215 # Please note that the actual code is *not* freely available.
2219 AC_PREREQ(2.13) dnl Minimum Autoconf version required.
2221 AC_DEFUN(AM_WITH_NLS,
2222 [AC_MSG_CHECKING([whether NLS is requested])
2223 dnl Default is enabled NLS
2225 [ --disable-nls do not use Native Language Support],
2226 USE_NLS=$enableval, USE_NLS=yes)
2227 AC_MSG_RESULT($USE_NLS)
2230 USE_INCLUDED_LIBINTL=no
2232 dnl If we use NLS figure out what method
2233 if test "$USE_NLS" = "yes"; then
2234 AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested.])
2235 AC_MSG_CHECKING([whether included gettext is requested])
2236 AC_ARG_WITH(included-gettext,
2237 [ --with-included-gettext use the GNU gettext library included here],
2238 nls_cv_force_use_gnu_gettext=$withval,
2239 nls_cv_force_use_gnu_gettext=no)
2240 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
2242 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
2243 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
2244 dnl User does not insist on using GNU NLS library. Figure out what
2245 dnl to use. If gettext or catgets are available (in this order) we
2246 dnl use this. Else we have to fall back to GNU NLS library.
2247 dnl catgets is only used if permitted by option --with-catgets.
2249 nls_cv_header_libgt=
2252 AC_CHECK_HEADER(libintl.h,
2253 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
2254 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
2255 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
2257 if test "$gt_cv_func_gettext_libc" != "yes"; then
2258 AC_CHECK_LIB(intl, bindtextdomain,
2259 [AC_CHECK_LIB(intl, gettext)])
2262 if test "$gt_cv_func_gettext_libc" = "yes" \
2263 || test "$ac_cv_lib_intl_gettext" = "yes"; then
2264 AC_DEFINE(HAVE_GETTEXT, 1,
2265 [Define to 1 if you have gettext and don't want to use GNU gettext.])
2266 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2267 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
2268 if test "$MSGFMT" != "no"; then
2269 AC_CHECK_FUNCS(dcgettext)
2270 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2271 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2272 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2273 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
2274 return _nl_msg_cat_cntr],
2284 if test "$CATOBJEXT" = "NONE"; then
2285 AC_MSG_CHECKING([whether catgets can be used])
2286 AC_ARG_WITH(catgets,
2287 [ --with-catgets use catgets functions if available],
2288 nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
2289 AC_MSG_RESULT($nls_cv_use_catgets)
2291 if test "$nls_cv_use_catgets" = "yes"; then
2292 dnl No gettext in C library. Try catgets next.
2293 AC_CHECK_LIB(i, main)
2294 AC_CHECK_FUNC(catgets,
2295 [AC_DEFINE(HAVE_CATGETS, 1,
2296 [Define as 1 if you have catgets and don't want to use GNU gettext.])
2297 INTLOBJS="\$(CATOBJS)"
2298 AC_PATH_PROG(GENCAT, gencat, no)dnl
2299 if test "$GENCAT" != "no"; then
2300 AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
2301 if test "$GMSGFMT" = "no"; then
2302 AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
2303 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
2305 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2306 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2307 USE_INCLUDED_LIBINTL=yes
2311 INTLDEPS='$(top_builddir)/intl/libintl.a'
2313 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
2314 nls_cv_header_intl=intl/libintl.h
2315 nls_cv_header_libgt=intl/libgettext.h
2320 if test "$CATOBJEXT" = "NONE"; then
2321 dnl Neither gettext nor catgets in included in the C library.
2322 dnl Fall back on GNU gettext library.
2323 nls_cv_use_gnu_gettext=yes
2327 if test "$nls_cv_use_gnu_gettext" = "yes"; then
2328 dnl Mark actions used to generate GNU NLS library.
2329 INTLOBJS="\$(GETTOBJS)"
2330 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2331 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
2332 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2333 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2334 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2336 USE_INCLUDED_LIBINTL=yes
2340 INTLDEPS='$(top_builddir)/intl/libintl.a'
2342 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
2343 nls_cv_header_intl=intl/libintl.h
2344 nls_cv_header_libgt=intl/libgettext.h
2347 dnl Test whether we really found GNU xgettext.
2348 if test "$XGETTEXT" != ":"; then
2349 dnl If it is no GNU xgettext we define it as : so that the
2350 dnl Makefiles still can work.
2351 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
2355 [found xgettext program is not GNU xgettext; ignore it])
2360 # We need to process the po/ directory.
2364 nls_cv_header_intl=intl/libintl.h
2365 nls_cv_header_libgt=intl/libgettext.h
2367 if test -z "$nls_cv_header_intl"; then
2368 # Clean out junk possibly left behind by a previous configuration.
2369 rm -f intl/libintl.h
2371 AC_CONFIG_LINKS($nls_cv_header_intl:$nls_cv_header_libgt)
2373 [case "$CONFIG_FILES" in *po/Makefile.in*)
2374 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
2378 # If this is used in GNU gettext we have to set USE_NLS to `yes'
2379 # because some of the sources are only built for this goal.
2380 if test "$PACKAGE" = gettext; then
2382 USE_INCLUDED_LIBINTL=yes
2385 dnl These rules are solely for the distribution goal. While doing this
2386 dnl we only have to keep exactly one list of the available catalogs
2387 dnl in configure.in.
2388 for lang in $ALL_LINGUAS; do
2389 GMOFILES="$GMOFILES $lang.gmo"
2390 POFILES="$POFILES $lang.po"
2393 dnl Make all variables we use known to autoconf.
2394 AC_SUBST(USE_INCLUDED_LIBINTL)
2397 AC_SUBST(DATADIRNAME)
2399 AC_SUBST(INSTOBJEXT)
2407 AC_DEFUN(AM_GNU_GETTEXT,
2408 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
2409 AC_REQUIRE([AC_PROG_CC])dnl
2410 AC_REQUIRE([AC_PROG_RANLIB])dnl
2411 AC_REQUIRE([AC_ISC_POSIX])dnl
2412 AC_REQUIRE([AC_HEADER_STDC])dnl
2413 AC_REQUIRE([AC_C_CONST])dnl
2414 AC_REQUIRE([AC_C_INLINE])dnl
2415 AC_REQUIRE([AC_TYPE_OFF_T])dnl
2416 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
2417 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
2418 AC_REQUIRE([AC_FUNC_MMAP])dnl
2420 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
2421 unistd.h sys/param.h])
2422 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
2423 strdup __argz_count __argz_stringify __argz_next])
2425 if test "${ac_cv_func_stpcpy+set}" != "set"; then
2426 AC_CHECK_FUNCS(stpcpy)
2428 if test "${ac_cv_func_stpcpy}" = "yes"; then
2429 AC_DEFINE(HAVE_STPCPY, 1, [Define to 1 if you have the stpcpy function.])
2435 if test "x$CATOBJEXT" != "x"; then
2436 if test "x$ALL_LINGUAS" = "x"; then
2439 AC_MSG_CHECKING(for catalogs to be installed)
2441 for lang in ${LINGUAS=$ALL_LINGUAS}; do
2442 case "$ALL_LINGUAS" in
2443 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
2446 LINGUAS=$NEW_LINGUAS
2447 AC_MSG_RESULT($LINGUAS)
2450 dnl Construct list of names of catalog files to be constructed.
2451 if test -n "$LINGUAS"; then
2452 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
2456 dnl The reference to <locale.h> in the installed <libintl.h> file
2457 dnl must be resolved because we cannot expect the users of this
2458 dnl to define HAVE_LOCALE_H.
2459 if test $ac_cv_header_locale_h = yes; then
2460 INCLUDE_LOCALE_H="#include <locale.h>"
2463 /* The system does not provide the header <locale.h>. Take care yourself. */"
2465 AC_SUBST(INCLUDE_LOCALE_H)
2467 dnl Determine which catalog format we have (if any is needed)
2468 dnl For now we know about two different formats:
2469 dnl Linux libc-5 and the normal X/Open format
2470 test -d intl || mkdir intl
2471 if test "$CATOBJEXT" = ".cat"; then
2472 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
2474 dnl Transform the SED scripts while copying because some dumb SEDs
2475 dnl cannot handle comments.
2476 sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
2478 dnl po2tbl.sed is always needed.
2479 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
2480 $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
2482 dnl In the intl/Makefile.in we have a special dependency which makes
2483 dnl only sense for gettext. We comment this out for non-gettext
2485 if test "$PACKAGE" = "gettext"; then
2495 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
2496 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
2497 dnl Try to locate is.
2499 if test -n "$ac_aux_dir"; then
2500 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
2502 if test -z "$MKINSTALLDIRS"; then
2503 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
2505 AC_SUBST(MKINSTALLDIRS)
2507 dnl *** For now the libtool support in intl/Makefile is not for real.
2511 dnl Generate list of files to be processed by xgettext which will
2512 dnl be included in po/Makefile.
2513 test -d po || mkdir po
2516 posrcprefix="../" ;;
2518 posrcprefix="$srcdir/" ;;
2520 posrcprefix="../$srcdir/" ;;
2523 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
2524 < $srcdir/po/POTFILES.in > po/POTFILES
2527 # Search path for a program which passes the given test.
2528 # Ulrich Drepper <drepper@cygnus.com>, 1996.
2530 # This file can be copied and used freely without restrictions. It can
2531 # be used in projects which are not available under the GNU Public License
2532 # but which still want to provide support for the GNU gettext functionality.
2533 # Please note that the actual code is *not* freely available.
2537 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
2538 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
2539 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
2540 [# Extract the first word of "$2", so it can be a program name with args.
2541 set dummy $2; ac_word=[$]2
2542 AC_MSG_CHECKING([for $ac_word])
2543 AC_CACHE_VAL(ac_cv_path_$1,
2546 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
2549 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
2550 for ac_dir in ifelse([$5], , $PATH, [$5]); do
2551 test -z "$ac_dir" && ac_dir=.
2552 if test -f $ac_dir/$ac_word; then
2554 ac_cv_path_$1="$ac_dir/$ac_word"
2560 dnl If no 4th arg is given, leave the cache variable unset,
2561 dnl so AC_PATH_PROGS will keep looking.
2562 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
2567 if test -n "[$]$1"; then
2568 AC_MSG_RESULT([$]$1)
2575 # Check whether LC_MESSAGES is available in <locale.h>.
2576 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2578 # This file can be copied and used freely without restrictions. It can
2579 # be used in projects which are not available under the GNU Public License
2580 # but which still want to provide support for the GNU gettext functionality.
2581 # Please note that the actual code is *not* freely available.
2585 AC_PREREQ(2.13) dnl Minimum Autoconf version required.
2587 AC_DEFUN(AM_LC_MESSAGES,
2588 [if test $ac_cv_header_locale_h = yes; then
2589 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
2590 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2591 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
2592 if test $am_cv_val_LC_MESSAGES = yes; then
2593 AC_DEFINE(HAVE_LC_MESSAGES, 1,
2594 [Define if your locale.h file contains LC_MESSAGES.])