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.
15 AC_DEFUN(AM_CONFIG_HEADER,
17 AC_CONFIG_HEADER([$1])
18 dnl When config.status generates a header, we must update the stamp-h file.
19 dnl This file resides in the same directory as the config header
20 dnl that is generated. We must strip everything past the first ":",
21 dnl and everything past the last "/".
22 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
23 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
24 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
26 for am_file in <<$1>>; do
27 case " <<$>>CONFIG_HEADERS " in
28 *" <<$>>am_file "*<<)>>
29 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
32 am_indx=`expr "<<$>>am_indx" + 1`
36 # Do all the work for Automake. This macro actually does too much --
37 # some checks are only needed if your package does certain things.
38 # But this isn't really a big deal.
43 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
45 AC_DEFUN(AM_INIT_AUTOMAKE,
46 [AC_REQUIRE([AC_PROG_INSTALL])
47 dnl We require 2.13 because we rely on SHELL being computed by configure.
53 dnl test to see if srcdir already configured
54 if test "`CDPATH=: && cd $srcdir && pwd`" != "`pwd`" &&
55 test -f $srcdir/config.status; then
56 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
59 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
60 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
61 AC_REQUIRE([AM_SANITY_CHECK])
62 AC_REQUIRE([AC_ARG_PROGRAM])
63 AM_MISSING_PROG(ACLOCAL, aclocal)
64 AM_MISSING_PROG(AUTOCONF, autoconf)
65 AM_MISSING_PROG(AUTOMAKE, automake)
66 AM_MISSING_PROG(AUTOHEADER, autoheader)
67 AM_MISSING_PROG(MAKEINFO, makeinfo)
68 AM_MISSING_PROG(AMTAR, tar)
70 dnl We need awk for the "check" target. The system "awk" is bad on
72 AC_REQUIRE([AC_PROG_AWK])
73 AC_REQUIRE([AC_PROG_MAKE_SET])
74 AC_REQUIRE([AM_DEP_TRACK])
75 AC_REQUIRE([AM_SET_DEPDIR])
76 ifdef([AC_PROVIDE_AC_PROG_CC], [AM_DEPENDENCIES(CC)], [
77 define([AC_PROG_CC], defn([AC_PROG_CC])[AM_DEPENDENCIES(CC)])])
78 ifdef([AC_PROVIDE_AC_PROG_CXX], [AM_DEPENDENCIES(CXX)], [
79 define([AC_PROG_CXX], defn([AC_PROG_CXX])[AM_DEPENDENCIES(CXX)])])
83 # Check to make sure that the build environment is sane.
86 AC_DEFUN(AM_SANITY_CHECK,
87 [AC_MSG_CHECKING([whether build environment is sane])
90 echo timestamp > conftestfile
91 # Do `set' in a subshell so we don't clobber the current shell's
92 # arguments. Must try -L first in case configure is actually a
93 # symlink; some systems play weird games with the mod time of symlinks
94 # (eg FreeBSD returns the mod time of the symlink's containing
97 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
98 if test "[$]*" = "X"; then
100 set X `ls -t $srcdir/configure conftestfile`
102 if test "[$]*" != "X $srcdir/configure conftestfile" \
103 && test "[$]*" != "X conftestfile $srcdir/configure"; then
105 # If neither matched, then we have a broken ls. This can happen
106 # if, for instance, CONFIG_SHELL is bash and it inherits a
107 # broken ls alias from the environment. This has actually
108 # happened. Such a system could not be considered "sane".
109 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
110 alias in your environment])
113 test "[$]2" = conftestfile
119 AC_MSG_ERROR([newly created file is older than distributed files!
120 Check your system clock])
125 dnl AM_MISSING_PROG(NAME, PROGRAM)
126 AC_DEFUN(AM_MISSING_PROG, [
127 AC_REQUIRE([AM_MISSING_HAS_RUN])
128 $1=${$1-"${am_missing_run}$2"}
131 dnl Like AM_MISSING_PROG, but only looks for install-sh.
132 dnl AM_MISSING_INSTALL_SH()
133 AC_DEFUN(AM_MISSING_INSTALL_SH, [
134 AC_REQUIRE([AM_MISSING_HAS_RUN])
135 if test -z "$install_sh"; then
136 install_sh="$ac_aux_dir/install-sh"
137 test -f "$install_sh" || install_sh="$ac_aux_dir/install.sh"
138 test -f "$install_sh" || install_sh="${am_missing_run}${ac_auxdir}/install-sh"
139 dnl FIXME: an evil hack: we remove the SHELL invocation from
140 dnl install_sh because automake adds it back in. Sigh.
141 install_sh="`echo $install_sh | sed -e 's/\${SHELL}//'`"
143 AC_SUBST(install_sh)])
145 dnl AM_MISSING_HAS_RUN.
146 dnl Define MISSING if not defined so far and test if it supports --run.
147 dnl If it does, set am_missing_run to use it, otherwise, to nothing.
148 AC_DEFUN([AM_MISSING_HAS_RUN], [
149 test x"${MISSING+set}" = xset || \
150 MISSING="\${SHELL} `CDPATH=: && cd $ac_aux_dir && pwd`/missing"
151 dnl Use eval to expand $SHELL
152 if eval "$MISSING --run :"; then
153 am_missing_run="$MISSING --run "
157 AC_MSG_WARN([${am_backtick}missing' script is too old or missing])
161 dnl See how the compiler implements dependency checking.
163 dnl AM_DEPENDENCIES(NAME)
164 dnl NAME is "CC", "CXX" or "OBJC".
166 dnl We try a few techniques and use that to set a single cache variable.
168 AC_DEFUN(AM_DEPENDENCIES,[
169 AC_REQUIRE([AM_SET_DEPDIR])
170 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])
172 AC_REQUIRE([AC_PROG_CC])
173 AC_REQUIRE([AC_PROG_CPP])
175 depcpp="$CPP"],[$1],CXX,[
176 AC_REQUIRE([AC_PROG_CXX])
177 AC_REQUIRE([AC_PROG_CXXCPP])
179 depcpp="$CXXCPP"],[$1],OBJC,[
180 am_cv_OBJC_dependencies_compiler_type=gcc],[
181 AC_REQUIRE([AC_PROG_][$1])
184 AC_MSG_CHECKING([dependency style of $depcc])
185 AC_CACHE_VAL(am_cv_[$1]_dependencies_compiler_type,[
186 if test -z "$AMDEP"; then
187 echo '#include "conftest.h"' > conftest.c
188 echo 'int i;' > conftest.h
190 am_cv_[$1]_dependencies_compiler_type=none
191 for depmode in `sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < "$am_depcomp"`; do
194 # after this tag, mechanisms are not by side-effect, so they'll
195 # only be used when explicitly requested
196 if test "x$enable_dependency_tracking" = xyes; then
204 if depmode="$depmode" \
205 source=conftest.c object=conftest.o \
206 depfile=conftest.Po tmpdepfile=conftest.TPo \
207 $SHELL $am_depcomp $depcc -c conftest.c 2>/dev/null &&
208 grep conftest.h conftest.Po > /dev/null 2>&1; then
209 am_cv_[$1]_dependencies_compiler_type="$depmode"
216 am_cv_[$1]_dependencies_compiler_type=none
219 AC_MSG_RESULT($am_cv_[$1]_dependencies_compiler_type)
220 [$1]DEPMODE="depmode=$am_cv_[$1]_dependencies_compiler_type"
221 AC_SUBST([$1]DEPMODE)
224 dnl Choose a directory name for dependency files.
225 dnl This macro is AC_REQUIREd in AM_DEPENDENCIES
227 AC_DEFUN(AM_SET_DEPDIR,[
228 if test -d .deps || mkdir .deps 2> /dev/null || test -d .deps; then
236 AC_DEFUN(AM_DEP_TRACK,[
237 AC_ARG_ENABLE(dependency-tracking,
238 [ --disable-dependency-tracking Speeds up one-time builds
239 --enable-dependency-tracking Do not reject slow dependency extractors])
240 if test "x$enable_dependency_tracking" = xno; then
243 am_depcomp="$ac_aux_dir/depcomp"
244 if test ! -f "$am_depcomp"; then
251 if test -z "$AMDEP"; then
256 pushdef([subst], defn([AC_SUBST]))
257 subst(AMDEPBACKSLASH)
261 dnl Generate code to set up dependency tracking.
262 dnl This macro should only be invoked once -- use via AC_REQUIRE.
264 dnl AM_OUTPUT_DEPENDENCY_COMMANDS
267 dnl This code is only required when automatic dependency tracking
268 dnl is enabled. FIXME. This creates each `.P' file that we will
269 dnl need in order to bootstrap the dependency handling code.
270 AC_DEFUN(AM_OUTPUT_DEPENDENCY_COMMANDS,[
272 test x"$AMDEP" != x"" ||
273 for mf in $CONFIG_FILES; do
275 Makefile) dirpart=.;;
276 */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;;
279 grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
280 # Extract the definition of DEP_FILES from the Makefile without
282 DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
283 test -z "$DEPDIR" && continue
284 # When using ansi2knr, U may be empty or an underscore; expand it
285 U=`sed -n -e '/^U = / s///p' < "$mf"`
286 test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
287 # We invoke sed twice because it is the simplest approach to
288 # changing $(DEPDIR) to its actual value in the expansion.
289 for file in `sed -n -e '
290 /^DEP_FILES = .*\\\\$/ {
299 /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
300 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
301 # Make sure the directory exists.
302 test -f "$dirpart/$file" && continue
303 fdir=`echo "$file" | sed -e 's|/[^/]*$||'`
304 $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1
305 # echo "creating $dirpart/$file"
306 echo '# dummy' > "$dirpart/$file"
310 ac_aux_dir="$ac_aux_dir"])])
313 dnl This test replaces the one in autoconf.
314 dnl Currently this macro should have the same name as the autoconf macro
315 dnl because gettext's gettext.m4 (distributed in the automake package)
316 dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader
317 dnl give these diagnostics:
318 dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
319 dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
321 undefine([AC_ISC_POSIX])
322 AC_DEFUN(AC_ISC_POSIX,
324 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
325 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
332 AC_DEFUN(AM_C_PROTOTYPES,
333 [AC_REQUIRE([AM_PROG_CC_STDC])
334 AC_REQUIRE([AC_PROG_CPP])
335 AC_MSG_CHECKING([for function prototypes])
336 if test "$am_cv_prog_cc_stdc" != no; then
338 AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
342 U=_ ANSI2KNR=./ansi2knr
343 # Ensure some checks needed by ansi2knr itself.
345 AC_CHECK_HEADERS(string.h)
348 AC_SUBST(ANSI2KNR)dnl
354 # @defmac AC_PROG_CC_STDC
355 # @maindex PROG_CC_STDC
357 # If the C compiler in not in ANSI C mode by default, try to add an option
358 # to output variable @code{CC} to make it so. This macro tries various
359 # options that select ANSI C on some system or another. It considers the
360 # compiler to be in ANSI C mode if it handles function prototypes correctly.
362 # If you use this macro, you should check after calling it whether the C
363 # compiler has been set to accept ANSI C; if not, the shell variable
364 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
365 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
366 # program @code{ansi2knr}, which comes with Ghostscript.
369 AC_DEFUN(AM_PROG_CC_STDC,
370 [AC_REQUIRE([AC_PROG_CC])
371 AC_BEFORE([$0], [AC_C_INLINE])
372 AC_BEFORE([$0], [AC_C_CONST])
373 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
374 dnl a magic option to avoid problems with ANSI preprocessor commands
376 dnl FIXME: can't do this because then AC_AIX won't work due to a
377 dnl circular dependency.
378 dnl AC_BEFORE([$0], [AC_PROG_CPP])
379 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
380 AC_CACHE_VAL(am_cv_prog_cc_stdc,
381 [am_cv_prog_cc_stdc=no
383 # Don't try gcc -ansi; that turns off useful extensions and
384 # breaks some systems' header files.
386 # Ultrix and OSF/1 -std1
387 # HP-UX 10.20 and later -Ae
388 # HP-UX older versions -Aa -D_HPUX_SOURCE
389 # SVR4 -Xc -D__EXTENSIONS__
390 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
392 CC="$ac_save_CC $ac_arg"
396 #include <sys/types.h>
397 #include <sys/stat.h>
398 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
399 struct buf { int x; };
400 FILE * (*rcsopen) (struct buf *, struct stat *, int);
401 static char *e (p, i)
407 static char *f (char * (*g) (char **, int), char **p, ...)
412 s = g (p, va_arg (v,int));
416 int test (int i, double x);
417 struct s1 {int (*f) (int a);};
418 struct s2 {int (*f) (double a);};
419 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
423 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
425 [am_cv_prog_cc_stdc="$ac_arg"; break])
429 if test -z "$am_cv_prog_cc_stdc"; then
430 AC_MSG_RESULT([none needed])
432 AC_MSG_RESULT($am_cv_prog_cc_stdc)
434 case "x$am_cv_prog_cc_stdc" in
436 *) CC="$CC $am_cv_prog_cc_stdc" ;;
442 dnl By default, many hosts won't let programs access large files;
443 dnl one must use special compiler options to get large-file access to work.
444 dnl For more details about this brain damage please see:
445 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
447 dnl Written by Paul Eggert <eggert@twinsun.com>.
449 dnl Internal subroutine of AC_SYS_LARGEFILE.
450 dnl AC_SYS_LARGEFILE_FLAGS(FLAGSNAME)
451 AC_DEFUN(AC_SYS_LARGEFILE_FLAGS,
452 [AC_CACHE_CHECK([for $1 value to request large file support],
453 ac_cv_sys_largefile_$1,
454 [if ($GETCONF LFS_$1) >conftest.1 2>conftest.2 && test ! -s conftest.2
456 ac_cv_sys_largefile_$1=`cat conftest.1`
458 ac_cv_sys_largefile_$1=no
461 # HP-UX 10.20 requires -D__STDC_EXT__ with gcc 2.95.1.
462 [ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)]
463 if test "$GCC" = yes; then
464 ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__
467 # IRIX 6.2 and later require cc -n32.
468 [ irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)]
469 if test "$GCC" != yes; then
470 ac_cv_sys_largefile_CFLAGS=-n32
473 if test "$ac_cv_sys_largefile_CFLAGS" != no; then
475 CC="$CC $ac_cv_sys_largefile_CFLAGS"
476 AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
482 dnl Internal subroutine of AC_SYS_LARGEFILE.
483 dnl AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL)
484 AC_DEFUN(AC_SYS_LARGEFILE_SPACE_APPEND,
494 dnl Internal subroutine of AC_SYS_LARGEFILE.
495 dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
496 AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE,
497 [AC_CACHE_CHECK([for $1], $2,
500 for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
505 $2=`expr " $ac_flag" : '[[^=]]*=\(.*\)'` ;;
509 if test "[$]$2" != no; then
510 AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
513 AC_DEFUN(AC_SYS_LARGEFILE,
514 [AC_REQUIRE([AC_CANONICAL_HOST])
515 AC_ARG_ENABLE(largefile,
516 [ --disable-largefile omit support for large files])
517 if test "$enable_largefile" != no; then
518 AC_CHECK_TOOL(GETCONF, getconf)
519 AC_SYS_LARGEFILE_FLAGS(CFLAGS)
520 AC_SYS_LARGEFILE_FLAGS(LDFLAGS)
521 AC_SYS_LARGEFILE_FLAGS(LIBS)
523 for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
526 -D_FILE_OFFSET_BITS=*) ;;
527 -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
528 -D_LARGE_FILES | -D_LARGE_FILES=*) ;;
530 AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
532 AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
535 AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
536 AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
537 AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
538 ac_cv_sys_file_offset_bits,
539 [Number of bits in a file offset, on hosts where this is settable.],
541 # HP-UX 10.20 and later
542 [ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)]
543 ac_cv_sys_file_offset_bits=64 ;;
545 AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
546 ac_cv_sys_largefile_source,
547 [Define to make fseeko etc. visible, on some hosts.],
549 # HP-UX 10.20 and later
550 [ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)]
551 ac_cv_sys_largefile_source=1 ;;
553 AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
554 ac_cv_sys_large_files,
555 [Define for large files, on AIX-style hosts.],
558 [ aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)]
559 ac_cv_sys_large_files=1 ;;
564 #serial 13, with several lines deleted for fileutils.
566 dnl Misc type-related macros for fileutils, sh-utils, textutils.
572 GNU_PACKAGE="GNU $PACKAGE"
573 AC_DEFINE_UNQUOTED(GNU_PACKAGE, "$GNU_PACKAGE",
574 [The concatenation of the strings `GNU ', and PACKAGE.])
575 AC_SUBST(GNU_PACKAGE)
577 AC_SUBST(OPTIONAL_BIN_PROGS)
578 AC_SUBST(OPTIONAL_BIN_ZCRIPTS)
582 dnl This macro actually runs replacement code. See isc-posix.m4.
583 AC_REQUIRE([AC_ISC_POSIX])dnl
622 jm_INCLUDED_REGEX([lib/regex.c])
624 AC_REQUIRE([jm_ASSERT])
625 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
626 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE])
627 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_INO])
628 AC_REQUIRE([jm_CHECK_DECLS])
630 AC_REQUIRE([jm_PREREQ])
632 AC_REQUIRE([jm_FUNC_MKTIME])
633 AC_REQUIRE([jm_FUNC_LSTAT])
634 AC_REQUIRE([jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
635 AC_REQUIRE([jm_FUNC_STAT])
636 AC_REQUIRE([jm_FUNC_REALLOC])
637 AC_REQUIRE([jm_FUNC_MALLOC])
638 AC_REQUIRE([jm_FUNC_STRERROR_R])
639 AC_REQUIRE([jm_FUNC_READDIR])
640 AC_REQUIRE([jm_FUNC_MEMCMP])
641 AC_REQUIRE([jm_FUNC_GLIBC_UNLOCKED_IO])
642 AC_REQUIRE([jm_FUNC_FNMATCH])
644 AC_REQUIRE([jm_AC_PREREQ_XSTRTOUMAX])
645 AC_REQUIRE([jm_AC_FUNC_LINK_FOLLOWS_SYMLINK])
646 AC_REQUIRE([AM_FUNC_ERROR_AT_LINE])
647 AC_REQUIRE([jm_FUNC_GNU_STRFTIME])
648 AC_REQUIRE([jm_FUNC_MKTIME])
650 AC_REQUIRE([AC_FUNC_VPRINTF])
651 AC_REQUIRE([AC_FUNC_ALLOCA])
653 AC_REPLACE_FUNCS(strncasecmp)
654 AC_REPLACE_FUNCS(stpcpy strstr strtol strtoul)
655 AC_REPLACE_FUNCS(memcmp)
657 dnl used by e.g. intl/*domain.c and lib/canon-host.c
658 AC_REPLACE_FUNCS(strdup)
660 AC_REPLACE_FUNCS(memcpy memset)
661 AC_CHECK_FUNCS(getpagesize)
663 # By default, argmatch should fail calling usage (1).
664 AC_DEFINE(ARGMATCH_DIE, [usage (1)],
665 [Define to the function xargmatch calls on failures.])
666 AC_DEFINE(ARGMATCH_DIE_DECL, [extern void usage ()],
667 [Define to the declaration of the xargmatch failure function.])
669 dnl Used to define SETVBUF in sys2.h.
670 dnl This evokes the following warning from autoconf:
671 dnl ...: warning: AC_TRY_RUN called without default to allow cross compiling
672 AC_FUNC_SETVBUF_REVERSED
674 # used by sleep and shred
675 # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
676 # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
677 AC_SEARCH_LIBS(clock_gettime, [rt posix4])
678 AC_CHECK_FUNCS(clock_gettime)
679 AC_CHECK_FUNCS(gettimeofday)
681 AC_CHECK_FUNCS(getdelim)
683 AC_REQUIRE([AC_FUNC_CLOSEDIR_VOID])
716 if test $am_cv_func_working_getline != yes; then
717 AC_CHECK_FUNCS(getdelim)
721 AC_DEFUN(jm_CHECK_ALL_TYPES,
723 dnl Checks for typedefs, structures, and compiler characteristics.
724 AC_REQUIRE([AC_C_BIGENDIAN])
725 AC_REQUIRE([AC_PROG_CC_STDC])
726 AC_REQUIRE([AC_C_CONST])
727 AC_REQUIRE([AC_C_VOLATILE])
728 AC_REQUIRE([AC_C_INLINE])
729 AC_REQUIRE([AC_C_LONG_DOUBLE])
731 AC_REQUIRE([AC_HEADER_DIRENT])
732 AC_REQUIRE([AC_HEADER_STDC])
733 AC_CHECK_MEMBERS((struct stat.st_blksize),,,[$ac_includes_default
734 #include <sys/stat.h>
736 AC_REQUIRE([AC_STRUCT_ST_BLOCKS])
738 AC_REQUIRE([AC_STRUCT_TM])
739 AC_REQUIRE([AC_STRUCT_TIMEZONE])
740 AC_REQUIRE([AC_HEADER_STAT])
741 AC_REQUIRE([AC_STRUCT_ST_MTIM_NSEC])
742 AC_REQUIRE([AC_STRUCT_ST_DM_MODE])
743 AC_REQUIRE([jm_CHECK_TYPE_STRUCT_TIMESPEC])
745 AC_REQUIRE([AC_TYPE_GETGROUPS])
746 AC_REQUIRE([AC_TYPE_MODE_T])
747 AC_REQUIRE([AC_TYPE_OFF_T])
748 AC_REQUIRE([AC_TYPE_PID_T])
749 AC_REQUIRE([AC_TYPE_SIGNAL])
750 AC_REQUIRE([AC_TYPE_SIZE_T])
751 AC_REQUIRE([AC_TYPE_UID_T])
752 AC_CHECK_TYPE(ino_t, unsigned long)
754 dnl This relies on the fact that autoconf 2.14a's implementation of
755 dnl AC_CHECK_TYPE checks includes unistd.h.
756 AC_CHECK_TYPE(ssize_t, int)
758 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
759 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
761 AC_REQUIRE([AC_HEADER_MAJOR])
762 AC_REQUIRE([AC_HEADER_DIRENT])
768 dnl Initially derived from code in GNU grep.
769 dnl Mostly written by Jim Meyering.
771 dnl Usage: jm_INCLUDED_REGEX([lib/regex.c])
773 AC_DEFUN(jm_INCLUDED_REGEX,
775 dnl Even packages that don't use regex.c can use this macro.
776 dnl Of course, for them it doesn't do anything.
778 # Assume we'll default to using the included regex.c.
779 ac_use_included_regex=yes
781 # However, if the system regex support is good enough that it passes the
782 # the following run test, then default to *not* using the included regex.c.
783 # If cross compiling, assume the test would fail and use the included
784 # regex.c. The first failing regular expression is from `Spencer ere
785 # test #75' in grep-2.3.
786 AC_CACHE_CHECK([for working re_compile_pattern],
787 jm_cv_func_working_re_compile_pattern,
794 static struct re_pattern_buffer regex;
796 re_set_syntax (RE_SYNTAX_POSIX_EGREP);
797 /* Add this third left square bracket, [, to balance the
798 three right ones below. Otherwise autoconf-2.14 chokes. */
799 s = re_compile_pattern ("a[[:]:]]b\n", 9, ®ex);
800 /* This should fail with _Invalid character class name_ error. */
804 /* This should succeed, but doesn't for e.g. glibc-2.1.3. */
805 s = re_compile_pattern ("{1", 2, ®ex);
810 jm_cv_func_working_re_compile_pattern=yes,
811 jm_cv_func_working_re_compile_pattern=no,
812 dnl When crosscompiling, assume it's broken.
813 jm_cv_func_working_re_compile_pattern=no))
814 if test $jm_cv_func_working_re_compile_pattern = yes; then
815 ac_use_included_regex=no
818 test -n "$1" || AC_MSG_ERROR([missing argument])
823 AC_ARG_WITH(included-regex,
824 [ --without-included-regex don't compile regex; this is the default on
825 systems with version 2 of the GNU C library
826 (use with caution on other system)],
827 jm_with_regex=$withval,
828 jm_with_regex=$ac_use_included_regex)
829 if test "$jm_with_regex" = yes; then
831 LIBOBJS="$LIBOBJS regex.$ac_objext"
839 dnl based on code from Eleftherios Gkioulekas
843 AC_MSG_CHECKING(whether to enable assertions)
844 AC_ARG_ENABLE(assert,
845 [ --disable-assert turn off assertions],
847 AC_DEFINE(NDEBUG,1,[Define to 1 if assertions should be disabled.]) ],
848 [ AC_MSG_RESULT(yes) ]
854 dnl From Paul Eggert.
856 # Define HAVE_INTTYPES_H if <inttypes.h> exists,
857 # doesn't clash with <sys/types.h>, and declares uintmax_t.
859 AC_DEFUN(jm_AC_HEADER_INTTYPES_H,
861 AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
863 [#include <sys/types.h>
864 #include <inttypes.h>],
865 [uintmax_t i = (uintmax_t) -1;],
866 jm_ac_cv_header_inttypes_h=yes,
867 jm_ac_cv_header_inttypes_h=no)])
868 if test $jm_ac_cv_header_inttypes_h = yes; then
869 AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
870 [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
871 and declares uintmax_t. ])
877 dnl From Jim Meyering.
879 dnl Check whether struct dirent has a member named d_type.
882 AC_DEFUN(jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE,
883 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
884 AC_CACHE_CHECK([for d_type member in directory struct],
885 jm_cv_struct_dirent_d_type,
888 #include <sys/types.h>
891 #else /* not HAVE_DIRENT_H */
892 # define dirent direct
893 # ifdef HAVE_SYS_NDIR_H
894 # include <sys/ndir.h>
895 # endif /* HAVE_SYS_NDIR_H */
896 # ifdef HAVE_SYS_DIR_H
897 # include <sys/dir.h>
898 # endif /* HAVE_SYS_DIR_H */
901 # endif /* HAVE_NDIR_H */
902 #endif /* HAVE_DIRENT_H */
904 [struct dirent dp; dp.d_type = 0;],
906 jm_cv_struct_dirent_d_type=yes,
907 jm_cv_struct_dirent_d_type=no)
910 if test $jm_cv_struct_dirent_d_type = yes; then
911 AC_DEFINE(D_TYPE_IN_DIRENT, 1,
912 [Define if there is a member named d_type in the struct describing
920 dnl From Jim Meyering.
922 dnl Check whether struct dirent has a member named d_ino.
925 AC_DEFUN(jm_CHECK_TYPE_STRUCT_DIRENT_D_INO,
926 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
927 AC_CACHE_CHECK([for d_ino member in directory struct],
928 jm_cv_struct_dirent_d_ino,
931 #include <sys/types.h>
934 #else /* not HAVE_DIRENT_H */
935 # define dirent direct
936 # ifdef HAVE_SYS_NDIR_H
937 # include <sys/ndir.h>
938 # endif /* HAVE_SYS_NDIR_H */
939 # ifdef HAVE_SYS_DIR_H
940 # include <sys/dir.h>
941 # endif /* HAVE_SYS_DIR_H */
944 # endif /* HAVE_NDIR_H */
945 #endif /* HAVE_DIRENT_H */
947 [struct dirent dp; dp.d_ino = 0;],
949 jm_cv_struct_dirent_d_ino=yes,
950 jm_cv_struct_dirent_d_ino=no)
953 if test $jm_cv_struct_dirent_d_ino = yes; then
954 AC_DEFINE(D_INO_IN_DIRENT, 1,
955 [Define if there is a member named d_ino in the struct describing
961 #serial 9, except remove memchr and nanosleep as findutils doesn't need them
963 dnl This is just a wrapper function to encapsulate this kludge.
964 dnl Putting it in a separate file like this helps share it between
965 dnl different packages.
966 AC_DEFUN(jm_CHECK_DECLS,
968 AC_REQUIRE([_jm_DECL_HEADERS])
969 AC_REQUIRE([AC_HEADER_TIME])
973 # if !STDC_HEADERS && HAVE_MEMORY_H
979 # include <strings.h>
989 #include <sys/types.h>
990 #if TIME_WITH_SYS_TIME
991 # include <sys/time.h>
995 # include <sys/time.h>
1014 ttyname), , , $headers)
1017 dnl FIXME: when autoconf has support for it.
1018 dnl This is a little helper so we can require these header checks.
1019 AC_DEFUN(_jm_DECL_HEADERS,
1021 AC_REQUIRE([AC_HEADER_STDC])
1022 AC_CHECK_HEADERS(memory.h string.h strings.h stdlib.h unistd.h sys/time.h)
1027 dnl These are the prerequisite macros for files in the lib/
1028 dnl directories of the fileutils, sh-utils, and textutils packages.
1033 jm_PREREQ_CANON_HOST
1040 AC_DEFUN(jm_PREREQ_ADDEXT,
1043 AC_SYS_LONG_FILE_NAMES
1044 AC_CHECK_FUNCS(pathconf)
1045 AC_CHECK_HEADERS(limits.h string.h unistd.h)
1048 AC_DEFUN(jm_PREREQ_CANON_HOST,
1050 dnl Add any libraries as early as possible.
1051 dnl In particular, inet_ntoa needs -lnsl at least on Solaris5.5.1,
1052 dnl so we have to add -lnsl to LIBS before checking for that function.
1053 AC_SEARCH_LIBS(gethostbyname, [inet nsl])
1055 dnl These come from -lnsl on Solaris5.5.1.
1056 AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
1058 AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
1059 AC_CHECK_HEADERS(unistd.h string.h netdb.h sys/socket.h \
1060 netinet/in.h arpa/inet.h)
1063 AC_DEFUN(jm_PREREQ_QUOTEARG,
1065 AC_CHECK_FUNCS(isascii mbrtowc)
1066 AC_CHECK_HEADERS(limits.h stdlib.h string.h wchar.h wctype.h)
1072 AC_DEFUN(jm_PREREQ_READUTMP,
1075 AC_CHECK_HEADERS(string.h utmpx.h sys/param.h)
1076 AC_CHECK_FUNCS(utmpname)
1077 AC_CHECK_FUNCS(utmpxname)
1081 $ac_includes_default
1088 AC_CHECK_MEMBERS((struct utmpx.ut_user),,,[$utmp_includes])
1089 AC_CHECK_MEMBERS((struct utmp.ut_user),,,[$utmp_includes])
1090 AC_CHECK_MEMBERS((struct utmpx.ut_name),,,[$utmp_includes])
1091 AC_CHECK_MEMBERS((struct utmp.ut_name),,,[$utmp_includes])
1094 AC_DEFUN(jm_PREREQ_REGEX,
1096 dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it.
1097 dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary
1099 AC_CHECK_FUNCS(bzero bcopy isascii btowc)
1100 AC_CHECK_HEADERS(alloca.h libintl.h wctype.h wchar.h)
1107 dnl FIXME: put these prerequisite-only *.m4 files in a separate
1108 dnl directory -- otherwise, they'll conflict with existing files.
1110 dnl These are the prerequisite macros for GNU's error.c file.
1111 AC_DEFUN(jm_PREREQ_ERROR,
1113 AC_CHECK_FUNCS(strerror strerror_r vprintf doprnt)
1119 dnl From Paul Eggert.
1121 AC_DEFUN(AC_C_BACKSLASH_A,
1123 AC_CACHE_CHECK([whether backslash-a works in strings], ac_cv_c_backslash_a,
1129 char buf['\a' == 'a' ? -1 : 1];
1131 return buf[0] != "\a"[0];
1133 ac_cv_c_backslash_a=yes,
1134 ac_cv_c_backslash_a=no)])
1135 if test $ac_cv_c_backslash_a = yes; then
1136 AC_DEFINE(HAVE_C_BACKSLASH_A, 1,
1137 [Define if backslash-a works in C strings.])
1143 dnl From Jim Meyering.
1144 dnl A wrapper around AC_FUNC_MKTIME.
1146 AC_DEFUN(jm_FUNC_MKTIME,
1147 [AC_REQUIRE([AC_FUNC_MKTIME])dnl
1149 dnl mktime.c uses localtime_r if it exists. Check for it.
1150 AC_CHECK_FUNCS(localtime_r)
1152 if test $ac_cv_func_working_mktime = no; then
1153 AC_DEFINE_UNQUOTED(mktime, rpl_mktime,
1154 [Define to rpl_mktime if the replacement function should be used.])
1160 dnl From Jim Meyering.
1161 dnl Determine whether lstat has the bug that it succeeds when given the
1162 dnl zero-length file name argument. The lstat from SunOS4.1.4 and the Hurd
1163 dnl (as of 1998-11-01) do this.
1165 dnl If it does, then define HAVE_LSTAT_EMPTY_STRING_BUG and arrange to
1166 dnl compile the wrapper function.
1169 AC_DEFUN(jm_FUNC_LSTAT,
1171 AC_CACHE_CHECK([whether lstat accepts an empty string],
1172 jm_cv_func_lstat_empty_string_bug,
1174 # include <sys/types.h>
1175 # include <sys/stat.h>
1181 exit (lstat ("", &sbuf) ? 1 : 0);
1184 jm_cv_func_lstat_empty_string_bug=yes,
1185 jm_cv_func_lstat_empty_string_bug=no,
1186 dnl When crosscompiling, assume lstat is broken.
1187 jm_cv_func_lstat_empty_string_bug=yes)
1189 if test $jm_cv_func_lstat_empty_string_bug = yes; then
1191 LIBOBJS="$LIBOBJS lstat.$ac_objext"
1192 AC_DEFINE_UNQUOTED(HAVE_LSTAT_EMPTY_STRING_BUG, 1,
1193 [Define if lstat has the bug that it succeeds when given the zero-length
1194 file name argument. The lstat from SunOS4.1.4 and the Hurd as of 1998-11-01)
1201 dnl From Jim Meyering.
1204 AC_DEFUN(jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK,
1207 [whether lstat dereferences a symlink specified with a trailing slash],
1208 jm_cv_func_lstat_dereferences_slashed_symlink,
1210 rm -f conftest.sym conftest.file
1212 if ln -s conftest.file conftest.sym; then
1214 # include <sys/types.h>
1215 # include <sys/stat.h>
1221 /* Linux will dereference the symlink and fail.
1222 That is better in the sense that it means we will not
1223 have to compile and use the lstat wrapper. */
1224 exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1);
1227 jm_cv_func_lstat_dereferences_slashed_symlink=yes,
1228 jm_cv_func_lstat_dereferences_slashed_symlink=no,
1229 dnl When crosscompiling, be pessimistic so we will end up using the
1230 dnl replacement version of lstat that checkes for trailing slashes
1231 dnl and calls lstat a second time when necessary.
1232 jm_cv_func_lstat_dereferences_slashed_symlink=no
1235 # If the `ln -s' command failed, then we probably don't even
1236 # have an lstat function.
1237 jm_cv_func_lstat_dereferences_slashed_symlink=no
1241 test $jm_cv_func_lstat_dereferences_slashed_symlink = yes \
1244 AC_DEFINE_UNQUOTED(LSTAT_FOLLOWS_SLASHED_SYMLINK, $zero_one,
1245 [Define if lstat dereferences a symlink specified with a trailing slash])
1247 if test $jm_cv_func_lstat_dereferences_slashed_symlink = no; then
1249 # Append lstat.o if it's not already in $LIBOBJS.
1251 *lstat.$ac_objext*) ;;
1252 *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;;
1259 dnl From Jim Meyering.
1260 dnl Determine whether stat has the bug that it succeeds when given the
1261 dnl zero-length file name argument. The stat from SunOS4.1.4 and the Hurd
1262 dnl (as of 1998-11-01) do this.
1264 dnl If it does, then define HAVE_STAT_EMPTY_STRING_BUG and arrange to
1265 dnl compile the wrapper function.
1268 AC_DEFUN(jm_FUNC_STAT,
1270 AC_CACHE_CHECK([whether stat accepts an empty string],
1271 jm_cv_func_stat_empty_string_bug,
1273 # include <sys/types.h>
1274 # include <sys/stat.h>
1280 exit (stat ("", &sbuf) ? 1 : 0);
1283 jm_cv_func_stat_empty_string_bug=yes,
1284 jm_cv_func_stat_empty_string_bug=no,
1285 dnl When crosscompiling, assume stat is broken.
1286 jm_cv_func_stat_empty_string_bug=yes)
1288 if test $jm_cv_func_stat_empty_string_bug = yes; then
1290 LIBOBJS="$LIBOBJS stat.$ac_objext"
1291 AC_DEFINE_UNQUOTED(HAVE_STAT_EMPTY_STRING_BUG, 1,
1292 [Define if stat has the bug that it succeeds when given the zero-length
1293 file name argument. The stat from SunOS4.1.4 and the Hurd as of 1998-11-01)
1300 dnl From Jim Meyering.
1301 dnl Determine whether realloc works when both arguments are 0.
1302 dnl If it doesn't, arrange to use the replacement function.
1305 AC_DEFUN(jm_FUNC_REALLOC,
1307 dnl xmalloc.c requires that this symbol be defined so it doesn't
1308 dnl mistakenly use a broken realloc -- as it might if this test were omitted.
1309 AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_REALLOC_CHECK, 1,
1310 [Define if the realloc check has been performed. ])
1312 AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc,
1318 exit (realloc (0, 0) ? 0 : 1);
1321 jm_cv_func_working_realloc=yes,
1322 jm_cv_func_working_realloc=no,
1323 dnl When crosscompiling, assume realloc is broken.
1324 jm_cv_func_working_realloc=no)
1326 if test $jm_cv_func_working_realloc = no; then
1328 LIBOBJS="$LIBOBJS realloc.$ac_objext"
1329 AC_DEFINE_UNQUOTED(realloc, rpl_realloc,
1330 [Define to rpl_realloc if the replacement function should be used.])
1336 dnl From Jim Meyering.
1337 dnl Determine whether malloc accepts 0 as its argument.
1338 dnl If it doesn't, arrange to use the replacement function.
1341 AC_DEFUN(jm_FUNC_MALLOC,
1343 dnl xmalloc.c requires that this symbol be defined so it doesn't
1344 dnl mistakenly use a broken malloc -- as it might if this test were omitted.
1345 AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_MALLOC_CHECK, 1,
1346 [Define if the malloc check has been performed. ])
1348 AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc,
1354 exit (malloc (0) ? 0 : 1);
1357 jm_cv_func_working_malloc=yes,
1358 jm_cv_func_working_malloc=no,
1359 dnl When crosscompiling, assume malloc is broken.
1360 jm_cv_func_working_malloc=no)
1362 if test $jm_cv_func_working_malloc = no; then
1364 LIBOBJS="$LIBOBJS malloc.$ac_objext"
1365 AC_DEFINE_UNQUOTED(malloc, rpl_malloc,
1366 [Define to rpl_malloc if the replacement function should be used.])
1372 dnl From Jim Meyering.
1373 dnl Determine whether the strerror_r implementation is one of
1374 dnl the broken ones that returns `int' rather than `char*'.
1375 dnl Actually, this tests only whether it returns a scalar
1376 dnl or an array, but that should be enough.
1377 dnl On at least DEC UNIX 4.0[A-D] and HP-UX B.10.20, strerror_r
1378 dnl returns `int'. This is used by lib/error.c.
1380 AC_DEFUN(jm_FUNC_STRERROR_R,
1383 AC_CHECK_FUNCS([strerror_r])
1384 if test $ac_cv_func_strerror_r = yes; then
1385 AC_CHECK_HEADERS(string.h)
1386 AC_CACHE_CHECK([for working strerror_r],
1387 jm_cv_func_working_strerror_r,
1393 # include <string.h>
1397 int buf; /* avoiding square brackets makes this easier */
1398 char x = *strerror_r (0, buf, sizeof buf);
1400 jm_cv_func_working_strerror_r=yes,
1401 jm_cv_func_working_strerror_r=no
1403 if test $jm_cv_func_working_strerror_r = yes; then
1404 AC_DEFINE_UNQUOTED(HAVE_WORKING_STRERROR_R, 1,
1405 [Define to 1 if strerror_r returns a string.])
1413 dnl SunOS's readdir is broken in such a way that rm.c has to add extra code
1414 dnl to test whether a NULL return value really means there are no more files
1415 dnl in the directory.
1417 dnl Detect the problem by creating a directory containing 300 files (254 not
1418 dnl counting . and .. is the minimum) and see if a loop doing `readdir; unlink'
1419 dnl removes all of them.
1421 dnl Define HAVE_WORKING_READDIR if readdir does *not* have this problem.
1423 dnl Written by Jim Meyering.
1425 AC_DEFUN(jm_FUNC_READDIR,
1427 AC_REQUIRE([AC_HEADER_DIRENT])
1428 AC_CHECK_HEADERS(string.h)
1429 AC_CACHE_CHECK([for working readdir], jm_cv_func_working_readdir,
1431 # Arrange for deletion of the temporary directory this test creates, in
1432 # case the test itself fails to delete everything -- as happens on Sunos.
1433 ac_clean_files="$ac_clean_files conf-dir"
1436 [# include <stdio.h>
1437 # include <sys/types.h>
1439 # include <string.h>
1442 # ifdef HAVE_DIRENT_H
1443 # include <dirent.h>
1444 # define NLENGTH(direct) (strlen((direct)->d_name))
1445 # else /* not HAVE_DIRENT_H */
1446 # define dirent direct
1447 # define NLENGTH(direct) ((direct)->d_namlen)
1448 # ifdef HAVE_SYS_NDIR_H
1449 # include <sys/ndir.h>
1450 # endif /* HAVE_SYS_NDIR_H */
1451 # ifdef HAVE_SYS_DIR_H
1452 # include <sys/dir.h>
1453 # endif /* HAVE_SYS_DIR_H */
1456 # endif /* HAVE_NDIR_H */
1457 # endif /* HAVE_DIRENT_H */
1459 # define DOT_OR_DOTDOT(Basename) \
1460 (Basename[0] == '.' && (Basename[1] == '\0' \
1461 || (Basename[1] == '.' && Basename[2] == '\0')))
1464 create_300_file_dir (const char *dir)
1468 if (mkdir (dir, 0700))
1473 for (i = 0; i < 300; i++)
1478 sprintf (file_name, "%03d", i);
1479 out = fopen (file_name, "w");
1482 if (fclose (out) == EOF)
1491 remove_dir (const char *dir)
1498 dirp = opendir (".");
1504 struct dirent *dp = readdir (dirp);
1508 if (DOT_OR_DOTDOT (dp->d_name))
1511 if (unlink (dp->d_name))
1526 const char *dir = "conf-dir";
1527 create_300_file_dir (dir);
1531 jm_cv_func_working_readdir=yes,
1532 jm_cv_func_working_readdir=no,
1533 jm_cv_func_working_readdir=no)])
1535 if test $jm_cv_func_working_readdir = yes; then
1536 AC_DEFINE_UNQUOTED(HAVE_WORKING_READDIR, 1,
1537 [Define if readdir is found to work properly in some unusual cases. ])
1543 dnl A replacement for autoconf's AC_FUNC_MEMCMP that detects
1544 dnl the losing memcmp on some x86 Next systems.
1545 AC_DEFUN(jm_AC_FUNC_MEMCMP,
1546 [AC_CACHE_CHECK([for working memcmp], jm_cv_func_memcmp_working,
1551 /* Some versions of memcmp are not 8-bit clean. */
1552 char c0 = 0x40, c1 = 0x80, c2 = 0x81;
1553 if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
1556 /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
1557 or more and with at least one buffer not starting on a 4-byte boundary.
1558 William Lewis provided this test program. */
1563 for (i = 0; i < 4; i++)
1567 strcpy (a, "--------01111111");
1568 strcpy (b, "--------10000000");
1569 if (memcmp (a, b, 16) >= 0)
1575 jm_cv_func_memcmp_working=yes,
1576 jm_cv_func_memcmp_working=no,
1577 jm_cv_func_memcmp_working=no)])
1578 test $jm_cv_func_memcmp_working = no \
1579 && LIBOBJS="$LIBOBJS memcmp.$ac_objext"
1580 AC_SUBST(LIBOBJS)dnl
1583 AC_DEFUN(jm_FUNC_MEMCMP,
1584 [AC_REQUIRE([jm_AC_FUNC_MEMCMP])dnl
1585 if test $jm_cv_func_memcmp_working = no; then
1586 AC_DEFINE_UNQUOTED(memcmp, rpl_memcmp,
1587 [Define to rpl_memcmp if the replacement function should be used.])
1593 dnl From Jim Meyering.
1595 dnl See if the glibc *_unlocked I/O macros are available.
1596 dnl Use only those *_unlocked macros that are declared.
1599 AC_DEFUN(jm_FUNC_GLIBC_UNLOCKED_IO,
1601 io_functions='clearerr_unlocked feof_unlocked ferror_unlocked
1602 fflush_unlocked fputc_unlocked fread_unlocked fwrite_unlocked
1603 getc_unlocked getchar_unlocked putc_unlocked putchar_unlocked'
1604 for jm_io_func in $io_functions; do
1605 # Check for the existence of each function only if its declared.
1606 # Otherwise, we'd get the Solaris5.5.1 functions that are not
1607 # declared, and that have been removed from Solaris5.6. The resulting
1608 # 5.5.1 binaries would not run on 5.6 due to shared library differences.
1609 AC_CHECK_DECLS(($jm_io_func),
1612 [#include <stdio.h>])
1613 if test $jm_declared = yes; then
1614 AC_CHECK_FUNCS($jm_io_func)
1622 dnl Determine whether to add fnmatch.o to LIBOBJS and to
1623 dnl define fnmatch to rpl_fnmatch.
1626 AC_DEFUN(jm_FUNC_FNMATCH,
1628 AC_REQUIRE([AM_GLIBC])
1630 if test $ac_cv_func_fnmatch_works = no \
1631 && test $ac_cv_gnu_library = no; then
1633 LIBOBJS="$LIBOBJS fnmatch.$ac_objext"
1634 AC_DEFINE_UNQUOTED(fnmatch, rpl_fnmatch,
1635 [Define to rpl_fnmatch if the replacement function should be used.])
1641 dnl From Gordon Matzigkeit.
1642 dnl Test for the GNU C Library.
1643 dnl FIXME: this should migrate into libit.
1647 AC_CACHE_CHECK(whether we are using the GNU C Library,
1649 [AC_EGREP_CPP([Thanks for using GNU],
1651 #include <features.h>
1652 #ifdef __GNU_LIBRARY__
1653 Thanks for using GNU
1656 ac_cv_gnu_library=yes,
1657 ac_cv_gnu_library=no)
1660 AC_CACHE_CHECK(for version 2 of the GNU C Library,
1662 [AC_EGREP_CPP([Thanks for using GNU too],
1664 #include <features.h>
1666 Thanks for using GNU too
1669 ac_cv_glibc=yes, ac_cv_glibc=no)
1678 AC_CHECKING(for AFS)
1680 && AC_DEFINE(AFS, 1, [Define if you have the Andrew File System.])
1685 # autoconf tests required for use of xstrtoumax.c
1687 AC_DEFUN(jm_AC_PREREQ_XSTRTOUMAX,
1689 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
1690 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
1691 AC_CHECK_HEADERS(stdlib.h)
1693 AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro],
1694 jm_cv_func_strtoumax_macro,
1695 AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include <inttypes.h>
1697 inttypes_h_defines_strtoumax
1699 jm_cv_func_strtoumax_macro=yes,
1700 jm_cv_func_strtoumax_macro=no))
1702 if test "$jm_cv_func_strtoumax_macro" != yes; then
1703 AC_REPLACE_FUNCS(strtoumax)
1706 dnl We don't need (and can't compile) the replacement strtoull
1707 dnl unless the type `unsigned long long' exists.
1708 dnl Also, only the replacement strtoumax invokes strtoull,
1709 dnl so we need the replacement strtoull only if strtoumax does not exist.
1710 case "$ac_cv_type_unsigned_long_long,$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in
1712 AC_REPLACE_FUNCS(strtoull)
1720 dnl From Paul Eggert.
1722 AC_DEFUN(jm_AC_TYPE_UNSIGNED_LONG_LONG,
1724 AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
1725 [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
1726 [unsigned long long ullmax = (unsigned long long) -1;
1727 return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
1728 ac_cv_type_unsigned_long_long=yes,
1729 ac_cv_type_unsigned_long_long=no)])
1730 if test $ac_cv_type_unsigned_long_long = yes; then
1731 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
1732 [Define if you have the unsigned long long type.])
1737 dnl Run a program to determine whether whether link(2) follows symlinks.
1738 dnl Set LINK_FOLLOWS_SYMLINKS accordingly.
1740 AC_DEFUN(jm_AC_FUNC_LINK_FOLLOWS_SYMLINK,
1742 AC_CACHE_CHECK([whether link(2) follows symlinks],
1743 jm_ac_cv_func_link_follows_symlink,
1745 dnl poor-man's AC_REQUIRE: FIXME: repair this once autoconf-3 provides
1746 dnl the appropriate framework.
1747 test -z "$ac_cv_header_unistd_h" \
1748 && AC_CHECK_HEADERS(unistd.h)
1750 # Create a regular file.
1751 echo > conftest.file
1754 # include <sys/types.h>
1755 # include <sys/stat.h>
1756 # ifdef HAVE_UNISTD_H
1757 # include <unistd.h>
1760 # define SAME_INODE(Stat_buf_1, Stat_buf_2) \
1761 ((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
1762 && (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)
1767 const char *file = "conftest.file";
1768 const char *sym = "conftest.sym";
1769 const char *hard = "conftest.hard";
1770 struct stat sb_file, sb_hard;
1772 /* Create a symlink to the regular file. */
1773 if (symlink (file, sym))
1776 /* Create a hard link to that symlink. */
1777 if (link (sym, hard))
1780 if (lstat (hard, &sb_hard))
1782 if (lstat (file, &sb_file))
1785 /* If the dev/inode of hard and file are the same, then
1786 the link call followed the symlink. */
1787 return SAME_INODE (sb_hard, sb_file) ? 0 : 1;
1790 jm_ac_cv_func_link_follows_symlink=yes,
1791 jm_ac_cv_func_link_follows_symlink=no,
1792 jm_ac_cv_func_link_follows_symlink=yes dnl We're cross compiling.
1795 if test $jm_ac_cv_func_link_follows_symlink = yes; then
1796 AC_DEFINE(LINK_FOLLOWS_SYMLINKS, 1,
1797 [Define if `link(2)' dereferences symbolic links.])
1801 dnl From Jim Meyering. Use this if you use the GNU error.[ch].
1802 dnl FIXME: Migrate into libit
1804 AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
1805 [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
1806 [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
1807 am_cv_lib_error_at_line=yes,
1808 am_cv_lib_error_at_line=no)])
1809 if test $am_cv_lib_error_at_line = no; then
1810 LIBOBJS="$LIBOBJS error.$ac_objext"
1812 AC_SUBST(LIBOBJS)dnl
1817 dnl This macro is intended to be used solely in this file.
1818 dnl These are the prerequisite macros for GNU's strftime.c replacement.
1819 AC_DEFUN(_jm_STRFTIME_PREREQS,
1821 dnl strftime.c uses localtime_r if it exists. Check for it.
1822 AC_CHECK_FUNCS(localtime_r)
1824 AC_CHECK_HEADERS(limits.h)
1825 AC_CHECK_FUNCS(bcopy tzset mempcpy memcpy memset)
1827 # This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE.
1830 AC_CHECK_FUNCS(mblen mbrlen)
1832 AC_CHECK_MEMBER(struct tm.tm_gmtoff,
1833 [AC_DEFINE(HAVE_TM_GMTOFF, 1,
1834 [Define if struct tm has the tm_gmtoff member.])],
1836 [#include <time.h>])
1839 dnl Determine if the strftime function has all the features of the GNU one.
1841 dnl From Jim Meyering.
1843 AC_DEFUN(jm_FUNC_GNU_STRFTIME,
1844 [AC_REQUIRE([AC_HEADER_TIME])dnl
1846 _jm_STRFTIME_PREREQS
1848 AC_REQUIRE([AC_C_CONST])dnl
1849 AC_REQUIRE([AC_HEADER_STDC])dnl
1850 AC_CHECK_HEADERS(sys/time.h)
1851 AC_CACHE_CHECK([for working GNU strftime], jm_cv_func_working_gnu_strftime,
1852 [# Set TZ to GMT0 to make strftime give consistent results during the test.
1853 ac_save_TZ="${TZ-GMT0}"
1857 [ /* Ulrich Drepper provided parts of the test program. */
1859 # include <stdlib.h>
1862 #if TIME_WITH_SYS_TIME
1863 # include <sys/time.h>
1866 # if HAVE_SYS_TIME_H
1867 # include <sys/time.h>
1874 compare (const char *fmt, const struct tm *tm, const char *expected)
1877 strftime (buf, 99, fmt, tm);
1878 if (strcmp (buf, expected))
1880 #ifdef SHOW_FAILURES
1881 printf ("fmt: \"%s\", expected \"%s\", got \"%s\"\n",
1882 fmt, expected, buf);
1894 time_t t = 738367; /* Fri Jan 9 13:06:07 1970 */
1898 #define CMP(Fmt, Expected) n_fail += compare ((Fmt), tm, (Expected))
1900 CMP ("%-m", "1"); /* GNU */
1901 CMP ("%A", "Friday");
1902 CMP ("%^A", "FRIDAY"); /* The ^ is a GNU extension. */
1903 CMP ("%B", "January");
1904 CMP ("%^B", "JANUARY");
1905 CMP ("%C", "19"); /* POSIX.2 */
1906 CMP ("%D", "01/09/70"); /* POSIX.2 */
1907 CMP ("%F", "1970-01-09");
1908 CMP ("%G", "1970"); /* GNU */
1913 CMP ("%R", "13:06"); /* POSIX.2 */
1915 CMP ("%T", "13:06:07"); /* POSIX.2 */
1919 CMP ("%X", "13:06:07");
1922 CMP ("%_m", " 1"); /* GNU */
1927 CMP ("%c", "Fri Jan 9 13:06:07 1970");
1928 CMP ("%^c", "FRI JAN 9 13:06:07 1970");
1930 CMP ("%e", " 9"); /* POSIX.2 */
1931 CMP ("%g", "70"); /* GNU */
1932 CMP ("%h", "Jan"); /* POSIX.2 */
1935 CMP ("%k", "13"); /* GNU */
1936 CMP ("%l", " 1"); /* GNU */
1938 CMP ("%n", "\n"); /* POSIX.2 */
1940 CMP ("%r", "01:06:07 PM"); /* POSIX.2 */
1941 CMP ("%s", "738367"); /* GNU */
1942 CMP ("%t", "\t"); /* POSIX.2 */
1943 CMP ("%u", "5"); /* POSIX.2 */
1945 CMP ("%x", "01/09/70");
1947 CMP ("%z", "+0000"); /* GNU */
1949 exit (n_fail ? 1 : 0);
1951 jm_cv_func_working_gnu_strftime=yes,
1952 jm_cv_func_working_gnu_strftime=no,
1953 dnl When crosscompiling, assume strftime is missing or broken.
1954 jm_cv_func_working_gnu_strftime=no)
1955 dnl If TZ wasn't set before, this sets it to GMT0. No real harm done.
1958 if test $jm_cv_func_working_gnu_strftime = no; then
1960 LIBOBJS="$LIBOBJS strftime.$ac_objext"
1961 AC_DEFINE_UNQUOTED(strftime, gnu_strftime,
1962 [Define to gnu_strftime if the replacement function should be used.])
1966 AC_DEFUN(jm_FUNC_STRFTIME,
1968 _jm_STRFTIME_PREREQS
1969 AC_REPLACE_FUNCS(strftime)
1974 dnl See if there's a working, system-supplied version of the getline function.
1975 dnl We can't just do AC_REPLACE_FUNCS(getline) because some systems
1976 dnl have a function by that name in -linet that doesn't have anything
1977 dnl to do with the function we need.
1978 AC_DEFUN(AM_FUNC_GETLINE,
1980 am_getline_needs_run_time_check=no
1981 AC_CHECK_FUNC(getline,
1982 dnl Found it in some library. Verify that it works.
1983 am_getline_needs_run_time_check=yes,
1984 am_cv_func_working_getline=no)
1985 if test $am_getline_needs_run_time_check = yes; then
1986 AC_CHECK_HEADERS(string.h)
1987 AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline,
1988 [echo fooN |tr -d '\012'|tr N '\012' > conftest.data
1991 # include <sys/types.h>
1993 # include <string.h>
1996 { /* Based on a test program from Karl Heuer. */
2000 FILE *in = fopen ("./conftest.data", "r");
2003 len = getline (&line, &siz, in);
2004 exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1);
2006 ], am_cv_func_working_getline=yes dnl The library version works.
2007 , am_cv_func_working_getline=no dnl The library version does NOT work.
2008 , am_cv_func_working_getline=no dnl We're cross compiling.
2012 if test $am_cv_func_working_getline = yes; then
2013 AC_DEFINE(HAVE_GETLINE, 1,
2014 [Define if you have the GETLINE function.])dnl
2020 dnl From Paul Eggert.
2022 # Define ST_MTIM_NSEC to be the nanoseconds member of struct stat's st_mtim,
2025 AC_DEFUN(AC_STRUCT_ST_MTIM_NSEC,
2026 [AC_CACHE_CHECK([for nanoseconds member of struct stat.st_mtim],
2027 ac_cv_struct_st_mtim_nsec,
2028 [ac_save_CPPFLAGS="$CPPFLAGS"
2029 ac_cv_struct_st_mtim_nsec=no
2030 # tv_nsec -- the usual case
2031 # _tv_nsec -- Solaris 2.6, if
2032 # (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1
2033 # && !defined __EXTENSIONS__)
2034 # st__tim.tv_nsec -- UnixWare 2.1.2
2035 for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do
2036 CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val"
2037 AC_TRY_COMPILE([#include <sys/types.h>
2038 #include <sys/stat.h>], [struct stat s; s.st_mtim.ST_MTIM_NSEC;],
2039 [ac_cv_struct_st_mtim_nsec=$ac_val; break])
2041 CPPFLAGS="$ac_save_CPPFLAGS"])
2043 if test $ac_cv_struct_st_mtim_nsec != no; then
2044 AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec,
2045 [Define to be the nanoseconds member of struct stat's st_mtim,
2053 # Define HAVE_ST_DM_MODE if struct stat has an st_dm_mode member.
2055 AC_DEFUN(AC_STRUCT_ST_DM_MODE,
2056 [AC_CACHE_CHECK([for st_dm_mode in struct stat], ac_cv_struct_st_dm_mode,
2057 [AC_TRY_COMPILE([#include <sys/types.h>
2058 #include <sys/stat.h>], [struct stat s; s.st_dm_mode;],
2059 ac_cv_struct_st_dm_mode=yes,
2060 ac_cv_struct_st_dm_mode=no)])
2062 if test $ac_cv_struct_st_dm_mode = yes; then
2063 AC_DEFINE_UNQUOTED(HAVE_ST_DM_MODE, 1,
2064 [Define if struct stat has an st_dm_mode member. ])
2071 dnl From Jim Meyering
2073 dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
2074 dnl in time.h or sys/time.h.
2076 AC_DEFUN(jm_CHECK_TYPE_STRUCT_TIMESPEC,
2078 AC_REQUIRE([AC_HEADER_TIME])
2079 AC_CACHE_CHECK([for struct timespec], fu_cv_sys_struct_timespec,
2082 # if TIME_WITH_SYS_TIME
2083 # include <sys/time.h>
2086 # if HAVE_SYS_TIME_H
2087 # include <sys/time.h>
2093 [static struct timespec x; x.tv_sec = x.tv_nsec;],
2094 fu_cv_sys_struct_timespec=yes,
2095 fu_cv_sys_struct_timespec=no)
2098 if test $fu_cv_sys_struct_timespec = yes; then
2099 AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMESPEC, 1,
2100 [Define if struct timespec is declared in <time.h>. ])
2106 dnl From Paul Eggert.
2110 # Define uintmax_t to `unsigned long' or `unsigned long long'
2111 # if <inttypes.h> does not exist.
2113 AC_DEFUN(jm_AC_TYPE_UINTMAX_T,
2115 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
2116 if test $jm_ac_cv_header_inttypes_h = no; then
2117 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
2118 test $ac_cv_type_unsigned_long_long = yes \
2119 && ac_type='unsigned long long' \
2120 || ac_type='unsigned long'
2121 AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
2122 [ Define to unsigned long or unsigned long long
2123 if <inttypes.h> doesn't define.])
2127 # Macro to add for using GNU gettext.
2128 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2130 # This file can be copied and used freely without restrictions. It can
2131 # be used in projects which are not available under the GNU Public License
2132 # but which still want to provide support for the GNU gettext functionality.
2133 # Please note that the actual code is *not* freely available.
2137 AC_PREREQ(2.13) dnl Minimum Autoconf version required.
2139 AC_DEFUN(AM_WITH_NLS,
2140 [AC_MSG_CHECKING([whether NLS is requested])
2141 dnl Default is enabled NLS
2143 [ --disable-nls do not use Native Language Support],
2144 USE_NLS=$enableval, USE_NLS=yes)
2145 AC_MSG_RESULT($USE_NLS)
2148 USE_INCLUDED_LIBINTL=no
2150 dnl If we use NLS figure out what method
2151 if test "$USE_NLS" = "yes"; then
2152 AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested.])
2153 AC_MSG_CHECKING([whether included gettext is requested])
2154 AC_ARG_WITH(included-gettext,
2155 [ --with-included-gettext use the GNU gettext library included here],
2156 nls_cv_force_use_gnu_gettext=$withval,
2157 nls_cv_force_use_gnu_gettext=no)
2158 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
2160 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
2161 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
2162 dnl User does not insist on using GNU NLS library. Figure out what
2163 dnl to use. If gettext or catgets are available (in this order) we
2164 dnl use this. Else we have to fall back to GNU NLS library.
2165 dnl catgets is only used if permitted by option --with-catgets.
2167 nls_cv_header_libgt=
2170 AC_CHECK_HEADER(libintl.h,
2171 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
2172 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
2173 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
2175 if test "$gt_cv_func_gettext_libc" != "yes"; then
2176 AC_CHECK_LIB(intl, bindtextdomain,
2177 [AC_CHECK_LIB(intl, gettext)])
2180 if test "$gt_cv_func_gettext_libc" = "yes" \
2181 || test "$ac_cv_lib_intl_gettext" = "yes"; then
2182 AC_DEFINE(HAVE_GETTEXT, 1,
2183 [Define to 1 if you have gettext and don't want to use GNU gettext.])
2184 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2185 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
2186 if test "$MSGFMT" != "no"; then
2187 AC_CHECK_FUNCS(dcgettext)
2188 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2189 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2190 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2191 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
2192 return _nl_msg_cat_cntr],
2202 if test "$CATOBJEXT" = "NONE"; then
2203 AC_MSG_CHECKING([whether catgets can be used])
2204 AC_ARG_WITH(catgets,
2205 [ --with-catgets use catgets functions if available],
2206 nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
2207 AC_MSG_RESULT($nls_cv_use_catgets)
2209 if test "$nls_cv_use_catgets" = "yes"; then
2210 dnl No gettext in C library. Try catgets next.
2211 AC_CHECK_LIB(i, main)
2212 AC_CHECK_FUNC(catgets,
2213 [AC_DEFINE(HAVE_CATGETS, 1,
2214 [Define as 1 if you have catgets and don't want to use GNU gettext.])
2215 INTLOBJS="\$(CATOBJS)"
2216 AC_PATH_PROG(GENCAT, gencat, no)dnl
2217 if test "$GENCAT" != "no"; then
2218 AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
2219 if test "$GMSGFMT" = "no"; then
2220 AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
2221 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
2223 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2224 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2225 USE_INCLUDED_LIBINTL=yes
2229 INTLDEPS='$(top_builddir)/intl/libintl.a'
2231 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
2232 nls_cv_header_intl=intl/libintl.h
2233 nls_cv_header_libgt=intl/libgettext.h
2238 if test "$CATOBJEXT" = "NONE"; then
2239 dnl Neither gettext nor catgets in included in the C library.
2240 dnl Fall back on GNU gettext library.
2241 nls_cv_use_gnu_gettext=yes
2245 if test "$nls_cv_use_gnu_gettext" = "yes"; then
2246 dnl Mark actions used to generate GNU NLS library.
2247 INTLOBJS="\$(GETTOBJS)"
2248 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2249 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
2250 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2251 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2252 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2254 USE_INCLUDED_LIBINTL=yes
2258 INTLDEPS='$(top_builddir)/intl/libintl.a'
2260 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
2261 nls_cv_header_intl=intl/libintl.h
2262 nls_cv_header_libgt=intl/libgettext.h
2265 dnl Test whether we really found GNU xgettext.
2266 if test "$XGETTEXT" != ":"; then
2267 dnl If it is no GNU xgettext we define it as : so that the
2268 dnl Makefiles still can work.
2269 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
2273 [found xgettext program is not GNU xgettext; ignore it])
2278 # We need to process the po/ directory.
2282 nls_cv_header_intl=intl/libintl.h
2283 nls_cv_header_libgt=intl/libgettext.h
2285 if test -z "$nls_cv_header_intl"; then
2286 # Clean out junk possibly left behind by a previous configuration.
2287 rm -f intl/libintl.h
2289 AC_CONFIG_LINKS($nls_cv_header_intl:$nls_cv_header_libgt)
2291 [case "$CONFIG_FILES" in *po/Makefile.in*)
2292 sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
2296 # If this is used in GNU gettext we have to set USE_NLS to `yes'
2297 # because some of the sources are only built for this goal.
2298 if test "$PACKAGE" = gettext; then
2300 USE_INCLUDED_LIBINTL=yes
2303 dnl These rules are solely for the distribution goal. While doing this
2304 dnl we only have to keep exactly one list of the available catalogs
2305 dnl in configure.in.
2306 for lang in $ALL_LINGUAS; do
2307 GMOFILES="$GMOFILES $lang.gmo"
2308 POFILES="$POFILES $lang.po"
2311 dnl Make all variables we use known to autoconf.
2312 AC_SUBST(USE_INCLUDED_LIBINTL)
2315 AC_SUBST(DATADIRNAME)
2317 AC_SUBST(INSTOBJEXT)
2325 AC_DEFUN(AM_GNU_GETTEXT,
2326 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
2327 AC_REQUIRE([AC_PROG_CC])dnl
2328 AC_REQUIRE([AC_PROG_RANLIB])dnl
2329 AC_REQUIRE([AC_ISC_POSIX])dnl
2330 AC_REQUIRE([AC_HEADER_STDC])dnl
2331 AC_REQUIRE([AC_C_CONST])dnl
2332 AC_REQUIRE([AC_C_INLINE])dnl
2333 AC_REQUIRE([AC_TYPE_OFF_T])dnl
2334 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
2335 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
2336 AC_REQUIRE([AC_FUNC_MMAP])dnl
2338 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
2339 unistd.h sys/param.h])
2340 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
2341 strdup __argz_count __argz_stringify __argz_next])
2343 if test "${ac_cv_func_stpcpy+set}" != "set"; then
2344 AC_CHECK_FUNCS(stpcpy)
2346 if test "${ac_cv_func_stpcpy}" = "yes"; then
2347 AC_DEFINE(HAVE_STPCPY, 1, [Define to 1 if you have the stpcpy function.])
2353 if test "x$CATOBJEXT" != "x"; then
2354 if test "x$ALL_LINGUAS" = "x"; then
2357 AC_MSG_CHECKING(for catalogs to be installed)
2359 for lang in ${LINGUAS=$ALL_LINGUAS}; do
2360 case "$ALL_LINGUAS" in
2361 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
2364 LINGUAS=$NEW_LINGUAS
2365 AC_MSG_RESULT($LINGUAS)
2368 dnl Construct list of names of catalog files to be constructed.
2369 if test -n "$LINGUAS"; then
2370 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
2374 dnl The reference to <locale.h> in the installed <libintl.h> file
2375 dnl must be resolved because we cannot expect the users of this
2376 dnl to define HAVE_LOCALE_H.
2377 if test $ac_cv_header_locale_h = yes; then
2378 INCLUDE_LOCALE_H="#include <locale.h>"
2381 /* The system does not provide the header <locale.h>. Take care yourself. */"
2383 AC_SUBST(INCLUDE_LOCALE_H)
2385 dnl Determine which catalog format we have (if any is needed)
2386 dnl For now we know about two different formats:
2387 dnl Linux libc-5 and the normal X/Open format
2388 test -d intl || mkdir intl
2389 if test "$CATOBJEXT" = ".cat"; then
2390 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
2392 dnl Transform the SED scripts while copying because some dumb SEDs
2393 dnl cannot handle comments.
2394 sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
2396 dnl po2tbl.sed is always needed.
2397 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
2398 $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
2400 dnl In the intl/Makefile.in we have a special dependency which makes
2401 dnl only sense for gettext. We comment this out for non-gettext
2403 if test "$PACKAGE" = "gettext"; then
2413 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
2414 dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
2415 dnl Try to locate is.
2417 if test -n "$ac_aux_dir"; then
2418 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
2420 if test -z "$MKINSTALLDIRS"; then
2421 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
2423 AC_SUBST(MKINSTALLDIRS)
2425 dnl *** For now the libtool support in intl/Makefile is not for real.
2429 dnl Generate list of files to be processed by xgettext which will
2430 dnl be included in po/Makefile.
2431 test -d po || mkdir po
2434 posrcprefix="../" ;;
2436 posrcprefix="$srcdir/" ;;
2438 posrcprefix="../$srcdir/" ;;
2441 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
2442 < $srcdir/po/POTFILES.in > po/POTFILES
2445 # Search path for a program which passes the given test.
2446 # Ulrich Drepper <drepper@cygnus.com>, 1996.
2448 # This file can be copied and used freely without restrictions. It can
2449 # be used in projects which are not available under the GNU Public License
2450 # but which still want to provide support for the GNU gettext functionality.
2451 # Please note that the actual code is *not* freely available.
2455 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
2456 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
2457 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
2458 [# Extract the first word of "$2", so it can be a program name with args.
2459 set dummy $2; ac_word=[$]2
2460 AC_MSG_CHECKING([for $ac_word])
2461 AC_CACHE_VAL(ac_cv_path_$1,
2464 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
2467 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
2468 for ac_dir in ifelse([$5], , $PATH, [$5]); do
2469 test -z "$ac_dir" && ac_dir=.
2470 if test -f $ac_dir/$ac_word; then
2472 ac_cv_path_$1="$ac_dir/$ac_word"
2478 dnl If no 4th arg is given, leave the cache variable unset,
2479 dnl so AC_PATH_PROGS will keep looking.
2480 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
2485 if test -n "[$]$1"; then
2486 AC_MSG_RESULT([$]$1)
2493 # Check whether LC_MESSAGES is available in <locale.h>.
2494 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2496 # This file can be copied and used freely without restrictions. It can
2497 # be used in projects which are not available under the GNU Public License
2498 # but which still want to provide support for the GNU gettext functionality.
2499 # Please note that the actual code is *not* freely available.
2503 AC_PREREQ(2.13) dnl Minimum Autoconf version required.
2505 AC_DEFUN(AM_LC_MESSAGES,
2506 [if test $ac_cv_header_locale_h = yes; then
2507 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
2508 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2509 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
2510 if test $am_cv_val_LC_MESSAGES = yes; then
2511 AC_DEFINE(HAVE_LC_MESSAGES, 1,
2512 [Define if your locale.h file contains LC_MESSAGES.])