Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / configure.ac @ 3d3718ae

History | View | Annotate | Download (8.58 KB)

1
define([gitversion], esyscmd([sh -c "git log --oneline | wc -l | tr -d '\n'"]))
2
define([gitbranch], esyscmd([sh -c "git branch | grep \* | cut -d ' ' -f2"]))
3
AC_INIT([lustrec], 1.5-gitversion, [ploc@garoche.net])
4
AC_SUBST(VERSION_CODENAME, "Xia/Shao Kang-dev")
5
AC_SUBST(GITBRANCH, gitbranch)
6
# Next release will be
7
#AC_INIT([lustrec], [1.6], [ploc@garoche.net])
8
#AC_SUBST(VERSION_CODENAME, "Xia/Zhu")
9
AC_MSG_NOTICE(Git branch: ${GITBRANCH})
10
AC_CONFIG_SRCDIR([src/main_lustre_compiler.ml])
11
AC_CONFIG_SRCDIR([src/main_lustre_testgen.ml])
12

    
13
AC_PATH_PROG([OCAMLC],[ocamlc],[:])
14
AC_MSG_CHECKING(OCaml version)
15
ocamlc_version=`$OCAMLC -v | grep version | rev| cut -d \  -f 1 | rev`
16
major=`echo $ocamlc_version | cut -d . -f 1`
17
minor=`echo $ocamlc_version | cut -d . -f 2`
18
if (test "$major" -lt 3 -a "$minor" -lt 11 ); then
19
  AC_MSG_ERROR([Ocaml version must be at least 3.11. You have version $ocamlc_version])
20
fi
21
AC_MSG_RESULT(valid ocaml version detected: $ocamlc_version)
22

    
23
AC_PATH_PROG([OCAMLBUILD],[ocamlbuild],[:])
24

    
25
# Handle a mismatch in available function btw 4.02 and 4.04
26
if (test $"$major" -eq 4 -a "$minor" -gt 2); then
27
   AC_SUBST(UPPERCASEFUN, "String.uppercase_ascii")
28
else
29
   AC_SUBST(UPPERCASEFUN, "String.uppercase")
30
fi
31

    
32
# default prefix is /usr/local
33
AC_PREFIX_DEFAULT(/usr/local)
34

    
35
dnl AC_ARG_WITH([ocamlgraph-path],
36
dnl         [AS_HELP_STRING([--ocamlgraph-path],
37
dnl               [specify the path of ocamlgraph library. graph.cmxa should be in ocamlgraph-path @<:@default=$(ocamlfind query ocamlgraph)@:>@])],
38
dnl         [AS_IF([test "x$ocamlgraph_path" = xno],
39
dnl                 [AC_MSG_ERROR([ocamlgraph library is needed])],
40
dnl                 [test "x$ocamlgraph_path" = xyes],
41
dnl                 [OCAMLGRAPH_PATH=$(ocamlfind query ocamlgraph)],
42
dnl                 [OCAMLGRAPH_PATH=$ocamlgraph_path]
43
dnl         )],
44
dnl         [OCAMLGRAPH_PATH=$(ocamlfind query ocamlgraph)]
45
dnl )
46
dnl AC_SUBST(OCAMLGRAPH_PATH)
47

    
48

    
49
# Checking libs
50
AC_CHECK_PROG(FINDLIB_CHECK,ocamlfind,yes)
51
if test x"$FINDLIB_CHECK" != x"yes" ; then
52
   AC_MSG_ERROR(ocamlfind required!)
53
fi
54
dnl AC_MSG_RESULT(Hourrah: ocamlfind found!)
55

    
56
# Checks for libraries.
57
# OCamlgraph
58
AC_MSG_CHECKING(ocaml libraries required (ocamlgraph cmdliner fmt logs num)) 
59
AS_IF([ocamlfind query ocamlgraph cmdliner fmt logs num >/dev/null 2>&1],
60
    [],[AC_MSG_ERROR(A few ocaml library required. opam install ocamlgraph cmdliner fmt logs num should solve the issue)],
61
)
62
AC_MSG_RESULT(yes)
63

    
64
#Yojson
65
AC_MSG_CHECKING(yojson library (optional))
66
AS_IF([ocamlfind query yojson >/dev/null 2>&1],
67
    [yojson=yes; AC_MSG_RESULT(yes)],[yojson=no; AC_MSG_WARN(Yojson required for lustresf. opam install yojson should solve the issue)],
68
)
69

    
70
# Seal
71
AC_MSG_CHECKING(seal library (optional))
72
AS_IF([ocamlfind query seal >/dev/null 2>&1],
73
    [seal=yes; AC_MSG_RESULT(yes)],[seal=no; AC_MSG_RESULT(no)],
74
)
75
AS_IF([test "x$seal" = "xyes"], [
76
   AC_SUBST(LUSTREV_SEAL, "(module Seal_verifier.Verifier : VerifierType.S);")
77
   AC_SUBST(LUSTREV_SEAL_TAG, "<**/*>: package(seal)")
78
])
79

    
80
# z3
81
AC_MSG_CHECKING(z3 library (optional))
82
define([z3path], esyscmd([ocamlfind query Z3 | tr -d '\n']))
83
#define([z3path], esyscmd([opam config var Z3:lib | tr -d '\n']))
84

    
85
AS_IF([ocamlfind query Z3 >/dev/null 2>&1],
86
    [z3=yes; AC_MSG_RESULT(yes)],[seal=no; AC_MSG_RESULT(no)],
87
)
88
AS_IF([test "x$z3" = "xyes"], [
89
   AC_SUBST(LUSTREV_ZUSTRE, "(module Zustre_verifier.Verifier : VerifierType.S);")
90
   AC_SUBST(LUSTREV_Z3_TAG, "<**/*>: package(Z3)")
91
   AC_SUBST(Z3LIBPATH, "z3path")
92
])
93

    
94

    
95

    
96

    
97
# Tiny
98
AC_MSG_CHECKING(tiny library (optional))
99
AS_IF([ocamlfind query tiny >/dev/null 2>&1],
100
    [tiny=yes; AC_MSG_RESULT(yes)],[tiny=no; AC_MSG_RESULT(no)],
101
)
102
AS_IF([test "x$tiny" = "xyes"], [
103
   AC_SUBST(LUSTREV_TINY, "(module Tiny_verifier.Verifier : VerifierType.S);")
104
   AC_SUBST(LUSTREV_TINY_TAG, "<**/*>: package(tiny)")
105
])
106

    
107
# Salsa
108
AC_ARG_ENABLE(salsa, [AS_HELP_STRING([--disable-salsa],
109
              [disable Salsa plugin. Enabled by default if available.])])
110

    
111
AC_MSG_CHECKING(salsa library)
112
AS_IF([ocamlfind query salsa >/dev/null 2>&1],
113
    [salsa=yes; AC_MSG_RESULT(yes)],[salsa=no; AC_MSG_WARN(no)]
114
)
115

    
116

    
117
AS_IF([test "x$enable_salsa" != "xno"], [
118
  if (test "x$salsa" = xyes ); then
119
   AC_SUBST(SALSA, "(module Salsa_plugin.Plugin : PluginType.S);")
120
   AC_SUBST(SALSA_TAG, "<**/*.native> or <plugins/salsa/*.cm?> : package(salsa)")
121
  fi
122
])
123

    
124
# GMP
125
AC_CHECK_LIB(gmp, __gmpz_init,
126
      [gmp=yes],
127
      [AC_MSG_RESULT([GNU MP not found])
128
      gmp=no])
129

    
130
AC_CHECK_LIB(mpfr, mpfr_add, [mpfr=yes],
131
		   [AC_MSG_RESULT(
132
[MPFR not found])
133
mpfr=no])
134

    
135
# lustresf
136
AC_ARG_ENABLE(lustresf, [AS_HELP_STRING([--disable-lustresf],
137
              [disable lustresf compilation. Enabled by default.])])
138

    
139
AC_SUBST_FILE(lustresf)
140
AC_SUBST_FILE(lustresf_src)
141
lustresf=/dev/null
142
lustresf_src=/dev/null
143

    
144
AS_IF([test "x$enable_lustresf" != "xno"], [
145
  AC_MSG_CHECKING(yojson library for lustresf)
146
  AS_IF([ocamlfind query yojson >/dev/null 2>&1],
147
      [yojson=yes; AC_MSG_RESULT(yes)],[yojson=no; AC_MSG_ERROR(Yojson required for lustresf. opam install yojson should solve the issue)],
148
  )
149
  lustresf=Makefile-lustresf.in
150
  lustresf_src=src/Makefile-lustresf.in
151
  AC_SUBST(lustresf_target, "lustresf")
152
])
153

    
154
# Checking availability of path to regression tests
155
tests_path="../lustrec-tests/regression_tests"
156

    
157
AC_ARG_WITH([tests-path],
158
            [AS_HELP_STRING([--with-tests-path],
159
               [provides path to test suite (default is ../lustrec-test if available)])],
160
            [tests_path="$withval";
161
	     if (test "x$tests_path" = xyes); then
162
	       AC_MSG_ERROR(Option --with-tests-path requires a parameter: eg. --with-tests-path=value);
163
	     fi],
164
            )
165
AC_MSG_NOTICE($tests_path)
166
AC_CHECK_FILE(${tests_path}/CMakeLists.txt,
167
              [
168
	      valid_test_path=true
169
	      ],
170
	      [
171
	      valid_test_path=false
172
	        AC_SUBST(PATH_TO_TESTS, $tests_path)	      ])
173
AC_SUBST(PATH_TO_TESTS_DEFINED, $valid_test_path)
174
AC_SUBST(PATH_TO_TESTS, $tests_path)
175

    
176
# End of config
177

    
178
AC_DEFUN([AC_DEFINE_DIR], [
179
  prefix_NONE=
180
  exec_prefix_NONE=
181
  test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
182
  test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
183
dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
184
dnl refers to ${prefix}.  Thus we have to use `eval' twice.
185
  eval ac_define_dir="\"[$]$2\""
186
  eval ac_define_dir="\"$ac_define_dir\""
187
  AC_SUBST($1, "$ac_define_dir")
188
  AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3])
189
  test "$prefix_NONE" && prefix=NONE
190
  test "$exec_prefix_NONE" && exec_prefix=NONE
191
])
192

    
193
AC_DEFINE_DIR([abs_datadir], [datadir])
194

    
195
# Instanciation
196
AC_CONFIG_FILES([Makefile
197
		 src/Makefile
198
		 src/version.ml
199
		 src/pluginList.ml
200
		 src/verifierList.ml
201
		 src/_tags
202
		 src/ocaml_utils.ml
203
		 include/z3librc
204
		 ])
205

    
206
AC_OUTPUT
207

    
208

    
209
# summary
210
AC_MSG_NOTICE(******** Configuration ********)
211
AC_MSG_NOTICE(bin path:     $prefix/bin)
212
AC_MSG_NOTICE(include path: $prefix/include)
213
AC_MSG_NOTICE(********    Plugins    ********)
214

    
215
  if (test "x$gmp" = xyes -a "x$mpfr" = xyes ); then
216
      AC_MSG_NOTICE([MPFR option enabled])
217
  else
218
      AC_MSG_WARN([MPFR option cannot be activated. Requires GMP and MPFR libs])
219
  fi
220

    
221
  if (test "x$salsa" = xyes -a "x$enable_salsa" != xno); then
222
      AC_MSG_NOTICE([Salsa plugin enabled])
223
  else
224
      AC_MSG_NOTICE([Salsa plugin disabled])
225
  fi
226

    
227
  if (test "x$yojson" = xyes -a "x$enable_lustresf" != "xno"); then
228
      AC_MSG_NOTICE([lustresf available])
229
  else
230
      if (test "x$enable_lustresf" = "xno"); then
231
        AC_MSG_NOTICE([lustresf not available (you explicitely disabled it)])
232
      else
233
        AC_MSG_NOTICE([lustresf not available])
234
      fi
235
  fi
236
AC_MSG_NOTICE(********   Verifiers    ********)
237

    
238
  if (test "x$seal" = "xyes"); then
239
      AC_MSG_NOTICE([Seal   enabled])
240
  else
241
      AC_MSG_NOTICE([Seal   disabled. Require Seal library])
242
  fi
243

    
244
  if (test "x$z3" = xyes); then
245
      AC_MSG_NOTICE([Zustre enabled])
246
      AC_MSG_WARN(Z3 shared lib (libz3.so) has to be available in the LD_LIBRARY_PATH.)
247
      AC_MSG_WARN(It is currently located in "z3path")
248
      AC_MSG_WARN(If not already available run "source ${prefix}/include/lustrec/z3librc")
249
      AC_MSG_WARN(or add that line to your ~/.profile or ~/.bashrc)
250
else
251
      AC_MSG_NOTICE([Zustre disabled. Require Z3 ocaml library])
252
  fi
253

    
254
  if (test "x$tiny" = xyes); then
255
      AC_MSG_NOTICE([Tiny   enabled])
256
  else
257
      AC_MSG_NOTICE([Tiny   disabled. Require Tiny library])
258
  fi
259

    
260
AC_MSG_NOTICE(****** Regression Tests  ******)
261
if (test "x$valid_test_path" = xfalse); then
262
  AC_MSG_NOTICE(no valid tests path provided ($tests_path))
263
else
264
AC_MSG_NOTICE(tests path: $tests_path)
265
fi
266
AC_MSG_NOTICE(******** Configuration ********)
267
AC_MSG_NOTICE(Execute "make; make install" now)