1 # aclocal.m4 generated automatically by aclocal 1.4a
3 # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
4 # Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14 # Like AC_CONFIG_HEADER, but automatically create stamp file.
18 # When config.status generates a header, we must update the stamp-h file.
19 # This file resides in the same directory as the config header
20 # that is generated. We must strip everything past the first ":",
21 # and everything past the last "/".
25 AC_DEFUN([AM_CONFIG_HEADER],
26 [AC_CONFIG_HEADER([$1])
28 ifelse(patsubst([$1], [[^ ]], []),
30 [test -z "$CONFIG_HEADERS" || echo timestamp >dnl
31 patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),
34 case " $CONFIG_HEADERS " in
36 echo timestamp > `echo $am_file | sed 's%:.*%%;s%[^/]*$%%'`stamp-h$am_indx
39 am_indx=\`expr \$am_indx + 1\`
43 # Do all the work for Automake. This macro actually does too much --
44 # some checks are only needed if your package does certain things.
45 # But this isn't really a big deal.
51 # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
52 # -----------------------------------------------------------
53 # If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED.
54 # The purpose of this macro is to provide the user with a means to
55 # check macros which are provided without letting her know how the
56 # information is coded.
57 # If this macro is not defined by Autoconf, define it here.
58 ifdef([AC_PROVIDE_IFELSE],
60 [define([AC_PROVIDE_IFELSE],
61 [ifdef([AC_PROVIDE_$1],
65 # AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE])
66 # ----------------------------------------------
67 AC_DEFUN([AM_INIT_AUTOMAKE],
68 [dnl We require 2.13 because we rely on SHELL being computed by configure.
69 AC_REQUIRE([AC_PROG_INSTALL])dnl
70 # test to see if srcdir already configured
71 if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" &&
72 test -f $srcdir/config.status; then
73 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
76 # Define the identity of the package.
82 [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
83 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])
85 # Some tools Automake needs.
86 AC_REQUIRE([AM_SANITY_CHECK])dnl
87 AC_REQUIRE([AC_ARG_PROGRAM])dnl
88 AM_MISSING_PROG(ACLOCAL, aclocal)
89 AM_MISSING_PROG(AUTOCONF, autoconf)
90 AM_MISSING_PROG(AUTOMAKE, automake)
91 AM_MISSING_PROG(AUTOHEADER, autoheader)
92 AM_MISSING_PROG(MAKEINFO, makeinfo)
93 AM_MISSING_PROG(AMTAR, tar)
95 # We need awk for the "check" target. The system "awk" is bad on
97 AC_REQUIRE([AC_PROG_AWK])dnl
98 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
99 AC_REQUIRE([AM_DEP_TRACK])dnl
100 AC_REQUIRE([AM_SET_DEPDIR])dnl
101 AC_PROVIDE_IFELSE([AC_PROG_CC],
102 [AM_DEPENDENCIES(CC)],
103 [define([AC_PROG_CC],
104 defn([AC_PROG_CC])[AM_DEPENDENCIES(CC)])])dnl
105 AC_PROVIDE_IFELSE([AC_PROG_CXX],
106 [AM_DEPENDENCIES(CXX)],
107 [define([AC_PROG_CXX],
108 defn([AC_PROG_CXX])[AM_DEPENDENCIES(CXX)])])dnl
112 # Check to make sure that the build environment is sane.
115 AC_DEFUN([AM_SANITY_CHECK],
116 [AC_MSG_CHECKING([whether build environment is sane])
119 echo timestamp > conftestfile
120 # Do `set' in a subshell so we don't clobber the current shell's
121 # arguments. Must try -L first in case configure is actually a
122 # symlink; some systems play weird games with the mod time of symlinks
123 # (eg FreeBSD returns the mod time of the symlink's containing
126 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
127 if test "[$]*" = "X"; then
129 set X `ls -t $srcdir/configure conftestfile`
131 if test "[$]*" != "X $srcdir/configure conftestfile" \
132 && test "[$]*" != "X conftestfile $srcdir/configure"; then
134 # If neither matched, then we have a broken ls. This can happen
135 # if, for instance, CONFIG_SHELL is bash and it inherits a
136 # broken ls alias from the environment. This has actually
137 # happened. Such a system could not be considered "sane".
138 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
139 alias in your environment])
142 test "[$]2" = conftestfile
148 AC_MSG_ERROR([newly created file is older than distributed files!
149 Check your system clock])
154 # AM_MISSING_PROG(NAME, PROGRAM)
155 AC_DEFUN([AM_MISSING_PROG], [
156 AC_REQUIRE([AM_MISSING_HAS_RUN])
157 $1=${$1-"${am_missing_run}$2"}
160 # Like AM_MISSING_PROG, but only looks for install-sh.
161 # AM_MISSING_INSTALL_SH()
162 AC_DEFUN([AM_MISSING_INSTALL_SH], [
163 AC_REQUIRE([AM_MISSING_HAS_RUN])
164 if test -z "$install_sh"; then
165 install_sh="$ac_aux_dir/install-sh"
166 test -f "$install_sh" || install_sh="$ac_aux_dir/install.sh"
167 test -f "$install_sh" || install_sh="${am_missing_run}${ac_auxdir}/install-sh"
168 dnl FIXME: an evil hack: we remove the SHELL invocation from
169 dnl install_sh because automake adds it back in. Sigh.
170 install_sh="`echo $install_sh | sed -e 's/\${SHELL}//'`"
172 AC_SUBST(install_sh)])
174 # AM_MISSING_HAS_RUN.
175 # Define MISSING if not defined so far and test if it supports --run.
176 # If it does, set am_missing_run to use it, otherwise, to nothing.
177 AC_DEFUN([AM_MISSING_HAS_RUN], [
178 test x"${MISSING+set}" = xset || \
179 MISSING="\${SHELL} `CDPATH=:; cd $ac_aux_dir && pwd`/missing"
180 # Use eval to expand $SHELL
181 if eval "$MISSING --run :"; then
182 am_missing_run="$MISSING --run "
186 AC_MSG_WARN([${am_backtick}missing' script is too old or missing])
190 # See how the compiler implements dependency checking.
192 # AM_DEPENDENCIES(NAME)
193 # NAME is "CC", "CXX" or "OBJC".
195 # We try a few techniques and use that to set a single cache variable.
197 AC_DEFUN([AM_DEPENDENCIES],[
198 AC_REQUIRE([AM_SET_DEPDIR])
199 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])
201 AC_REQUIRE([AC_PROG_CC])
202 AC_REQUIRE([AC_PROG_CPP])
204 depcpp="$CPP"],[$1],CXX,[
205 AC_REQUIRE([AC_PROG_CXX])
206 AC_REQUIRE([AC_PROG_CXXCPP])
208 depcpp="$CXXCPP"],[$1],OBJC,[
209 am_cv_OBJC_dependencies_compiler_type=gcc],[
210 AC_REQUIRE([AC_PROG_][$1])
213 AC_MSG_CHECKING([dependency style of $depcc])
214 AC_CACHE_VAL(am_cv_[$1]_dependencies_compiler_type,[
215 if test -z "$AMDEP"; then
216 echo '#include "conftest.h"' > conftest.c
217 echo 'int i;' > conftest.h
219 am_cv_[$1]_dependencies_compiler_type=none
220 for depmode in `sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < "$am_depcomp"`; do
223 # after this tag, mechanisms are not by side-effect, so they'll
224 # only be used when explicitly requested
225 if test "x$enable_dependency_tracking" = xyes; then
233 # We check with `-c' and `-o' for the sake of the "dashmstdout"
234 # mode. It turns out that the SunPro C++ compiler does not properly
235 # handle `-M -o', and we need to detect this.
236 if depmode="$depmode" \
237 source=conftest.c object=conftest.o \
238 depfile=conftest.Po tmpdepfile=conftest.TPo \
239 $SHELL $am_depcomp $depcc -c conftest.c -o conftest.o 2>/dev/null &&
240 grep conftest.h conftest.Po > /dev/null 2>&1; then
241 am_cv_[$1]_dependencies_compiler_type="$depmode"
248 am_cv_[$1]_dependencies_compiler_type=none
251 AC_MSG_RESULT($am_cv_[$1]_dependencies_compiler_type)
252 [$1]DEPMODE="depmode=$am_cv_[$1]_dependencies_compiler_type"
253 AC_SUBST([$1]DEPMODE)
256 # Choose a directory name for dependency files.
257 # This macro is AC_REQUIREd in AM_DEPENDENCIES
259 AC_DEFUN([AM_SET_DEPDIR],[
260 if test -d .deps || mkdir .deps 2> /dev/null || test -d .deps; then
268 AC_DEFUN([AM_DEP_TRACK],[
269 AC_ARG_ENABLE(dependency-tracking,
270 [ --disable-dependency-tracking Speeds up one-time builds
271 --enable-dependency-tracking Do not reject slow dependency extractors])
272 if test "x$enable_dependency_tracking" = xno; then
275 am_depcomp="$ac_aux_dir/depcomp"
276 if test ! -f "$am_depcomp"; then
283 if test -z "$AMDEP"; then
288 pushdef([subst], defn([AC_SUBST]))
289 subst(AMDEPBACKSLASH)
293 # Generate code to set up dependency tracking.
294 # This macro should only be invoked once -- use via AC_REQUIRE.
296 # AM_OUTPUT_DEPENDENCY_COMMANDS
299 # This code is only required when automatic dependency tracking
300 # is enabled. FIXME. This creates each `.P' file that we will
301 # need in order to bootstrap the dependency handling code.
302 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],[
304 test x"$AMDEP" != x"" ||
305 for mf in $CONFIG_FILES; do
307 Makefile) dirpart=.;;
308 */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;;
311 grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
312 # Extract the definition of DEP_FILES from the Makefile without
314 DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
315 test -z "$DEPDIR" && continue
316 # When using ansi2knr, U may be empty or an underscore; expand it
317 U=`sed -n -e '/^U = / s///p' < "$mf"`
318 test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
319 # We invoke sed twice because it is the simplest approach to
320 # changing $(DEPDIR) to its actual value in the expansion.
321 for file in `sed -n -e '
322 /^DEP_FILES = .*\\\\$/ {
331 /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
332 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
333 # Make sure the directory exists.
334 test -f "$dirpart/$file" && continue
335 fdir=`echo "$file" | sed -e 's|/[^/]*$||'`
336 $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1
337 # echo "creating $dirpart/$file"
338 echo '# dummy' > "$dirpart/$file"
342 ac_aux_dir="$ac_aux_dir"])])
345 dnl This test replaces the one in autoconf.
346 dnl Currently this macro should have the same name as the autoconf macro
347 dnl because gettext's gettext.m4 (distributed in the automake package)
348 dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader
349 dnl give these diagnostics:
350 dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
351 dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
353 undefine([AC_ISC_POSIX])
354 AC_DEFUN(AC_ISC_POSIX,
356 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
357 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
364 AC_DEFUN([AM_C_PROTOTYPES],
365 [AC_REQUIRE([AM_PROG_CC_STDC])
366 AC_REQUIRE([AC_PROG_CPP])
367 AC_MSG_CHECKING([for function prototypes])
368 if test "$am_cv_prog_cc_stdc" != no; then
370 AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
374 U=_ ANSI2KNR=./ansi2knr
375 # Ensure some checks needed by ansi2knr itself.
377 AC_CHECK_HEADERS(string.h)
380 AC_SUBST(ANSI2KNR)dnl
386 # @defmac AC_PROG_CC_STDC
387 # @maindex PROG_CC_STDC
389 # If the C compiler in not in ANSI C mode by default, try to add an option
390 # to output variable @code{CC} to make it so. This macro tries various
391 # options that select ANSI C on some system or another. It considers the
392 # compiler to be in ANSI C mode if it handles function prototypes correctly.
394 # If you use this macro, you should check after calling it whether the C
395 # compiler has been set to accept ANSI C; if not, the shell variable
396 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
397 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
398 # program @code{ansi2knr}, which comes with Ghostscript.
401 AC_DEFUN([AM_PROG_CC_STDC],
402 [AC_REQUIRE([AC_PROG_CC])
403 AC_BEFORE([$0], [AC_C_INLINE])
404 AC_BEFORE([$0], [AC_C_CONST])
405 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
406 dnl a magic option to avoid problems with ANSI preprocessor commands
408 dnl FIXME: can't do this because then AC_AIX won't work due to a
409 dnl circular dependency.
410 dnl AC_BEFORE([$0], [AC_PROG_CPP])
411 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
412 AC_CACHE_VAL(am_cv_prog_cc_stdc,
413 [am_cv_prog_cc_stdc=no
415 # Don't try gcc -ansi; that turns off useful extensions and
416 # breaks some systems' header files.
418 # Ultrix and OSF/1 -std1
419 # HP-UX 10.20 and later -Ae
420 # HP-UX older versions -Aa -D_HPUX_SOURCE
421 # SVR4 -Xc -D__EXTENSIONS__
422 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
424 CC="$ac_save_CC $ac_arg"
428 #include <sys/types.h>
429 #include <sys/stat.h>
430 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
431 struct buf { int x; };
432 FILE * (*rcsopen) (struct buf *, struct stat *, int);
433 static char *e (p, i)
439 static char *f (char * (*g) (char **, int), char **p, ...)
444 s = g (p, va_arg (v,int));
448 int test (int i, double x);
449 struct s1 {int (*f) (int a);};
450 struct s2 {int (*f) (double a);};
451 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
455 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
457 [am_cv_prog_cc_stdc="$ac_arg"; break])
461 if test -z "$am_cv_prog_cc_stdc"; then
462 AC_MSG_RESULT([none needed])
464 AC_MSG_RESULT($am_cv_prog_cc_stdc)
466 case "x$am_cv_prog_cc_stdc" in
468 *) CC="$CC $am_cv_prog_cc_stdc" ;;
474 dnl By default, many hosts won't let programs access large files;
475 dnl one must use special compiler options to get large-file access to work.
476 dnl For more details about this brain damage please see:
477 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
479 dnl Written by Paul Eggert <eggert@twinsun.com>.
481 dnl Internal subroutine of AC_SYS_LARGEFILE.
482 dnl AC_SYS_LARGEFILE_FLAGS(FLAGSNAME)
483 AC_DEFUN(AC_SYS_LARGEFILE_FLAGS,
484 [AC_CACHE_CHECK([for $1 value to request large file support],
485 ac_cv_sys_largefile_$1,
486 [if ($GETCONF LFS_$1) >conftest.1 2>conftest.2 && test ! -s conftest.2
488 ac_cv_sys_largefile_$1=`cat conftest.1`
490 ac_cv_sys_largefile_$1=no
493 # HP-UX 10.20 requires -D__STDC_EXT__ with gcc 2.95.1.
494 [ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)]
495 if test "$GCC" = yes; then
496 ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__
499 # IRIX 6.2 and later require cc -n32.
500 [ irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)]
501 if test "$GCC" != yes; then
502 ac_cv_sys_largefile_CFLAGS=-n32
505 if test "$ac_cv_sys_largefile_CFLAGS" != no; then
507 CC="$CC $ac_cv_sys_largefile_CFLAGS"
508 AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
514 dnl Internal subroutine of AC_SYS_LARGEFILE.
515 dnl AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL)
516 AC_DEFUN(AC_SYS_LARGEFILE_SPACE_APPEND,
526 dnl Internal subroutine of AC_SYS_LARGEFILE.
527 dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
528 AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE,
529 [AC_CACHE_CHECK([for $1], $2,
532 for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
537 $2=`expr " $ac_flag" : '[[^=]]*=\(.*\)'` ;;
541 if test "[$]$2" != no; then
542 AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
545 AC_DEFUN(AC_SYS_LARGEFILE,
546 [AC_REQUIRE([AC_CANONICAL_HOST])
547 AC_ARG_ENABLE(largefile,
548 [ --disable-largefile omit support for large files])
549 if test "$enable_largefile" != no; then
550 AC_CHECK_TOOL(GETCONF, getconf)
551 AC_SYS_LARGEFILE_FLAGS(CFLAGS)
552 AC_SYS_LARGEFILE_FLAGS(LDFLAGS)
553 AC_SYS_LARGEFILE_FLAGS(LIBS)
555 for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
558 -D_FILE_OFFSET_BITS=*) ;;
559 -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
560 -D_LARGE_FILES | -D_LARGE_FILES=*) ;;
562 AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
564 AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
567 AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
568 AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
569 AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
570 ac_cv_sys_file_offset_bits,
571 [Number of bits in a file offset, on hosts where this is settable.],
573 # HP-UX 10.20 and later
574 [ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)]
575 ac_cv_sys_file_offset_bits=64 ;;
577 AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
578 ac_cv_sys_largefile_source,
579 [Define to make fseeko etc. visible, on some hosts.],
581 # HP-UX 10.20 and later
582 [ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)]
583 ac_cv_sys_largefile_source=1 ;;
585 AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
586 ac_cv_sys_large_files,
587 [Define for large files, on AIX-style hosts.],
590 [ aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)]
591 ac_cv_sys_large_files=1 ;;
596 #serial 13, with several lines deleted for fileutils.
598 dnl Misc type-related macros for fileutils, sh-utils, textutils.
604 GNU_PACKAGE="GNU $PACKAGE"
605 AC_DEFINE_UNQUOTED(GNU_PACKAGE, "$GNU_PACKAGE",
606 [The concatenation of the strings `GNU ', and PACKAGE.])
607 AC_SUBST(GNU_PACKAGE)
609 AC_SUBST(OPTIONAL_BIN_PROGS)
610 AC_SUBST(OPTIONAL_BIN_ZCRIPTS)
614 dnl This macro actually runs replacement code. See isc-posix.m4.
615 AC_REQUIRE([AC_ISC_POSIX])dnl
654 jm_INCLUDED_REGEX([lib/regex.c])
656 AC_REQUIRE([jm_ASSERT])
657 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
658 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE])
659 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_INO])
660 AC_REQUIRE([jm_CHECK_DECLS])
662 AC_REQUIRE([jm_PREREQ])
664 AC_REQUIRE([jm_FUNC_MKTIME])
665 AC_REQUIRE([jm_FUNC_LSTAT])
666 AC_REQUIRE([jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
667 AC_REQUIRE([jm_FUNC_STAT])
668 AC_REQUIRE([jm_FUNC_REALLOC])
669 AC_REQUIRE([jm_FUNC_MALLOC])
670 AC_REQUIRE([jm_FUNC_STRERROR_R])
671 AC_REQUIRE([jm_FUNC_READDIR])
672 AC_REQUIRE([jm_FUNC_MEMCMP])
673 AC_REQUIRE([jm_FUNC_GLIBC_UNLOCKED_IO])
674 AC_REQUIRE([kd_FUNC_FNMATCH_CASE_RPL])
676 AC_REQUIRE([jm_AC_PREREQ_XSTRTOUMAX])
677 AC_REQUIRE([jm_AC_FUNC_LINK_FOLLOWS_SYMLINK])
678 AC_REQUIRE([AM_FUNC_ERROR_AT_LINE])
679 AC_REQUIRE([jm_FUNC_GNU_STRFTIME])
680 AC_REQUIRE([jm_FUNC_MKTIME])
682 AC_REQUIRE([AC_FUNC_VPRINTF])
683 AC_REQUIRE([AC_FUNC_ALLOCA])
685 AC_REPLACE_FUNCS(strncasecmp)
686 AC_REPLACE_FUNCS(stpcpy strstr strtol strtoul)
687 AC_REPLACE_FUNCS(memcmp rpmatch)
689 dnl used by e.g. intl/*domain.c and lib/canon-host.c
690 AC_REPLACE_FUNCS(strdup)
692 AC_REPLACE_FUNCS(memcpy memset)
693 AC_CHECK_FUNCS(getpagesize)
695 # By default, argmatch should fail calling usage (1).
696 AC_DEFINE(ARGMATCH_DIE, [usage (1)],
697 [Define to the function xargmatch calls on failures.])
698 AC_DEFINE(ARGMATCH_DIE_DECL, [extern void usage ()],
699 [Define to the declaration of the xargmatch failure function.])
701 dnl Used to define SETVBUF in sys2.h.
702 dnl This evokes the following warning from autoconf:
703 dnl ...: warning: AC_TRY_RUN called without default to allow cross compiling
704 AC_FUNC_SETVBUF_REVERSED
706 # used by sleep and shred
707 # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
708 # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
709 AC_SEARCH_LIBS(clock_gettime, [rt posix4])
710 AC_CHECK_FUNCS(clock_gettime)
711 AC_CHECK_FUNCS(gettimeofday)
713 AC_CHECK_FUNCS(getdelim)
715 AC_REQUIRE([AC_FUNC_CLOSEDIR_VOID])
748 if test $am_cv_func_working_getline != yes; then
749 AC_CHECK_FUNCS(getdelim)
752 # These tests are for df.
757 AC_DEFUN(jm_CHECK_ALL_TYPES,
759 dnl Checks for typedefs, structures, and compiler characteristics.
760 AC_REQUIRE([AC_C_BIGENDIAN])
761 AC_REQUIRE([AC_PROG_CC_STDC])
762 AC_REQUIRE([AC_C_CONST])
763 AC_REQUIRE([AC_C_VOLATILE])
764 AC_REQUIRE([AC_C_INLINE])
765 AC_REQUIRE([AC_C_LONG_DOUBLE])
767 AC_REQUIRE([AC_HEADER_DIRENT])
768 AC_REQUIRE([AC_HEADER_STDC])
769 AC_CHECK_MEMBERS((struct stat.st_blksize),,,[$ac_includes_default
770 #include <sys/stat.h>
772 AC_REQUIRE([AC_STRUCT_ST_BLOCKS])
774 AC_REQUIRE([AC_STRUCT_TM])
775 AC_REQUIRE([AC_STRUCT_TIMEZONE])
776 AC_REQUIRE([AC_HEADER_STAT])
777 AC_REQUIRE([AC_STRUCT_ST_MTIM_NSEC])
778 AC_REQUIRE([AC_STRUCT_ST_DM_MODE])
779 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_TIMESPEC])
781 AC_REQUIRE([AC_TYPE_GETGROUPS])
782 AC_REQUIRE([AC_TYPE_MODE_T])
783 AC_REQUIRE([AC_TYPE_OFF_T])
784 AC_REQUIRE([AC_TYPE_PID_T])
785 AC_REQUIRE([AC_TYPE_SIGNAL])
786 AC_REQUIRE([AC_TYPE_SIZE_T])
787 AC_REQUIRE([AC_TYPE_UID_T])
788 AC_CHECK_TYPE(ino_t, unsigned long)
790 dnl This relies on the fact that autoconf 2.14a's implementation of
791 dnl AC_CHECK_TYPE checks includes unistd.h.
792 AC_CHECK_TYPE(ssize_t, int)
794 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
795 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
797 AC_REQUIRE([AC_HEADER_MAJOR])
798 AC_REQUIRE([AC_HEADER_DIRENT])
804 dnl Initially derived from code in GNU grep.
805 dnl Mostly written by Jim Meyering.
807 dnl Usage: jm_INCLUDED_REGEX([lib/regex.c])
809 AC_DEFUN(jm_INCLUDED_REGEX,
811 dnl Even packages that don't use regex.c can use this macro.
812 dnl Of course, for them it doesn't do anything.
814 # Assume we'll default to using the included regex.c.
815 ac_use_included_regex=yes
817 # However, if the system regex support is good enough that it passes the
818 # the following run test, then default to *not* using the included regex.c.
819 # If cross compiling, assume the test would fail and use the included
820 # regex.c. The first failing regular expression is from `Spencer ere
821 # test #75' in grep-2.3.
822 AC_CACHE_CHECK([for working re_compile_pattern],
823 jm_cv_func_working_re_compile_pattern,
830 static struct re_pattern_buffer regex;
832 re_set_syntax (RE_SYNTAX_POSIX_EGREP);
833 /* Add this third left square bracket, [, to balance the
834 three right ones below. Otherwise autoconf-2.14 chokes. */
835 s = re_compile_pattern ("a[[:]:]]b\n", 9, ®ex);
836 /* This should fail with _Invalid character class name_ error. */
840 /* This should succeed, but doesn't for e.g. glibc-2.1.3. */
841 s = re_compile_pattern ("{1", 2, ®ex);
846 jm_cv_func_working_re_compile_pattern=yes,
847 jm_cv_func_working_re_compile_pattern=no,
848 dnl When crosscompiling, assume it's broken.
849 jm_cv_func_working_re_compile_pattern=no))
850 if test $jm_cv_func_working_re_compile_pattern = yes; then
851 ac_use_included_regex=no
854 test -n "$1" || AC_MSG_ERROR([missing argument])
859 AC_ARG_WITH(included-regex,
860 [ --without-included-regex don't compile regex; this is the default on
861 systems with version 2 of the GNU C library
862 (use with caution on other system)],
863 jm_with_regex=$withval,
864 jm_with_regex=$ac_use_included_regex)
865 if test "$jm_with_regex" = yes; then
867 LIBOBJS="$LIBOBJS regex.$ac_objext"
875 dnl based on code from Eleftherios Gkioulekas
879 AC_MSG_CHECKING(whether to enable assertions)
880 AC_ARG_ENABLE(assert,
881 [ --disable-assert turn off assertions],
883 AC_DEFINE(NDEBUG,1,[Define to 1 if assertions should be disabled.]) ],
884 [ AC_MSG_RESULT(yes) ]
890 dnl From Paul Eggert.
892 # Define HAVE_INTTYPES_H if <inttypes.h> exists,
893 # doesn't clash with <sys/types.h>, and declares uintmax_t.
895 AC_DEFUN(jm_AC_HEADER_INTTYPES_H,
897 AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
899 [#include <sys/types.h>
900 #include <inttypes.h>],
901 [uintmax_t i = (uintmax_t) -1;],
902 jm_ac_cv_header_inttypes_h=yes,
903 jm_ac_cv_header_inttypes_h=no)])
904 if test $jm_ac_cv_header_inttypes_h = yes; then
905 AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
906 [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
907 and declares uintmax_t. ])
913 dnl From Jim Meyering.
915 dnl Check whether struct dirent has a member named d_type.
918 AC_DEFUN(jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE,
919 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
920 AC_CACHE_CHECK([for d_type member in directory struct],
921 jm_cv_struct_dirent_d_type,
924 #include <sys/types.h>
927 #else /* not HAVE_DIRENT_H */
928 # define dirent direct
929 # ifdef HAVE_SYS_NDIR_H
930 # include <sys/ndir.h>
931 # endif /* HAVE_SYS_NDIR_H */
932 # ifdef HAVE_SYS_DIR_H
933 # include <sys/dir.h>
934 # endif /* HAVE_SYS_DIR_H */
937 # endif /* HAVE_NDIR_H */
938 #endif /* HAVE_DIRENT_H */
940 [struct dirent dp; dp.d_type = 0;],
942 jm_cv_struct_dirent_d_type=yes,
943 jm_cv_struct_dirent_d_type=no)
946 if test $jm_cv_struct_dirent_d_type = yes; then
947 AC_DEFINE(D_TYPE_IN_DIRENT, 1,
948 [Define if there is a member named d_type in the struct describing
956 dnl From Jim Meyering.
958 dnl Check whether struct dirent has a member named d_ino.
961 AC_DEFUN(jm_CHECK_TYPE_STRUCT_DIRENT_D_INO,
962 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
963 AC_CACHE_CHECK([for d_ino member in directory struct],
964 jm_cv_struct_dirent_d_ino,
967 #include <sys/types.h>
970 #else /* not HAVE_DIRENT_H */
971 # define dirent direct
972 # ifdef HAVE_SYS_NDIR_H
973 # include <sys/ndir.h>
974 # endif /* HAVE_SYS_NDIR_H */
975 # ifdef HAVE_SYS_DIR_H
976 # include <sys/dir.h>
977 # endif /* HAVE_SYS_DIR_H */
980 # endif /* HAVE_NDIR_H */
981 #endif /* HAVE_DIRENT_H */
983 [struct dirent dp; dp.d_ino = 0;],
985 jm_cv_struct_dirent_d_ino=yes,
986 jm_cv_struct_dirent_d_ino=no)
989 if test $jm_cv_struct_dirent_d_ino = yes; then
990 AC_DEFINE(D_INO_IN_DIRENT, 1,
991 [Define if there is a member named d_ino in the struct describing
997 #serial 9, except remove memchr and nanosleep as findutils doesn't need them
999 dnl This is just a wrapper function to encapsulate this kludge.
1000 dnl Putting it in a separate file like this helps share it between
1001 dnl different packages.
1002 AC_DEFUN(jm_CHECK_DECLS,
1004 AC_REQUIRE([_jm_DECL_HEADERS])
1005 AC_REQUIRE([AC_HEADER_TIME])
1009 # if !STDC_HEADERS && HAVE_MEMORY_H
1010 # include <memory.h>
1012 # include <string.h>
1015 # include <strings.h>
1019 # include <stdlib.h>
1022 # include <unistd.h>
1025 #include <sys/types.h>
1026 #if TIME_WITH_SYS_TIME
1027 # include <sys/time.h>
1030 # if HAVE_SYS_TIME_H
1031 # include <sys/time.h>
1050 ttyname), , , $headers)
1053 dnl FIXME: when autoconf has support for it.
1054 dnl This is a little helper so we can require these header checks.
1055 AC_DEFUN(_jm_DECL_HEADERS,
1057 AC_REQUIRE([AC_HEADER_STDC])
1058 AC_CHECK_HEADERS(memory.h string.h strings.h stdlib.h unistd.h sys/time.h)
1063 dnl These are the prerequisite macros for files in the lib/
1064 dnl directories of the fileutils, sh-utils, and textutils packages.
1069 jm_PREREQ_CANON_HOST
1076 AC_DEFUN(jm_PREREQ_ADDEXT,
1079 AC_SYS_LONG_FILE_NAMES
1080 AC_CHECK_FUNCS(pathconf)
1081 AC_CHECK_HEADERS(limits.h string.h unistd.h)
1084 AC_DEFUN(jm_PREREQ_CANON_HOST,
1086 dnl Add any libraries as early as possible.
1087 dnl In particular, inet_ntoa needs -lnsl at least on Solaris5.5.1,
1088 dnl so we have to add -lnsl to LIBS before checking for that function.
1089 AC_SEARCH_LIBS(gethostbyname, [inet nsl])
1091 dnl These come from -lnsl on Solaris5.5.1.
1092 AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
1094 AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
1095 AC_CHECK_HEADERS(unistd.h string.h netdb.h sys/socket.h \
1096 netinet/in.h arpa/inet.h)
1099 AC_DEFUN(jm_PREREQ_QUOTEARG,
1101 AC_CHECK_FUNCS(isascii iswprint mbrtowc)
1102 AC_CHECK_HEADERS(limits.h stdlib.h string.h wchar.h wctype.h)
1109 AC_DEFUN(jm_PREREQ_READUTMP,
1112 AC_CHECK_HEADERS(string.h utmpx.h sys/param.h)
1113 AC_CHECK_FUNCS(utmpname)
1114 AC_CHECK_FUNCS(utmpxname)
1118 $ac_includes_default
1125 AC_CHECK_MEMBERS((struct utmpx.ut_user),,,[$utmp_includes])
1126 AC_CHECK_MEMBERS((struct utmp.ut_user),,,[$utmp_includes])
1127 AC_CHECK_MEMBERS((struct utmpx.ut_name),,,[$utmp_includes])
1128 AC_CHECK_MEMBERS((struct utmp.ut_name),,,[$utmp_includes])
1131 AC_DEFUN(jm_PREREQ_REGEX,
1133 dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it.
1134 dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary
1136 AC_CHECK_FUNCS(bzero bcopy isascii btowc)
1137 AC_CHECK_HEADERS(alloca.h libintl.h wctype.h wchar.h)
1144 dnl FIXME: put these prerequisite-only *.m4 files in a separate
1145 dnl directory -- otherwise, they'll conflict with existing files.
1147 dnl These are the prerequisite macros for GNU's error.c file.
1148 AC_DEFUN(jm_PREREQ_ERROR,
1150 AC_CHECK_FUNCS(strerror strerror_r vprintf doprnt)
1156 dnl From Paul Eggert.
1158 AC_DEFUN(AC_C_BACKSLASH_A,
1160 AC_CACHE_CHECK([whether backslash-a works in strings], ac_cv_c_backslash_a,
1166 char buf['\a' == 'a' ? -1 : 1];
1168 return buf[0] != "\a"[0];
1170 ac_cv_c_backslash_a=yes,
1171 ac_cv_c_backslash_a=no)])
1172 if test $ac_cv_c_backslash_a = yes; then
1173 AC_DEFINE(HAVE_C_BACKSLASH_A, 1,
1174 [Define if backslash-a works in C strings.])
1182 # Some versions of BeOS define mbstate_t to be an incomplete type,
1183 # so you can't declare an object of that type.
1184 # Check for this incompatibility with Standard C.
1186 AC_DEFUN(AC_MBSTATE_T_OBJECT,
1187 [AC_CACHE_CHECK([for mbstate_t object type], ac_cv_type_mbstate_t_object,
1188 [AC_TRY_COMPILE([#include <wchar.h>],
1189 [mbstate_t x; return sizeof x;],
1190 ac_cv_type_mbstate_t_object=yes,
1191 ac_cv_type_mbstate_t_object=no)])
1192 if test $ac_cv_type_mbstate_t_object = yes; then
1193 AC_DEFINE(HAVE_MBSTATE_T_OBJECT, 1,
1194 [Define if mbstate_t is an object type.])
1199 dnl From Jim Meyering.
1200 dnl A wrapper around AC_FUNC_MKTIME.
1202 AC_DEFUN(jm_FUNC_MKTIME,
1203 [AC_REQUIRE([AC_FUNC_MKTIME])dnl
1205 dnl mktime.c uses localtime_r if it exists. Check for it.
1206 AC_CHECK_FUNCS(localtime_r)
1208 if test $ac_cv_func_working_mktime = no; then
1209 AC_DEFINE_UNQUOTED(mktime, rpl_mktime,
1210 [Define to rpl_mktime if the replacement function should be used.])
1216 dnl From Jim Meyering.
1217 dnl Determine whether lstat has the bug that it succeeds when given the
1218 dnl zero-length file name argument. The lstat from SunOS4.1.4 and the Hurd
1219 dnl (as of 1998-11-01) do this.
1221 dnl If it does, then define HAVE_LSTAT_EMPTY_STRING_BUG and arrange to
1222 dnl compile the wrapper function.
1225 AC_DEFUN(jm_FUNC_LSTAT,
1227 AC_CACHE_CHECK([whether lstat accepts an empty string],
1228 jm_cv_func_lstat_empty_string_bug,
1230 # include <sys/types.h>
1231 # include <sys/stat.h>
1237 exit (lstat ("", &sbuf) ? 1 : 0);
1240 jm_cv_func_lstat_empty_string_bug=yes,
1241 jm_cv_func_lstat_empty_string_bug=no,
1242 dnl When crosscompiling, assume lstat is broken.
1243 jm_cv_func_lstat_empty_string_bug=yes)
1245 if test $jm_cv_func_lstat_empty_string_bug = yes; then
1247 LIBOBJS="$LIBOBJS lstat.$ac_objext"
1248 AC_DEFINE_UNQUOTED(HAVE_LSTAT_EMPTY_STRING_BUG, 1,
1249 [Define if lstat has the bug that it succeeds when given the zero-length
1250 file name argument. The lstat from SunOS4.1.4 and the Hurd as of 1998-11-01)
1257 dnl From Jim Meyering.
1260 AC_DEFUN(jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK,
1263 [whether lstat dereferences a symlink specified with a trailing slash],
1264 jm_cv_func_lstat_dereferences_slashed_symlink,
1266 rm -f conftest.sym conftest.file
1268 if ln -s conftest.file conftest.sym; then
1270 # include <sys/types.h>
1271 # include <sys/stat.h>
1277 /* Linux will dereference the symlink and fail.
1278 That is better in the sense that it means we will not
1279 have to compile and use the lstat wrapper. */
1280 exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1);
1283 jm_cv_func_lstat_dereferences_slashed_symlink=yes,
1284 jm_cv_func_lstat_dereferences_slashed_symlink=no,
1285 dnl When crosscompiling, be pessimistic so we will end up using the
1286 dnl replacement version of lstat that checkes for trailing slashes
1287 dnl and calls lstat a second time when necessary.
1288 jm_cv_func_lstat_dereferences_slashed_symlink=no
1291 # If the `ln -s' command failed, then we probably don't even
1292 # have an lstat function.
1293 jm_cv_func_lstat_dereferences_slashed_symlink=no
1297 test $jm_cv_func_lstat_dereferences_slashed_symlink = yes \
1300 AC_DEFINE_UNQUOTED(LSTAT_FOLLOWS_SLASHED_SYMLINK, $zero_one,
1301 [Define if lstat dereferences a symlink specified with a trailing slash])
1303 if test $jm_cv_func_lstat_dereferences_slashed_symlink = no; then
1305 # Append lstat.o if it's not already in $LIBOBJS.
1307 *lstat.$ac_objext*) ;;
1308 *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;;
1315 dnl From Jim Meyering.
1316 dnl Determine whether stat has the bug that it succeeds when given the
1317 dnl zero-length file name argument. The stat from SunOS4.1.4 and the Hurd
1318 dnl (as of 1998-11-01) do this.
1320 dnl If it does, then define HAVE_STAT_EMPTY_STRING_BUG and arrange to
1321 dnl compile the wrapper function.
1324 AC_DEFUN(jm_FUNC_STAT,
1326 AC_CACHE_CHECK([whether stat accepts an empty string],
1327 jm_cv_func_stat_empty_string_bug,
1329 # include <sys/types.h>
1330 # include <sys/stat.h>
1336 exit (stat ("", &sbuf) ? 1 : 0);
1339 jm_cv_func_stat_empty_string_bug=yes,
1340 jm_cv_func_stat_empty_string_bug=no,
1341 dnl When crosscompiling, assume stat is broken.
1342 jm_cv_func_stat_empty_string_bug=yes)
1344 if test $jm_cv_func_stat_empty_string_bug = yes; then
1346 LIBOBJS="$LIBOBJS stat.$ac_objext"
1347 AC_DEFINE_UNQUOTED(HAVE_STAT_EMPTY_STRING_BUG, 1,
1348 [Define if stat has the bug that it succeeds when given the zero-length
1349 file name argument. The stat from SunOS4.1.4 and the Hurd as of 1998-11-01)
1356 dnl From Jim Meyering.
1357 dnl Determine whether realloc works when both arguments are 0.
1358 dnl If it doesn't, arrange to use the replacement function.
1361 AC_DEFUN(jm_FUNC_REALLOC,
1363 dnl xmalloc.c requires that this symbol be defined so it doesn't
1364 dnl mistakenly use a broken realloc -- as it might if this test were omitted.
1365 AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_REALLOC_CHECK, 1,
1366 [Define if the realloc check has been performed. ])
1368 AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc,
1374 exit (realloc (0, 0) ? 0 : 1);
1377 jm_cv_func_working_realloc=yes,
1378 jm_cv_func_working_realloc=no,
1379 dnl When crosscompiling, assume realloc is broken.
1380 jm_cv_func_working_realloc=no)
1382 if test $jm_cv_func_working_realloc = no; then
1384 LIBOBJS="$LIBOBJS realloc.$ac_objext"
1385 AC_DEFINE_UNQUOTED(realloc, rpl_realloc,
1386 [Define to rpl_realloc if the replacement function should be used.])
1392 dnl From Jim Meyering.
1393 dnl Determine whether malloc accepts 0 as its argument.
1394 dnl If it doesn't, arrange to use the replacement function.
1397 AC_DEFUN(jm_FUNC_MALLOC,
1399 dnl xmalloc.c requires that this symbol be defined so it doesn't
1400 dnl mistakenly use a broken malloc -- as it might if this test were omitted.
1401 AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_MALLOC_CHECK, 1,
1402 [Define if the malloc check has been performed. ])
1404 AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc,
1410 exit (malloc (0) ? 0 : 1);
1413 jm_cv_func_working_malloc=yes,
1414 jm_cv_func_working_malloc=no,
1415 dnl When crosscompiling, assume malloc is broken.
1416 jm_cv_func_working_malloc=no)
1418 if test $jm_cv_func_working_malloc = no; then
1420 LIBOBJS="$LIBOBJS malloc.$ac_objext"
1421 AC_DEFINE_UNQUOTED(malloc, rpl_malloc,
1422 [Define to rpl_malloc if the replacement function should be used.])
1428 dnl From Jim Meyering.
1429 dnl Determine whether the strerror_r implementation is one of
1430 dnl the broken ones that returns `int' rather than `char*'.
1431 dnl Actually, this tests only whether it returns a scalar
1432 dnl or an array, but that should be enough.
1433 dnl On at least DEC UNIX 4.0[A-D] and HP-UX B.10.20, strerror_r
1434 dnl returns `int'. This is used by lib/error.c.
1436 AC_DEFUN(jm_FUNC_STRERROR_R,
1439 AC_CHECK_FUNCS([strerror_r])
1440 if test $ac_cv_func_strerror_r = yes; then
1441 AC_CHECK_HEADERS(string.h)
1442 AC_CACHE_CHECK([for working strerror_r],
1443 jm_cv_func_working_strerror_r,
1449 # include <string.h>
1453 int buf; /* avoiding square brackets makes this easier */
1454 char x = *strerror_r (0, buf, sizeof buf);
1456 jm_cv_func_working_strerror_r=yes,
1457 jm_cv_func_working_strerror_r=no
1459 if test $jm_cv_func_working_strerror_r = yes; then
1460 AC_DEFINE_UNQUOTED(HAVE_WORKING_STRERROR_R, 1,
1461 [Define to 1 if strerror_r returns a string.])
1469 dnl SunOS's readdir is broken in such a way that rm.c has to add extra code
1470 dnl to test whether a NULL return value really means there are no more files
1471 dnl in the directory.
1473 dnl Detect the problem by creating a directory containing 300 files (254 not
1474 dnl counting . and .. is the minimum) and see if a loop doing `readdir; unlink'
1475 dnl removes all of them.
1477 dnl Define HAVE_WORKING_READDIR if readdir does *not* have this problem.
1479 dnl Written by Jim Meyering.
1481 AC_DEFUN(jm_FUNC_READDIR,
1483 AC_REQUIRE([AC_HEADER_DIRENT])
1484 AC_CHECK_HEADERS(string.h)
1485 AC_CACHE_CHECK([for working readdir], jm_cv_func_working_readdir,
1487 # Arrange for deletion of the temporary directory this test creates, in
1488 # case the test itself fails to delete everything -- as happens on Sunos.
1489 ac_clean_files="$ac_clean_files conf-dir"
1492 [# include <stdio.h>
1493 # include <sys/types.h>
1495 # include <string.h>
1498 # ifdef HAVE_DIRENT_H
1499 # include <dirent.h>
1500 # define NLENGTH(direct) (strlen((direct)->d_name))
1501 # else /* not HAVE_DIRENT_H */
1502 # define dirent direct
1503 # define NLENGTH(direct) ((direct)->d_namlen)
1504 # ifdef HAVE_SYS_NDIR_H
1505 # include <sys/ndir.h>
1506 # endif /* HAVE_SYS_NDIR_H */
1507 # ifdef HAVE_SYS_DIR_H
1508 # include <sys/dir.h>
1509 # endif /* HAVE_SYS_DIR_H */
1512 # endif /* HAVE_NDIR_H */
1513 # endif /* HAVE_DIRENT_H */
1515 # define DOT_OR_DOTDOT(Basename) \
1516 (Basename[0] == '.' && (Basename[1] == '\0' \
1517 || (Basename[1] == '.' && Basename[2] == '\0')))
1520 create_300_file_dir (const char *dir)
1524 if (mkdir (dir, 0700))
1529 for (i = 0; i < 300; i++)
1534 sprintf (file_name, "%03d", i);
1535 out = fopen (file_name, "w");
1538 if (fclose (out) == EOF)
1547 remove_dir (const char *dir)
1554 dirp = opendir (".");
1560 struct dirent *dp = readdir (dirp);
1564 if (DOT_OR_DOTDOT (dp->d_name))
1567 if (unlink (dp->d_name))
1582 const char *dir = "conf-dir";
1583 create_300_file_dir (dir);
1587 jm_cv_func_working_readdir=yes,
1588 jm_cv_func_working_readdir=no,
1589 jm_cv_func_working_readdir=no)])
1591 if test $jm_cv_func_working_readdir = yes; then
1592 AC_DEFINE_UNQUOTED(HAVE_WORKING_READDIR, 1,
1593 [Define if readdir is found to work properly in some unusual cases. ])
1599 dnl A replacement for autoconf's AC_FUNC_MEMCMP that detects
1600 dnl the losing memcmp on some x86 Next systems.
1601 AC_DEFUN(jm_AC_FUNC_MEMCMP,
1602 [AC_CACHE_CHECK([for working memcmp], jm_cv_func_memcmp_working,
1607 /* Some versions of memcmp are not 8-bit clean. */
1608 char c0 = 0x40, c1 = 0x80, c2 = 0x81;
1609 if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
1612 /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
1613 or more and with at least one buffer not starting on a 4-byte boundary.
1614 William Lewis provided this test program. */
1619 for (i = 0; i < 4; i++)
1623 strcpy (a, "--------01111111");
1624 strcpy (b, "--------10000000");
1625 if (memcmp (a, b, 16) >= 0)
1631 jm_cv_func_memcmp_working=yes,
1632 jm_cv_func_memcmp_working=no,
1633 jm_cv_func_memcmp_working=no)])
1634 test $jm_cv_func_memcmp_working = no \
1635 && LIBOBJS="$LIBOBJS memcmp.$ac_objext"
1636 AC_SUBST(LIBOBJS)dnl
1639 AC_DEFUN(jm_FUNC_MEMCMP,
1640 [AC_REQUIRE([jm_AC_FUNC_MEMCMP])dnl
1641 if test $jm_cv_func_memcmp_working = no; then
1642 AC_DEFINE_UNQUOTED(memcmp, rpl_memcmp,
1643 [Define to rpl_memcmp if the replacement function should be used.])
1649 dnl From Jim Meyering.
1651 dnl See if the glibc *_unlocked I/O macros are available.
1652 dnl Use only those *_unlocked macros that are declared.
1655 AC_DEFUN(jm_FUNC_GLIBC_UNLOCKED_IO,
1657 io_functions='clearerr_unlocked feof_unlocked ferror_unlocked
1658 fflush_unlocked fputc_unlocked fread_unlocked fwrite_unlocked
1659 getc_unlocked getchar_unlocked putc_unlocked putchar_unlocked'
1660 for jm_io_func in $io_functions; do
1661 # Check for the existence of each function only if its declared.
1662 # Otherwise, we'd get the Solaris5.5.1 functions that are not
1663 # declared, and that have been removed from Solaris5.6. The resulting
1664 # 5.5.1 binaries would not run on 5.6 due to shared library differences.
1665 AC_CHECK_DECLS(($jm_io_func),
1668 [#include <stdio.h>])
1669 if test $jm_declared = yes; then
1670 AC_CHECK_FUNCS($jm_io_func)
1678 dnl Determine whether to add fnmatch.o to LIBOBJS and to
1679 dnl define fnmatch to rpl_fnmatch.
1684 # We look for fnmatch.h to avoid that the test fails in C++.
1685 AC_DEFUN(kd_FUNC_FNMATCH_CASE,
1686 [AC_CHECK_HEADERS(fnmatch.h)
1687 AC_CACHE_CHECK(for working fnmatch with case folding, ac_cv_func_fnmatch_works,
1688 # Some versions of Solaris or SCO have a broken fnmatch function.
1689 # So we run a test program. If we are cross-compiling, take no chance.
1690 # Also want FNM_CASEFOLD
1691 # Thanks to John Oleynick and Franc,ois Pinard for this test.
1696 # include <fnmatch.h>
1702 exit (fnmatch ("A*", "abc", FNM_CASEFOLD) != 0);
1704 ac_cv_func_fnmatch_works=yes, ac_cv_func_fnmatch_works=no,
1705 ac_cv_func_fnmatch_works=no)])
1706 if test $ac_cv_func_fnmatch_works = yes; then
1707 AC_DEFINE(HAVE_FNMATCH, 1,
1708 [Define if your system has a working `fnmatch' function with case folding.])
1713 AC_DEFUN(kd_FUNC_FNMATCH_CASE_RPL,
1715 AC_REQUIRE([AM_GLIBC])
1716 kd_FUNC_FNMATCH_CASE
1717 if test $ac_cv_func_fnmatch_works = no \
1718 && test $ac_cv_gnu_library = no; then
1720 LIBOBJS="$LIBOBJS fnmatch.$ac_objext"
1721 AC_DEFINE_UNQUOTED(fnmatch, rpl_fnmatch,
1722 [Define to rpl_fnmatch if the replacement function should be used.])
1728 dnl From Gordon Matzigkeit.
1729 dnl Test for the GNU C Library.
1730 dnl FIXME: this should migrate into libit.
1734 AC_CACHE_CHECK(whether we are using the GNU C Library,
1736 [AC_EGREP_CPP([Thanks for using GNU],
1738 #include <features.h>
1739 #ifdef __GNU_LIBRARY__
1740 Thanks for using GNU
1743 ac_cv_gnu_library=yes,
1744 ac_cv_gnu_library=no)
1747 AC_CACHE_CHECK(for version 2 of the GNU C Library,
1749 [AC_EGREP_CPP([Thanks for using GNU too],
1751 #include <features.h>
1753 Thanks for using GNU too
1756 ac_cv_glibc=yes, ac_cv_glibc=no)
1765 AC_CHECKING(for AFS)
1767 && AC_DEFINE(AFS, 1, [Define if you have the Andrew File System.])
1772 # autoconf tests required for use of xstrtoumax.c
1774 AC_DEFUN(jm_AC_PREREQ_XSTRTOUMAX,
1776 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
1777 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
1778 AC_CHECK_HEADERS(stdlib.h)
1780 AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro],
1781 jm_cv_func_strtoumax_macro,
1782 AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include <inttypes.h>
1784 inttypes_h_defines_strtoumax
1786 jm_cv_func_strtoumax_macro=yes,
1787 jm_cv_func_strtoumax_macro=no))
1789 if test "$jm_cv_func_strtoumax_macro" != yes; then
1790 AC_REPLACE_FUNCS(strtoumax)
1793 dnl We don't need (and can't compile) the replacement strtoull
1794 dnl unless the type `unsigned long long' exists.
1795 dnl Also, only the replacement strtoumax invokes strtoull,
1796 dnl so we need the replacement strtoull only if strtoumax does not exist.
1797 case "$ac_cv_type_unsigned_long_long,$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in
1799 AC_REPLACE_FUNCS(strtoull)
1807 dnl From Paul Eggert.
1809 AC_DEFUN(jm_AC_TYPE_UNSIGNED_LONG_LONG,
1811 AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
1812 [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
1813 [unsigned long long ullmax = (unsigned long long) -1;
1814 return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
1815 ac_cv_type_unsigned_long_long=yes,
1816 ac_cv_type_unsigned_long_long=no)])
1817 if test $ac_cv_type_unsigned_long_long = yes; then
1818 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
1819 [Define if you have the unsigned long long type.])
1824 dnl Run a program to determine whether whether link(2) follows symlinks.
1825 dnl Set LINK_FOLLOWS_SYMLINKS accordingly.
1827 AC_DEFUN(jm_AC_FUNC_LINK_FOLLOWS_SYMLINK,
1829 AC_CACHE_CHECK([whether link(2) follows symlinks],
1830 jm_ac_cv_func_link_follows_symlink,
1832 dnl poor-man's AC_REQUIRE: FIXME: repair this once autoconf-3 provides
1833 dnl the appropriate framework.
1834 test -z "$ac_cv_header_unistd_h" \
1835 && AC_CHECK_HEADERS(unistd.h)
1837 # Create a regular file.
1838 echo > conftest.file
1841 # include <sys/types.h>
1842 # include <sys/stat.h>
1843 # ifdef HAVE_UNISTD_H
1844 # include <unistd.h>
1847 # define SAME_INODE(Stat_buf_1, Stat_buf_2) \
1848 ((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
1849 && (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)
1854 const char *file = "conftest.file";
1855 const char *sym = "conftest.sym";
1856 const char *hard = "conftest.hard";
1857 struct stat sb_file, sb_hard;
1859 /* Create a symlink to the regular file. */
1860 if (symlink (file, sym))
1863 /* Create a hard link to that symlink. */
1864 if (link (sym, hard))
1867 if (lstat (hard, &sb_hard))
1869 if (lstat (file, &sb_file))
1872 /* If the dev/inode of hard and file are the same, then
1873 the link call followed the symlink. */
1874 return SAME_INODE (sb_hard, sb_file) ? 0 : 1;
1877 jm_ac_cv_func_link_follows_symlink=yes,
1878 jm_ac_cv_func_link_follows_symlink=no,
1879 jm_ac_cv_func_link_follows_symlink=yes dnl We're cross compiling.
1882 if test $jm_ac_cv_func_link_follows_symlink = yes; then
1883 AC_DEFINE(LINK_FOLLOWS_SYMLINKS, 1,
1884 [Define if `link(2)' dereferences symbolic links.])
1888 # From Jim Meyering. Use this if you use the GNU error.[ch].
1889 # FIXME: Migrate into libit
1891 AC_DEFUN([AM_FUNC_ERROR_AT_LINE],
1892 [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
1893 [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
1894 am_cv_lib_error_at_line=yes,
1895 am_cv_lib_error_at_line=no)])
1896 if test $am_cv_lib_error_at_line = no; then
1897 LIBOBJS="$LIBOBJS error.$ac_objext"
1899 AC_SUBST(LIBOBJS)dnl
1904 dnl This macro is intended to be used solely in this file.
1905 dnl These are the prerequisite macros for GNU's strftime.c replacement.
1906 AC_DEFUN(_jm_STRFTIME_PREREQS,
1908 dnl strftime.c uses localtime_r if it exists. Check for it.
1909 AC_CHECK_FUNCS(localtime_r)
1911 AC_CHECK_HEADERS(limits.h)
1912 AC_CHECK_FUNCS(bcopy tzset mempcpy memcpy memset)
1914 # This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE.
1917 AC_CHECK_FUNCS(mblen mbrlen)
1919 AC_CHECK_MEMBER(struct tm.tm_gmtoff,
1920 [AC_DEFINE(HAVE_TM_GMTOFF, 1,
1921 [Define if struct tm has the tm_gmtoff member.])],
1923 [#include <time.h>])
1926 dnl Determine if the strftime function has all the features of the GNU one.
1928 dnl From Jim Meyering.
1930 AC_DEFUN(jm_FUNC_GNU_STRFTIME,
1931 [AC_REQUIRE([AC_HEADER_TIME])dnl
1933 _jm_STRFTIME_PREREQS
1935 AC_REQUIRE([AC_C_CONST])dnl
1936 AC_REQUIRE([AC_HEADER_STDC])dnl
1937 AC_CHECK_HEADERS(sys/time.h)
1938 AC_CACHE_CHECK([for working GNU strftime], jm_cv_func_working_gnu_strftime,
1939 [# Set TZ to GMT0 to make strftime give consistent results during the test.
1940 ac_save_TZ="${TZ-GMT0}"
1944 [ /* Ulrich Drepper provided parts of the test program. */
1946 # include <stdlib.h>
1949 #if TIME_WITH_SYS_TIME
1950 # include <sys/time.h>
1953 # if HAVE_SYS_TIME_H
1954 # include <sys/time.h>
1961 compare (const char *fmt, const struct tm *tm, const char *expected)
1964 strftime (buf, 99, fmt, tm);
1965 if (strcmp (buf, expected))
1967 #ifdef SHOW_FAILURES
1968 printf ("fmt: \"%s\", expected \"%s\", got \"%s\"\n",
1969 fmt, expected, buf);
1981 time_t t = 738367; /* Fri Jan 9 13:06:07 1970 */
1985 #define CMP(Fmt, Expected) n_fail += compare ((Fmt), tm, (Expected))
1987 CMP ("%-m", "1"); /* GNU */
1988 CMP ("%A", "Friday");
1989 CMP ("%^A", "FRIDAY"); /* The ^ is a GNU extension. */
1990 CMP ("%B", "January");
1991 CMP ("%^B", "JANUARY");
1992 CMP ("%C", "19"); /* POSIX.2 */
1993 CMP ("%D", "01/09/70"); /* POSIX.2 */
1994 CMP ("%F", "1970-01-09");
1995 CMP ("%G", "1970"); /* GNU */
2000 CMP ("%R", "13:06"); /* POSIX.2 */
2002 CMP ("%T", "13:06:07"); /* POSIX.2 */
2006 CMP ("%X", "13:06:07");
2009 CMP ("%_m", " 1"); /* GNU */
2014 CMP ("%c", "Fri Jan 9 13:06:07 1970");
2015 CMP ("%^c", "FRI JAN 9 13:06:07 1970");
2017 CMP ("%e", " 9"); /* POSIX.2 */
2018 CMP ("%g", "70"); /* GNU */
2019 CMP ("%h", "Jan"); /* POSIX.2 */
2022 CMP ("%k", "13"); /* GNU */
2023 CMP ("%l", " 1"); /* GNU */
2025 CMP ("%n", "\n"); /* POSIX.2 */
2027 CMP ("%r", "01:06:07 PM"); /* POSIX.2 */
2028 CMP ("%s", "738367"); /* GNU */
2029 CMP ("%t", "\t"); /* POSIX.2 */
2030 CMP ("%u", "5"); /* POSIX.2 */
2032 CMP ("%x", "01/09/70");
2034 CMP ("%z", "+0000"); /* GNU */
2036 exit (n_fail ? 1 : 0);
2038 jm_cv_func_working_gnu_strftime=yes,
2039 jm_cv_func_working_gnu_strftime=no,
2040 dnl When crosscompiling, assume strftime is missing or broken.
2041 jm_cv_func_working_gnu_strftime=no)
2042 dnl If TZ wasn't set before, this sets it to GMT0. No real harm done.
2045 if test $jm_cv_func_working_gnu_strftime = no; then
2047 LIBOBJS="$LIBOBJS strftime.$ac_objext"
2048 AC_DEFINE_UNQUOTED(strftime, gnu_strftime,
2049 [Define to gnu_strftime if the replacement function should be used.])
2053 AC_DEFUN(jm_FUNC_STRFTIME,
2055 _jm_STRFTIME_PREREQS
2056 AC_REPLACE_FUNCS(strftime)
2061 dnl See if there's a working, system-supplied version of the getline function.
2062 dnl We can't just do AC_REPLACE_FUNCS(getline) because some systems
2063 dnl have a function by that name in -linet that doesn't have anything
2064 dnl to do with the function we need.
2065 AC_DEFUN(AM_FUNC_GETLINE,
2067 am_getline_needs_run_time_check=no
2068 AC_CHECK_FUNC(getline,
2069 dnl Found it in some library. Verify that it works.
2070 am_getline_needs_run_time_check=yes,
2071 am_cv_func_working_getline=no)
2072 if test $am_getline_needs_run_time_check = yes; then
2073 AC_CHECK_HEADERS(string.h)
2074 AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline,
2075 [echo fooN |tr -d '\012'|tr N '\012' > conftest.data
2078 # include <sys/types.h>
2080 # include <string.h>
2083 { /* Based on a test program from Karl Heuer. */
2087 FILE *in = fopen ("./conftest.data", "r");
2090 len = getline (&line, &siz, in);
2091 exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1);
2093 ], am_cv_func_working_getline=yes dnl The library version works.
2094 , am_cv_func_working_getline=no dnl The library version does NOT work.
2095 , am_cv_func_working_getline=no dnl We're cross compiling.
2099 if test $am_cv_func_working_getline = yes; then
2100 AC_DEFINE(HAVE_GETLINE, 1,
2101 [Define if you have the GETLINE function.])dnl
2107 dnl From Jim Meyering.
2109 dnl See if struct statfs has the f_fstypename member.
2110 dnl If so, define HAVE_F_FSTYPENAME_IN_STATFS.
2113 AC_DEFUN(jm_FSTYPENAME,
2115 AC_CACHE_CHECK([for f_fstypename in struct statfs],
2116 fu_cv_sys_f_fstypename_in_statfs,
2120 #include <sys/param.h>
2121 #include <sys/types.h>
2122 #include <sys/mount.h>
2124 [struct statfs s; int i = sizeof s.f_fstypename;],
2125 fu_cv_sys_f_fstypename_in_statfs=yes,
2126 fu_cv_sys_f_fstypename_in_statfs=no
2131 if test $fu_cv_sys_f_fstypename_in_statfs = yes; then
2132 AC_DEFINE_UNQUOTED(HAVE_F_FSTYPENAME_IN_STATFS, 1,
2133 [Define if struct statfs has the f_fstypename member.])
2140 dnl From Paul Eggert.
2142 # Define ST_MTIM_NSEC to be the nanoseconds member of struct stat's st_mtim,
2145 AC_DEFUN(AC_STRUCT_ST_MTIM_NSEC,
2146 [AC_CACHE_CHECK([for nanoseconds member of struct stat.st_mtim],
2147 ac_cv_struct_st_mtim_nsec,
2148 [ac_save_CPPFLAGS="$CPPFLAGS"
2149 ac_cv_struct_st_mtim_nsec=no
2150 # tv_nsec -- the usual case
2151 # _tv_nsec -- Solaris 2.6, if
2152 # (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1
2153 # && !defined __EXTENSIONS__)
2154 # st__tim.tv_nsec -- UnixWare 2.1.2
2155 for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do
2156 CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val"
2157 AC_TRY_COMPILE([#include <sys/types.h>
2158 #include <sys/stat.h>], [struct stat s; s.st_mtim.ST_MTIM_NSEC;],
2159 [ac_cv_struct_st_mtim_nsec=$ac_val; break])
2161 CPPFLAGS="$ac_save_CPPFLAGS"])
2163 if test $ac_cv_struct_st_mtim_nsec != no; then
2164 AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec,
2165 [Define to be the nanoseconds member of struct stat's st_mtim,
2173 # Define HAVE_ST_DM_MODE if struct stat has an st_dm_mode member.
2175 AC_DEFUN(AC_STRUCT_ST_DM_MODE,
2176 [AC_CACHE_CHECK([for st_dm_mode in struct stat], ac_cv_struct_st_dm_mode,
2177 [AC_TRY_COMPILE([#include <sys/types.h>
2178 #include <sys/stat.h>], [struct stat s; s.st_dm_mode;],
2179 ac_cv_struct_st_dm_mode=yes,
2180 ac_cv_struct_st_dm_mode=no)])
2182 if test $ac_cv_struct_st_dm_mode = yes; then
2183 AC_DEFINE_UNQUOTED(HAVE_ST_DM_MODE, 1,
2184 [Define if struct stat has an st_dm_mode member. ])
2191 dnl From Jim Meyering
2193 dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
2194 dnl in time.h or sys/time.h.
2196 AC_DEFUN(jm_CHECK_TYPE_STRUCT_TIMESPEC,
2198 AC_REQUIRE([AC_HEADER_TIME])
2199 AC_CACHE_CHECK([for struct timespec], fu_cv_sys_struct_timespec,
2202 # if TIME_WITH_SYS_TIME
2203 # include <sys/time.h>
2206 # if HAVE_SYS_TIME_H
2207 # include <sys/time.h>
2213 [static struct timespec x; x.tv_sec = x.tv_nsec;],
2214 fu_cv_sys_struct_timespec=yes,
2215 fu_cv_sys_struct_timespec=no)
2218 if test $fu_cv_sys_struct_timespec = yes; then
2219 AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMESPEC, 1,
2220 [Define if struct timespec is declared in <time.h>. ])
2226 dnl From Paul Eggert.
2230 # Define uintmax_t to `unsigned long' or `unsigned long long'
2231 # if <inttypes.h> does not exist.
2233 AC_DEFUN(jm_AC_TYPE_UINTMAX_T,
2235 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
2236 if test $jm_ac_cv_header_inttypes_h = no; then
2237 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
2238 test $ac_cv_type_unsigned_long_long = yes \
2239 && ac_type='unsigned long long' \
2240 || ac_type='unsigned long'
2241 AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
2242 [ Define to unsigned long or unsigned long long
2243 if <inttypes.h> doesn't define.])
2247 # Macro to add for using GNU gettext.
2248 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2250 # This file can be copied and used freely without restrictions. It can
2251 # be used in projects which are not available under the GNU Public License
2252 # but which still want to provide support for the GNU gettext functionality.
2253 # Please note that the actual code is *not* freely available.
2257 AC_PREREQ(2.13) dnl Minimum Autoconf version required.
2259 AC_DEFUN(AM_WITH_NLS,
2260 [AC_MSG_CHECKING([whether NLS is requested])
2261 dnl Default is enabled NLS
2263 [ --disable-nls do not use Native Language Support],
2264 USE_NLS=$enableval, USE_NLS=yes)
2265 AC_MSG_RESULT($USE_NLS)
2268 USE_INCLUDED_LIBINTL=no
2270 dnl If we use NLS figure out what method
2271 if test "$USE_NLS" = "yes"; then
2272 AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested.])
2273 AC_MSG_CHECKING([whether included gettext is requested])
2274 AC_ARG_WITH(included-gettext,
2275 [ --with-included-gettext use the GNU gettext library included here],
2276 nls_cv_force_use_gnu_gettext=$withval,
2277 nls_cv_force_use_gnu_gettext=no)
2278 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
2280 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
2281 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
2282 dnl User does not insist on using GNU NLS library. Figure out what
2283 dnl to use. If gettext or catgets are available (in this order) we
2284 dnl use this. Else we have to fall back to GNU NLS library.
2285 dnl catgets is only used if permitted by option --with-catgets.
2287 nls_cv_header_libgt=
2290 AC_CHECK_HEADER(libintl.h,
2291 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
2292 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
2293 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
2295 if test "$gt_cv_func_gettext_libc" != "yes"; then
2296 AC_CHECK_LIB(intl, bindtextdomain,
2297 [AC_CHECK_LIB(intl, gettext)])
2300 if test "$gt_cv_func_gettext_libc" = "yes" \
2301 || test "$ac_cv_lib_intl_gettext" = "yes"; then
2302 AC_DEFINE(HAVE_GETTEXT, 1,
2303 [Define to 1 if you have gettext and don't want to use GNU gettext.])
2304 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2305 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
2306 if test "$MSGFMT" != "no"; then
2307 AC_CHECK_FUNCS(dcgettext)
2308 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2309 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2310 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2311 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
2312 return _nl_msg_cat_cntr],
2322 if test "$CATOBJEXT" = "NONE"; then
2323 AC_MSG_CHECKING([whether catgets can be used])
2324 AC_ARG_WITH(catgets,
2325 [ --with-catgets use catgets functions if available],
2326 nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
2327 AC_MSG_RESULT($nls_cv_use_catgets)
2329 if test "$nls_cv_use_catgets" = "yes"; then
2330 dnl No gettext in C library. Try catgets next.
2331 AC_CHECK_LIB(i, main)
2332 AC_CHECK_FUNC(catgets,
2333 [AC_DEFINE(HAVE_CATGETS, 1,
2334 [Define as 1 if you have catgets and don't want to use GNU gettext.])
2335 INTLOBJS="\$(CATOBJS)"
2336 AC_PATH_PROG(GENCAT, gencat, no)dnl
2337 if test "$GENCAT" != "no"; then
2338 AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
2339 if test "$GMSGFMT" = "no"; then
2340 AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
2341 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
2343 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2344 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2345 USE_INCLUDED_LIBINTL=yes
2349 INTLDEPS='$(top_builddir)/intl/libintl.a'
2351 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
2352 nls_cv_header_intl=intl/libintl.h
2353 nls_cv_header_libgt=intl/libgettext.h
2358 if test "$CATOBJEXT" = "NONE"; then
2359 dnl Neither gettext nor catgets in included in the C library.
2360 dnl Fall back on GNU gettext library.
2361 nls_cv_use_gnu_gettext=yes
2365 if test "$nls_cv_use_gnu_gettext" = "yes"; then
2366 dnl Mark actions used to generate GNU NLS library.
2367 INTLOBJS="\$(GETTOBJS)"
2368 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2369 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
2370 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2371 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2372 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2374 USE_INCLUDED_LIBINTL=yes
2378 INTLDEPS='$(top_builddir)/intl/libintl.a'
2380 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
2381 nls_cv_header_intl=intl/libintl.h
2382 nls_cv_header_libgt=intl/libgettext.h
2385 dnl Test whether we really found GNU xgettext.
2386 if test "$XGETTEXT" != ":"; then
2387 dnl If it is no GNU xgettext we define it as : so that the
2388 dnl Makefiles still can work.
2389 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
2393 [found xgettext program is not GNU xgettext; ignore it])
2398 # We need to process the po/ directory.
2402 nls_cv_header_intl=intl/libintl.h
2403 nls_cv_header_libgt=intl/libgettext.h
2405 if test -z "$nls_cv_header_intl"; then
2406 # Clean out junk possibly left behind by a previous configuration.
2407 rm -f intl/libintl.h
2409 AC_CONFIG_LINKS($nls_cv_header_intl:$nls_cv_header_libgt)
2411 [case "$CONFIG_FILES" in *po/Makefile.in*)
2412 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
2416 # If this is used in GNU gettext we have to set USE_NLS to `yes'
2417 # because some of the sources are only built for this goal.
2418 if test "$PACKAGE" = gettext; then
2420 USE_INCLUDED_LIBINTL=yes
2423 dnl These rules are solely for the distribution goal. While doing this
2424 dnl we only have to keep exactly one list of the available catalogs
2425 dnl in configure.in.
2426 for lang in $ALL_LINGUAS; do
2427 GMOFILES="$GMOFILES $lang.gmo"
2428 POFILES="$POFILES $lang.po"
2431 dnl Make all variables we use known to autoconf.
2432 AC_SUBST(USE_INCLUDED_LIBINTL)
2435 AC_SUBST(DATADIRNAME)
2437 AC_SUBST(INSTOBJEXT)
2445 AC_DEFUN(AM_GNU_GETTEXT,
2446 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
2447 AC_REQUIRE([AC_PROG_CC])dnl
2448 AC_REQUIRE([AC_PROG_RANLIB])dnl
2449 AC_REQUIRE([AC_ISC_POSIX])dnl
2450 AC_REQUIRE([AC_HEADER_STDC])dnl
2451 AC_REQUIRE([AC_C_CONST])dnl
2452 AC_REQUIRE([AC_C_INLINE])dnl
2453 AC_REQUIRE([AC_TYPE_OFF_T])dnl
2454 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
2455 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
2456 AC_REQUIRE([AC_FUNC_MMAP])dnl
2458 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
2459 unistd.h sys/param.h])
2460 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
2461 strdup __argz_count __argz_stringify __argz_next])
2463 if test "${ac_cv_func_stpcpy+set}" != "set"; then
2464 AC_CHECK_FUNCS(stpcpy)
2466 if test "${ac_cv_func_stpcpy}" = "yes"; then
2467 AC_DEFINE(HAVE_STPCPY, 1, [Define to 1 if you have the stpcpy function.])
2473 if test "x$CATOBJEXT" != "x"; then
2474 if test "x$ALL_LINGUAS" = "x"; then
2477 AC_MSG_CHECKING(for catalogs to be installed)
2479 for lang in ${LINGUAS=$ALL_LINGUAS}; do
2480 case "$ALL_LINGUAS" in
2481 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
2484 LINGUAS=$NEW_LINGUAS
2485 AC_MSG_RESULT($LINGUAS)
2488 dnl Construct list of names of catalog files to be constructed.
2489 if test -n "$LINGUAS"; then
2490 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
2494 dnl The reference to <locale.h> in the installed <libintl.h> file
2495 dnl must be resolved because we cannot expect the users of this
2496 dnl to define HAVE_LOCALE_H.
2497 if test $ac_cv_header_locale_h = yes; then
2498 INCLUDE_LOCALE_H="#include <locale.h>"
2501 /* The system does not provide the header <locale.h>. Take care yourself. */"
2503 AC_SUBST(INCLUDE_LOCALE_H)
2505 dnl Determine which catalog format we have (if any is needed)
2506 dnl For now we know about two different formats:
2507 dnl Linux libc-5 and the normal X/Open format
2508 test -d intl || mkdir intl
2509 if test "$CATOBJEXT" = ".cat"; then
2510 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
2512 dnl Transform the SED scripts while copying because some dumb SEDs
2513 dnl cannot handle comments.
2514 sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
2516 dnl po2tbl.sed is always needed.
2517 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
2518 $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
2520 dnl In the intl/Makefile.in we have a special dependency which makes
2521 dnl only sense for gettext. We comment this out for non-gettext
2523 if test "$PACKAGE" = "gettext"; then
2533 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
2534 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
2535 dnl Try to locate is.
2537 if test -n "$ac_aux_dir"; then
2538 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
2540 if test -z "$MKINSTALLDIRS"; then
2541 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
2543 AC_SUBST(MKINSTALLDIRS)
2545 dnl *** For now the libtool support in intl/Makefile is not for real.
2549 dnl Generate list of files to be processed by xgettext which will
2550 dnl be included in po/Makefile.
2551 test -d po || mkdir po
2554 posrcprefix="../" ;;
2556 posrcprefix="$srcdir/" ;;
2558 posrcprefix="../$srcdir/" ;;
2561 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
2562 < $srcdir/po/POTFILES.in > po/POTFILES
2565 # Search path for a program which passes the given test.
2566 # Ulrich Drepper <drepper@cygnus.com>, 1996.
2568 # This file can be copied and used freely without restrictions. It can
2569 # be used in projects which are not available under the GNU Public License
2570 # but which still want to provide support for the GNU gettext functionality.
2571 # Please note that the actual code is *not* freely available.
2575 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
2576 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
2577 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
2578 [# Extract the first word of "$2", so it can be a program name with args.
2579 set dummy $2; ac_word=[$]2
2580 AC_MSG_CHECKING([for $ac_word])
2581 AC_CACHE_VAL(ac_cv_path_$1,
2584 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
2587 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
2588 for ac_dir in ifelse([$5], , $PATH, [$5]); do
2589 test -z "$ac_dir" && ac_dir=.
2590 if test -f $ac_dir/$ac_word; then
2592 ac_cv_path_$1="$ac_dir/$ac_word"
2598 dnl If no 4th arg is given, leave the cache variable unset,
2599 dnl so AC_PATH_PROGS will keep looking.
2600 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
2605 if test -n "[$]$1"; then
2606 AC_MSG_RESULT([$]$1)
2613 # Check whether LC_MESSAGES is available in <locale.h>.
2614 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2616 # This file can be copied and used freely without restrictions. It can
2617 # be used in projects which are not available under the GNU Public License
2618 # but which still want to provide support for the GNU gettext functionality.
2619 # Please note that the actual code is *not* freely available.
2623 AC_PREREQ(2.13) dnl Minimum Autoconf version required.
2625 AC_DEFUN(AM_LC_MESSAGES,
2626 [if test $ac_cv_header_locale_h = yes; then
2627 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
2628 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2629 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
2630 if test $am_cv_val_LC_MESSAGES = yes; then
2631 AC_DEFINE(HAVE_LC_MESSAGES, 1,
2632 [Define if your locale.h file contains LC_MESSAGES.])