Add the initial configure script.
[tatoo.git] / configure.in
1 #
2 # autoconf input for Objective Caml programs
3 # Copyright (C) 2001 Jean-Christophe Filliâtre
4 #   from a first script by Georges Mariano
5 #
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Library General Public
8 # License version 2, as published by the Free Software Foundation.
9 #
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 #
14 # See the GNU Library General Public License version 2 for more details
15 # (enclosed in the file LGPL).
16
17 # modified by Kim Nguyẽn
18
19 # the script generated by autoconf from this input will set the following
20 # variables:
21 #   OCAMLC        "ocamlc" if present in the path, or a failure
22 #                 or "ocamlc.opt" if present with same version number as ocamlc
23 #   OCAMLOPT      "ocamlopt" (or "ocamlopt.opt" if present), or "no"
24 #   OCAMLBEST     either "byte" if no native compiler was found,
25 #                 or "opt" otherwise
26 #   OCAMLDEP      "ocamldep"
27 #   OCAMLLEX      "ocamllex" (or "ocamllex.opt" if present)
28 #   OCAMLYACC     "ocamlyac"
29 #   OCAMLLIB      the path to the ocaml standard library
30 #   OCAMLVERSION  the ocaml version number
31 #   OCAMLWEB      "ocamlweb" (not mandatory)
32 #   OCAMLWIN32    "yes"/"no" depending on Sys.os_type = "Win32"
33 #   EXE           ".exe" if OCAMLWIN32=yes, "" otherwise
34
35 # check for one particular file of the sources
36 # ADAPT THE FOLLOWING LINE TO YOUR SOURCES!
37 AC_INIT([tatoo], [0.0.1], [kim.nguyen@lri.fr])
38
39 # Check for Ocaml compilers
40
41 AC_CHECK_PROG(HAS_OCAMLFIND,ocamlfind,yes,no)
42 if test "$HAS_OCAMLFIND" = "no"  ; then
43         AC_MSG_ERROR(Cannot find ocamlfind.)
44 else
45    OCAMLFIND=ocamlfind
46 fi
47
48 # we first look for ocamlc in the path; if not present, we fail
49 OCAMLC="$OCAMLFIND ocamlc"
50 AC_MSG_CHECKING(ocamlc)
51 $OCAMLC
52 if test  ! $? ;  then
53         AC_MSG_RESULT(not found)
54         AC_MSG_ERROR(Cannot find ocamlc.)
55 else
56         AC_MSG_RESULT($OCAMLC)
57 fi
58 OCAMLOPT="$OCAMLFIND ocamlopt"
59 AC_MSG_CHECKING(ocamlopt)
60 $OCAMLOPT
61
62 if test ! $?;  then
63         AC_MSG_RESULT(not found)
64         AC_MSG_ERROR(Cannot find ocamlopt.)
65 else
66         AC_MSG_RESULT($OCAMLOPT)
67 fi
68
69 # we extract Ocaml version number and library path
70 OCAMLVERSION=$($OCAMLC -version)
71 echo "ocaml version is $OCAMLVERSION"
72 OCAMLLIB=$($OCAMLC -where)
73 echo "ocaml library path is $OCAMLLIB"
74
75 # ocamldep, ocamllex and ocamlyacc should also be present in the path
76 OCAMLOPT="ocamlfind ocamldep"
77 AC_MSG_CHECKING(ocamldep)
78 $OCAMLDEP
79 if test ! $?;  then
80         AC_MSG_RESULT(not found)
81         AC_MSG_ERROR(Cannot find ocamldep.)
82 else
83         AC_MSG_RESULT($OCAMLDEP)
84 fi
85
86 AC_CHECK_PROG(OCAMLYACC,ocamlyacc, yes ,no)
87 if test "$OCAMLYACC" = "no" ; then
88         AC_MSG_ERROR(Cannot find ocamlyacc.)
89 fi
90
91 AC_CHECK_PROG(CAMLP4,camlp4, yes,no)
92 if test "$CAMLP4" = "no" ; then
93         AC_MSG_ERROR(Cannot find camlp4.)
94 fi
95
96 AC_MSG_CHECKING(for ulex)
97 ULEX_PATH=$($OCAMLFIND query ulex 2>/dev/null)
98 if test -z "$ULEX_PATH"; then
99         AC_MSG_RESULT(no)
100         AC_MSG_ERROR(Cannot find ulex.)
101 else
102         AC_MSG_RESULT(yes)
103 fi
104
105 AC_MSG_CHECKING(for expat)
106 EXPAT_PATH=$($OCAMLFIND query expat 2>/dev/null)
107 if test -z "$EXPAT_PATH"; then
108         AC_MSG_RESULT(no)
109         AC_MSG_ERROR(Cannot find expat.)
110 else
111         AC_MSG_RESULT(yes)
112 fi
113
114 # substitutions to perform
115
116 AC_SUBST(OCAMLFIND)
117 AC_SUBST(OCAMLC)
118 AC_SUBST(OCAMLOPT)
119 AC_SUBST(OCAMLDEP)
120 AC_SUBST(OCAMLYACC)
121 AC_SUBST(CAMLP4)