dnl Process this file with autoconf to produce a configure script.
AC_INIT(cxref,1.6)

dnl Specify the autoconf file.
AC_CONFIG_HEADER(src/autoconfig.h)

dnl Check the page size
PAGE=A4
AC_ARG_ENABLE(us-paper,
[  --enable-us-paper      use US paper instead of A4],
[if test "$enableval" = "yes"; then PAGE=US; fi])
AC_SUBST(PAGE)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_AWK
AC_PROG_YACC
AC_PROG_CPP
AC_PROG_LEX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_CHECK_PROG(PERL, perl, perl, )
AC_CHECK_PROG(LATEX, latex, latex, )
AC_CHECK_PROG(DVIPS, dvips, dvips, )

if test -z "$LEX"; then
   AC_MSG_ERROR([No lex (or flex) program was found])
fi

if test -z "$YACC"; then
   AC_MSG_ERROR([No yacc/byacc (or bison) program was found])
fi

dnl Checks for libraries.

dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(malloc.h unistd.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T

dnl Checks for library functions.
AC_CHECK_FUNCS(getcwd mkdir strerror strstr)

objdir=`pwd`
AC_SUBST(objdir)

dnl Check the cpp directory
AC_CONFIG_SUBDIRS(cpp)

dnl Create the output files.
AC_OUTPUT(Makefile src/Makefile doc/Makefile query/Makefile)
