Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / configure.ac @ master

History | View | Annotate | Download (6.33 KB)

1 6de6bcf4 ploc
define([gitversion], esyscmd([sh -c "git log --oneline | wc -l | tr -d ' \n'"]))
2 fb716d2c ploc
3 a7ce880f ploc
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 3471cb4d ploc
7 fb716d2c ploc
8 3e38100a Eric NOULARD
# Next release will be
9 a7ce880f ploc
#AC_INIT([lustrec], [1.8], [ploc@garoche.net])
10
#AC_SUBST(VERSION_CODENAME, "Xia/Mang")
11 9205fd1a ploc
AC_MSG_NOTICE(Git branch: ${GITBRANCH})
12 1e48ef45 ploc
AC_CONFIG_SRCDIR([src/main_lustre_compiler.ml])
13 bde99c3f xavier.thirioux
AC_CONFIG_SRCDIR([src/main_lustre_testgen.ml])
14 1e48ef45 ploc
15 f6acf47b ploc
AC_PATH_PROG([OCAMLC],[ocamlc],[:])
16
AC_MSG_CHECKING(OCaml version)
17
ocamlc_version=`$OCAMLC -v | grep version | rev| cut -d \  -f 1 | rev`
18
major=`echo $ocamlc_version | cut -d . -f 1`
19
minor=`echo $ocamlc_version | cut -d . -f 2`
20 85da3a4b ploc
if (test "$major" -lt 3 -a "$minor" -lt 11 ); then
21
  AC_MSG_ERROR([Ocaml version must be at least 3.11. You have version $ocamlc_version])
22 f6acf47b ploc
fi
23
AC_MSG_RESULT(valid ocaml version detected: $ocamlc_version)
24
25
AC_PATH_PROG([OCAMLBUILD],[ocamlbuild],[:])
26
27 c80e92d1 ploc
# Handle a mismatch in available function btw 4.02 and 4.04
28
if (test $"$major" -eq 4 -a "$minor" -gt 2); then
29
   AC_SUBST(UPPERCASEFUN, "String.uppercase_ascii")
30
else
31
   AC_SUBST(UPPERCASEFUN, "String.uppercase")
32
fi
33 f6acf47b ploc
34 1e48ef45 ploc
# default prefix is /usr/local
35
AC_PREFIX_DEFAULT(/usr/local)
36
37 1954d776 ploc
dnl AC_ARG_WITH([ocamlgraph-path],
38
dnl         [AS_HELP_STRING([--ocamlgraph-path],
39
dnl               [specify the path of ocamlgraph library. graph.cmxa should be in ocamlgraph-path @<:@default=$(ocamlfind query ocamlgraph)@:>@])],
40
dnl         [AS_IF([test "x$ocamlgraph_path" = xno],
41
dnl                 [AC_MSG_ERROR([ocamlgraph library is needed])],
42
dnl                 [test "x$ocamlgraph_path" = xyes],
43
dnl                 [OCAMLGRAPH_PATH=$(ocamlfind query ocamlgraph)],
44
dnl                 [OCAMLGRAPH_PATH=$ocamlgraph_path]
45
dnl         )],
46
dnl         [OCAMLGRAPH_PATH=$(ocamlfind query ocamlgraph)]
47
dnl )
48
dnl AC_SUBST(OCAMLGRAPH_PATH)
49 1e48ef45 ploc
50
51
# Checking libs
52 1954d776 ploc
AC_CHECK_PROG(FINDLIB_CHECK,ocamlfind,yes)
53
if test x"$FINDLIB_CHECK" != x"yes" ; then
54
   AC_MSG_ERROR(ocamlfind required!)
55
fi
56
dnl AC_MSG_RESULT(Hourrah: ocamlfind found!)
57 1e48ef45 ploc
58 d21f00de Christophe Garion
# Checks for libraries.
59
# OCamlgraph
60 a1230f68 ploc
AC_MSG_CHECKING(ocaml libraries required)
61
AS_IF([ocamlfind query ocamlgraph cmdliner fmt logs num >/dev/null 2>&1],
62
    [],[AC_MSG_ERROR(A few ocaml library required. opam install ocamlgraph cmdliner fmt logs num should solve the issue)],
63 d21f00de Christophe Garion
)
64
AC_MSG_RESULT(yes)
65 1954d776 ploc
66 d21f00de Christophe Garion
# Salsa
67 1954d776 ploc
AC_ARG_ENABLE(salsa, [AS_HELP_STRING([--disable-salsa],
68
              [disable Salsa plugin. Enabled by default if available.])])
69
70
AC_MSG_CHECKING(salsa library)
71
AS_IF([ocamlfind query salsa >/dev/null 2>&1],
72
    [salsa=yes; AC_MSG_RESULT(yes)],[salsa=no; AC_MSG_WARN(no)]
73
)
74
75
76
AS_IF([test "x$enable_salsa" != "xno"], [
77
  if (test "x$salsa" = xyes ); then
78
   AC_SUBST(SALSA, "(module Salsa_plugin.Plugin : PluginType.PluginType);")
79
   AC_SUBST(SALSA_TAG, "<**/*.native> or <plugins/salsa/*.cm?> : package(salsa)")
80 bad7b67a Christophe Garion
  fi
81 1954d776 ploc
])
82
83 d21f00de Christophe Garion
# GMP
84 bad7b67a Christophe Garion
AC_CHECK_LIB(gmp, __gmpz_init,
85 04a63d25 xthirioux
      [gmp=yes],
86
      [AC_MSG_RESULT([GNU MP not found])
87
      gmp=no])
88
89 bad7b67a Christophe Garion
AC_CHECK_LIB(mpfr, mpfr_add, [mpfr=yes],
90 04a63d25 xthirioux
		   [AC_MSG_RESULT(
91
[MPFR not found])
92
mpfr=no])
93
94 3b4b7a2e Christophe Garion
# lustresf
95
AC_ARG_ENABLE(lustresf, [AS_HELP_STRING([--disable-lustresf],
96
              [disable lustresf compilation. Enabled by default.])])
97
98
AC_SUBST_FILE(lustresf)
99
AC_SUBST_FILE(lustresf_src)
100
lustresf=/dev/null
101
lustresf_src=/dev/null
102
103 c2db548b Christophe Garion
AS_IF([test "x$enable_lustresf" != "xno"], [
104
  AC_MSG_CHECKING(yojson library for lustresf)
105
  AS_IF([ocamlfind query yojson >/dev/null 2>&1],
106
      [yojson=yes; AC_MSG_RESULT(yes)],[yojson=no; AC_MSG_ERROR(Yojson required for lustresf. opam install yojson should solve the issue)],
107
  )
108 3b4b7a2e Christophe Garion
  lustresf=Makefile-lustresf.in
109
  lustresf_src=src/Makefile-lustresf.in
110 a1230f68 ploc
  AC_SUBST(lustresf_target, "lustresf")
111 3b4b7a2e Christophe Garion
])
112 1e48ef45 ploc
113 a86bae77 ploc
# Checking availability of path to regression tests
114
tests_path="../lustrec-tests/regression_tests"
115
116
AC_ARG_WITH([tests-path],
117
            [AS_HELP_STRING([--with-tests-path],
118
               [provides path to test suite (default is ../lustrec-test if available)])],
119
            [tests_path="$withval";
120
	     if (test "x$tests_path" = xyes); then
121
	       AC_MSG_ERROR(Option --with-tests-path requires a parameter: eg. --with-tests-path=value);
122
	     fi],
123
            )
124
AC_MSG_NOTICE($tests_path)
125
AC_CHECK_FILE(${tests_path}/CMakeLists.txt,
126
              [
127 bad7b67a Christophe Garion
	      valid_test_path=true
128 a86bae77 ploc
	      ],
129
	      [
130
	      valid_test_path=false
131
	        AC_SUBST(PATH_TO_TESTS, $tests_path)	      ])
132
AC_SUBST(PATH_TO_TESTS_DEFINED, $valid_test_path)
133
AC_SUBST(PATH_TO_TESTS, $tests_path)
134 1e48ef45 ploc
135
# End of config
136
137
AC_DEFUN([AC_DEFINE_DIR], [
138
  prefix_NONE=
139
  exec_prefix_NONE=
140
  test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
141
  test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
142
dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
143
dnl refers to ${prefix}.  Thus we have to use `eval' twice.
144
  eval ac_define_dir="\"[$]$2\""
145
  eval ac_define_dir="\"$ac_define_dir\""
146
  AC_SUBST($1, "$ac_define_dir")
147
  AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3])
148
  test "$prefix_NONE" && prefix=NONE
149
  test "$exec_prefix_NONE" && exec_prefix=NONE
150
])
151
152
AC_DEFINE_DIR([abs_datadir], [datadir])
153
154
# Instanciation
155 fb716d2c ploc
AC_CONFIG_FILES([opam
156
		 Makefile
157 e8b6d5ca ploc
		 src/Makefile
158 1954d776 ploc
		 src/version.ml
159
		 src/pluginList.ml
160
		 src/_tags
161 c80e92d1 ploc
		 src/ocaml_utils.ml
162 5c3b45a0 ploc
		 share/FindLustre.cmake
163 1954d776 ploc
		 ])
164 1e48ef45 ploc
165
AC_OUTPUT
166
167
168
# summary
169 04a63d25 xthirioux
AC_MSG_NOTICE(******** Configuration ********)
170
AC_MSG_NOTICE(bin path:     $prefix/bin)
171
AC_MSG_NOTICE(include path: $prefix/include)
172
AC_MSG_NOTICE(********    Plugins    ********)
173
174
  if (test "x$gmp" = xyes -a "x$mpfr" = xyes ); then
175 a86bae77 ploc
      AC_MSG_NOTICE([MPFR option enabled])
176 bad7b67a Christophe Garion
  else
177 1954d776 ploc
      AC_MSG_WARN([MPFR option cannot be activated. Requires GMP and MPFR libs])
178
  fi
179 04a63d25 xthirioux
180 a86bae77 ploc
  if (test "x$salsa" = xyes -a "x$enable_salsa" != xno); then
181 1954d776 ploc
      AC_MSG_NOTICE([Salsa plugin enabled])
182 bad7b67a Christophe Garion
  else
183 1954d776 ploc
      AC_MSG_NOTICE([Salsa plugin disabled])
184
  fi
185 3b4b7a2e Christophe Garion
186
  if (test "x$yojson" = xyes -a "x$enable_lustresf" != "xno"); then
187
      AC_MSG_NOTICE([lustresf available])
188
  else
189
      if (test "x$enable_lustresf" = "xno"); then
190
        AC_MSG_NOTICE([lustresf not available (you explicitely disabled it)])
191
      else
192
        AC_MSG_NOTICE([lustresf not available])
193
      fi
194
  fi
195
196 a86bae77 ploc
AC_MSG_NOTICE(****** Regression Tests  ******)
197
if (test "x$valid_test_path" = xfalse); then
198
  AC_MSG_NOTICE(no valid tests path provided ($tests_path))
199
else
200
AC_MSG_NOTICE(tests path: $tests_path)
201
fi
202 1954d776 ploc
AC_MSG_NOTICE(******** Configuration ********)
203
AC_MSG_NOTICE(Execute "make; make install" now)