Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / configure.ac @ a7ce880f

History | View | Annotate | Download (6.62 KB)

1
define([gitversion], esyscmd([sh -c "git log --oneline | wc -l | tr -d ' \n'"]))
2

    
3
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

    
7

    
8
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
if test x"$GITBRANCH" != "xmaster"; then
13
  AC_SUBST(CDASHSUBPROJ, "unstable")
14
else
15
  AC_SUBST(CDASHSUBPROJ, "master")
16
fi
17
# Next release will be
18
#AC_INIT([lustrec], [1.8], [ploc@garoche.net])
19
#AC_SUBST(VERSION_CODENAME, "Xia/Mang")
20
AC_MSG_NOTICE(Git branch: ${GITBRANCH})
21
AC_CONFIG_SRCDIR([src/main_lustre_compiler.ml])
22
AC_CONFIG_SRCDIR([src/main_lustre_testgen.ml])
23

    
24
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
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
fi
32
AC_MSG_RESULT(valid ocaml version detected: $ocamlc_version)
33

    
34
AC_PATH_PROG([OCAMLBUILD],[ocamlbuild],[:])
35

    
36
# 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

    
43
# default prefix is /usr/local
44
AC_PREFIX_DEFAULT(/usr/local)
45

    
46
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

    
59

    
60
# Checking libs
61
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

    
67
# Checks for libraries.
68
# OCamlgraph
69
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
)
73
AC_MSG_RESULT(yes)
74

    
75
# Salsa
76
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
  fi
90
])
91

    
92
# GMP
93
AC_CHECK_LIB(gmp, __gmpz_init,
94
      [gmp=yes],
95
      [AC_MSG_RESULT([GNU MP not found])
96
      gmp=no])
97

    
98
AC_CHECK_LIB(mpfr, mpfr_add, [mpfr=yes],
99
		   [AC_MSG_RESULT(
100
[MPFR not found])
101
mpfr=no])
102

    
103
# 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
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
  lustresf=Makefile-lustresf.in
118
  lustresf_src=src/Makefile-lustresf.in
119
  AC_SUBST(lustresf_target, "lustresf")
120
])
121

    
122
# 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
	      valid_test_path=true
137
	      ],
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

    
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
AC_CONFIG_FILES([opam
165
		 Makefile
166
		 src/Makefile
167
		 src/version.ml
168
		 src/pluginList.ml
169
		 src/_tags
170
		 src/ocaml_utils.ml
171
		 share/FindLustre.cmake
172
		 ])
173

    
174
AC_OUTPUT
175

    
176

    
177
# summary
178
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
      AC_MSG_NOTICE([MPFR option enabled])
185
  else
186
      AC_MSG_WARN([MPFR option cannot be activated. Requires GMP and MPFR libs])
187
  fi
188

    
189
  if (test "x$salsa" = xyes -a "x$enable_salsa" != xno); then
190
      AC_MSG_NOTICE([Salsa plugin enabled])
191
  else
192
      AC_MSG_NOTICE([Salsa plugin disabled])
193
  fi
194

    
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
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
AC_MSG_NOTICE(******** Configuration ********)
212
AC_MSG_NOTICE(Execute "make; make install" now)