dnl Process this file with autoconf to produce a configure script.
AC_INIT(readline.h)
AC_CONFIG_HEADER(config.h)
AC_REVISION(Configure for Readline 2.0)

# We want these before the checks, so the checks can modify their values.
test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1

AC_PROG_CC

# If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"

AC_SUBST(CFLAGS)dnl
AC_SUBST(LDFLAGS)dnl

AC_GCC_TRADITIONAL
AC_PROG_INSTALL
AC_PROG_RANLIB

AC_USG

AC_HAVE_FUNCS(strcasecmp sighold)

AC_HAVE_HEADERS(unistd.h stdlib.h varargs.h string.h alloca.h \
		dirent.h sys/ptem.h sys/pte.h sys/stream.h termcap.h \
		termio.h)

AC_HEADER_CHECK(sys/file.h, ,AC_DEFINE(NO_SYS_FILE))

if test -z "$have_tiocgwinsz"; then
AC_COMPILE_CHECK(TIOCGWINSZ in sys/ioctl.h,
[#include <sys/types.h>
#include <sys/ioctl.h>], [int x = TIOCGWINSZ;],
AC_DEFINE(GWINSZ_IN_SYS_IOCTL))
fi

AC_COMPILE_CHECK(programs able to redeclare getpw functions,
[#include <sys/types.h>
#include <pwd.h>
extern struct passwd *getpwuid();], [struct passwd *z; z = getpwuid(0);], ,
AC_DEFINE(HAVE_GETPW_DECLS))

AC_ALLOCA

AC_OUTPUT(Makefile, [
# Makefile uses this timestamp file to record whether config.h is up to date.
touch stamp-config])
