diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 00000000..660df526 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,2597 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4a + +dnl Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +# serial 3 + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. We must strip everything past the first ":", +# and everything past the last "/". + +AC_PREREQ([2.12]) + +AC_DEFUN([AM_CONFIG_HEADER], +[AC_CONFIG_HEADER([$1]) + AC_OUTPUT_COMMANDS( + ifelse(patsubst([$1], [[^ ]], []), + [], + [test -z "$CONFIG_HEADERS" || echo timestamp >dnl + patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]), + [am_indx=1 + for am_file in $1; do + case " $CONFIG_HEADERS " in + *" $am_file "*) + echo timestamp > `echo $am_file | sed 's%:.*%%;s%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=\`expr \$am_indx + 1\` + done]) +]) + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 3 + +AC_PREREQ([2.13]) + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED. +# The purpose of this macro is to provide the user with a means to +# check macros which are provided without letting her know how the +# information is coded. +# If this macro is not defined by Autoconf, define it here. +ifdef([AC_PROVIDE_IFELSE], + [], + [define([AC_PROVIDE_IFELSE], + [ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE]) +# ---------------------------------------------- +AC_DEFUN([AM_INIT_AUTOMAKE], +[dnl We require 2.13 because we rely on SHELL being computed by configure. +AC_REQUIRE([AC_PROG_INSTALL])dnl +# test to see if srcdir already configured +if test "`CDPATH=: && cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi + +# Define the identity of the package. +PACKAGE=$1 +AC_SUBST(PACKAGE)dnl +VERSION=$2 +AC_SUBST(VERSION)dnl +ifelse([$3],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])]) + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_MISSING_PROG(AMTAR, tar) +AM_MISSING_INSTALL_SH +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl +AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_PROVIDE_IFELSE([AC_PROG_CC], + [AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[AM_DEPENDENCIES(CXX)])])dnl +]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +# AM_MISSING_PROG(NAME, PROGRAM) +AC_DEFUN([AM_MISSING_PROG], [ +AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + +# Like AM_MISSING_PROG, but only looks for install-sh. +# AM_MISSING_INSTALL_SH() +AC_DEFUN([AM_MISSING_INSTALL_SH], [ +AC_REQUIRE([AM_MISSING_HAS_RUN]) +if test -z "$install_sh"; then + install_sh="$ac_aux_dir/install-sh" + test -f "$install_sh" || install_sh="$ac_aux_dir/install.sh" + test -f "$install_sh" || install_sh="${am_missing_run}${ac_auxdir}/install-sh" + dnl FIXME: an evil hack: we remove the SHELL invocation from + dnl install_sh because automake adds it back in. Sigh. + install_sh="`echo $install_sh | sed -e 's/\${SHELL}//'`" +fi +AC_SUBST(install_sh)]) + +# AM_MISSING_HAS_RUN. +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], [ +test x"${MISSING+set}" = xset || \ + MISSING="\${SHELL} `CDPATH=: && cd $ac_aux_dir && pwd`/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run :"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + am_backtick='`' + AC_MSG_WARN([${am_backtick}missing' script is too old or missing]) +fi +]) + +# See how the compiler implements dependency checking. +# Usage: +# AM_DEPENDENCIES(NAME) +# NAME is "CC", "CXX" or "OBJC". + +# We try a few techniques and use that to set a single cache variable. + +AC_DEFUN([AM_DEPENDENCIES],[ +AC_REQUIRE([AM_SET_DEPDIR]) +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS]) +ifelse([$1],CC,[ +AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AC_PROG_CPP]) +depcc="$CC" +depcpp="$CPP"],[$1],CXX,[ +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) +depcc="$CXX" +depcpp="$CXXCPP"],[$1],OBJC,[ +am_cv_OBJC_dependencies_compiler_type=gcc],[ +AC_REQUIRE([AC_PROG_][$1]) +depcc="$[$1]" +depcpp=""]) +AC_MSG_CHECKING([dependency style of $depcc]) +AC_CACHE_VAL(am_cv_[$1]_dependencies_compiler_type,[ +if test -z "$AMDEP"; then + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + + am_cv_[$1]_dependencies_compiler_type=none + for depmode in `sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < "$am_depcomp"`; do + case "$depmode" in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode="$depmode" \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL $am_depcomp $depcc -c conftest.c -o conftest.o 2>/dev/null && + grep conftest.h conftest.Po > /dev/null 2>&1; then + am_cv_[$1]_dependencies_compiler_type="$depmode" + break + fi + done + + rm -f conftest.* +else + am_cv_[$1]_dependencies_compiler_type=none +fi +]) +AC_MSG_RESULT($am_cv_[$1]_dependencies_compiler_type) +[$1]DEPMODE="depmode=$am_cv_[$1]_dependencies_compiler_type" +AC_SUBST([$1]DEPMODE) +]) + +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in AM_DEPENDENCIES + +AC_DEFUN([AM_SET_DEPDIR],[ +if test -d .deps || mkdir .deps 2> /dev/null || test -d .deps; then + DEPDIR=.deps +else + DEPDIR=_deps +fi +AC_SUBST(DEPDIR) +]) + +AC_DEFUN([AM_DEP_TRACK],[ +AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" = xno; then + AMDEP="#" +else + am_depcomp="$ac_aux_dir/depcomp" + if test ! -f "$am_depcomp"; then + AMDEP="#" + else + AMDEP= + fi +fi +AC_SUBST(AMDEP) +if test -z "$AMDEP"; then + AMDEPBACKSLASH='\' +else + AMDEPBACKSLASH= +fi +pushdef([subst], defn([AC_SUBST])) +subst(AMDEPBACKSLASH) +popdef([subst]) +]) + +# Generate code to set up dependency tracking. +# This macro should only be invoked once -- use via AC_REQUIRE. +# Usage: +# AM_OUTPUT_DEPENDENCY_COMMANDS + +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],[ +AC_OUTPUT_COMMANDS([ +test x"$AMDEP" != x"" || +for mf in $CONFIG_FILES; do + case "$mf" in + Makefile) dirpart=.;; + */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;; + *) continue;; + esac + grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`echo "$file" | sed -e 's|/[^/]*$||'` + $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1 + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +], [AMDEP="$AMDEP" +ac_aux_dir="$ac_aux_dir"])]) + +#serial 1 +dnl This test replaces the one in autoconf. +dnl Currently this macro should have the same name as the autoconf macro +dnl because gettext's gettext.m4 (distributed in the automake package) +dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader +dnl give these diagnostics: +dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX +dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX + +undefine([AC_ISC_POSIX]) +AC_DEFUN(AC_ISC_POSIX, + [ + dnl This test replaces the obsolescent AC_ISC_POSIX kludge. + AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) + ] +) + + +# serial 1 + +AC_DEFUN([AM_C_PROTOTYPES], +[AC_REQUIRE([AM_PROG_CC_STDC]) +AC_REQUIRE([AC_PROG_CPP]) +AC_MSG_CHECKING([for function prototypes]) +if test "$am_cv_prog_cc_stdc" != no; then + AC_MSG_RESULT(yes) + AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes]) + U= ANSI2KNR= +else + AC_MSG_RESULT(no) + U=_ ANSI2KNR=./ansi2knr + # Ensure some checks needed by ansi2knr itself. + AC_HEADER_STDC + AC_CHECK_HEADERS(string.h) +fi +AC_SUBST(U)dnl +AC_SUBST(ANSI2KNR)dnl +]) + + +# serial 1 + +# @defmac AC_PROG_CC_STDC +# @maindex PROG_CC_STDC +# @ovindex CC +# If the C compiler in not in ANSI C mode by default, try to add an option +# to output variable @code{CC} to make it so. This macro tries various +# options that select ANSI C on some system or another. It considers the +# compiler to be in ANSI C mode if it handles function prototypes correctly. +# +# If you use this macro, you should check after calling it whether the C +# compiler has been set to accept ANSI C; if not, the shell variable +# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source +# code in ANSI C, you can make an un-ANSIfied copy of it by using the +# program @code{ansi2knr}, which comes with Ghostscript. +# @end defmac + +AC_DEFUN([AM_PROG_CC_STDC], +[AC_REQUIRE([AC_PROG_CC]) +AC_BEFORE([$0], [AC_C_INLINE]) +AC_BEFORE([$0], [AC_C_CONST]) +dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require +dnl a magic option to avoid problems with ANSI preprocessor commands +dnl like #elif. +dnl FIXME: can't do this because then AC_AIX won't work due to a +dnl circular dependency. +dnl AC_BEFORE([$0], [AC_PROG_CPP]) +AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) +AC_CACHE_VAL(am_cv_prog_cc_stdc, +[am_cv_prog_cc_stdc=no +ac_save_CC="$CC" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + AC_TRY_COMPILE( +[#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +], [ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; +], +[am_cv_prog_cc_stdc="$ac_arg"; break]) +done +CC="$ac_save_CC" +]) +if test -z "$am_cv_prog_cc_stdc"; then + AC_MSG_RESULT([none needed]) +else + AC_MSG_RESULT($am_cv_prog_cc_stdc) +fi +case "x$am_cv_prog_cc_stdc" in + x|xno) ;; + *) CC="$CC $am_cv_prog_cc_stdc" ;; +esac +]) + +#serial 8 + +dnl By default, many hosts won't let programs access large files; +dnl one must use special compiler options to get large-file access to work. +dnl For more details about this brain damage please see: +dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html + +dnl Written by Paul Eggert . + +dnl Internal subroutine of AC_SYS_LARGEFILE. +dnl AC_SYS_LARGEFILE_FLAGS(FLAGSNAME) +AC_DEFUN(AC_SYS_LARGEFILE_FLAGS, + [AC_CACHE_CHECK([for $1 value to request large file support], + ac_cv_sys_largefile_$1, + [if ($GETCONF LFS_$1) >conftest.1 2>conftest.2 && test ! -s conftest.2 + then + ac_cv_sys_largefile_$1=`cat conftest.1` + else + ac_cv_sys_largefile_$1=no + ifelse($1, CFLAGS, + [case "$host_os" in + # HP-UX 10.20 requires -D__STDC_EXT__ with gcc 2.95.1. +[ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)] + if test "$GCC" = yes; then + ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__ + fi + ;; + # IRIX 6.2 and later require cc -n32. +[ irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)] + if test "$GCC" != yes; then + ac_cv_sys_largefile_CFLAGS=-n32 + fi + esac + if test "$ac_cv_sys_largefile_CFLAGS" != no; then + ac_save_CC="$CC" + CC="$CC $ac_cv_sys_largefile_CFLAGS" + AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no) + CC="$ac_save_CC" + fi]) + fi + rm -f conftest*])]) + +dnl Internal subroutine of AC_SYS_LARGEFILE. +dnl AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL) +AC_DEFUN(AC_SYS_LARGEFILE_SPACE_APPEND, + [case $2 in + no) ;; + ?*) + case "[$]$1" in + '') $1=$2 ;; + *) $1=[$]$1' '$2 ;; + esac ;; + esac]) + +dnl Internal subroutine of AC_SYS_LARGEFILE. +dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT) +AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE, + [AC_CACHE_CHECK([for $1], $2, + [$2=no + $4 + for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do + case "$ac_flag" in + -D$1) + $2=1 ;; + -D$1=*) + $2=`expr " $ac_flag" : '[[^=]]*=\(.*\)'` ;; + esac + done + ]) + if test "[$]$2" != no; then + AC_DEFINE_UNQUOTED([$1], [$]$2, [$3]) + fi]) + +AC_DEFUN(AC_SYS_LARGEFILE, + [AC_REQUIRE([AC_CANONICAL_HOST]) + AC_ARG_ENABLE(largefile, + [ --disable-largefile omit support for large files]) + if test "$enable_largefile" != no; then + AC_CHECK_TOOL(GETCONF, getconf) + AC_SYS_LARGEFILE_FLAGS(CFLAGS) + AC_SYS_LARGEFILE_FLAGS(LDFLAGS) + AC_SYS_LARGEFILE_FLAGS(LIBS) + + for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do + case "$ac_flag" in + no) ;; + -D_FILE_OFFSET_BITS=*) ;; + -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;; + -D_LARGE_FILES | -D_LARGE_FILES=*) ;; + -D?* | -I?*) + AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;; + *) + AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;; + esac + done + AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS") + AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS") + AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, + ac_cv_sys_file_offset_bits, + [Number of bits in a file offset, on hosts where this is settable.], + [case "$host_os" in + # HP-UX 10.20 and later +[ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)] + ac_cv_sys_file_offset_bits=64 ;; + esac]) + AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, + ac_cv_sys_largefile_source, + [Define to make fseeko etc. visible, on some hosts.], + [case "$host_os" in + # HP-UX 10.20 and later +[ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)] + ac_cv_sys_largefile_source=1 ;; + esac]) + AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, + ac_cv_sys_large_files, + [Define for large files, on AIX-style hosts.], + [case "$host_os" in + # AIX 4.2 and later +[ aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)] + ac_cv_sys_large_files=1 ;; + esac]) + fi + ]) + +#serial 13, with several lines deleted for fileutils. + +dnl Misc type-related macros for fileutils, sh-utils, textutils. + +AC_DEFUN(jm_MACROS, +[ + AC_PREREQ(2.14a) + + GNU_PACKAGE="GNU $PACKAGE" + AC_DEFINE_UNQUOTED(GNU_PACKAGE, "$GNU_PACKAGE", + [The concatenation of the strings `GNU ', and PACKAGE.]) + AC_SUBST(GNU_PACKAGE) + + AC_SUBST(OPTIONAL_BIN_PROGS) + AC_SUBST(OPTIONAL_BIN_ZCRIPTS) + AC_SUBST(MAN) + AC_SUBST(DF_PROG) + + dnl This macro actually runs replacement code. See isc-posix.m4. + AC_REQUIRE([AC_ISC_POSIX])dnl + + AC_CHECK_HEADERS( \ + errno.h \ + fcntl.h \ + fenv.h \ + float.h \ + limits.h \ + memory.h \ + mntent.h \ + mnttab.h \ + netdb.h \ + paths.h \ + stdlib.h \ + stddef.h \ + string.h \ + sys/acl.h \ + sys/filsys.h \ + sys/fs/s5param.h \ + sys/fs_types.h \ + sys/fstyp.h \ + sys/ioctl.h \ + sys/mntent.h \ + sys/mount.h \ + sys/param.h \ + sys/socket.h \ + sys/statfs.h \ + sys/statvfs.h \ + sys/systeminfo.h \ + sys/time.h \ + sys/timeb.h \ + sys/vfs.h \ + sys/wait.h \ + syslog.h \ + termios.h \ + unistd.h \ + values.h \ + ) + + jm_INCLUDED_REGEX([lib/regex.c]) + + AC_REQUIRE([jm_ASSERT]) + AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE]) + AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_INO]) + AC_REQUIRE([jm_CHECK_DECLS]) + + AC_REQUIRE([jm_PREREQ]) + + AC_REQUIRE([jm_FUNC_MKTIME]) + AC_REQUIRE([jm_FUNC_LSTAT]) + AC_REQUIRE([jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK]) + AC_REQUIRE([jm_FUNC_STAT]) + AC_REQUIRE([jm_FUNC_REALLOC]) + AC_REQUIRE([jm_FUNC_MALLOC]) + AC_REQUIRE([jm_FUNC_STRERROR_R]) + AC_REQUIRE([jm_FUNC_READDIR]) + AC_REQUIRE([jm_FUNC_MEMCMP]) + AC_REQUIRE([jm_FUNC_GLIBC_UNLOCKED_IO]) + AC_REQUIRE([kd_FUNC_FNMATCH_CASE_RPL]) + AC_REQUIRE([jm_AFS]) + AC_REQUIRE([jm_AC_PREREQ_XSTRTOUMAX]) + AC_REQUIRE([jm_AC_FUNC_LINK_FOLLOWS_SYMLINK]) + AC_REQUIRE([AM_FUNC_ERROR_AT_LINE]) + AC_REQUIRE([jm_FUNC_GNU_STRFTIME]) + AC_REQUIRE([jm_FUNC_MKTIME]) + + AC_REQUIRE([AC_FUNC_VPRINTF]) + AC_REQUIRE([AC_FUNC_ALLOCA]) + + AC_REPLACE_FUNCS(strncasecmp) + AC_REPLACE_FUNCS(stpcpy strstr strtol strtoul) + AC_REPLACE_FUNCS(memcmp) + + dnl used by e.g. intl/*domain.c and lib/canon-host.c + AC_REPLACE_FUNCS(strdup) + + AC_REPLACE_FUNCS(memcpy memset) + AC_CHECK_FUNCS(getpagesize) + + # By default, argmatch should fail calling usage (1). + AC_DEFINE(ARGMATCH_DIE, [usage (1)], + [Define to the function xargmatch calls on failures.]) + AC_DEFINE(ARGMATCH_DIE_DECL, [extern void usage ()], + [Define to the declaration of the xargmatch failure function.]) + + dnl Used to define SETVBUF in sys2.h. + dnl This evokes the following warning from autoconf: + dnl ...: warning: AC_TRY_RUN called without default to allow cross compiling + AC_FUNC_SETVBUF_REVERSED + + # used by sleep and shred + # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function. + # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4. + AC_SEARCH_LIBS(clock_gettime, [rt posix4]) + AC_CHECK_FUNCS(clock_gettime) + AC_CHECK_FUNCS(gettimeofday) + + AC_CHECK_FUNCS(getdelim) + + AC_REQUIRE([AC_FUNC_CLOSEDIR_VOID]) + + AC_CHECK_FUNCS( \ + acl \ + bcopy \ + endgrent \ + endpwent \ + fchdir \ + fdatasync \ + fseeko \ + ftime \ + ftruncate \ + getcwd \ + gethrtime \ + getmntinfo \ + hasmntopt \ + isascii \ + listmntent \ + localeconv \ + memcpy \ + mempcpy \ + mkfifo \ + realpath \ + resolvepath \ + sethostname \ + strchr \ + strerror \ + strrchr \ + sysinfo \ + tzset \ + ) + + AM_FUNC_GETLINE + if test $am_cv_func_working_getline != yes; then + AC_CHECK_FUNCS(getdelim) + fi +]) + +AC_DEFUN(jm_CHECK_ALL_TYPES, +[ + dnl Checks for typedefs, structures, and compiler characteristics. + AC_REQUIRE([AC_C_BIGENDIAN]) + AC_REQUIRE([AC_PROG_CC_STDC]) + AC_REQUIRE([AC_C_CONST]) + AC_REQUIRE([AC_C_VOLATILE]) + AC_REQUIRE([AC_C_INLINE]) + AC_REQUIRE([AC_C_LONG_DOUBLE]) + + AC_REQUIRE([AC_HEADER_DIRENT]) + AC_REQUIRE([AC_HEADER_STDC]) + AC_CHECK_MEMBERS((struct stat.st_blksize),,,[$ac_includes_default +#include + ]) + AC_REQUIRE([AC_STRUCT_ST_BLOCKS]) + + AC_REQUIRE([AC_STRUCT_TM]) + AC_REQUIRE([AC_STRUCT_TIMEZONE]) + AC_REQUIRE([AC_HEADER_STAT]) + AC_REQUIRE([AC_STRUCT_ST_MTIM_NSEC]) + AC_REQUIRE([AC_STRUCT_ST_DM_MODE]) + AC_REQUIRE([jm_CHECK_TYPE_STRUCT_TIMESPEC]) + + AC_REQUIRE([AC_TYPE_GETGROUPS]) + AC_REQUIRE([AC_TYPE_MODE_T]) + AC_REQUIRE([AC_TYPE_OFF_T]) + AC_REQUIRE([AC_TYPE_PID_T]) + AC_REQUIRE([AC_TYPE_SIGNAL]) + AC_REQUIRE([AC_TYPE_SIZE_T]) + AC_REQUIRE([AC_TYPE_UID_T]) + AC_CHECK_TYPE(ino_t, unsigned long) + + dnl This relies on the fact that autoconf 2.14a's implementation of + dnl AC_CHECK_TYPE checks includes unistd.h. + AC_CHECK_TYPE(ssize_t, int) + + AC_REQUIRE([jm_AC_TYPE_UINTMAX_T]) + AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG]) + + AC_REQUIRE([AC_HEADER_MAJOR]) + AC_REQUIRE([AC_HEADER_DIRENT]) + +]) + +#serial 7 + +dnl Initially derived from code in GNU grep. +dnl Mostly written by Jim Meyering. + +dnl Usage: jm_INCLUDED_REGEX([lib/regex.c]) +dnl +AC_DEFUN(jm_INCLUDED_REGEX, + [ + dnl Even packages that don't use regex.c can use this macro. + dnl Of course, for them it doesn't do anything. + + # Assume we'll default to using the included regex.c. + ac_use_included_regex=yes + + # However, if the system regex support is good enough that it passes the + # the following run test, then default to *not* using the included regex.c. + # If cross compiling, assume the test would fail and use the included + # regex.c. The first failing regular expression is from `Spencer ere + # test #75' in grep-2.3. + AC_CACHE_CHECK([for working re_compile_pattern], + jm_cv_func_working_re_compile_pattern, + AC_TRY_RUN( +[#include +#include + int + main () + { + static struct re_pattern_buffer regex; + const char *s; + re_set_syntax (RE_SYNTAX_POSIX_EGREP); + /* Add this third left square bracket, [, to balance the + three right ones below. Otherwise autoconf-2.14 chokes. */ + s = re_compile_pattern ("a[[:]:]]b\n", 9, ®ex); + /* This should fail with _Invalid character class name_ error. */ + if (!s) + exit (1); + + /* This should succeed, but doesn't for e.g. glibc-2.1.3. */ + s = re_compile_pattern ("{1", 2, ®ex); + + exit (s ? 1 : 0); + } + ], + jm_cv_func_working_re_compile_pattern=yes, + jm_cv_func_working_re_compile_pattern=no, + dnl When crosscompiling, assume it's broken. + jm_cv_func_working_re_compile_pattern=no)) + if test $jm_cv_func_working_re_compile_pattern = yes; then + ac_use_included_regex=no + fi + + test -n "$1" || AC_MSG_ERROR([missing argument]) + syscmd([test -f $1]) + ifelse(sysval, 0, + [ + + AC_ARG_WITH(included-regex, + [ --without-included-regex don't compile regex; this is the default on + systems with version 2 of the GNU C library + (use with caution on other system)], + jm_with_regex=$withval, + jm_with_regex=$ac_use_included_regex) + if test "$jm_with_regex" = yes; then + AC_SUBST(LIBOBJS) + LIBOBJS="$LIBOBJS regex.$ac_objext" + fi + ], + ) + ] +) + +#serial 2 +dnl based on code from Eleftherios Gkioulekas + +AC_DEFUN(jm_ASSERT, +[ + AC_MSG_CHECKING(whether to enable assertions) + AC_ARG_ENABLE(assert, + [ --disable-assert turn off assertions], + [ AC_MSG_RESULT(no) + AC_DEFINE(NDEBUG,1,[Define to 1 if assertions should be disabled.]) ], + [ AC_MSG_RESULT(yes) ] + ) +]) + +#serial 3 + +dnl From Paul Eggert. + +# Define HAVE_INTTYPES_H if exists, +# doesn't clash with , and declares uintmax_t. + +AC_DEFUN(jm_AC_HEADER_INTTYPES_H, +[ + AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h, + [AC_TRY_COMPILE( + [#include +#include ], + [uintmax_t i = (uintmax_t) -1;], + jm_ac_cv_header_inttypes_h=yes, + jm_ac_cv_header_inttypes_h=no)]) + if test $jm_ac_cv_header_inttypes_h = yes; then + AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1, +[Define if exists, doesn't clash with , + and declares uintmax_t. ]) + fi +]) + +#serial 3 + +dnl From Jim Meyering. +dnl +dnl Check whether struct dirent has a member named d_type. +dnl + +AC_DEFUN(jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE, + [AC_REQUIRE([AC_HEADER_DIRENT])dnl + AC_CACHE_CHECK([for d_type member in directory struct], + jm_cv_struct_dirent_d_type, + [AC_TRY_LINK(dnl + [ +#include +#ifdef HAVE_DIRENT_H +# include +#else /* not HAVE_DIRENT_H */ +# define dirent direct +# ifdef HAVE_SYS_NDIR_H +# include +# endif /* HAVE_SYS_NDIR_H */ +# ifdef HAVE_SYS_DIR_H +# include +# endif /* HAVE_SYS_DIR_H */ +# ifdef HAVE_NDIR_H +# include +# endif /* HAVE_NDIR_H */ +#endif /* HAVE_DIRENT_H */ + ], + [struct dirent dp; dp.d_type = 0;], + + jm_cv_struct_dirent_d_type=yes, + jm_cv_struct_dirent_d_type=no) + ] + ) + if test $jm_cv_struct_dirent_d_type = yes; then + AC_DEFINE(D_TYPE_IN_DIRENT, 1, + [Define if there is a member named d_type in the struct describing + directory headers.]) + fi + ] +) + +#serial 3 + +dnl From Jim Meyering. +dnl +dnl Check whether struct dirent has a member named d_ino. +dnl + +AC_DEFUN(jm_CHECK_TYPE_STRUCT_DIRENT_D_INO, + [AC_REQUIRE([AC_HEADER_DIRENT])dnl + AC_CACHE_CHECK([for d_ino member in directory struct], + jm_cv_struct_dirent_d_ino, + [AC_TRY_LINK(dnl + [ +#include +#ifdef HAVE_DIRENT_H +# include +#else /* not HAVE_DIRENT_H */ +# define dirent direct +# ifdef HAVE_SYS_NDIR_H +# include +# endif /* HAVE_SYS_NDIR_H */ +# ifdef HAVE_SYS_DIR_H +# include +# endif /* HAVE_SYS_DIR_H */ +# ifdef HAVE_NDIR_H +# include +# endif /* HAVE_NDIR_H */ +#endif /* HAVE_DIRENT_H */ + ], + [struct dirent dp; dp.d_ino = 0;], + + jm_cv_struct_dirent_d_ino=yes, + jm_cv_struct_dirent_d_ino=no) + ] + ) + if test $jm_cv_struct_dirent_d_ino = yes; then + AC_DEFINE(D_INO_IN_DIRENT, 1, + [Define if there is a member named d_ino in the struct describing + directory headers.]) + fi + ] +) + +#serial 9, except remove memchr and nanosleep as findutils doesn't need them + +dnl This is just a wrapper function to encapsulate this kludge. +dnl Putting it in a separate file like this helps share it between +dnl different packages. +AC_DEFUN(jm_CHECK_DECLS, +[ + AC_REQUIRE([_jm_DECL_HEADERS]) + AC_REQUIRE([AC_HEADER_TIME]) + headers=' +#include +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#else +# if HAVE_STRINGS_H +# include +# endif +#endif +#if HAVE_STDLIB_H +# include +#endif +#if HAVE_UNISTD_H +# include +#endif + +#include +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif +' + + AC_CHECK_DECLS(( + free, + getenv, + geteuid, + getlogin, + lseek, + malloc, + realloc, + stpcpy, + strstr, + strtoul, + strtoull, + ttyname), , , $headers) +]) + +dnl FIXME: when autoconf has support for it. +dnl This is a little helper so we can require these header checks. +AC_DEFUN(_jm_DECL_HEADERS, +[ + AC_REQUIRE([AC_HEADER_STDC]) + AC_CHECK_HEADERS(memory.h string.h strings.h stdlib.h unistd.h sys/time.h) +]) + +#serial 5 + +dnl These are the prerequisite macros for files in the lib/ +dnl directories of the fileutils, sh-utils, and textutils packages. + +AC_DEFUN(jm_PREREQ, +[ + jm_PREREQ_ADDEXT + jm_PREREQ_CANON_HOST + jm_PREREQ_ERROR + jm_PREREQ_QUOTEARG + jm_PREREQ_READUTMP + jm_PREREQ_REGEX +]) + +AC_DEFUN(jm_PREREQ_ADDEXT, +[ + dnl For addext.c. + AC_SYS_LONG_FILE_NAMES + AC_CHECK_FUNCS(pathconf) + AC_CHECK_HEADERS(limits.h string.h unistd.h) +]) + +AC_DEFUN(jm_PREREQ_CANON_HOST, +[ + dnl Add any libraries as early as possible. + dnl In particular, inet_ntoa needs -lnsl at least on Solaris5.5.1, + dnl so we have to add -lnsl to LIBS before checking for that function. + AC_SEARCH_LIBS(gethostbyname, [inet nsl]) + + dnl These come from -lnsl on Solaris5.5.1. + AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa) + + AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa) + AC_CHECK_HEADERS(unistd.h string.h netdb.h sys/socket.h \ + netinet/in.h arpa/inet.h) +]) + +AC_DEFUN(jm_PREREQ_QUOTEARG, +[ + AC_CHECK_FUNCS(isascii iswprint mbrtowc) + AC_CHECK_HEADERS(limits.h stdlib.h string.h wchar.h wctype.h) + AC_HEADER_STDC + AC_C_BACKSLASH_A + AC_MBSTATE_T_OBJECT + AM_C_PROTOTYPES +]) + +AC_DEFUN(jm_PREREQ_READUTMP, +[ + AC_HEADER_STDC + AC_CHECK_HEADERS(string.h utmpx.h sys/param.h) + AC_CHECK_FUNCS(utmpname) + AC_CHECK_FUNCS(utmpxname) + AM_C_PROTOTYPES + + utmp_includes="\ +$ac_includes_default +#ifdef HAVE_UTMPX_H +# include +#else +# include +#endif +" + AC_CHECK_MEMBERS((struct utmpx.ut_user),,,[$utmp_includes]) + AC_CHECK_MEMBERS((struct utmp.ut_user),,,[$utmp_includes]) + AC_CHECK_MEMBERS((struct utmpx.ut_name),,,[$utmp_includes]) + AC_CHECK_MEMBERS((struct utmp.ut_name),,,[$utmp_includes]) +]) + +AC_DEFUN(jm_PREREQ_REGEX, +[ + dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it. + dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary + dnl to get them. + AC_CHECK_FUNCS(bzero bcopy isascii btowc) + AC_CHECK_HEADERS(alloca.h libintl.h wctype.h wchar.h) + AC_HEADER_STDC + AC_FUNC_ALLOCA +]) + +#serial 1 + +dnl FIXME: put these prerequisite-only *.m4 files in a separate +dnl directory -- otherwise, they'll conflict with existing files. + +dnl These are the prerequisite macros for GNU's error.c file. +AC_DEFUN(jm_PREREQ_ERROR, +[ + AC_CHECK_FUNCS(strerror strerror_r vprintf doprnt) + AC_HEADER_STDC +]) + +#serial 3 + +dnl From Paul Eggert. + +AC_DEFUN(AC_C_BACKSLASH_A, +[ + AC_CACHE_CHECK([whether backslash-a works in strings], ac_cv_c_backslash_a, + [AC_TRY_COMPILE([], + [ +#if '\a' == 'a' + syntax error; +#endif + char buf['\a' == 'a' ? -1 : 1]; + buf[0] = '\a'; + return buf[0] != "\a"[0]; + ], + ac_cv_c_backslash_a=yes, + ac_cv_c_backslash_a=no)]) + if test $ac_cv_c_backslash_a = yes; then + AC_DEFINE(HAVE_C_BACKSLASH_A, 1, + [Define if backslash-a works in C strings.]) + fi +]) + +# serial 1 + +# From Paul Eggert. + +# Some versions of BeOS define mbstate_t to be an incomplete type, +# so you can't declare an object of that type. +# Check for this incompatibility with Standard C. + +AC_DEFUN(AC_MBSTATE_T_OBJECT, + [AC_CACHE_CHECK([for mbstate_t object type], ac_cv_type_mbstate_t_object, + [AC_TRY_COMPILE([#include ], + [mbstate_t x; return sizeof x;], + ac_cv_type_mbstate_t_object=yes, + ac_cv_type_mbstate_t_object=no)]) + if test $ac_cv_type_mbstate_t_object = yes; then + AC_DEFINE(HAVE_MBSTATE_T_OBJECT, 1, + [Define if mbstate_t is an object type.]) + fi]) + +#serial 7 + +dnl From Jim Meyering. +dnl A wrapper around AC_FUNC_MKTIME. + +AC_DEFUN(jm_FUNC_MKTIME, +[AC_REQUIRE([AC_FUNC_MKTIME])dnl + + dnl mktime.c uses localtime_r if it exists. Check for it. + AC_CHECK_FUNCS(localtime_r) + + if test $ac_cv_func_working_mktime = no; then + AC_DEFINE_UNQUOTED(mktime, rpl_mktime, + [Define to rpl_mktime if the replacement function should be used.]) + fi +]) + +#serial 3 + +dnl From Jim Meyering. +dnl Determine whether lstat has the bug that it succeeds when given the +dnl zero-length file name argument. The lstat from SunOS4.1.4 and the Hurd +dnl (as of 1998-11-01) do this. +dnl +dnl If it does, then define HAVE_LSTAT_EMPTY_STRING_BUG and arrange to +dnl compile the wrapper function. +dnl + +AC_DEFUN(jm_FUNC_LSTAT, +[ + AC_CACHE_CHECK([whether lstat accepts an empty string], + jm_cv_func_lstat_empty_string_bug, + [AC_TRY_RUN([ +# include +# include + + int + main () + { + struct stat sbuf; + exit (lstat ("", &sbuf) ? 1 : 0); + } + ], + jm_cv_func_lstat_empty_string_bug=yes, + jm_cv_func_lstat_empty_string_bug=no, + dnl When crosscompiling, assume lstat is broken. + jm_cv_func_lstat_empty_string_bug=yes) + ]) + if test $jm_cv_func_lstat_empty_string_bug = yes; then + AC_SUBST(LIBOBJS) + LIBOBJS="$LIBOBJS lstat.$ac_objext" + AC_DEFINE_UNQUOTED(HAVE_LSTAT_EMPTY_STRING_BUG, 1, +[Define if lstat has the bug that it succeeds when given the zero-length + file name argument. The lstat from SunOS4.1.4 and the Hurd as of 1998-11-01) + do this. ]) + fi +]) + +#serial 1 + +dnl From Jim Meyering. +dnl FIXME: describe + +AC_DEFUN(jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK, +[ + AC_CACHE_CHECK( + [whether lstat dereferences a symlink specified with a trailing slash], + jm_cv_func_lstat_dereferences_slashed_symlink, + [ + rm -f conftest.sym conftest.file + : > conftest.file + if ln -s conftest.file conftest.sym; then + AC_TRY_RUN([ +# include +# include + + int + main () + { + struct stat sbuf; + /* Linux will dereference the symlink and fail. + That is better in the sense that it means we will not + have to compile and use the lstat wrapper. */ + exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1); + } + ], + jm_cv_func_lstat_dereferences_slashed_symlink=yes, + jm_cv_func_lstat_dereferences_slashed_symlink=no, + dnl When crosscompiling, be pessimistic so we will end up using the + dnl replacement version of lstat that checkes for trailing slashes + dnl and calls lstat a second time when necessary. + jm_cv_func_lstat_dereferences_slashed_symlink=no + ) + else + # If the `ln -s' command failed, then we probably don't even + # have an lstat function. + jm_cv_func_lstat_dereferences_slashed_symlink=no + fi + ]) + + test $jm_cv_func_lstat_dereferences_slashed_symlink = yes \ + && zero_one=1 \ + || zero_one=0 + AC_DEFINE_UNQUOTED(LSTAT_FOLLOWS_SLASHED_SYMLINK, $zero_one, + [Define if lstat dereferences a symlink specified with a trailing slash]) + + if test $jm_cv_func_lstat_dereferences_slashed_symlink = no; then + AC_SUBST(LIBOBJS) + # Append lstat.o if it's not already in $LIBOBJS. + case "$LIBOBJS" in + *lstat.$ac_objext*) ;; + *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; + esac + fi +]) + +#serial 3 + +dnl From Jim Meyering. +dnl Determine whether stat has the bug that it succeeds when given the +dnl zero-length file name argument. The stat from SunOS4.1.4 and the Hurd +dnl (as of 1998-11-01) do this. +dnl +dnl If it does, then define HAVE_STAT_EMPTY_STRING_BUG and arrange to +dnl compile the wrapper function. +dnl + +AC_DEFUN(jm_FUNC_STAT, +[ + AC_CACHE_CHECK([whether stat accepts an empty string], + jm_cv_func_stat_empty_string_bug, + [AC_TRY_RUN([ +# include +# include + + int + main () + { + struct stat sbuf; + exit (stat ("", &sbuf) ? 1 : 0); + } + ], + jm_cv_func_stat_empty_string_bug=yes, + jm_cv_func_stat_empty_string_bug=no, + dnl When crosscompiling, assume stat is broken. + jm_cv_func_stat_empty_string_bug=yes) + ]) + if test $jm_cv_func_stat_empty_string_bug = yes; then + AC_SUBST(LIBOBJS) + LIBOBJS="$LIBOBJS stat.$ac_objext" + AC_DEFINE_UNQUOTED(HAVE_STAT_EMPTY_STRING_BUG, 1, +[Define if stat has the bug that it succeeds when given the zero-length + file name argument. The stat from SunOS4.1.4 and the Hurd as of 1998-11-01) + do this. ]) + fi +]) + +#serial 3 + +dnl From Jim Meyering. +dnl Determine whether realloc works when both arguments are 0. +dnl If it doesn't, arrange to use the replacement function. +dnl + +AC_DEFUN(jm_FUNC_REALLOC, +[ + dnl xmalloc.c requires that this symbol be defined so it doesn't + dnl mistakenly use a broken realloc -- as it might if this test were omitted. + AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_REALLOC_CHECK, 1, + [Define if the realloc check has been performed. ]) + + AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc, + [AC_TRY_RUN([ + char *realloc (); + int + main () + { + exit (realloc (0, 0) ? 0 : 1); + } + ], + jm_cv_func_working_realloc=yes, + jm_cv_func_working_realloc=no, + dnl When crosscompiling, assume realloc is broken. + jm_cv_func_working_realloc=no) + ]) + if test $jm_cv_func_working_realloc = no; then + AC_SUBST(LIBOBJS) + LIBOBJS="$LIBOBJS realloc.$ac_objext" + AC_DEFINE_UNQUOTED(realloc, rpl_realloc, + [Define to rpl_realloc if the replacement function should be used.]) + fi +]) + +#serial 3 + +dnl From Jim Meyering. +dnl Determine whether malloc accepts 0 as its argument. +dnl If it doesn't, arrange to use the replacement function. +dnl + +AC_DEFUN(jm_FUNC_MALLOC, +[ + dnl xmalloc.c requires that this symbol be defined so it doesn't + dnl mistakenly use a broken malloc -- as it might if this test were omitted. + AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_MALLOC_CHECK, 1, + [Define if the malloc check has been performed. ]) + + AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc, + [AC_TRY_RUN([ + char *malloc (); + int + main () + { + exit (malloc (0) ? 0 : 1); + } + ], + jm_cv_func_working_malloc=yes, + jm_cv_func_working_malloc=no, + dnl When crosscompiling, assume malloc is broken. + jm_cv_func_working_malloc=no) + ]) + if test $jm_cv_func_working_malloc = no; then + AC_SUBST(LIBOBJS) + LIBOBJS="$LIBOBJS malloc.$ac_objext" + AC_DEFINE_UNQUOTED(malloc, rpl_malloc, + [Define to rpl_malloc if the replacement function should be used.]) + fi +]) + +#serial 2 + +dnl From Jim Meyering. +dnl Determine whether the strerror_r implementation is one of +dnl the broken ones that returns `int' rather than `char*'. +dnl Actually, this tests only whether it returns a scalar +dnl or an array, but that should be enough. +dnl On at least DEC UNIX 4.0[A-D] and HP-UX B.10.20, strerror_r +dnl returns `int'. This is used by lib/error.c. + +AC_DEFUN(jm_FUNC_STRERROR_R, +[ + # Check strerror_r + AC_CHECK_FUNCS([strerror_r]) + if test $ac_cv_func_strerror_r = yes; then + AC_CHECK_HEADERS(string.h) + AC_CACHE_CHECK([for working strerror_r], + jm_cv_func_working_strerror_r, + [ + AC_TRY_COMPILE( + [ +# include +# if HAVE_STRING_H +# include +# endif + ], + [ + int buf; /* avoiding square brackets makes this easier */ + char x = *strerror_r (0, buf, sizeof buf); + ], + jm_cv_func_working_strerror_r=yes, + jm_cv_func_working_strerror_r=no + ) + if test $jm_cv_func_working_strerror_r = yes; then + AC_DEFINE_UNQUOTED(HAVE_WORKING_STRERROR_R, 1, + [Define to 1 if strerror_r returns a string.]) + fi + ]) + fi +]) + +#serial 3 + +dnl SunOS's readdir is broken in such a way that rm.c has to add extra code +dnl to test whether a NULL return value really means there are no more files +dnl in the directory. +dnl +dnl Detect the problem by creating a directory containing 300 files (254 not +dnl counting . and .. is the minimum) and see if a loop doing `readdir; unlink' +dnl removes all of them. +dnl +dnl Define HAVE_WORKING_READDIR if readdir does *not* have this problem. + +dnl Written by Jim Meyering. + +AC_DEFUN(jm_FUNC_READDIR, +[dnl +AC_REQUIRE([AC_HEADER_DIRENT]) +AC_CHECK_HEADERS(string.h) +AC_CACHE_CHECK([for working readdir], jm_cv_func_working_readdir, + [dnl + # Arrange for deletion of the temporary directory this test creates, in + # case the test itself fails to delete everything -- as happens on Sunos. + ac_clean_files="$ac_clean_files conf-dir" + + AC_TRY_RUN( +[# include +# include +# if HAVE_STRING_H +# include +# endif + +# ifdef HAVE_DIRENT_H +# include +# define NLENGTH(direct) (strlen((direct)->d_name)) +# else /* not HAVE_DIRENT_H */ +# define dirent direct +# define NLENGTH(direct) ((direct)->d_namlen) +# ifdef HAVE_SYS_NDIR_H +# include +# endif /* HAVE_SYS_NDIR_H */ +# ifdef HAVE_SYS_DIR_H +# include +# endif /* HAVE_SYS_DIR_H */ +# ifdef HAVE_NDIR_H +# include +# endif /* HAVE_NDIR_H */ +# endif /* HAVE_DIRENT_H */ + +# define DOT_OR_DOTDOT(Basename) \ + (Basename[0] == '.' && (Basename[1] == '\0' \ + || (Basename[1] == '.' && Basename[2] == '\0'))) + + static void + create_300_file_dir (const char *dir) + { + int i; + + if (mkdir (dir, 0700)) + abort (); + if (chdir (dir)) + abort (); + + for (i = 0; i < 300; i++) + { + char file_name[4]; + FILE *out; + + sprintf (file_name, "%03d", i); + out = fopen (file_name, "w"); + if (!out) + abort (); + if (fclose (out) == EOF) + abort (); + } + + if (chdir ("..")) + abort (); + } + + static void + remove_dir (const char *dir) + { + DIR *dirp; + + if (chdir (dir)) + abort (); + + dirp = opendir ("."); + if (dirp == NULL) + abort (); + + while (1) + { + struct dirent *dp = readdir (dirp); + if (dp == NULL) + break; + + if (DOT_OR_DOTDOT (dp->d_name)) + continue; + + if (unlink (dp->d_name)) + abort (); + } + closedir (dirp); + + if (chdir ("..")) + abort (); + + if (rmdir (dir)) + exit (1); + } + + int + main () + { + const char *dir = "conf-dir"; + create_300_file_dir (dir); + remove_dir (dir); + exit (0); + }], + jm_cv_func_working_readdir=yes, + jm_cv_func_working_readdir=no, + jm_cv_func_working_readdir=no)]) + + if test $jm_cv_func_working_readdir = yes; then + AC_DEFINE_UNQUOTED(HAVE_WORKING_READDIR, 1, +[Define if readdir is found to work properly in some unusual cases. ]) + fi +]) + +#serial 4 + +dnl A replacement for autoconf's AC_FUNC_MEMCMP that detects +dnl the losing memcmp on some x86 Next systems. +AC_DEFUN(jm_AC_FUNC_MEMCMP, +[AC_CACHE_CHECK([for working memcmp], jm_cv_func_memcmp_working, +[AC_TRY_RUN( +[int +main () +{ + /* Some versions of memcmp are not 8-bit clean. */ + char c0 = 0x40, c1 = 0x80, c2 = 0x81; + if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) + exit (1); + + /* The Next x86 OpenStep bug shows up only when comparing 16 bytes + or more and with at least one buffer not starting on a 4-byte boundary. + William Lewis provided this test program. */ + { + char foo[21]; + char bar[21]; + int i; + for (i = 0; i < 4; i++) + { + char *a = foo + i; + char *b = bar + i; + strcpy (a, "--------01111111"); + strcpy (b, "--------10000000"); + if (memcmp (a, b, 16) >= 0) + exit (1); + } + exit (0); + } +}], + jm_cv_func_memcmp_working=yes, + jm_cv_func_memcmp_working=no, + jm_cv_func_memcmp_working=no)]) +test $jm_cv_func_memcmp_working = no \ + && LIBOBJS="$LIBOBJS memcmp.$ac_objext" +AC_SUBST(LIBOBJS)dnl +]) + +AC_DEFUN(jm_FUNC_MEMCMP, +[AC_REQUIRE([jm_AC_FUNC_MEMCMP])dnl + if test $jm_cv_func_memcmp_working = no; then + AC_DEFINE_UNQUOTED(memcmp, rpl_memcmp, + [Define to rpl_memcmp if the replacement function should be used.]) + fi +]) + +#serial 3 + +dnl From Jim Meyering. +dnl +dnl See if the glibc *_unlocked I/O macros are available. +dnl Use only those *_unlocked macros that are declared. +dnl + +AC_DEFUN(jm_FUNC_GLIBC_UNLOCKED_IO, + [ + io_functions='clearerr_unlocked feof_unlocked ferror_unlocked + fflush_unlocked fputc_unlocked fread_unlocked fwrite_unlocked + getc_unlocked getchar_unlocked putc_unlocked putchar_unlocked' + for jm_io_func in $io_functions; do + # Check for the existence of each function only if its declared. + # Otherwise, we'd get the Solaris5.5.1 functions that are not + # declared, and that have been removed from Solaris5.6. The resulting + # 5.5.1 binaries would not run on 5.6 due to shared library differences. + AC_CHECK_DECLS(($jm_io_func), + jm_declared=yes, + jm_declared=no, + [#include ]) + if test $jm_declared = yes; then + AC_CHECK_FUNCS($jm_io_func) + fi + done + ] +) + +#serial 2 + +dnl Determine whether to add fnmatch.o to LIBOBJS and to +dnl define fnmatch to rpl_fnmatch. +dnl + +# AC_FUNC_FNMATCH +# --------------- +# We look for fnmatch.h to avoid that the test fails in C++. +AC_DEFUN(kd_FUNC_FNMATCH_CASE, +[AC_CHECK_HEADERS(fnmatch.h) +AC_CACHE_CHECK(for working fnmatch with case folding, ac_cv_func_fnmatch_works, +# Some versions of Solaris or SCO have a broken fnmatch function. +# So we run a test program. If we are cross-compiling, take no chance. +# Also want FNM_CASEFOLD +# Thanks to John Oleynick and Franc,ois Pinard for this test. +[AC_TRY_RUN( +[#include +#define _GNU_SOURCE +#if HAVE_FNMATCH_H +# include +#endif + +int +main () +{ + exit (fnmatch ("A*", "abc", FNM_CASEFOLD) != 0); +}], +ac_cv_func_fnmatch_works=yes, ac_cv_func_fnmatch_works=no, +ac_cv_func_fnmatch_works=no)]) +if test $ac_cv_func_fnmatch_works = yes; then + AC_DEFINE(HAVE_FNMATCH, 1, + [Define if your system has a working `fnmatch' function with case folding.]) +fi +])# AC_FUNC_FNMATCH + + +AC_DEFUN(kd_FUNC_FNMATCH_CASE_RPL, +[ + AC_REQUIRE([AM_GLIBC]) + kd_FUNC_FNMATCH_CASE + if test $ac_cv_func_fnmatch_works = no \ + && test $ac_cv_gnu_library = no; then + AC_SUBST(LIBOBJS) + LIBOBJS="$LIBOBJS fnmatch.$ac_objext" + AC_DEFINE_UNQUOTED(fnmatch, rpl_fnmatch, + [Define to rpl_fnmatch if the replacement function should be used.]) + fi +]) + +#serial 2 + +dnl From Gordon Matzigkeit. +dnl Test for the GNU C Library. +dnl FIXME: this should migrate into libit. + +AC_DEFUN(AM_GLIBC, + [ + AC_CACHE_CHECK(whether we are using the GNU C Library, + ac_cv_gnu_library, + [AC_EGREP_CPP([Thanks for using GNU], + [ +#include +#ifdef __GNU_LIBRARY__ + Thanks for using GNU +#endif + ], + ac_cv_gnu_library=yes, + ac_cv_gnu_library=no) + ] + ) + AC_CACHE_CHECK(for version 2 of the GNU C Library, + ac_cv_glibc, + [AC_EGREP_CPP([Thanks for using GNU too], + [ +#include +#ifdef __GLIBC__ + Thanks for using GNU too +#endif + ], + ac_cv_glibc=yes, ac_cv_glibc=no) + ] + ) + ] +) + +#serial 1 + +AC_DEFUN(jm_AFS, + AC_CHECKING(for AFS) + test -d /afs \ + && AC_DEFINE(AFS, 1, [Define if you have the Andrew File System.]) +) + +#serial 2 + +# autoconf tests required for use of xstrtoumax.c + +AC_DEFUN(jm_AC_PREREQ_XSTRTOUMAX, +[ + AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG]) + AC_CHECK_HEADERS(stdlib.h) + + AC_CACHE_CHECK([whether defines strtoumax as a macro], + jm_cv_func_strtoumax_macro, + AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include +#ifdef strtoumax + inttypes_h_defines_strtoumax +#endif], + jm_cv_func_strtoumax_macro=yes, + jm_cv_func_strtoumax_macro=no)) + + if test "$jm_cv_func_strtoumax_macro" != yes; then + AC_REPLACE_FUNCS(strtoumax) + fi + + dnl We don't need (and can't compile) the replacement strtoull + dnl unless the type `unsigned long long' exists. + dnl Also, only the replacement strtoumax invokes strtoull, + dnl so we need the replacement strtoull only if strtoumax does not exist. + case "$ac_cv_type_unsigned_long_long,$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in + yes,no,no) + AC_REPLACE_FUNCS(strtoull) + ;; + esac + +]) + +#serial 2 + +dnl From Paul Eggert. + +AC_DEFUN(jm_AC_TYPE_UNSIGNED_LONG_LONG, +[ + AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, + [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;], + [unsigned long long ullmax = (unsigned long long) -1; + return ull << i | ull >> i | ullmax / ull | ullmax % ull;], + ac_cv_type_unsigned_long_long=yes, + ac_cv_type_unsigned_long_long=no)]) + if test $ac_cv_type_unsigned_long_long = yes; then + AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, + [Define if you have the unsigned long long type.]) + fi +]) + +#serial 1 +dnl Run a program to determine whether whether link(2) follows symlinks. +dnl Set LINK_FOLLOWS_SYMLINKS accordingly. + +AC_DEFUN(jm_AC_FUNC_LINK_FOLLOWS_SYMLINK, +[dnl + AC_CACHE_CHECK([whether link(2) follows symlinks], + jm_ac_cv_func_link_follows_symlink, + [ + dnl poor-man's AC_REQUIRE: FIXME: repair this once autoconf-3 provides + dnl the appropriate framework. + test -z "$ac_cv_header_unistd_h" \ + && AC_CHECK_HEADERS(unistd.h) + + # Create a regular file. + echo > conftest.file + AC_TRY_RUN( + [ +# include +# include +# ifdef HAVE_UNISTD_H +# include +# endif + +# define SAME_INODE(Stat_buf_1, Stat_buf_2) \ + ((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \ + && (Stat_buf_1).st_dev == (Stat_buf_2).st_dev) + + int + main () + { + const char *file = "conftest.file"; + const char *sym = "conftest.sym"; + const char *hard = "conftest.hard"; + struct stat sb_file, sb_hard; + + /* Create a symlink to the regular file. */ + if (symlink (file, sym)) + abort (); + + /* Create a hard link to that symlink. */ + if (link (sym, hard)) + abort (); + + if (lstat (hard, &sb_hard)) + abort (); + if (lstat (file, &sb_file)) + abort (); + + /* If the dev/inode of hard and file are the same, then + the link call followed the symlink. */ + return SAME_INODE (sb_hard, sb_file) ? 0 : 1; + } + ], + jm_ac_cv_func_link_follows_symlink=yes, + jm_ac_cv_func_link_follows_symlink=no, + jm_ac_cv_func_link_follows_symlink=yes dnl We're cross compiling. + ) + ]) + if test $jm_ac_cv_func_link_follows_symlink = yes; then + AC_DEFINE(LINK_FOLLOWS_SYMLINKS, 1, + [Define if `link(2)' dereferences symbolic links.]) + fi +]) + +# From Jim Meyering. Use this if you use the GNU error.[ch]. +# FIXME: Migrate into libit + +AC_DEFUN([AM_FUNC_ERROR_AT_LINE], +[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line, + [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");], + am_cv_lib_error_at_line=yes, + am_cv_lib_error_at_line=no)]) + if test $am_cv_lib_error_at_line = no; then + LIBOBJS="$LIBOBJS error.$ac_objext" + fi + AC_SUBST(LIBOBJS)dnl +]) + +#serial 9 + +dnl This macro is intended to be used solely in this file. +dnl These are the prerequisite macros for GNU's strftime.c replacement. +AC_DEFUN(_jm_STRFTIME_PREREQS, +[ + dnl strftime.c uses localtime_r if it exists. Check for it. + AC_CHECK_FUNCS(localtime_r) + + AC_CHECK_HEADERS(limits.h) + AC_CHECK_FUNCS(bcopy tzset mempcpy memcpy memset) + + # This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE. + AC_STRUCT_TIMEZONE + + AC_CHECK_FUNCS(mblen mbrlen) + + AC_CHECK_MEMBER(struct tm.tm_gmtoff, + [AC_DEFINE(HAVE_TM_GMTOFF, 1, + [Define if struct tm has the tm_gmtoff member.])], + , + [#include ]) +]) + +dnl Determine if the strftime function has all the features of the GNU one. +dnl +dnl From Jim Meyering. +dnl +AC_DEFUN(jm_FUNC_GNU_STRFTIME, +[AC_REQUIRE([AC_HEADER_TIME])dnl + + _jm_STRFTIME_PREREQS + + AC_REQUIRE([AC_C_CONST])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_CHECK_HEADERS(sys/time.h) + AC_CACHE_CHECK([for working GNU strftime], jm_cv_func_working_gnu_strftime, + [# Set TZ to GMT0 to make strftime give consistent results during the test. + ac_save_TZ="${TZ-GMT0}" + TZ=GMT0 + export TZ + AC_TRY_RUN( +[ /* Ulrich Drepper provided parts of the test program. */ +#if STDC_HEADERS +# include +#endif + +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif + +static int +compare (const char *fmt, const struct tm *tm, const char *expected) +{ + char buf[99]; + strftime (buf, 99, fmt, tm); + if (strcmp (buf, expected)) + { +#ifdef SHOW_FAILURES + printf ("fmt: \"%s\", expected \"%s\", got \"%s\"\n", + fmt, expected, buf); +#endif + return 1; + } + return 0; +} + +int +main () +{ + int n_fail = 0; + struct tm *tm; + time_t t = 738367; /* Fri Jan 9 13:06:07 1970 */ + tm = gmtime (&t); + +#undef CMP +#define CMP(Fmt, Expected) n_fail += compare ((Fmt), tm, (Expected)) + + CMP ("%-m", "1"); /* GNU */ + CMP ("%A", "Friday"); + CMP ("%^A", "FRIDAY"); /* The ^ is a GNU extension. */ + CMP ("%B", "January"); + CMP ("%^B", "JANUARY"); + CMP ("%C", "19"); /* POSIX.2 */ + CMP ("%D", "01/09/70"); /* POSIX.2 */ + CMP ("%F", "1970-01-09"); + CMP ("%G", "1970"); /* GNU */ + CMP ("%H", "13"); + CMP ("%I", "01"); + CMP ("%M", "06"); + CMP ("%M", "06"); + CMP ("%R", "13:06"); /* POSIX.2 */ + CMP ("%S", "07"); + CMP ("%T", "13:06:07"); /* POSIX.2 */ + CMP ("%U", "01"); + CMP ("%V", "02"); + CMP ("%W", "01"); + CMP ("%X", "13:06:07"); + CMP ("%Y", "1970"); + CMP ("%Z", "GMT"); + CMP ("%_m", " 1"); /* GNU */ + CMP ("%a", "Fri"); + CMP ("%^a", "FRI"); + CMP ("%b", "Jan"); + CMP ("%^b", "JAN"); + CMP ("%c", "Fri Jan 9 13:06:07 1970"); + CMP ("%^c", "FRI JAN 9 13:06:07 1970"); + CMP ("%d", "09"); + CMP ("%e", " 9"); /* POSIX.2 */ + CMP ("%g", "70"); /* GNU */ + CMP ("%h", "Jan"); /* POSIX.2 */ + CMP ("%^h", "JAN"); + CMP ("%j", "009"); + CMP ("%k", "13"); /* GNU */ + CMP ("%l", " 1"); /* GNU */ + CMP ("%m", "01"); + CMP ("%n", "\n"); /* POSIX.2 */ + CMP ("%p", "PM"); + CMP ("%r", "01:06:07 PM"); /* POSIX.2 */ + CMP ("%s", "738367"); /* GNU */ + CMP ("%t", "\t"); /* POSIX.2 */ + CMP ("%u", "5"); /* POSIX.2 */ + CMP ("%w", "5"); + CMP ("%x", "01/09/70"); + CMP ("%y", "70"); + CMP ("%z", "+0000"); /* GNU */ + + exit (n_fail ? 1 : 0); +}], + jm_cv_func_working_gnu_strftime=yes, + jm_cv_func_working_gnu_strftime=no, + dnl When crosscompiling, assume strftime is missing or broken. + jm_cv_func_working_gnu_strftime=no) + dnl If TZ wasn't set before, this sets it to GMT0. No real harm done. + TZ="$ac_save_TZ" + ]) + if test $jm_cv_func_working_gnu_strftime = no; then + AC_SUBST(LIBOBJS) + LIBOBJS="$LIBOBJS strftime.$ac_objext" + AC_DEFINE_UNQUOTED(strftime, gnu_strftime, + [Define to gnu_strftime if the replacement function should be used.]) + fi +]) + +AC_DEFUN(jm_FUNC_STRFTIME, +[ + _jm_STRFTIME_PREREQS + AC_REPLACE_FUNCS(strftime) +]) + +#serial 3 + +dnl See if there's a working, system-supplied version of the getline function. +dnl We can't just do AC_REPLACE_FUNCS(getline) because some systems +dnl have a function by that name in -linet that doesn't have anything +dnl to do with the function we need. +AC_DEFUN(AM_FUNC_GETLINE, +[dnl + am_getline_needs_run_time_check=no + AC_CHECK_FUNC(getline, + dnl Found it in some library. Verify that it works. + am_getline_needs_run_time_check=yes, + am_cv_func_working_getline=no) + if test $am_getline_needs_run_time_check = yes; then + AC_CHECK_HEADERS(string.h) + AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline, + [echo fooN |tr -d '\012'|tr N '\012' > conftest.data + AC_TRY_RUN([ +# include +# include +# if HAVE_STRING_H +# include +# endif + int main () + { /* Based on a test program from Karl Heuer. */ + char *line = NULL; + size_t siz = 0; + int len; + FILE *in = fopen ("./conftest.data", "r"); + if (!in) + return 1; + len = getline (&line, &siz, in); + exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1); + } + ], am_cv_func_working_getline=yes dnl The library version works. + , am_cv_func_working_getline=no dnl The library version does NOT work. + , am_cv_func_working_getline=no dnl We're cross compiling. + )]) + fi + + if test $am_cv_func_working_getline = yes; then + AC_DEFINE(HAVE_GETLINE, 1, + [Define if you have the GETLINE function.])dnl + fi +]) + +#serial 4 + +dnl From Paul Eggert. + +# Define ST_MTIM_NSEC to be the nanoseconds member of struct stat's st_mtim, +# if it exists. + +AC_DEFUN(AC_STRUCT_ST_MTIM_NSEC, + [AC_CACHE_CHECK([for nanoseconds member of struct stat.st_mtim], + ac_cv_struct_st_mtim_nsec, + [ac_save_CPPFLAGS="$CPPFLAGS" + ac_cv_struct_st_mtim_nsec=no + # tv_nsec -- the usual case + # _tv_nsec -- Solaris 2.6, if + # (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1 + # && !defined __EXTENSIONS__) + # st__tim.tv_nsec -- UnixWare 2.1.2 + for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do + CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val" + AC_TRY_COMPILE([#include +#include ], [struct stat s; s.st_mtim.ST_MTIM_NSEC;], + [ac_cv_struct_st_mtim_nsec=$ac_val; break]) + done + CPPFLAGS="$ac_save_CPPFLAGS"]) + + if test $ac_cv_struct_st_mtim_nsec != no; then + AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec, + [Define to be the nanoseconds member of struct stat's st_mtim, + if it exists.]) + fi + ] +) + +#serial 2 + +# Define HAVE_ST_DM_MODE if struct stat has an st_dm_mode member. + +AC_DEFUN(AC_STRUCT_ST_DM_MODE, + [AC_CACHE_CHECK([for st_dm_mode in struct stat], ac_cv_struct_st_dm_mode, + [AC_TRY_COMPILE([#include +#include ], [struct stat s; s.st_dm_mode;], + ac_cv_struct_st_dm_mode=yes, + ac_cv_struct_st_dm_mode=no)]) + + if test $ac_cv_struct_st_dm_mode = yes; then + AC_DEFINE_UNQUOTED(HAVE_ST_DM_MODE, 1, + [Define if struct stat has an st_dm_mode member. ]) + fi + ] +) + +#serial 4 + +dnl From Jim Meyering + +dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared +dnl in time.h or sys/time.h. + +AC_DEFUN(jm_CHECK_TYPE_STRUCT_TIMESPEC, +[ + AC_REQUIRE([AC_HEADER_TIME]) + AC_CACHE_CHECK([for struct timespec], fu_cv_sys_struct_timespec, + [AC_TRY_COMPILE( + [ +# if TIME_WITH_SYS_TIME +# include +# include +# else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +# endif + ], + [static struct timespec x; x.tv_sec = x.tv_nsec;], + fu_cv_sys_struct_timespec=yes, + fu_cv_sys_struct_timespec=no) + ]) + + if test $fu_cv_sys_struct_timespec = yes; then + AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMESPEC, 1, + [Define if struct timespec is declared in . ]) + fi +]) + +#serial 5 + +dnl From Paul Eggert. + +AC_PREREQ(2.13) + +# Define uintmax_t to `unsigned long' or `unsigned long long' +# if does not exist. + +AC_DEFUN(jm_AC_TYPE_UINTMAX_T, +[ + AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) + if test $jm_ac_cv_header_inttypes_h = no; then + AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG]) + test $ac_cv_type_unsigned_long_long = yes \ + && ac_type='unsigned long long' \ + || ac_type='unsigned long' + AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, +[ Define to unsigned long or unsigned long long + if doesn't define.]) + fi +]) + +# Macro to add for using GNU gettext. +# Ulrich Drepper , 1995. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +# serial 108 + +AC_PREREQ(2.13) dnl Minimum Autoconf version required. + +AC_DEFUN(AM_WITH_NLS, + [AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE(nls, + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT($USE_NLS) + AC_SUBST(USE_NLS) + + USE_INCLUDED_LIBINTL=no + + dnl If we use NLS figure out what method + if test "$USE_NLS" = "yes"; then + AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested.]) + AC_MSG_CHECKING([whether included gettext is requested]) + AC_ARG_WITH(included-gettext, + [ --with-included-gettext use the GNU gettext library included here], + nls_cv_force_use_gnu_gettext=$withval, + nls_cv_force_use_gnu_gettext=no) + AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + dnl User does not insist on using GNU NLS library. Figure out what + dnl to use. If gettext or catgets are available (in this order) we + dnl use this. Else we have to fall back to GNU NLS library. + dnl catgets is only used if permitted by option --with-catgets. + nls_cv_header_intl= + nls_cv_header_libgt= + CATOBJEXT=NONE + + AC_CHECK_HEADER(libintl.h, + [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc, + [AC_TRY_LINK([#include ], [return (int) gettext ("")], + gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)]) + + if test "$gt_cv_func_gettext_libc" != "yes"; then + AC_CHECK_LIB(intl, bindtextdomain, + [AC_CHECK_LIB(intl, gettext)]) + fi + + if test "$gt_cv_func_gettext_libc" = "yes" \ + || test "$ac_cv_lib_intl_gettext" = "yes"; then + AC_DEFINE(HAVE_GETTEXT, 1, + [Define to 1 if you have gettext and don't want to use GNU gettext.]) + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl + if test "$MSGFMT" != "no"; then + AC_CHECK_FUNCS(dcgettext) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr], + [CATOBJEXT=.gmo + DATADIRNAME=share], + [CATOBJEXT=.mo + DATADIRNAME=lib]) + INSTOBJEXT=.mo + fi + fi + ]) + + if test "$CATOBJEXT" = "NONE"; then + AC_MSG_CHECKING([whether catgets can be used]) + AC_ARG_WITH(catgets, + [ --with-catgets use catgets functions if available], + nls_cv_use_catgets=$withval, nls_cv_use_catgets=no) + AC_MSG_RESULT($nls_cv_use_catgets) + + if test "$nls_cv_use_catgets" = "yes"; then + dnl No gettext in C library. Try catgets next. + AC_CHECK_LIB(i, main) + AC_CHECK_FUNC(catgets, + [AC_DEFINE(HAVE_CATGETS, 1, + [Define as 1 if you have catgets and don't want to use GNU gettext.]) + INTLOBJS="\$(CATOBJS)" + AC_PATH_PROG(GENCAT, gencat, no)dnl + if test "$GENCAT" != "no"; then + AC_PATH_PROG(GMSGFMT, gmsgfmt, no) + if test "$GMSGFMT" = "no"; then + AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no) + fi + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.cat + INSTOBJEXT=.cat + DATADIRNAME=lib + INTLDEPS='$(top_builddir)/intl/libintl.a' + INTLLIBS=$INTLDEPS + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi]) + fi + fi + + if test "$CATOBJEXT" = "NONE"; then + dnl Neither gettext nor catgets in included in the C library. + dnl Fall back on GNU gettext library. + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions used to generate GNU NLS library. + INTLOBJS="\$(GETTOBJS)" + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + AC_SUBST(MSGFMT) + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.gmo + INSTOBJEXT=.mo + DATADIRNAME=share + INTLDEPS='$(top_builddir)/intl/libintl.a' + INTLLIBS=$INTLDEPS + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi + + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is no GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + AC_MSG_RESULT( + [found xgettext program is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + fi + + # We need to process the po/ directory. + POSUB=po + else + DATADIRNAME=share + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi + if test -z "$nls_cv_header_intl"; then + # Clean out junk possibly left behind by a previous configuration. + rm -f intl/libintl.h + fi + AC_CONFIG_LINKS($nls_cv_header_intl:$nls_cv_header_libgt) + AC_OUTPUT_COMMANDS( + [case "$CONFIG_FILES" in *po/Makefile.in*) + sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile + esac]) + + + # If this is used in GNU gettext we have to set USE_NLS to `yes' + # because some of the sources are only built for this goal. + if test "$PACKAGE" = gettext; then + USE_NLS=yes + USE_INCLUDED_LIBINTL=yes + fi + + dnl These rules are solely for the distribution goal. While doing this + dnl we only have to keep exactly one list of the available catalogs + dnl in configure.in. + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + done + + dnl Make all variables we use known to autoconf. + AC_SUBST(USE_INCLUDED_LIBINTL) + AC_SUBST(CATALOGS) + AC_SUBST(CATOBJEXT) + AC_SUBST(DATADIRNAME) + AC_SUBST(GMOFILES) + AC_SUBST(INSTOBJEXT) + AC_SUBST(INTLDEPS) + AC_SUBST(INTLLIBS) + AC_SUBST(INTLOBJS) + AC_SUBST(POFILES) + AC_SUBST(POSUB) + ]) + +AC_DEFUN(AM_GNU_GETTEXT, + [AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_ISC_POSIX])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_C_CONST])dnl + AC_REQUIRE([AC_C_INLINE])dnl + AC_REQUIRE([AC_TYPE_OFF_T])dnl + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([AC_FUNC_ALLOCA])dnl + AC_REQUIRE([AC_FUNC_MMAP])dnl + + AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \ +unistd.h sys/param.h]) + AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ +strdup __argz_count __argz_stringify __argz_next]) + + if test "${ac_cv_func_stpcpy+set}" != "set"; then + AC_CHECK_FUNCS(stpcpy) + fi + if test "${ac_cv_func_stpcpy}" = "yes"; then + AC_DEFINE(HAVE_STPCPY, 1, [Define to 1 if you have the stpcpy function.]) + fi + + AM_LC_MESSAGES + AM_WITH_NLS + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + AC_MSG_CHECKING(for catalogs to be installed) + NEW_LINGUAS= + for lang in ${LINGUAS=$ALL_LINGUAS}; do + case "$ALL_LINGUAS" in + *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; + esac + done + LINGUAS=$NEW_LINGUAS + AC_MSG_RESULT($LINGUAS) + fi + + dnl Construct list of names of catalog files to be constructed. + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + dnl The reference to in the installed file + dnl must be resolved because we cannot expect the users of this + dnl to define HAVE_LOCALE_H. + if test $ac_cv_header_locale_h = yes; then + INCLUDE_LOCALE_H="#include " + else + INCLUDE_LOCALE_H="\ +/* The system does not provide the header . Take care yourself. */" + fi + AC_SUBST(INCLUDE_LOCALE_H) + + dnl Determine which catalog format we have (if any is needed) + dnl For now we know about two different formats: + dnl Linux libc-5 and the normal X/Open format + test -d intl || mkdir intl + if test "$CATOBJEXT" = ".cat"; then + AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen) + + dnl Transform the SED scripts while copying because some dumb SEDs + dnl cannot handle comments. + sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed + fi + dnl po2tbl.sed is always needed. + sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ + $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed + + dnl In the intl/Makefile.in we have a special dependency which makes + dnl only sense for gettext. We comment this out for non-gettext + dnl packages. + if test "$PACKAGE" = "gettext"; then + GT_NO="#NO#" + GT_YES= + else + GT_NO= + GT_YES="#YES#" + fi + AC_SUBST(GT_NO) + AC_SUBST(GT_YES) + + dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly + dnl find the mkinstalldirs script in another subdir but ($top_srcdir). + dnl Try to locate is. + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + AC_SUBST(MKINSTALLDIRS) + + dnl *** For now the libtool support in intl/Makefile is not for real. + l= + AC_SUBST(l) + + dnl Generate list of files to be processed by xgettext which will + dnl be included in po/Makefile. + test -d po || mkdir po + case "$srcdir" in + .) + posrcprefix="../" ;; + /* | [[A-Za-z]]:*) + posrcprefix="$srcdir/" ;; + *) + posrcprefix="../$srcdir/" ;; + esac + rm -f po/POTFILES + sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ + < $srcdir/po/POTFILES.in > po/POTFILES + ]) + +# Search path for a program which passes the given test. +# Ulrich Drepper , 1996. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +# serial 1 + +dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN(AM_PATH_PROG_WITH_TEST, +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in ifelse([$5], , $PATH, [$5]); do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test -n "[$]$1"; then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) + +# Check whether LC_MESSAGES is available in . +# Ulrich Drepper , 1995. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +# serial 2 + +AC_PREREQ(2.13) dnl Minimum Autoconf version required. + +AC_DEFUN(AM_LC_MESSAGES, + [if test $ac_cv_header_locale_h = yes; then + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include ], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES, 1, + [Define if your locale.h file contains LC_MESSAGES.]) + fi + fi]) +