Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / configure.ac @ 5c3b45a0

History | View | Annotate | Download (6.58 KB)

1
define([gitversion], esyscmd([sh -c "git log --oneline | wc -l | tr -d ' \n'"]))
2
AC_INIT([lustrec], 1.6-gitversion, [ploc@garoche.net])
3
AC_SUBST(VERSION_CODENAME, "Xia/Zhu-dev")
4

    
5
gitbranch=`git branch | grep \* | sed "s/\*[ ]*//"`
6
#define([gitbranch], esyscmd([sh -c "git branch | grep \* | cut -d ' ' -f2"]))
7

    
8
AC_SUBST(GITBRANCH, "$gitbranch")
9
if test x"$GITBRANCH" != "xmaster"; then
10
  AC_SUBST(CDASHSUBPROJ, "unstable")
11
else
12
  AC_SUBST(CDASHSUBPROJ, "master")
13
fi
14
# Next release will be
15
#AC_INIT([lustrec], [1.7], [ploc@garoche.net])
16
#AC_SUBST(VERSION_CODENAME, "Xia/Huai")
17
AC_MSG_NOTICE(Git branch: ${GITBRANCH})
18
AC_CONFIG_SRCDIR([src/main_lustre_compiler.ml])
19
AC_CONFIG_SRCDIR([src/main_lustre_testgen.ml])
20

    
21
AC_PATH_PROG([OCAMLC],[ocamlc],[:])
22
AC_MSG_CHECKING(OCaml version)
23
ocamlc_version=`$OCAMLC -v | grep version | rev| cut -d \  -f 1 | rev`
24
major=`echo $ocamlc_version | cut -d . -f 1`
25
minor=`echo $ocamlc_version | cut -d . -f 2`
26
if (test "$major" -lt 3 -a "$minor" -lt 11 ); then
27
  AC_MSG_ERROR([Ocaml version must be at least 3.11. You have version $ocamlc_version])
28
fi
29
AC_MSG_RESULT(valid ocaml version detected: $ocamlc_version)
30

    
31
AC_PATH_PROG([OCAMLBUILD],[ocamlbuild],[:])
32

    
33
# Handle a mismatch in available function btw 4.02 and 4.04
34
if (test $"$major" -eq 4 -a "$minor" -gt 2); then
35
   AC_SUBST(UPPERCASEFUN, "String.uppercase_ascii")
36
else
37
   AC_SUBST(UPPERCASEFUN, "String.uppercase")
38
fi
39

    
40
# default prefix is /usr/local
41
AC_PREFIX_DEFAULT(/usr/local)
42

    
43
dnl AC_ARG_WITH([ocamlgraph-path],
44
dnl         [AS_HELP_STRING([--ocamlgraph-path],
45
dnl               [specify the path of ocamlgraph library. graph.cmxa should be in ocamlgraph-path @<:@default=$(ocamlfind query ocamlgraph)@:>@])],
46
dnl         [AS_IF([test "x$ocamlgraph_path" = xno],
47
dnl                 [AC_MSG_ERROR([ocamlgraph library is needed])],
48
dnl                 [test "x$ocamlgraph_path" = xyes],
49
dnl                 [OCAMLGRAPH_PATH=$(ocamlfind query ocamlgraph)],
50
dnl                 [OCAMLGRAPH_PATH=$ocamlgraph_path]
51
dnl         )],
52
dnl         [OCAMLGRAPH_PATH=$(ocamlfind query ocamlgraph)]
53
dnl )
54
dnl AC_SUBST(OCAMLGRAPH_PATH)
55

    
56

    
57
# Checking libs
58
AC_CHECK_PROG(FINDLIB_CHECK,ocamlfind,yes)
59
if test x"$FINDLIB_CHECK" != x"yes" ; then
60
   AC_MSG_ERROR(ocamlfind required!)
61
fi
62
dnl AC_MSG_RESULT(Hourrah: ocamlfind found!)
63

    
64
# Checks for libraries.
65
# OCamlgraph
66
AC_MSG_CHECKING(ocaml libraries required)
67
AS_IF([ocamlfind query ocamlgraph cmdliner fmt logs num >/dev/null 2>&1],
68
    [],[AC_MSG_ERROR(A few ocaml library required. opam install ocamlgraph cmdliner fmt logs num should solve the issue)],
69
)
70
AC_MSG_RESULT(yes)
71

    
72
# Salsa
73
AC_ARG_ENABLE(salsa, [AS_HELP_STRING([--disable-salsa],
74
              [disable Salsa plugin. Enabled by default if available.])])
75

    
76
AC_MSG_CHECKING(salsa library)
77
AS_IF([ocamlfind query salsa >/dev/null 2>&1],
78
    [salsa=yes; AC_MSG_RESULT(yes)],[salsa=no; AC_MSG_WARN(no)]
79
)
80

    
81

    
82
AS_IF([test "x$enable_salsa" != "xno"], [
83
  if (test "x$salsa" = xyes ); then
84
   AC_SUBST(SALSA, "(module Salsa_plugin.Plugin : PluginType.PluginType);")
85
   AC_SUBST(SALSA_TAG, "<**/*.native> or <plugins/salsa/*.cm?> : package(salsa)")
86
  fi
87
])
88

    
89
# GMP
90
AC_CHECK_LIB(gmp, __gmpz_init,
91
      [gmp=yes],
92
      [AC_MSG_RESULT([GNU MP not found])
93
      gmp=no])
94

    
95
AC_CHECK_LIB(mpfr, mpfr_add, [mpfr=yes],
96
		   [AC_MSG_RESULT(
97
[MPFR not found])
98
mpfr=no])
99

    
100
# lustresf
101
AC_ARG_ENABLE(lustresf, [AS_HELP_STRING([--disable-lustresf],
102
              [disable lustresf compilation. Enabled by default.])])
103

    
104
AC_SUBST_FILE(lustresf)
105
AC_SUBST_FILE(lustresf_src)
106
lustresf=/dev/null
107
lustresf_src=/dev/null
108

    
109
AS_IF([test "x$enable_lustresf" != "xno"], [
110
  AC_MSG_CHECKING(yojson library for lustresf)
111
  AS_IF([ocamlfind query yojson >/dev/null 2>&1],
112
      [yojson=yes; AC_MSG_RESULT(yes)],[yojson=no; AC_MSG_ERROR(Yojson required for lustresf. opam install yojson should solve the issue)],
113
  )
114
  lustresf=Makefile-lustresf.in
115
  lustresf_src=src/Makefile-lustresf.in
116
  AC_SUBST(lustresf_target, "lustresf")
117
])
118

    
119
# Checking availability of path to regression tests
120
tests_path="../lustrec-tests/regression_tests"
121

    
122
AC_ARG_WITH([tests-path],
123
            [AS_HELP_STRING([--with-tests-path],
124
               [provides path to test suite (default is ../lustrec-test if available)])],
125
            [tests_path="$withval";
126
	     if (test "x$tests_path" = xyes); then
127
	       AC_MSG_ERROR(Option --with-tests-path requires a parameter: eg. --with-tests-path=value);
128
	     fi],
129
            )
130
AC_MSG_NOTICE($tests_path)
131
AC_CHECK_FILE(${tests_path}/CMakeLists.txt,
132
              [
133
	      valid_test_path=true
134
	      ],
135
	      [
136
	      valid_test_path=false
137
	        AC_SUBST(PATH_TO_TESTS, $tests_path)	      ])
138
AC_SUBST(PATH_TO_TESTS_DEFINED, $valid_test_path)
139
AC_SUBST(PATH_TO_TESTS, $tests_path)
140

    
141
# End of config
142

    
143
AC_DEFUN([AC_DEFINE_DIR], [
144
  prefix_NONE=
145
  exec_prefix_NONE=
146
  test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
147
  test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
148
dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
149
dnl refers to ${prefix}.  Thus we have to use `eval' twice.
150
  eval ac_define_dir="\"[$]$2\""
151
  eval ac_define_dir="\"$ac_define_dir\""
152
  AC_SUBST($1, "$ac_define_dir")
153
  AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3])
154
  test "$prefix_NONE" && prefix=NONE
155
  test "$exec_prefix_NONE" && exec_prefix=NONE
156
])
157

    
158
AC_DEFINE_DIR([abs_datadir], [datadir])
159

    
160
# Instanciation
161
AC_CONFIG_FILES([Makefile
162
		 src/Makefile
163
		 src/version.ml
164
		 src/pluginList.ml
165
		 src/_tags
166
		 src/ocaml_utils.ml
167
		 share/FindLustre.cmake
168
		 ])
169

    
170
AC_OUTPUT
171

    
172

    
173
# summary
174
AC_MSG_NOTICE(******** Configuration ********)
175
AC_MSG_NOTICE(bin path:     $prefix/bin)
176
AC_MSG_NOTICE(include path: $prefix/include)
177
AC_MSG_NOTICE(********    Plugins    ********)
178

    
179
  if (test "x$gmp" = xyes -a "x$mpfr" = xyes ); then
180
      AC_MSG_NOTICE([MPFR option enabled])
181
  else
182
      AC_MSG_WARN([MPFR option cannot be activated. Requires GMP and MPFR libs])
183
  fi
184

    
185
  if (test "x$salsa" = xyes -a "x$enable_salsa" != xno); then
186
      AC_MSG_NOTICE([Salsa plugin enabled])
187
  else
188
      AC_MSG_NOTICE([Salsa plugin disabled])
189
  fi
190

    
191
  if (test "x$yojson" = xyes -a "x$enable_lustresf" != "xno"); then
192
      AC_MSG_NOTICE([lustresf available])
193
  else
194
      if (test "x$enable_lustresf" = "xno"); then
195
        AC_MSG_NOTICE([lustresf not available (you explicitely disabled it)])
196
      else
197
        AC_MSG_NOTICE([lustresf not available])
198
      fi
199
  fi
200

    
201
AC_MSG_NOTICE(****** Regression Tests  ******)
202
if (test "x$valid_test_path" = xfalse); then
203
  AC_MSG_NOTICE(no valid tests path provided ($tests_path))
204
else
205
AC_MSG_NOTICE(tests path: $tests_path)
206
fi
207
AC_MSG_NOTICE(******** Configuration ********)
208
AC_MSG_NOTICE(Execute "make; make install" now)