-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure.ac
186 lines (149 loc) · 5.81 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
# Copyright (c) 2009-2013, Mickaël Delahaye, http://micdel.fr
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
AC_INIT(ocamlyices,0.8.0)
CFLAGS="-O3 -fPIC"
LIBS="-lstdc++ -lm"
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
################################################################################
# Ocaml ########################################################################
AC_CHECK_PROG([OCAMLC], [ocamlc], [ocamlc])
AS_IF([test "x$OCAMLC" = x], [
AC_MSG_ERROR(Cannot find ocamlc.)
])
AC_MSG_CHECKING([for OCaml version])
OCAMLVERSION=`$OCAMLC -version`
AC_MSG_RESULT([$OCAMLVERSION])
AC_MSG_CHECKING([for OCaml stdlib path])
OCAMLLIB=`$OCAMLC -where`
AC_MSG_RESULT([$OCAMLLIB])
LDFLAGS="$LDFLAGS -L$OCAMLLIB"
CPPFLAGS="$CPPFLAGS -I$OCAMLLIB"
AC_CHECK_PROG([OCAMLFIND], [ocamlfind], [ocamlfind])
AS_IF([ test "x$OCAMLFIND" = x ], [
AC_MSG_ERROR([Cannot find ocamlfind.])
])
AC_CHECK_PROG([OCAMLOPT], [ocamlopt], [ocamlopt])
AS_IF([ test "x$OCAMLOPT" = x ], [
AC_MSG_ERROR([Cannot find ocamlopt.])
])
AC_MSG_CHECKING([for OCaml version consistency])
TMPVERSION=`$OCAMLOPT -version`
AS_IF([ test "$TMPVERSION" != "$OCAMLVERSION" ], [
AC_MSG_RESULT([no])
AC_MSG_ERROR([Version differs $TMPVERSION != $OCAMLVERSION])
], [
AC_MSG_RESULT([yes])
])
AC_CHECK_PROG([OCAMLDOC], [ocamldoc], [ocamldoc])
AS_IF([ test "x$OCAMLDOC" = x ], [
AC_MSG_ERROR([Cannot find ocamldoc.])
])
################################################################################
# Camlidl ######################################################################
AC_CHECK_PROG([CAMLIDL], [camlidl], [camlidl])
AS_IF([ test "x$CAMLIDL" = x ], [
AC_MSG_ERROR(Cannot find camlidl.)
])
AC_MSG_CHECKING([for camlidl's package])
CAMLIDLPATH=`ocamlfind query camlidl || true`
AS_IF([ test "x$CAMLIDLPATH" = x ], [
AC_MSG_RESULT([unknown])
], [
AC_MSG_RESULT([$CAMLIDLPATH])
AC_MSG_NOTICE([add camlidl to library search path])
CPPFLAGS="$CPPFLAGS -I$CAMLIDLPATH"
LDFLAGS="$LDFLAGS -L$CAMLIDLPATH"
])
AC_CHECK_HEADER([caml/camlidlruntime.h], [], [
AC_MSG_ERROR([Cannot find "caml/camlidlruntime.h".])
])
################################################################################
# Yices library ################################################################
# Add Yices as a library dependency
LIBS="-lyices $LIBS"
# Checks if GMP is built in Yices (if it is there)
AC_CHECK_FUNC([__gmpz_init], [
STATIC_YICES=yes
], [
# __gmpz_init is not available yet, but, for all we know, neither is Yices
STATIC_YICES=
# add GMP, reported to be needed on some systems (tari3x), still stands?
LIBS="$LIBS -lgmp"
])
# Checks if Yices is really there now (with GMP if needed)
AC_CHECK_FUNC([yices_version], [], [
AC_MSG_ERROR([Cannot find yices.
Please download and install Yices 1.0.40 or more recent (but not 2).
(1) Download the latest tarball of Yices from SRI website:
http://yices.csl.sri.com/download.shtml
(2) Install it on your system (libraries and headers).
You may use either the following command:
wget -q -O- http://git.io/sWxMmg | sh -s yices-XYZ.tar.gz
In both case, yices-XYZ.tar.gz should be replaced with the path to the
downloaded tarball. Also, additional parameters can be added to specify
installation directories (root and library path), e.g.:
wget -q -O- http://git.io/sWxMmg | sh -s <yices-XYZ.tar.gz> --prefix /opt --libdir /opt/lib64
])
])
# Prints linking information
AS_IF([ test -n "$STATIC_YICES" ], [
AC_MSG_NOTICE([Yices with GMP statically linked])
AC_MSG_NOTICE([OCamlyices will be linked with libyices.a])
], [
AC_MSG_NOTICE([Yices with GMP dynamically linked])
AC_MSG_NOTICE([OCamlyices will be linked with libyices.so])
])
DEFAULT_CUSTOM=no
AC_MSG_CHECKING([whether Yices can be linked into a shared library])
YDLC_TEST=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -shared -xc - $LIBS -o - <<EOF > /dev/null 2> /dev/null && echo yes
extern const char* yices_version();
const char* myf() {
return yices_version();
}
EOF`
AS_IF([ test "x$YDLC_TEST" == xyes ], [
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
AC_MSG_WARN([Ocaml custom compilation necessary.])
AC_MSG_NOTICE([Custom compilation by default (--enable-custom to override).])
DEFAULT_CUSTOM=yes
])
################################################################################
# Options ######################################################################
AC_ARG_ENABLE(custom,
[ AS_HELP_STRING([--enable-custom], [Custom compilation (ocamlc option)]) ],
[ CUSTOM=${enableval} ], [ CUSTOM=$DEFAULT_CUSTOM ])
AC_ARG_ENABLE(partial-linking,
[ AS_HELP_STRING([--disable-partial-linking],
[Disable incremental compilation]) ],
[ PARTIAL_LINKING=${enableval} ], [ PARTIAL_LINKING=yes ])
AS_IF([ test "x$PARTIAL_LINKING" = xno ], [ PARTIAL_LINKING= ])
AS_IF([ test "x$CUSTOM" = xno ], [ CUSTOM= ])
################################################################################
################################################################################
AC_SUBST(PARTIAL_LINKING)
AC_SUBST(CUSTOM)
AC_SUBST(OCAMLC)
AC_SUBST(CAMLIDL)
AC_SUBST(OCAMLOPT)
AC_SUBST(OCAMLDOC)
AC_SUBST(OCAMLDEP)
AC_SUBST(OCAMLFIND)
AC_SUBST(DESTDIR)
AC_SUBST(STATIC_YICES)
AC_CONFIG_FILES([ Makefile ], [ chmod a-w Makefile ])
AC_OUTPUT