forked from cubicle-model-checker/cubicle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
154 lines (131 loc) · 4.19 KB
/
configure.in
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
##########################################################################
# #
# Cubicle #
# #
# Copyright (C) 2011-2014 #
# #
# Sylvain Conchon and Alain Mebsout #
# Universite Paris-Sud 11 #
# #
# #
# This file is distributed under the terms of the Apache Software #
# License version 2.0 #
# #
##########################################################################
AC_INIT(main.ml)
m4_include([m4/ax_compare_version.m4])
AC_CHECK_PROG(OCAMLC,ocamlc.opt,ocamlc.opt,no)
if test "$OCAMLC" = no ; then
AC_MSG_ERROR(Cannot find ocamlc.)
fi
MINOCAMLVERSION=4.03.0
OCAMLVERSION=`$OCAMLC -version`
echo "OCaml version is $OCAMLVERSION"
AX_COMPARE_VERSION([$OCAMLVERSION], [ge], [$MINOCAMLVERSION],
[], [badocaml=yes])
if test "$badocaml" = yes; then
AC_MSG_ERROR(Need OCaml version $MINOCAMLVERSION or higher.)
fi
OCAMLLIB=`$OCAMLC -where`
echo "OCaml library path is $OCAMLLIB"
# we look for ocamlfind; if not present, we just don't use it to find
# libraries
AC_CHECK_PROG(USEOCAMLFIND,ocamlfind,yes,no)
if test "$USEOCAMLFIND" = yes; then
OCAMLFINDLIB=$(ocamlfind printconf stdlib)
OCAMLFIND=$(which ocamlfind)
if test "$OCAMLFINDLIB" != "$OCAMLLIB"; then
USEOCAMLFIND=no;
echo "but your ocamlfind is not compatible with your ocamlc:"
echo "ocamlfind : $OCAMLFINDLIB, ocamlc : $OCAMLLIB"
fi
fi
AC_CHECK_PROG(OCAMLOPT,ocamlopt.opt,ocamlopt.opt,no)
OCAMLBEST=byte
if test "$OCAMLOPT" = no ; then
AC_MSG_WARN(Cannot find ocamlopt; bytecode compilation only.)
else
OCAMLBEST=opt
fi
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.)
fi
AC_CHECK_PROG(OCAMLYACC,ocamlyacc,ocamlyacc,no)
if test "$OCAMLYACC" = no ; then
AC_MSG_ERROR(Cannot find ocamlyacc.)
fi
#looking for functory library
if test "$USEOCAMLFIND" = yes; then
FUNCTORYLIB=$(ocamlfind query -i-format functory)
fi
if test -n "$FUNCTORYLIB";then
echo "ocamlfind found functory in $FUNCTORYLIB"
FUNCTORYLD=yes
else
AC_CHECK_FILE($OCAMLLIB/functory/functory.cma,FUNCTORYLD=yes,FUNCTORYLD=no)
if test "$FUNCTORYLD" = no ; then
AC_MSG_RESULT(Cannot find functory library.)
FUNCTORYLIB=""
else
FUNCTORYLIB="-I +functory"
fi
fi
#looking for Z3 ocaml bindings
AC_ARG_WITH([z3],
AS_HELP_STRING([--with-z3], [enable support for Z3 backend SMT solver] ),
[],
[with_z3=no])
Z3LIB=""
Z3CCFLAGS=""
AS_IF([test "x$with_z3" != xno],
if test "$USEOCAMLFIND" = yes; then
Z3LIB=$(ocamlfind query -i-format Z3)
Z3CCFLAGS="-cclib \"-L$(ocamlfind query Z3) -lz3\""
fi
if test -n "$Z3LIB";then
echo "ocamlfind found Z3 bindings in $Z3LIB"
Z3LD=yes
else
AC_CHECK_FILE($OCAMLLIB/Z3/z3.cma,Z3LD=yes,Z3LD=no)
if test "$Z3LD" = no ; then
AC_MSG_RESULT(Cannot find Z3 OCaml bindings.)
else
Z3LIB="-I +z3"
Z3CCFLAGS="-cclib \"-L$OCAMLLIB/Z3 -lz3\""
fi
fi
,
AC_MSG_RESULT(Compiling without support for Z3.)
)
AC_MSG_CHECKING(platform)
if echo "let _ = Sys.os_type" | ocaml | grep -q Win32; then
echo "Windows platform"
AC_MSG_RESULT(Win32)
OCAMLWIN32=yes
EXE=.exe
else
echo "Unix platform"
OCAMLWIN32=no
EXE=
fi
AC_SUBST(OCAMLC)
AC_SUBST(OCAMLOPT)
AC_SUBST(OCAMLDEP)
AC_SUBST(OCAMLLEX)
AC_SUBST(OCAMLYACC)
AC_SUBST(OCAMLBEST)
AC_SUBST(OCAMLVERSION)
AC_SUBST(OCAMLLIB)
AC_SUBST(ALTERGOLIB)
AC_SUBST(FUNCTORYLIB)
AC_SUBST(Z3LIB)
AC_SUBST(Z3CCFLAGS)
AC_SUBST(OCAMLWIN32)
AC_SUBST(EXE)
AC_OUTPUT(Makefile)
chmod a-w Makefile