forked from coq-community/coq-dpdgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
228 lines (198 loc) · 6.3 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This file is part of the DpdGraph tools.
# Copyright (C) 2009-2017 Anne Pacalet (Anne.Pacalet@free.fr)
# and Yves Bertot (Yves.Bertot@inria.fr)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This file is distributed under the terms of the
# GNU Lesser General Public License Version 2.1
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# the script generated by autoconf from this input
# will set several variables: (see AC_SUBST at the end of this file)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AC_INIT(coq-dpdgraph,0.6.3)
AC_MSG_NOTICE(AC_PACKAGE_NAME version AC_PACKAGE_VERSION)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
new_section() {
title="~~ $1 "
banner=$(echo "$title" | sed -e 's/./~/g')
AC_MSG_NOTICE($banner)
AC_MSG_NOTICE($title)
AC_MSG_NOTICE($banner)
}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
new_section "OCaml compilers"
AC_CHECK_PROG(OCAMLC,ocamlc,ocamlc,no)
if test "$OCAMLC" = no ; then
AC_MSG_ERROR(Cannot find ocamlc.)
fi
AC_MSG_CHECKING(ocamlc version)
OCAMLVERSION=$($OCAMLC -version)
AC_MSG_RESULT($OCAMLVERSION)
case $OCAMLVERSION in
0.*|1.*|2.*|3.*)
AC_MSG_ERROR(AC_PACKAGE_NAME needs ocaml version 4.00.0 or higher)
;;
esac
AC_MSG_CHECKING(ocamlc -safe-string option)
case $OCAMLVERSION in
4.00.*|4.01.*)
AC_MSG_RESULT(no)
;;
*)
OCAML_EXTRA_OPTS="-safe-string"; AC_MSG_RESULT(yes)
;;
esac
AC_MSG_CHECKING(ocaml library path)
OCAMLLIB=$($OCAMLC -where | tr -d '\r')
AC_MSG_RESULT($OCAMLLIB)
# then we look for ocamlopt; if not present, we issue a warning
# if the version is not the same, we also discard it
# we set OCAMLBEST to "opt" or "byte", whether ocamlopt is available or not
AC_CHECK_PROG(OCAMLOPT,ocamlopt,ocamlopt,no)
OCAMLBEST=byte
if test "$OCAMLOPT" = no ; then
AC_MSG_WARN(cannot find ocamlopt; bytecode compilation only.)
else
AC_MSG_CHECKING(ocamlopt version)
TMPVERSION=$($OCAMLOPT -version)
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
AC_MSG_RESULT($TMPVERSION)
AC_MSG_WARN(version differs from ocamlc; ocamlopt discarded.)
OCAMLOPT=no
else
AC_MSG_RESULT(ok)
OCAMLBEST=opt
fi
fi
AC_CHECK_PROG(OCAMLCDOTOPT,ocamlc.opt,ocamlc.opt,no)
if test "$OCAMLCDOTOPT" != no ; then
AC_MSG_CHECKING(ocamlc.opt version)
TMPVERSION=$($OCAMLCDOTOPT -version)
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
AC_MSG_RESULT($TMPVERSION)
AC_MSG_WARN(version differs from ocamlc; ocamlc.opt discarded.)
else
AC_MSG_RESULT(ok)
OCAMLC=$OCAMLCDOTOPT
fi
fi
AC_CHECK_PROG(OCAMLOPTDOTOPT,ocamlopt.opt,ocamlopt.opt,no)
if test "$OCAMLOPTDOTOPT" != no ; then
AC_MSG_CHECKING(ocamlc.opt version)
TMPVERSION=$($OCAMLOPTDOTOPT -version)
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
AC_MSG_RESULT($TMPVERSION)
AC_MSG_WARN(version differs from ocamlc; ocamlopt.opt discarded.)
else
AC_MSG_RESULT(ok)
OCAMLOPT=$OCAMLOPTDOTOPT
fi
fi
# ocamldep, ocamllex and ocamlyacc should also be present in the path
AC_CHECK_PROG(OCAMLDEP,ocamldep,ocamldep,no)
if test "$OCAMLDEP" = no ; then
AC_MSG_ERROR(Cannot find ocamldep.)
fi
AC_CHECK_PROG(OCAMLLEX,ocamllex,ocamllex,no)
if test "$OCAMLLEX" = no ; then
AC_MSG_ERROR(Cannot find ocamllex.)
else
AC_CHECK_PROG(OCAMLLEXDOTOPT,ocamllex.opt,ocamllex.opt,no)
if test "$OCAMLLEXDOTOPT" != no ; then
OCAMLLEX=$OCAMLLEXDOTOPT
fi
fi
AC_CHECK_PROG(OCAMLYACC,ocamlyacc,ocamlyacc,no)
if test "$OCAMLYACC" = no ; then
AC_MSG_ERROR(Cannot find ocamlyacc.)
fi
AC_CHECK_PROG(OCAMLDOC,ocamldoc,ocamldoc,true)
if test "$OCAMLDOC" = true ; then
AC_MSG_WARN(Cannot find ocamldoc)
else
AC_CHECK_PROG(OCAMLDOCOPT,ocamldoc.opt,ocamldoc.opt,no)
if test "$OCAMLDOCOPT" != no ; then
OCAMLDOC=$OCAMLDOCOPT
fi
fi
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
new_section "ocamlgraph"
AC_CHECK_PROG(OCAMLFIND,ocamlfind,ocamlfind,no)
if test "$OCAMLFIND" = "no" ; then
AC_MSG_WARN(No ocamlfind detected)
else
AC_MSG_CHECKING(ocamlfind compatibility)
OCAMLLIB_BY_FINDLIB=$(ocamlfind printconf stdlib | tr -d '\r')
if test "$OCAMLLIB_BY_FINDLIB" = "$OCAMLLIB" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_WARN(ocamlfind detected but disabled. Standard libraries differ:)
echo " ocamlc: '$OCAMLLIB'"
echo " ocamlfind: '$OCAMLLIB_BY_FINDLIB'"
OCAMLFIND="no"
fi
fi
AC_MSG_CHECKING(ocamlgraph package)
if test "$OCAMLFIND" = "no"; then
if test -f "$OCAMLLIB/ocamlgraph/graph.cmxa" ; then
OCAMLGRAPH=yes
else
OCAMLGRAPH=no
fi
OCAMLGRAPH_PATH=+ocamlgraph
else
OCAMLGRAPH_PATH=$(ocamlfind query ocamlgraph | tr -d '\r')
if test "$OCAMLGRAPH_PATH" = "" ;then
OCAMLGRAPH=no
fi
fi
if test "$OCAMLGRAPH" = no ; then
AC_MSG_RESULT(no)
AC_MSG_ERROR(ocamlgraph is not found.)
else
AC_MSG_RESULT($OCAMLGRAPH_PATH)
fi
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
new_section "Coq"
AC_CHECK_PROG(COQC,coqc,coqc,no)
if test "$COQC" = no ; then
AC_MSG_ERROR(Cannot find coqc.)
fi
AC_MSG_CHECKING(coq version)
COQVERSION=$($COQC -v | sed -n -e 's|.*version *\(.*\)$|\1|p' )
AC_MSG_RESULT($COQVERSION)
case $COQVERSION in
8.1*|8.2*|8.3*|8.4*|8.5*|8.6*|8.7*)
AC_MSG_ERROR(AC_PACKAGE_NAME needs Coq version 8.8 or higher)
;;
esac
AC_CHECK_PROG(COQ_MAKEFILE,coq_makefile,coq_makefile,no)
if test "$COQ_MAKEFILE" = no ; then
AC_MSG_ERROR(cannot find coq_makefile.)
fi
BINDIR_PRE=$(which coqc)
BINDIR=$(dirname $BINDIR_PRE)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
new_section "creating Makefile"
# substitutions to perform
AC_SUBST(PACKAGE_NAME)
AC_SUBST(PACKAGE_VERSION)
AC_SUBST(OCAMLC)
AC_SUBST(OCAMLOPT)
AC_SUBST(OCAMLDEP)
AC_SUBST(OCAMLLEX)
AC_SUBST(OCAMLYACC)
# AC_SUBST(OCAMLDOC) TODO: use it in Makefile
# AC_SUBST(OCAMLBEST) TODO: use it in Makefile
# AC_SUBST(OCAMLVERSION)
# AC_SUBST(OCAMLLIB)
AC_SUBST(OCAML_EXTRA_OPTS)
AC_SUBST(COQC)
AC_SUBST(COQ_MAKEFILE)
AC_SUBST(BINDIR)
AC_SUBST(OCAMLGRAPH_PATH)
# Finally create the Makefile from Makefile.in
AC_OUTPUT(Makefile)
chmod a-w Makefile
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~