-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
186 lines (164 loc) · 5.1 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
AC_INIT(yices2,0.0.3)
AC_CONFIG_AUX_DIR([autoconf])
m4_include([ext/yices/autoconf/m4/csl_check_libs.m4]) # for CSL_STATIC_CHECK_GMP, CSL_CHECK_STATIC_LIBPOLY, etc...
AC_CANONICAL_HOST
: ${CFLAGS="-O2 -Wall -Wextra -Wconversion"}
AC_PROG_CC
AC_CHECK_HEADER(gmp.h, [],
[AC_MSG_ERROR(GMP headers required)])
AC_CHECK_FUNC(fopencookie, [
AC_DEFINE([HAVE_FOPENCOOKIE],[1],[Define if fopencookie available])
HAVE_FOPENCOOKIE=yes
])
AC_CHECK_FUNC(funopen, [
AC_DEFINE([HAVE_FUNOPEN], [1],[Define if funopen available])
HAVE_FUNOPEN=yes
])
AS_IF([test "x$HAVE_FUNOPEN$HAVE_FOPENCOOKIE" = x], [
AC_MSG_WARN(Your system support funopen or fopencookie: print functions not supported!)
])
AC_CHECK_PROG([OCAMLFIND], [ocamlfind], [ocamlfind])
AS_IF([test "x$OCAMLFIND" = x], AC_MSG_ERROR(Cannot find ocamlfind.))
AC_MSG_CHECKING([for ocamlfind ocamlc])
AS_IF([$OCAMLFIND ocamlc 1> /dev/null 2>&1], [
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
AC_MSG_ERROR("'ocamlfind' not configured correctly (cannot run 'ocamlc')")
])
AC_MSG_CHECKING([for ocamlfind ocamlopt])
AS_IF([$OCAMLFIND ocamlopt 1> /dev/null 2>&1], [
AC_MSG_RESULT(yes)
HAVE_OCAMLOPT=yes
], [
AC_MSG_RESULT(no)
AC_MSG_WARN("'ocamlopt' not installed or not configured in findlib.conf")
])
AC_MSG_CHECKING([for ocamlfind ocamldoc])
AS_IF([$OCAMLFIND ocamldoc 1> /dev/null 2>&1], [
AC_MSG_RESULT(yes)
HAVE_OCAMLDOC=yes
], [
AC_MSG_RESULT(no)
AC_MSG_WARN("'ocamldoc' not installed or not configured in findlib.conf")
])
AC_MSG_CHECKING([OCaml version])
OCAMLVERSION=`$OCAMLFIND ocamlc -version 2>/dev/null`
AC_MSG_RESULT([$OCAMLVERSION])
AS_VERSION_COMPARE($OCAMLVERSION, 3.12,
AC_MSG_ERROR([Please update to a newer version of ocaml.]))
AC_MSG_CHECKING([for OCaml library zarith])
AS_IF([$OCAMLFIND query zarith 1> /dev/null 2>&1], [
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
AC_MSG_ERROR([Cannot find zarith with 'ocamlfind'. Please install zarith.])
])
# OUnit is only needed for testing.
AC_MSG_CHECKING([for OCaml library ounit])
AS_IF([$OCAMLFIND query oUnit 1> /dev/null 2>&1], [
AC_MSG_RESULT(yes)
HAVE_OUNIT=yes
], [
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING([for OCaml binary annotations (.cmt, .cmti)])
AS_IF([$OCAMLFIND ocamlc -bin-annot 1> /dev/null 2>&1], [
AC_MSG_RESULT([yes])
BIN_ANNOT='-bin-annot'
ANNOTFLAG="-bin-annot -annot"
],[
AC_MSG_RESULT([no])
ANNOTFLAG="-annot"
])
AC_ARG_WITH([static-gmp],
[AS_HELP_STRING([--with-static-gmp=<path>],[Full path to a static GMP library
(e.g., libgmp.a). This static GMP will be used for zarith and for building
yices with gmp statically linked to libgmp.a. Without this option, -lgmp will be used.])],
[if test "x$withval" == x; then
AC_MSG_WARN([--with-static-gmp was used but no path was given. Using system libgmp.a or shared lib if not found.])
else
static_libgmp=$withval
fi
],
[])
#
# Options for forcing the use of shared gmp.
#
# By default, configure will search for a static version of each library. If
# the user wants to disable this behaviour, he can use these.
#
AC_ARG_WITH([shared-gmp],[AS_HELP_STRING([--with-shared-gmp],
[By default, a static version of the GMP library will be searched.
This option forces the use of the shared version.
This applies for both shared and static libraries.])],
[FORCE_SHARED_GMP=yes],
[FORCE_SHARED_GMP=no])
AC_SUBST(FORCE_SHARED_GMP)
if test $FORCE_SHARED_GMP = yes; then
AC_MSG_NOTICE([use gmp shared library (--with-shared-gmp)])
else
AC_MSG_NOTICE([trying to use static libgmp.a (to disable, use --with-shared-gmp)])
CSL_CHECK_STATIC_GMP([$static_libgmp],[])
fi
if test "x$STATIC_GMP" = x; then
AC_CHECK_LIB(gmp, __gmpz_init, [],
[AC_MSG_ERROR(GMP required, see https://gmplib.org)])
fi
# -fPIC is not necessary for mingw and cygwin because on windows, every
# object is position-indenpendant code. For other hosts, use -fPIC.
# The flag -DNOYICES_DLL disables the 'dll' mode on windows and allows to
# create a static library.
# -DCYGWIN and -DMINGW tell to the yices.h header to pick the right fonction
# calls (for getc()) that are specific to windows.
case $host_os in
mingw*)
CPPFLAGS+=" -DNOYICES_DLL -DMINGW"
;;
cygwin*)
CPPFLAGS+=" -DNOYICES_DLL -DCYGWIN"
;;
darwin*)
CPPFLAGS+=" -DMACOSX"
;;
sunos*)
CPPFLAGS+=" -DSOLARIS"
;;
linux*)
CPPFLAGS+=" -DLINUX -U_FORTIFY_SOURCE"
;;
freebsd*)
CPPFLAGS+=" -DFREEBSD"
;;
unix*)
CPPFLAGS+=" -DLINUX"
;;
*)
AC_MSG_ERROR([Don't know how to compile on $host_os])
;;
esac
case $host_os in
mingw* | cygwin*)
SO=dll
;;
linux* | *bsd* | unix* | sunos* | darwin*)
SO=so
;;
esac
AC_SUBST(SO)
AC_SUBST([ANNOTFLAG])
AC_SUBST([BIN_ANNOT])
AC_SUBST([HAVE_OCAMLOPT])
AC_SUBST([HAVE_OCAMLDOC])
AC_SUBST([HAVE_OUNIT])
AC_SUBST(CPPFLAGS)
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(STATIC_GMP)
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_FILES([Makefile.config META opam])
AC_OUTPUT
AC_MSG_NOTICE([summary:
Host: $host
Static gmp library: $STATIC_GMP
Use shared gmp instead of static: $FORCE_SHARED_GMP])