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