]> matita.cs.unibo.it Git - helm.git/blob - helm/interface/configure.in
Initial revision
[helm.git] / helm / interface / configure.in
1 AC_INIT(configuration.ml.in)
2
3 PACKAGE=helm_gtk_interface
4 MAJOR_VERSION=0
5 MINOR_VERSION=0
6 MICRO_VERSION=2
7 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
8
9 DEFAULT_HELM_CONFIGURATION_DIR=/usr/local/etc/helm
10
11 AC_ARG_ENABLE(
12         defaults,
13         [  --enable-defaults[=ARG] if yes then use defaults (don't ask user) [default=auto]],
14         USE_DEFAULTS=$enableval,
15         USE_DEFAULTS=auto
16 )
17
18 if test "x$prefix" != xNONE; then
19   RESOLVED_PREFIX=$prefix
20 else
21   RESOLVED_PREFIX=$ac_default_prefix
22 fi
23
24 if test "x$exec_prefix" != xNONE; then
25   RESOLVED_EXEC_PREFIX=$exec_prefix
26 else
27   RESOLVED_EXEC_PREFIX=$RESOLVED_PREFIX
28 fi
29
30 dnl The following is the directory where the binary will be installed
31 BIN_DIR=$RESOLVED_EXEC_PREFIX/bin
32
33 AC_PATH_PROG(WGET_BINARY,wget,no)
34 if test $WGET_BINARY = no; then
35         AC_MSG_WARN(wget is required to update the database)
36 fi
37
38 AC_PATH_PROG(PERL_BINARY,perl,no)
39 if test $PERL_BINARY = no ; then
40    AC_MSG_ERROR(Could not find perl)
41 fi
42
43 dnl MISSING CHECKS:
44 dnl ocaml-findlib, ocaml-netstring, ocaml-pxp, ocaml-netclient
45
46 dnl Check for Ocaml
47 AC_CHECK_PROG(HAVE_OCAMLC, ocamlc, yes, no)
48 if test $HAVE_OCAMLC = "no"; then
49   AC_MSG_ERROR(could not find ocamlc in PATH, please make sure ocaml is installed)
50 fi
51
52 dnl Check for the Ocaml library dir
53 AC_MSG_CHECKING(for the ocaml library dir)
54 OCAML_ROOT=`ocamlc -v | grep "^Standard" | sed 's/^.*: *//'`
55 AC_MSG_RESULT($OCAML_ROOT)
56
57 DEFAULT_MLMINIDOM_LIB_DIR=$OCAML_ROOT/mlminidom
58 DEFAULT_LABLGTK_LIB_DIR=$OCAML_ROOT/lablgtk
59 DEFAULT_LABLGTKMATHVIEW_LIB_DIR=$OCAML_ROOT/lablgtkmathview
60
61 dnl Check for mlminidom
62 DEFAULTS=$USE_DEFAULTS
63 if test $DEFAULTS = auto; then
64         if test -f $DEFAULT_MLMINIDOM_LIB_DIR/minidom.mli; then
65                 MLMINIDOM_LIB_DIR=$DEFAULT_MLMINIDOM_LIB_DIR
66         else
67                 DEFAULTS=no
68         fi
69 fi
70
71 if test $DEFAULTS = no; then
72         echo
73         echo "Where can I find the mlminidom library?"
74         echo
75         echo -n "[[$DEFAULT_MLMINIDOM_LIB_DIR]] ? "
76         echo
77         read MLMINIDOM_LIB_DIR
78         if test "x$MLMINIDOM_LIB_DIR" = x; then
79                 MLMINIDOM_LIB_DIR=$DEFAULT_MLMINIDOM_LIB_DIR
80         fi
81 elif test $DEFAULTS = yes; then
82         MLMINIDOM_LIB_DIR=$DEFAULT_MLMINIDOM_LIB_DIR
83 fi
84
85 AC_MSG_CHECKING(for $MLMINIDOM_LIB_DIR/minidom.mli)
86 if test ! -f $MLMINIDOM_LIB_DIR/minidom.mli; then
87         AC_MSG_RESULT(no)
88         AC_MSG_ERROR(please check your installation)
89 fi
90 AC_MSG_RESULT(ok)
91
92 dnl Check for lablgtk
93 DEFAULTS=$USE_DEFAULTS
94 if test $DEFAULTS = auto; then
95         if test -f $DEFAULT_LABLGTK_LIB_DIR/gtk.ml; then
96                 LABLGTK_LIB_DIR=$DEFAULT_LABLGTK_LIB_DIR
97         else
98                 DEFAULTS=no
99         fi
100 fi
101
102 if test $DEFAULTS = no; then
103         echo
104         echo "Where can I find the lablgtk library?"
105         echo
106         echo -n "[[$DEFAULT_LABLGTK_LIB_DIR]] ? "
107         read LABLGTK_LIB_DIR
108         echo
109         if test "x$LABLGTK_LIB_DIR" = x; then
110                 LABLGTK_LIB_DIR=$DEFAULT_LABLGTK_LIB_DIR
111         fi
112 elif test $DEFAULTS = yes; then
113         LABLGTK_LIB_DIR=$DEFAULT_LABLGTK_LIB_DIR
114 fi
115
116 AC_MSG_CHECKING(for $LABLGTK_LIB_DIR/gtk.ml)
117 if test ! -f $LABLGTK_LIB_DIR/gtk.ml; then
118         AC_MSG_RESULT(no)
119         AC_MSG_ERROR(please check your installation)
120 fi
121 AC_MSG_RESULT(ok)
122
123 dnl Check for lablgtkmathview
124 DEFAULTS=$USE_DEFAULTS
125 if test $DEFAULTS = auto; then
126         if test -f $DEFAULT_LABLGTKMATHVIEW_LIB_DIR/gMathView.ml; then
127                 LABLGTKMATHVIEW_LIB_DIR=$DEFAULT_LABLGTKMATHVIEW_LIB_DIR
128         else
129                 DEFAULTS=no
130         fi
131 fi
132
133 if test $DEFAULTS = no; then
134         echo
135         echo "Where can I find the lablgtkmathview library?"
136         echo
137         echo -n "[[$DEFAULT_LABLGTKMATHVIEW_LIB_DIR]] ? "
138         read LABLGTKMATHVIEW_LIB_DIR
139         echo
140         if test "x$LABLGTKMATHVIEW_LIB_DIR" = x; then
141                 LABLGTKMATHVIEW_LIB_DIR=$DEFAULT_LABLGTKMATHVIEW_LIB_DIR
142         fi
143 elif test $DEFAULTS = yes; then
144         LABLGTKMATHVIEW_LIB_DIR=$DEFAULT_LABLGTKMATHVIEW_LIB_DIR
145 fi
146
147 AC_MSG_CHECKING(for $LABLGTKMATHVIEW_LIB_DIR/gMathView.ml)
148 if test ! -f $LABLGTKMATHVIEW_LIB_DIR/gMathView.ml; then
149         AC_MSG_RESULT(no)
150         AC_MSG_ERROR(please check your installation)
151 fi
152 AC_MSG_RESULT(ok)
153
154 dnl Check for HELM
155 DEFAULTS=$USE_DEFAULTS
156 if test $DEFAULTS = auto; then
157         AC_CHECK_PROG(HAVE_HELM_CONFIG, helm-config, yes, no)
158         if test $HAVE_HELM_CONFIG = yes; then
159                 HELM_CONFIGURATION_DIR=`helm-config --etc-dir`
160         else
161                 DEFAULTS=no
162         fi
163 fi
164
165 if test $DEFAULTS = no; then
166         echo
167         echo "\`helm-config' is not installed (or I can't find it in your path)."
168         echo "Please, insert the directory where I can find the configuration"
169         echo "files for HELM (configuration.xml in particular)..."
170         echo
171         echo -n "[[$DEFAULT_HELM_CONFIGURATION_DIR]] ? "
172         read HELM_CONFIGURATION_DIR
173         echo
174         if test "x$HELM_CONFIGURATION_DIR" = "x"; then
175                 HELM_CONFIGURATION_DIR=$DEFAULT_HELM_CONFIGURATION_DIR
176         fi
177 elif test $DEFAULTS = yes; then
178         HELM_CONFIGURATION_DIR=$DEFAULT_HELM_CONFIGURATION_DIR
179 fi
180
181 AC_MSG_CHECKING(for configuration.xml)
182 if test -f $HELM_CONFIGURATION_DIR/configuration.xml; then
183         AC_MSG_RESULT(ok)
184 else
185         AC_MSG_RESULT(no)
186         AC_MSG_ERROR(please check your installation)
187 fi
188
189 AC_SUBST(PACKAGE)
190 AC_SUBST(VERSION)
191 AC_SUBST(OCAML_ROOT)
192 AC_SUBST(MLMINIDOM_LIB_DIR)
193 AC_SUBST(LABLGTK_LIB_DIR)
194 AC_SUBST(LABLGTKMATHVIEW_LIB_DIR)
195 AC_SUBST(BIN_DIR)
196 AC_SUBST(HELM_CONFIGURATION_DIR)
197 AC_SUBST(PERL_BINARY)
198
199 AC_OUTPUT([
200   Makefile
201   configuration.ml
202   helm_wget
203   helm_gtk_interface.spec
204 ],
205   chmod +x helm_wget
206 )