Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / configure.ac @ a4158a4b

History | View | Annotate | Download (9.4 KB)

1
define([gitversion], esyscmd([sh -c "git log --oneline | wc -l | tr -d ' \n'"]))
2

    
3
AC_INIT([lustrec], 1.7-gitversion, [ploc@garoche.net])
4
AC_SUBST(VERSION_NUMBER, 1.7)
5
AC_SUBST(VERSION_CODENAME, "Xia/Huai-dev")
6

    
7
gitbranch=`git branch | grep \* | sed "s/\*[ ]*//"`
8
AC_SUBST(GITBRANCH, "$gitbranch")
9
if test x"$GITBRANCH" != "xmaster"; then
10
  AC_SUBST(CDASHSUBPROJ, "unstable")
11
else
12
  AC_SUBST(CDASHSUBPROJ, "master")
13
fi
14

    
15
# Next release will be
16
#AC_INIT([lustrec], [1.8], [ploc@garoche.net])
17
#AC_SUBST(VERSION_CODENAME, "Xia/Mang")
18
AC_MSG_NOTICE(Git branch: ${GITBRANCH})
19
AC_CONFIG_SRCDIR([src/main_lustre_compiler.ml])
20
AC_CONFIG_SRCDIR([src/main_lustre_testgen.ml])
21

    
22
AC_PATH_PROG([OCAMLC],[ocamlc],[:])
23
AC_MSG_CHECKING(OCaml version)
24
ocamlc_version=`$OCAMLC -v | grep version | rev| cut -d \  -f 1 | rev`
25
major=`echo $ocamlc_version | cut -d . -f 1`
26
minor=`echo $ocamlc_version | cut -d . -f 2`
27
if (test "$major" -lt 3 -a "$minor" -lt 11 ); then
28
  AC_MSG_ERROR([Ocaml version must be at least 3.11. You have version $ocamlc_version])
29
fi
30
AC_MSG_RESULT(valid ocaml version detected: $ocamlc_version)
31

    
32
AC_PATH_PROG([OCAMLBUILD],[ocamlbuild],[:])
33

    
34
# Handle a mismatch in available function btw 4.02 and 4.04
35
if (test $"$major" -eq 4 -a "$minor" -gt 2); then
36
   AC_SUBST(UPPERCASEFUN, "String.uppercase_ascii")
37
else
38
   AC_SUBST(UPPERCASEFUN, "String.uppercase")
39
fi
40

    
41
# default prefix is /usr/local
42
AC_PREFIX_DEFAULT(/usr/local)
43

    
44
dnl AC_ARG_WITH([ocamlgraph-path],
45
dnl         [AS_HELP_STRING([--ocamlgraph-path],
46
dnl               [specify the path of ocamlgraph library. graph.cmxa should be in ocamlgraph-path @<:@default=$(ocamlfind query ocamlgraph)@:>@])],
47
dnl         [AS_IF([test "x$ocamlgraph_path" = xno],
48
dnl                 [AC_MSG_ERROR([ocamlgraph library is needed])],
49
dnl                 [test "x$ocamlgraph_path" = xyes],
50
dnl                 [OCAMLGRAPH_PATH=$(ocamlfind query ocamlgraph)],
51
dnl                 [OCAMLGRAPH_PATH=$ocamlgraph_path]
52
dnl         )],
53
dnl         [OCAMLGRAPH_PATH=$(ocamlfind query ocamlgraph)]
54
dnl )
55
dnl AC_SUBST(OCAMLGRAPH_PATH)
56

    
57

    
58
# Checking libs
59
AC_CHECK_PROG(FINDLIB_CHECK,ocamlfind,yes)
60
if test x"$FINDLIB_CHECK" != x"yes" ; then
61
   AC_MSG_ERROR(ocamlfind required!)
62
fi
63
dnl AC_MSG_RESULT(Hourrah: ocamlfind found!)
64

    
65
# Checks for libraries.
66
# OCamlgraph
67
AC_MSG_CHECKING(ocaml libraries required (ocamlgraph cmdliner fmt logs num)) 
68
AS_IF([ocamlfind query ocamlgraph cmdliner fmt logs num >/dev/null 2>&1],
69
    [],[AC_MSG_ERROR(A few ocaml library required. opam install ocamlgraph cmdliner fmt logs num should solve the issue)],
70
)
71
AC_MSG_RESULT(yes)
72

    
73
#Yojson
74
AC_MSG_CHECKING(yojson library (optional))
75
AS_IF([ocamlfind query yojson >/dev/null 2>&1],
76
    [yojson=yes; AC_MSG_RESULT(yes)],[yojson=no; AC_MSG_WARN(Yojson required for lustresf. opam install yojson should solve the issue)],
77
)
78

    
79
# Seal
80
AC_MSG_CHECKING(seal library (optional))
81
AS_IF([ocamlfind query seal >/dev/null 2>&1],
82
    [seal=yes; AC_MSG_RESULT(yes)],[seal=no; AC_MSG_RESULT(no)],
83
)
84
AS_IF([test "x$seal" = "xyes"], [
85
   AC_SUBST(LUSTREV_SEAL, "(module Seal_verifier.Verifier : VerifierType.S);")
86
   AC_SUBST(LUSTREV_SEAL_TAG, "<**/*>: package(seal)")
87
])
88

    
89
# z3 (optional)
90

    
91
# option to rely on github version if installed
92
AC_ARG_WITH(z3_github, [AS_HELP_STRING([--with-z3-github],
93
              [Rely on Z3 as distributed by the official github
94
	       repo rather then the opam distribution. Disabled by default.])])
95

    
96
AS_IF([test "x$with_z3_github" != "xyes"],
97
      [z3name=z3],
98
      [z3name=Z3]
99
      )
100
	
101
AC_MSG_CHECKING(z3 library)
102

    
103

    
104
#define([z3path], esyscmd([ocamlfind query z3 | tr -d '\n']))
105
#define([z3path], esyscmd([opam config var Z3:lib | tr -d '\n']))
106

    
107
AS_IF([ocamlfind query $z3name >/dev/null 2>&1],
108
    [z3=yes; AC_MSG_RESULT([yes])],[zustre=no; AC_MSG_RESULT(no)],
109
)
110
AS_IF([test "x$z3" = "xyes"], [
111
   AC_SUBST(LUSTREV_ZUSTRE, "(module Zustre_verifier.Verifier : VerifierType.S);")
112
   AC_SUBST(LUSTREV_Z3_TAG, "<**/*verifier.native> or <tools/zustre/*.ml> or <tools/zustre/*.mli>: package($z3name)")
113
   AS_IF([test "x$z3name" = "xZ3"],
114
   	       [define([Z3path], esyscmd([ocamlfind query Z3 | tr -d '\n']))
115
	        AC_SUBST(Z3LIBPATH, "Z3path")],
116
 	       [define([z3path], esyscmd([ocamlfind query z3 | tr -d '\n']))
117
	        AC_SUBST(Z3LIBPATH, "z3path")]
118
		)
119
])
120

    
121

    
122
# Tiny
123
AC_MSG_CHECKING(tiny library (optional))
124
AS_IF([ocamlfind query tiny >/dev/null 2>&1],
125
    [tiny=yes; AC_MSG_RESULT(yes)],[tiny=no; AC_MSG_RESULT(no)],
126
)
127
AS_IF([test "x$tiny" = "xyes"], [
128
   AC_SUBST(LUSTREV_TINY, "(module Tiny_verifier.Verifier : VerifierType.S);")
129
   AC_SUBST(LUSTREV_TINY_TAG, "<**/*>: package(tiny)")
130
])
131

    
132
# Salsa
133
AC_ARG_ENABLE(salsa, [AS_HELP_STRING([--disable-salsa],
134
              [disable Salsa plugin. Enabled by default if available.])])
135

    
136
AC_MSG_CHECKING(salsa library)
137
AS_IF([ocamlfind query salsa >/dev/null 2>&1],
138
    [salsa=yes; AC_MSG_RESULT(yes)],[salsa=no; AC_MSG_WARN(no)]
139
)
140

    
141

    
142
AS_IF([test "x$enable_salsa" != "xno"], [
143
  if (test "x$salsa" = xyes ); then
144
   AC_SUBST(SALSA, "(module Salsa_plugin.Plugin : PluginType.S);")
145
   AC_SUBST(SALSA_TAG, "<**/*.native> or <plugins/salsa/*.cm?> : package(salsa)")
146
  fi
147
])
148

    
149
# GMP
150
AC_CHECK_LIB(gmp, __gmpz_init,
151
      [gmp=yes],
152
      [AC_MSG_RESULT([GNU MP not found])
153
      gmp=no])
154

    
155
AC_CHECK_LIB(mpfr, mpfr_add, [mpfr=yes],
156
		   [AC_MSG_RESULT(
157
[MPFR not found])
158
mpfr=no])
159

    
160
# lustresf
161
AC_ARG_ENABLE(lustresf, [AS_HELP_STRING([--disable-lustresf],
162
              [disable lustresf compilation. Enabled by default.])])
163

    
164
AC_SUBST_FILE(lustresf)
165
AC_SUBST_FILE(lustresf_src)
166
lustresf=/dev/null
167
lustresf_src=/dev/null
168

    
169
AS_IF([test "x$enable_lustresf" != "xno"], [
170
  AC_MSG_CHECKING(yojson library for lustresf)
171
  AS_IF([ocamlfind query yojson >/dev/null 2>&1],
172
      [yojson=yes; AC_MSG_RESULT(yes)],[yojson=no; AC_MSG_ERROR(Yojson required for lustresf. opam install yojson should solve the issue)],
173
  )
174
  lustresf=Makefile-lustresf.in
175
  lustresf_src=src/Makefile-lustresf.in
176
  AC_SUBST(lustresf_target, "lustresf")
177
])
178

    
179
# Checking availability of path to regression tests
180
tests_path="../lustrec-tests/regression_tests"
181

    
182
AC_ARG_WITH([tests-path],
183
            [AS_HELP_STRING([--with-tests-path],
184
               [provides path to test suite (default is ../lustrec-test if available)])],
185
            [tests_path="$withval";
186
	     if (test "x$tests_path" = xyes); then
187
	       AC_MSG_ERROR(Option --with-tests-path requires a parameter: eg. --with-tests-path=value);
188
	     fi],
189
            )
190
AC_MSG_NOTICE($tests_path)
191
AC_CHECK_FILE(${tests_path}/CMakeLists.txt,
192
              [
193
	      valid_test_path=true
194
	      ],
195
	      [
196
	      valid_test_path=false
197
	        AC_SUBST(PATH_TO_TESTS, $tests_path)	      ])
198
AC_SUBST(PATH_TO_TESTS_DEFINED, $valid_test_path)
199
AC_SUBST(PATH_TO_TESTS, $tests_path)
200

    
201
# End of config
202

    
203
AC_DEFUN([AC_DEFINE_DIR], [
204
  prefix_NONE=
205
  exec_prefix_NONE=
206
  test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
207
  test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
208
dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
209
dnl refers to ${prefix}.  Thus we have to use `eval' twice.
210
  eval ac_define_dir="\"[$]$2\""
211
  eval ac_define_dir="\"$ac_define_dir\""
212
  AC_SUBST($1, "$ac_define_dir")
213
  AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3])
214
  test "$prefix_NONE" && prefix=NONE
215
  test "$exec_prefix_NONE" && exec_prefix=NONE
216
])
217

    
218
AC_DEFINE_DIR([abs_datadir], [datadir])
219

    
220
# Instanciation
221
AC_CONFIG_FILES([opam
222
		 Makefile
223
		 src/Makefile
224
		 src/version.ml
225
		 src/pluginList.ml
226
		 src/verifierList.ml
227
		 src/_tags
228
		 src/ocaml_utils.ml
229
		 include/z3librc
230
		 share/FindLustre.cmake
231
		 ])
232

    
233
AC_OUTPUT
234

    
235

    
236
# summary
237
AC_MSG_NOTICE(******** Configuration ********)
238
AC_MSG_NOTICE(bin path:     $prefix/bin)
239
AC_MSG_NOTICE(include path: $prefix/include)
240
AC_MSG_NOTICE(********    Plugins    ********)
241

    
242
  if (test "x$gmp" = xyes -a "x$mpfr" = xyes ); then
243
      AC_MSG_NOTICE([MPFR option enabled])
244
  else
245
      AC_MSG_WARN([MPFR option cannot be activated. Requires GMP and MPFR libs])
246
  fi
247

    
248
  if (test "x$salsa" = xyes -a "x$enable_salsa" != xno); then
249
      AC_MSG_NOTICE([Salsa plugin enabled])
250
  else
251
      AC_MSG_NOTICE([Salsa plugin disabled])
252
  fi
253

    
254
  if (test "x$yojson" = xyes -a "x$enable_lustresf" != "xno"); then
255
      AC_MSG_NOTICE([lustresf available])
256
  else
257
      if (test "x$enable_lustresf" = "xno"); then
258
        AC_MSG_NOTICE([lustresf not available (you explicitely disabled it)])
259
      else
260
        AC_MSG_NOTICE([lustresf not available])
261
      fi
262
  fi
263
AC_MSG_NOTICE(********   Verifiers    ********)
264

    
265
  if (test "x$seal" = "xyes"); then
266
      AC_MSG_NOTICE([Seal   enabled])
267
  else
268
      AC_MSG_NOTICE([Seal   disabled. Require Seal library])
269
  fi
270

    
271
  if (test "x$z3" = xyes); then
272
      AC_MSG_NOTICE([Zustre enabled])
273
      AC_MSG_WARN(Z3 shared lib (libz3.so) has to be available in the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH in OSX).)
274
      dnl AC_MSG_WARN(It is currently located in "z3path")
275
      AC_MSG_WARN(If not already available run "source ${prefix}/include/lustrec/z3librc")
276
      AC_MSG_WARN(or add that line to your ~/.profile or ~/.bashrc)
277
else
278
      AC_MSG_NOTICE([Zustre disabled. Require Z3 ocaml library])
279
  fi
280

    
281
  if (test "x$tiny" = xyes); then
282
      AC_MSG_NOTICE([Tiny   enabled])
283
  else
284
      AC_MSG_NOTICE([Tiny   disabled. Require Tiny library])
285
  fi
286

    
287
AC_MSG_NOTICE(****** Regression Tests  ******)
288
if (test "x$valid_test_path" = xfalse); then
289
  AC_MSG_NOTICE(no valid tests path provided ($tests_path))
290
else
291
AC_MSG_NOTICE(tests path: $tests_path)
292
fi
293
AC_MSG_NOTICE(******** Configuration ********)
294
AC_MSG_NOTICE(Execute "make; make install" now)