]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/mathml_editor/configure.ac
* this is a large commit
[helm.git] / helm / DEVEL / mathml_editor / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT
3 AC_CONFIG_SRCDIR([src/TToken.hh])
4
5 PACKAGE=editex
6 VERSION=0.0.1
7 EDITEX_VERSION_INFO=`echo $VERSION | awk -F. '{ printf "%d:%d:%d", $1+$2, $3, $2 }'`
8 AC_SUBST(EDITEX_VERSION_INFO)
9
10 AC_ARG_ENABLE(
11         profile,
12         [  --enable-profile[=ARG]  include profiling information [default=no]],
13         profile=$enableval,
14         profile=no
15 )
16
17 AC_ARG_ENABLE(
18         debug,
19         [  --enable-debug[=ARG]    include debugging debug [default=yes]],
20         enable_debug=$enableval,
21         enable_debug=yes
22 )
23
24 if test "x$enable_debug" = "xyes"; then
25    AC_DEFINE(ENABLE_DEBUG,,[Define to 1 if you want to enable validity checks while running])
26 fi
27
28 GMETADOM_PREFIX=""
29 AC_ARG_WITH(gmetadom-prefix,
30         [  --with-gmetadom-prefix=[PFX]         Specify location of gmetadom],
31         GMETADOM_PREFIX=$withval
32 )
33
34 AC_CONFIG_HEADERS([config.h])
35 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
36 AM_CONFIG_HEADER(config.h)
37
38 AH_TOP([
39 /* Copyright (C) 2002, Luca Padovani <luca.padovani@cs.unibo.it>.
40  *
41  * This file is part of EdiTeX, an editor of mathematical
42  * expressions based on TeX syntax
43  * 
44  * EdiTeX is free software; you can redistribute it and/or
45  * modify it under the terms of the GNU General Public License
46  * as published by the Free Software Foundation; either version 2
47  * of the License, or (at your option) any later version.
48  *
49  * EdiTeX is distributed in the hope that it will be useful,
50  * but WITHOUT ANY WARRANTY; without even the implied warranty of
51  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
52  * GNU General Public License for more details.
53  *
54  * You should have received a copy of the GNU General Public License
55  * along with EdiTeX; if not, write to the Free Software
56  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
57  * 
58  * For details, see the EdiTeX World-Wide-Web page,
59  * http://helm.cs.unibo.it/editex, or send a mail to
60  * <luca.padovani@cs.unibo.it>
61  */
62 #ifndef config_h
63 #define config_h
64 ])
65
66 AH_BOTTOM([
67 #endif /* config_h */
68 ])
69
70 AC_PROG_CC
71 AC_PROG_CXX
72 AC_PROG_INSTALL
73 AC_HEADER_STDC([])
74
75 AC_LANG_PUSH(C++)
76 AC_CHECK_HEADERS(hash_map)
77 AC_CHECK_HEADERS(ext/hash_map)
78 AC_LANG_POP(C++)
79
80 AC_SUBST(CFLAGS)
81 AC_SUBST(CPPFLAGS)
82 AC_SUBST(LDFLAGS)
83
84 AM_PROG_LIBTOOL
85
86 GMETADOM_CONFIG="gmetadom-config"
87 GMETADOM_MIN_VERSION=0.1.0
88 AC_MSG_CHECKING([for GMetaDOM C++ library] >= $GMETADOM_MIN_VERSION) 
89 if test "x$GMETADOM_PREFIX" != "x"
90 then
91         if ${GMETADOM_PREFIX}/bin/$GMETADOM_CONFIG --version > /dev/null 2>&1
92         then
93                 GMETADOM_CONFIG=${GMETADOM_PREFIX}/bin/$GMETADOM_CONFIG
94         elif ! $GMETADOM_CONFIG --version > /dev/null 2>&1
95         then
96                 AC_MSG_ERROR([Could not find gmetadom anywhere (see config.log for details).])
97         fi
98 fi
99
100 dnl
101 dnl test version and init our variables
102 dnl
103 vers=`$GMETADOM_CONFIG --version | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
104 minvers=`echo $GMETADOM_MIN_VERSION | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
105 if test "$vers" -ge "$minvers"
106 then
107         GMETADOM_LIBS="`$GMETADOM_CONFIG --module=gdome_cpp_smart --libs`"
108         GMETADOM_CFLAGS="`$GMETADOM_CONFIG --module=gdome_cpp_smart --cflags`"
109         AC_MSG_RESULT(found)
110 else
111         AC_MSG_ERROR([You need at least GMetaDOM (C++) $GMETADOM_MIN_VERSION for this version of $PACKAGE])
112 fi
113
114 AC_SUBST(GMETADOM_CFLAGS)
115 AC_SUBST(GMETADOM_LIBS)
116
117 GDOMEXSLT_CONFIG="gdome_xslt_cpp_smart-config"
118 GDOMEXSLT_MIN_VERSION=0.0.4
119 AC_MSG_CHECKING([for gdome_xslt C++ library] >= $GDOMEXSLT_MIN_VERSION) 
120 if test "x$GDOMEXSLT_PREFIX" != "x"
121 then
122         if ${GDOMEXSLT_PREFIX}/bin/$GDOMEXSLT_CONFIG --version > /dev/null 2>&1
123         then
124                 GDOMEXSLT_CONFIG=${GDOMEXSLT_PREFIX}/bin/$GDOMEXSLT_CONFIG
125         elif ! $GDOMEXSLT_CONFIG --version > /dev/null 2>&1
126         then
127                 AC_MSG_ERROR([Could not find gdome_xslt anywhere (see config.log for details).])
128         fi
129 fi
130
131 dnl
132 dnl test version and init our variables
133 dnl
134 vers=`$GDOMEXSLT_CONFIG --version | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
135 minvers=`echo $GDOMEXSLT_MIN_VERSION | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
136 if test "$vers" -ge "$minvers"
137 then
138         GDOMEXSLT_LIBS="`$GDOMEXSLT_CONFIG --libs`"
139         GDOMEXSLT_CFLAGS="`$GDOMEXSLT_CONFIG --cflags`"
140         AC_MSG_RESULT(found)
141 else
142         AC_MSG_ERROR([You need at least gdome_xslt (C++) $GDOMEXSLT_MIN_VERSION for this version of $PACKAGE])
143 fi
144
145 AC_SUBST(GDOMEXSLT_CFLAGS)
146 AC_SUBST(GDOMEXSLT_LIBS)
147
148 GTKMATHVIEW_CONFIG="gtkmathview-config"
149 GTKMATHVIEW_MIN_VERSION=0.4.0
150 AC_MSG_CHECKING([for gtkmathview library] >= $GTKMATHVIEW_MIN_VERSION) 
151 if test "x$GTKMATHVIEW_PREFIX" != "x"
152 then
153         if ${GTKMATHVIEW_PREFIX}/bin/$GTKMATHVIEW_CONFIG --version > /dev/null 2>&1
154         then
155                 GTKMATHVIEW_CONFIG=${GTKMATHVIEW_PREFIX}/bin/$GTKMATHVIEW_CONFIG
156         elif ! $GTKMATHVIEW_CONFIG --version > /dev/null 2>&1
157         then
158                 AC_MSG_ERROR([Could not find gtkmathview anywhere (see config.log for details).])
159         fi
160 fi
161
162 dnl
163 dnl test version and init our variables
164 dnl
165 vers=`$GTKMATHVIEW_CONFIG --version | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
166 minvers=`echo $GTKMATHVIEW_MIN_VERSION | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
167 if test "$vers" -ge "$minvers"
168 then
169         GTKMATHVIEW_LIBS="`$GTKMATHVIEW_CONFIG --libs`"
170         GTKMATHVIEW_CFLAGS="`$GTKMATHVIEW_CONFIG --cflags`"
171         AC_MSG_RESULT(found)
172 else
173         AC_MSG_ERROR([You need at least gtkmathview $GTKMATHVIEW_MIN_VERSION for this version of $PACKAGE])
174 fi
175
176 AC_SUBST(GTKMATHVIEW_CFLAGS)
177 AC_SUBST(GTKMATHVIEW_LIBS)
178
179 AC_CHECK_PROG(HAVE_OCAMLC, ocamlc, yes, no)
180 if test $HAVE_OCAMLC = "no"; then
181   AC_MSG_ERROR([could not find ocamlc in PATH, please make sure ocaml is installed])
182 else
183   OCAMLC=ocamlc
184   OCAMLSTDLIBDIR="`ocamlc -where`"
185   OCAMLSTUBDIR="`ocamlc -where`/stublibs"
186   AC_SUBST(OCAMLC)
187   AC_SUBST(OCAMLSTDLIBDIR)
188   AC_SUBST(OCAMLSTUBDIR)
189 fi
190
191 AC_CHECK_PROG(HAVE_OCAMLOPT, ocamlopt, yes, no)
192 if test $HAVE_OCAMLOPT = "no"; then
193         AC_MSG_WARN([ocaml native libraries won't be compiled since ocamlopt was not found])
194 else
195   OCAMLOPT=ocamlopt
196   AC_SUBST(OCAMLOPT)
197 fi
198 AM_CONDITIONAL(HAVE_OCAMLOPT_COND, test x$HAVE_OCAMLOPT = xyes)
199
200 AC_CHECK_PROG(HAVE_OCAMLFIND, ocamlfind, yes, no)
201 if test $HAVE_OCAMLFIND = "no"; then
202   AC_MSG_ERROR([could not find ocamlfind in PATH, please make sure findlib is installed])
203 else
204   OCAMLFIND=ocamlfind
205   AC_SUBST(OCAMLFIND)
206 fi
207
208 AC_CHECK_PROG(HAVE_OCAMLDEP, ocamldep, yes, no)
209 if test $HAVE_OCAMLDEP = "yes"; then
210   OCAMLDEP=ocamldep
211   AC_SUBST(OCAMLDEP)
212 fi
213
214 AC_CHECK_PROG(HAVE_OCAMLMKLIB, ocamlmklib, yes, no)
215 if test $HAVE_OCAMLMKLIB = "no"; then
216   AC_MSG_ERROR([could not find ocamlmklib in PATH, please make sure ocamlmklib is installed])
217 else
218   OCAMLMKLIB=ocamlmklib
219   AC_SUBST(OCAMLMKLIB)
220 fi
221
222 AC_MSG_CHECKING(for gdome2 ocaml binding)
223 ocamlfind query gdome2 ||
224   AC_MSG_ERROR(gdome2 not installed (according to findlib))
225 MLGDOME_CFLAGS="`$OCAMLFIND query -i-format gdome2`"
226 AC_SUBST(MLGDOME_CFLAGS)
227
228 AC_MSG_CHECKING(for the ocaml library dir)
229 OCAML_LIB_DIR=`ocamlc -where`
230 AC_MSG_RESULT($OCAML_LIB_DIR)
231
232 AC_CHECK_FILE(/usr/include/caml/mlvalues.h,
233         OCAML_INCLUDE_DIR=/usr/include/caml,
234         OCAML_INCLUDE_DIR=$OCAML_LIB_DIR/caml
235 )
236
237 AC_SUBST(OCAML_INCLUDE_DIR)
238
239 AC_CONFIG_FILES([
240  Makefile 
241  src/Makefile
242  test/Makefile
243  ocaml/Makefile
244  editex-config
245 ])
246 AC_CONFIG_COMMANDS([default],[[chmod +x editex-config]],[[]])
247 AC_OUTPUT