Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / configure.ac @ 4d841db7

History | View | Annotate | Download (6.38 KB)

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