+#
+# autoconf input for Objective Caml programs
+# Copyright (C) 2001 Jean-Christophe Filliâtre
+# from a first script by Georges Mariano
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License version 2, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# See the GNU Library General Public License version 2 for more details
+# (enclosed in the file LGPL).
+
+# modified by Kim Nguyẽn
+
+# the script generated by autoconf from this input will set the following
+# variables:
+# OCAMLC "ocamlc" if present in the path, or a failure
+# or "ocamlc.opt" if present with same version number as ocamlc
+# OCAMLOPT "ocamlopt" (or "ocamlopt.opt" if present), or "no"
+# OCAMLBEST either "byte" if no native compiler was found,
+# or "opt" otherwise
+# OCAMLDEP "ocamldep"
+# OCAMLLEX "ocamllex" (or "ocamllex.opt" if present)
+# OCAMLYACC "ocamlyac"
+# OCAMLLIB the path to the ocaml standard library
+# OCAMLVERSION the ocaml version number
+# OCAMLWEB "ocamlweb" (not mandatory)
+# OCAMLWIN32 "yes"/"no" depending on Sys.os_type = "Win32"
+# EXE ".exe" if OCAMLWIN32=yes, "" otherwise
+
+# check for one particular file of the sources
+# ADAPT THE FOLLOWING LINE TO YOUR SOURCES!
+AC_INIT([tatoo], [0.0.1], [kim.nguyen@lri.fr])
+
+# Check for Ocaml compilers
+
+AC_CHECK_PROG(HAS_OCAMLFIND,ocamlfind,yes,no)
+if test "$HAS_OCAMLFIND" = "no" ; then
+ AC_MSG_ERROR(Cannot find ocamlfind.)
+else
+ OCAMLFIND=ocamlfind
+fi
+
+# we first look for ocamlc in the path; if not present, we fail
+OCAMLC="$OCAMLFIND ocamlc"
+AC_MSG_CHECKING(ocamlc)
+$OCAMLC
+if test ! $? ; then
+ AC_MSG_RESULT(not found)
+ AC_MSG_ERROR(Cannot find ocamlc.)
+else
+ AC_MSG_RESULT($OCAMLC)
+fi
+OCAMLOPT="$OCAMLFIND ocamlopt"
+AC_MSG_CHECKING(ocamlopt)
+$OCAMLOPT
+
+if test ! $?; then
+ AC_MSG_RESULT(not found)
+ AC_MSG_ERROR(Cannot find ocamlopt.)
+else
+ AC_MSG_RESULT($OCAMLOPT)
+fi
+
+# we extract Ocaml version number and library path
+OCAMLVERSION=$($OCAMLC -version)
+echo "ocaml version is $OCAMLVERSION"
+OCAMLLIB=$($OCAMLC -where)
+echo "ocaml library path is $OCAMLLIB"
+
+# ocamldep, ocamllex and ocamlyacc should also be present in the path
+OCAMLOPT="ocamlfind ocamldep"
+AC_MSG_CHECKING(ocamldep)
+$OCAMLDEP
+if test ! $?; then
+ AC_MSG_RESULT(not found)
+ AC_MSG_ERROR(Cannot find ocamldep.)
+else
+ AC_MSG_RESULT($OCAMLDEP)
+fi
+
+AC_CHECK_PROG(OCAMLYACC,ocamlyacc, yes ,no)
+if test "$OCAMLYACC" = "no" ; then
+ AC_MSG_ERROR(Cannot find ocamlyacc.)
+fi
+
+AC_CHECK_PROG(CAMLP4,camlp4, yes,no)
+if test "$CAMLP4" = "no" ; then
+ AC_MSG_ERROR(Cannot find camlp4.)
+fi
+
+AC_MSG_CHECKING(for ulex)
+ULEX_PATH=$($OCAMLFIND query ulex 2>/dev/null)
+if test -z "$ULEX_PATH"; then
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR(Cannot find ulex.)
+else
+ AC_MSG_RESULT(yes)
+fi
+
+AC_MSG_CHECKING(for expat)
+EXPAT_PATH=$($OCAMLFIND query expat 2>/dev/null)
+if test -z "$EXPAT_PATH"; then
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR(Cannot find expat.)
+else
+ AC_MSG_RESULT(yes)
+fi
+
+# substitutions to perform
+
+AC_SUBST(OCAMLFIND)
+AC_SUBST(OCAMLC)
+AC_SUBST(OCAMLOPT)
+AC_SUBST(OCAMLDEP)
+AC_SUBST(OCAMLYACC)
+AC_SUBST(CAMLP4)