Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / configure.ac @ ad4774b0

History | View | Annotate | Download (7.89 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
AS_IF([ocamlfind query z3 >/dev/null 2>&1],
83
    [z3=yes; AC_MSG_RESULT(yes)],[seal=no; AC_MSG_RESULT(no)],
84
)
85
AS_IF([test "x$z3" = "xyes"], [
86
   AC_SUBST(LUSTREV_ZUSTRE, "(module Zustre_verifier.Verifier : VerifierType.S);")
87
   AC_SUBST(LUSTREV_Z3_TAG, "<**/*>: package(z3)")
88
])
89

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

    
100
# Salsa
101
AC_ARG_ENABLE(salsa, [AS_HELP_STRING([--disable-salsa],
102
              [disable Salsa plugin. Enabled by default if available.])])
103

    
104
AC_MSG_CHECKING(salsa library)
105
AS_IF([ocamlfind query salsa >/dev/null 2>&1],
106
    [salsa=yes; AC_MSG_RESULT(yes)],[salsa=no; AC_MSG_WARN(no)]
107
)
108

    
109

    
110
AS_IF([test "x$enable_salsa" != "xno"], [
111
  if (test "x$salsa" = xyes ); then
112
   AC_SUBST(SALSA, "(module Salsa_plugin.Plugin : PluginType.S);")
113
   AC_SUBST(SALSA_TAG, "<**/*.native> or <plugins/salsa/*.cm?> : package(salsa)")
114
  fi
115
])
116

    
117
# GMP
118
AC_CHECK_LIB(gmp, __gmpz_init,
119
      [gmp=yes],
120
      [AC_MSG_RESULT([GNU MP not found])
121
      gmp=no])
122

    
123
AC_CHECK_LIB(mpfr, mpfr_add, [mpfr=yes],
124
		   [AC_MSG_RESULT(
125
[MPFR not found])
126
mpfr=no])
127

    
128
# lustresf
129
AC_ARG_ENABLE(lustresf, [AS_HELP_STRING([--disable-lustresf],
130
              [disable lustresf compilation. Enabled by default.])])
131

    
132
AC_SUBST_FILE(lustresf)
133
AC_SUBST_FILE(lustresf_src)
134
lustresf=/dev/null
135
lustresf_src=/dev/null
136

    
137
AS_IF([test "x$enable_lustresf" != "xno" -a "x$yojson" = "xyes"], [
138
  lustresf=Makefile-lustresf.in
139
  lustresf_src=src/Makefile-lustresf.in
140
  AC_SUBST(lustresf_target, "lustresf")
141
])
142

    
143
# Checking availability of path to regression tests
144
tests_path="../lustrec-tests/regression_tests"
145

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

    
165
# End of config
166

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

    
182
AC_DEFINE_DIR([abs_datadir], [datadir])
183

    
184
# Instanciation
185
AC_CONFIG_FILES([Makefile
186
		 src/Makefile
187
		 src/version.ml
188
		 src/pluginList.ml
189
		 src/verifierList.ml
190
		 src/_tags
191
		 src/ocaml_utils.ml
192
		 ])
193

    
194
AC_OUTPUT
195

    
196

    
197
# summary
198
AC_MSG_NOTICE(******** Configuration ********)
199
AC_MSG_NOTICE(bin path:     $prefix/bin)
200
AC_MSG_NOTICE(include path: $prefix/include)
201
AC_MSG_NOTICE(********    Plugins    ********)
202

    
203
  if (test "x$gmp" = xyes -a "x$mpfr" = xyes ); then
204
      AC_MSG_NOTICE([MPFR option enabled])
205
  else
206
      AC_MSG_WARN([MPFR option cannot be activated. Requires GMP and MPFR libs])
207
  fi
208

    
209
  if (test "x$salsa" = xyes -a "x$enable_salsa" != xno); then
210
      AC_MSG_NOTICE([Salsa plugin enabled])
211
  else
212
      AC_MSG_NOTICE([Salsa plugin disabled])
213
  fi
214

    
215
  if (test "x$yojson" = xyes -a "x$enable_lustresf" != "xno"); then
216
      AC_MSG_NOTICE([lustresf available])
217
  else
218
      if (test "x$enable_lustresf" = "xno"); then
219
        AC_MSG_NOTICE([lustresf not available (you explicitely disabled it)])
220
      else
221
        AC_MSG_NOTICE([lustresf not available])
222
      fi
223
  fi
224
AC_MSG_NOTICE(********   Verifiers    ********)
225

    
226
  if (test "x$seal" = "xyes"); then
227
      AC_MSG_NOTICE([Seal   enabled])
228
  else
229
      AC_MSG_NOTICE([Seal   disabled. Require Seal library])
230
  fi
231

    
232
  if (test "x$z3" = xyes); then
233
      AC_MSG_NOTICE([Zustre enabled])
234
  else
235
      AC_MSG_NOTICE([Zustre disabled. Require Z3 ocaml library])
236
  fi
237

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

    
244
AC_MSG_NOTICE(****** Regression Tests  ******)
245
if (test "x$valid_test_path" = xfalse); then
246
  AC_MSG_NOTICE(no valid tests path provided ($tests_path))
247
else
248
AC_MSG_NOTICE(tests path: $tests_path)
249
fi
250
AC_MSG_NOTICE(******** Configuration ********)
251
AC_MSG_NOTICE(Execute "make; make install" now)