Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / configure.ac @ fb716d2c

History | View | Annotate | Download (6.61 KB)

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