dnl Process this file with autoconf to produce a configure script.
AC_INIT(configure.in)

dnl Determine system type
BBH_SYS_GETSYSTEM

dnl Checks for programs.

AC_CHECK_PROG(LEX,lex,lex,no)
if test "$LEX" != lex; then
AC_CHECK_PROG(LEX,flex,flex,no)
if test "$LEX" != flex; then
AC_MSG_ERROR(Can't find lex.)
fi
fi
AC_CHECK_PROG(YACC,yacc,yacc,no)
if test "$YACC" != yacc; then
AC_CHECK_PROG(YACC,bison,"bison -y",no)
if test "$YACC" != "bison -y"; then
AC_MSG_ERROR(Can't find yacc.)
fi
fi
AC_CHECK_PROG(PERL,perl,perl,no)
if test "$PERL" != perl; then
AC_MSG_ERROR(Fortran interface requires Perl. ftp://mrcnext.cso.uiuc.edu/pub/gnu/perl-4.036.tar.gz)
fi
AC_CHECK_PROG(RANLIB,ranlib,ranlib,touch)
AC_CHECK_PROG(AR,ar,ar,touch)
AC_PROG_CC

dnl Set up Fortran environment
BBH_F77_CONFIGURE

dnl Set default path for rnpl, path to include and lib 
BBH_RNPL_DEFAULT_PATH
AC_SUBST(BBH_DEFS)
AC_SUBST(RNPL_F77_INCLUDE)

dnl Checks for standard libraries.
AC_CHECK_LIB(l, main)
AC_CHECK_LIB(y, yyerror)

dnl Locates include, lib directories for hdf, netcdf and vs

BBH_CHECK_RNPL_LIBS
BBH_RNPL_SET_VARS

dnl Checks for header files.
AC_HEADER_STDC

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

dnl Checks for library functions.
AC_CHECK_FUNCS(strdup)
AC_CHECK_FUNCS(atexit)
AC_CHECK_FUNCS(atabort)

AC_OUTPUT(
          Makefile
          src/Makefile
          etc/Makefile
          doc/Makefile
          examples/wave1d/c/Makefile
          examples/wave1d/f77/Makefile
          examples/wave2d/c/Makefile
          examples/wave2d/f77/Makefile
          examples/wave3d/c/Makefile
          examples/wave3d/f77/Makefile
					examples/templates/c/Makefile
					examples/templates/f77/Makefile
         )
