dnl Process this file with autoconf to produce a configure script.
dnl $Id: configure.in,v 1.32 1998/03/03 18:29:17 karl Exp $
dnl
AC_INIT(makeinfo/makeinfo.c)
AC_PREREQ(2.12)dnl Minimum Autoconf version required.
AM_CONFIG_HEADER(config.h)

AM_INIT_AUTOMAKE([texinfo], [3.12])

dnl Checks for programs.
AC_PROG_CC
AC_PROG_GCC_TRADITIONAL
AC_PROG_INSTALL
AC_PROG_RANLIB

dnl The --enable-multiplatform option.
AC_CANONICAL_HOST
AC_ARG_ENABLE(multiplatform,
[  --enable-multiplatform     put executables in bin/PLATFORM],
if test "x$enable_multiplatform" = xyes &&
    test "x$bindir" = 'x${exec_prefix}/bin'
then
  bindir="$bindir/$host"
fi)

# We do this for the sake of a more helpful warning in doc/Makefile.
TEXMF='$(datadir)/texmf'
AC_SUBST(TEXMF)

AC_ISC_POSIX
AC_MINIX

dnl Checks for libraries.
dnl AC_CHECK_LIB(z, gzdopen)
AC_CHECK_LIB(z, nonesuch)

# Needed on sysV68 for sigblock, sigsetmask.  But check for it in libc first.
AC_CHECK_FUNC(sigblock, , AC_CHECK_LIB(bsd, sigblock))

# Some GNU/Linux systems (e.g., SuSE 4.3, 1996) don't have curses, but
# rather ncurses.  So we check for it.
TERMLIBS=
for termlib in curses ncurses termcap terminfo termlib ; do
   AC_CHECK_LIB(${termlib}, tputs,
     [TERMLIBS="${TERMLIBS} -l${termlib}"; break])
done
AC_SUBST(TERMLIBS)

dnl Checks for header files.
dnl Do not use <ncurses/termcap.h> unless we're linking with ncurses.
if test "x$termlib" = xncurses; then
  dnl Use AC_CHECK_HEADERS so the HAVE_*_H symbol gets defined.
  AC_CHECK_HEADERS(ncurses/termcap.h)
fi
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h pwd.h string.h strings.h termcap.h termio.h \
  termios.h unistd.h \
  sys/fcntl.h sys/file.h sys/ptem.h sys/time.h sys/ttold.h sys/wait.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_OFF_T
AC_TYPE_SIGNAL
AC_C_CONST
AC_STRUCT_TM

dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_VPRINTF
AC_FUNC_SETVBUF_REVERSED
AC_CHECK_FUNCS(setvbuf getcwd memset bzero strchr strcasecmp \
  sigprocmask sigsetmask)
dnl strcasecmp, strerror, xmalloc, xrealloc, probably others should be added.
AC_REPLACE_FUNCS(memcpy memmove strdup strerror)

dnl Set of available languages and i18n macros.
ALL_LINGUAS="de fr"
AM_GNU_GETTEXT
AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)

AC_OUTPUT([Makefile             \
           doc/Makefile         \
           info/Makefile        \
           intl/Makefile        \
           lib/Makefile         \
           makeinfo/Makefile    \
           po/Makefile.in       \
           util/Makefile        \
           ],
          [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in >po/Makefile])
