dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/fold.c)
AM_CONFIG_HEADER(config.h)
AC_PREREQ(2.12)dnl               dnl Minimum Autoconf version required.

AM_INIT_AUTOMAKE([textutils], [1.22])
GNU_PACKAGE="GNU $PACKAGE"
AC_DEFINE_UNQUOTED(GNU_PACKAGE, "$GNU_PACKAGE")

AM_MAINTAINER_MODE

ALL_LINGUAS="de es fr ko nl pl"

dnl Checks for programs.
AC_PATH_PROG(PERL, perl)
AC_PROG_CC
AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL
AC_PROG_RANLIB
AC_AIX
AC_MINIX

AM_WITH_REGEX

dnl Checks for header files.
AC_CHECK_HEADERS(limits.h string.h memory.h fcntl.h float.h unistd.h values.h)
AC_HEADER_STAT
AC_HEADER_STDC

dnl This test must precede tests of compiler characteristics like
dnl that for the inline keyword, since it may change the degree to
dnl which the compiler supports such features.
AM_C_PROTOTYPES

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN
AC_C_CONST
AC_C_INLINE
AC_C_LONG_DOUBLE

AC_HEADER_DIRENT
AC_STRUCT_ST_BLKSIZE
AC_TYPE_OFF_T
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T

dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])

dnl Checks for library functions.
AC_CHECK_FUNCS(strerror isascii strchr strrchr)
AC_FUNC_ALLOCA
jm_FUNC_MEMCMP
AC_FUNC_VPRINTF
AC_REPLACE_FUNCS(memcpy memmove memset stpcpy strpbrk strtol strtoul)

AM_FUNC_STRTOD
AC_SUBST(POW_LIBM)
test $am_cv_func_strtod_needs_libm = yes && POW_LIBM=-lm

AM_FUNC_ERROR_AT_LINE

AC_REPLACE_FUNCS(getline)
if test $ac_cv_func_getline != yes; then
  AC_CHECK_FUNCS(getdelim)
fi

AM_GNU_GETTEXT
AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)

AC_OUTPUT([Makefile doc/Makefile intl/Makefile lib/Makefile \
man/Makefile m4/Makefile po/Makefile.in src/Makefile tests/Makefile \
tests/cut-test/Makefile
tests/join-test/Makefile
tests/md5sum-test/Makefile
tests/pr-test/Makefile
tests/sort-test/Makefile
tests/tail/Makefile
tests/tr-test/Makefile],
[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
