Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / configure.ac @ e4edf171

History | View | Annotate | Download (8.3 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

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

    
93

    
94

    
95

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

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

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

    
115

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

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

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

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

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

    
143
AS_IF([test "x$enable_lustresf" != "xno" -a "x$yojson" = "xyes"], [
144
  lustresf=Makefile-lustresf.in
145
  lustresf_src=src/Makefile-lustresf.in
146
  AC_SUBST(lustresf_target, "lustresf")
147
])
148

    
149
# Checking availability of path to regression tests
150
tests_path="../lustrec-tests/regression_tests"
151

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

    
171
# End of config
172

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

    
188
AC_DEFINE_DIR([abs_datadir], [datadir])
189

    
190
# Instanciation
191
AC_CONFIG_FILES([Makefile
192
		 src/Makefile
193
		 src/version.ml
194
		 src/pluginList.ml
195
		 src/verifierList.ml
196
		 src/_tags
197
		 src/ocaml_utils.ml
198
		 include/z3librc
199
		 ])
200

    
201
AC_OUTPUT
202

    
203

    
204
# summary
205
AC_MSG_NOTICE(******** Configuration ********)
206
AC_MSG_NOTICE(bin path:     $prefix/bin)
207
AC_MSG_NOTICE(include path: $prefix/include)
208
AC_MSG_NOTICE(********    Plugins    ********)
209

    
210
  if (test "x$gmp" = xyes -a "x$mpfr" = xyes ); then
211
      AC_MSG_NOTICE([MPFR option enabled])
212
  else
213
      AC_MSG_WARN([MPFR option cannot be activated. Requires GMP and MPFR libs])
214
  fi
215

    
216
  if (test "x$salsa" = xyes -a "x$enable_salsa" != xno); then
217
      AC_MSG_NOTICE([Salsa plugin enabled])
218
  else
219
      AC_MSG_NOTICE([Salsa plugin disabled])
220
  fi
221

    
222
  if (test "x$yojson" = xyes -a "x$enable_lustresf" != "xno"); then
223
      AC_MSG_NOTICE([lustresf available])
224
  else
225
      if (test "x$enable_lustresf" = "xno"); then
226
        AC_MSG_NOTICE([lustresf not available (you explicitely disabled it)])
227
      else
228
        AC_MSG_NOTICE([lustresf not available])
229
      fi
230
  fi
231
AC_MSG_NOTICE(********   Verifiers    ********)
232

    
233
  if (test "x$seal" = "xyes"); then
234
      AC_MSG_NOTICE([Seal   enabled])
235
  else
236
      AC_MSG_NOTICE([Seal   disabled. Require Seal library])
237
  fi
238

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

    
249
  if (test "x$tiny" = xyes); then
250
      AC_MSG_NOTICE([Tiny   enabled])
251
  else
252
      AC_MSG_NOTICE([Tiny   disabled. Require Tiny library])
253
  fi
254

    
255
AC_MSG_NOTICE(****** Regression Tests  ******)
256
if (test "x$valid_test_path" = xfalse); then
257
  AC_MSG_NOTICE(no valid tests path provided ($tests_path))
258
else
259
AC_MSG_NOTICE(tests path: $tests_path)
260
fi
261
AC_MSG_NOTICE(******** Configuration ********)
262
AC_MSG_NOTICE(Execute "make; make install" now)