AC_INIT(tintin.h)
AC_PROG_CC
AC_PROG_CPP
AC_ISC_POSIX
AC_AIX
AC_MINIX

# Too many people had problems with -pipe and cc; dunno why
# configure didn't detect that they don't work together, though.
# Anyhow, I got rid of the pipe shit.

# # By default, the helpfile'll now be uncompressed.
# # The file is pretty damn small anyways. <moan>
DEFS="$DEFS -DCOMPRESSED_HELP=0"
# 
# echo "Do you want the helpfile to be compressed (yes/no)? "
# read YESNO
# if test $YESNO; then
#   if echo "$YESNO"|grep -i "no" >/dev/null; then
#     DEFS="$DEFS -DCOMPRESSED_HELP=0"
#   else
#     DEFS="$DEFS -DCOMPRESSED_HELP=1"
#     COMPRESSED_HELP="Ok"
#   fi
# fi

AC_GCC_TRADITIONAL
AC_DYNIX_SEQ
AC_IRIX_SUN
AC_XENIX_DIR
AC_SCO_INTL
AC_HAVE_HEADERS(strings.h string.h stdlib.h time.h sys/termio.h param.h sys/ptem.h)
AC_HEADER_EGREP(tcflag_t, sys/termio.h, DEFS="$DEFS -DHAVE_TCFLAG_T=1")

# If we're using a SGI, we need to use BSD signals to compile readline.
AC_HEADER_EGREP(yes, [#ifdef sgi
			yes
			#endif],
	echo;
	echo "Please read the file docs/sgi if you have not already done so.";
	echo; sleep 5)

AC_COMPILE_CHECK(which method to use to turn keyboard echo on/off,
	[ #include <sys/termio.h> 
	  #include <sgtty.h> ],
	[ CBREAK ],
	DEFS="$DEFS -DBSD_ECHO=1", 
	[ ])
AC_HAVE_LIBRARY(socket, [LIBS="$LIBS -lsocket"])
AC_HAVE_LIBRARY(nsl, [LIBS="$LIBS -lnsl"])
AC_HAVE_FUNCS(bcopy)

AC_OUTPUT(Makefile)

# Do configure on readline/ directory, too.  God I hope this works ok.
export DEFS
cd readline/
./configure