Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / configure.ac @ 3b4b7a2e

History | View | Annotate | Download (6.72 KB)

1
define([gitversion], esyscmd([sh -c "git log --oneline | wc -l | tr -d '\n'"]))
2
define([gitbranch], esyscmd([sh -c "git branch | grep \* | cut -d ' ' -f2"]))
3
AC_INIT([lustrec], 1.5-gitversion, [ploc@garoche.net])
4
AC_SUBST(VERSION_CODENAME, "Xia/Shao Kang-dev")
5
AC_SUBST(GITBRANCH, gitbranch)
6
# Next release will be
7
#AC_INIT([lustrec], [1.6], [ploc@garoche.net])
8
#AC_SUBST(VERSION_CODENAME, "Xia/Zhu")
9
AC_MSG_NOTICE(Git branch: ${GITBRANCH})
10
AC_CONFIG_SRCDIR([src/main_lustre_compiler.ml])
11
AC_CONFIG_SRCDIR([src/main_lustre_testgen.ml])
12

    
13
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
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
fi
21
AC_MSG_RESULT(valid ocaml version detected: $ocamlc_version)
22

    
23
AC_PATH_PROG([OCAMLBUILD],[ocamlbuild],[:])
24

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

    
32
# default prefix is /usr/local
33
AC_PREFIX_DEFAULT(/usr/local)
34

    
35
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

    
48

    
49
# Checking libs
50
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

    
56
# Checks for libraries.
57
# OCamlgraph
58
AC_MSG_CHECKING(ocamlgraph library)
59
AS_IF([ocamlfind query ocamlgraph >/dev/null 2>&1],
60
    [],[AC_MSG_ERROR(ocamlgraph required. opam install ocamlgraph should solve the issue)],
61
)
62
AC_MSG_RESULT(yes)
63

    
64
# logging and command line librairies
65
AC_MSG_CHECKING(cmdliner library)
66
AS_IF([ocamlfind query cmdliner >/dev/null 2>&1],
67
    [],[AC_MSG_ERROR(cmdliner required. opam install cmdliner should solve the issue)],
68
)
69
AC_MSG_RESULT(yes)
70

    
71
AC_MSG_CHECKING(fmt and logs library)
72
AS_IF([ocamlfind query fmt logs >/dev/null 2>&1],
73
    [],[AC_MSG_ERROR(fmt and logs required. opam install fmt logs should solve the issue)],
74
)
75
AC_MSG_RESULT(yes)
76

    
77
#Yojson
78
AC_MSG_CHECKING(yojson library)
79
AS_IF([ocamlfind query yojson >/dev/null 2>&1],
80
    [yojson=yes; AC_MSG_RESULT(yes)],[yojson=no; AC_MSG_WARN(Yojson required for lustresf. opam install yojson should solve the issue)],
81
)
82

    
83
# Salsa
84
AC_ARG_ENABLE(salsa, [AS_HELP_STRING([--disable-salsa],
85
              [disable Salsa plugin. Enabled by default if available.])])
86

    
87
AC_MSG_CHECKING(salsa library)
88
AS_IF([ocamlfind query salsa >/dev/null 2>&1],
89
    [salsa=yes; AC_MSG_RESULT(yes)],[salsa=no; AC_MSG_WARN(no)]
90
)
91

    
92

    
93
AS_IF([test "x$enable_salsa" != "xno"], [
94
  if (test "x$salsa" = xyes ); then
95
   AC_SUBST(SALSA, "(module Salsa_plugin.Plugin : PluginType.PluginType);")
96
   AC_SUBST(SALSA_TAG, "<**/*.native> or <plugins/salsa/*.cm?> : package(salsa)")
97
  fi
98
])
99

    
100
# GMP
101
AC_CHECK_LIB(gmp, __gmpz_init,
102
      [gmp=yes],
103
      [AC_MSG_RESULT([GNU MP not found])
104
      gmp=no])
105

    
106
AC_CHECK_LIB(mpfr, mpfr_add, [mpfr=yes],
107
		   [AC_MSG_RESULT(
108
[MPFR not found])
109
mpfr=no])
110

    
111
# lustresf
112
AC_ARG_ENABLE(lustresf, [AS_HELP_STRING([--disable-lustresf],
113
              [disable lustresf compilation. Enabled by default.])])
114

    
115
AC_SUBST_FILE(lustresf)
116
AC_SUBST_FILE(lustresf_src)
117
lustresf=/dev/null
118
lustresf_src=/dev/null
119

    
120
AS_IF([test "x$enable_lustresf" != "xno" -a "x$yojson" = "xyes"], [
121
  lustresf=Makefile-lustresf.in
122
  lustresf_src=src/Makefile-lustresf.in
123
])
124

    
125
# Checking availability of path to regression tests
126
tests_path="../lustrec-tests/regression_tests"
127

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

    
147
# End of config
148

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

    
164
AC_DEFINE_DIR([abs_datadir], [datadir])
165

    
166
# Instanciation
167
AC_CONFIG_FILES([Makefile
168
		 src/Makefile
169
		 src/version.ml
170
		 src/pluginList.ml
171
		 src/_tags
172
		 src/ocaml_utils.ml
173
		 ])
174

    
175
AC_OUTPUT
176

    
177

    
178
# summary
179
AC_MSG_NOTICE(******** Configuration ********)
180
AC_MSG_NOTICE(bin path:     $prefix/bin)
181
AC_MSG_NOTICE(include path: $prefix/include)
182
AC_MSG_NOTICE(********    Plugins    ********)
183

    
184
  if (test "x$gmp" = xyes -a "x$mpfr" = xyes ); then
185
      AC_MSG_NOTICE([MPFR option enabled])
186
  else
187
      AC_MSG_WARN([MPFR option cannot be activated. Requires GMP and MPFR libs])
188
  fi
189

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

    
196
  if (test "x$yojson" = xyes -a "x$enable_lustresf" != "xno"); then
197
      AC_MSG_NOTICE([lustresf available])
198
  else
199
      if (test "x$enable_lustresf" = "xno"); then
200
        AC_MSG_NOTICE([lustresf not available (you explicitely disabled it)])
201
      else
202
        AC_MSG_NOTICE([lustresf not available])
203
      fi
204
  fi
205

    
206
AC_MSG_NOTICE(****** Regression Tests  ******)
207
if (test "x$valid_test_path" = xfalse); then
208
  AC_MSG_NOTICE(no valid tests path provided ($tests_path))
209
else
210
AC_MSG_NOTICE(tests path: $tests_path)
211
fi
212
AC_MSG_NOTICE(******** Configuration ********)
213
AC_MSG_NOTICE(Execute "make; make install" now)