Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / configure.ac @ 27446b88

History | View | Annotate | Download (6.5 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
if test x"$GITBRANCH" != "xmaster"; then
7
  AC_SUBST(CDASHSUBPROJ, "unstable")
8
else
9
  AC_SUBST(CDASHSUBPROJ, "master")
10
fi
11
# Next release will be
12
#AC_INIT([lustrec], [1.6], [ploc@garoche.net])
13
#AC_SUBST(VERSION_CODENAME, "Xia/Zhu")
14
AC_MSG_NOTICE(Git branch: ${GITBRANCH})
15
AC_CONFIG_SRCDIR([src/main_lustre_compiler.ml])
16
AC_CONFIG_SRCDIR([src/main_lustre_testgen.ml])
17

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

    
28
AC_PATH_PROG([OCAMLBUILD],[ocamlbuild],[:])
29

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

    
37
# default prefix is /usr/local
38
AC_PREFIX_DEFAULT(/usr/local)
39

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

    
53

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

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

    
69
# Salsa
70
AC_ARG_ENABLE(salsa, [AS_HELP_STRING([--disable-salsa],
71
              [disable Salsa plugin. Enabled by default if available.])])
72

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

    
78

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

    
86
# GMP
87
AC_CHECK_LIB(gmp, __gmpz_init,
88
      [gmp=yes],
89
      [AC_MSG_RESULT([GNU MP not found])
90
      gmp=no])
91

    
92
AC_CHECK_LIB(mpfr, mpfr_add, [mpfr=yes],
93
		   [AC_MSG_RESULT(
94
[MPFR not found])
95
mpfr=no])
96

    
97
# lustresf
98
AC_ARG_ENABLE(lustresf, [AS_HELP_STRING([--disable-lustresf],
99
              [disable lustresf compilation. Enabled by default.])])
100

    
101
AC_SUBST_FILE(lustresf)
102
AC_SUBST_FILE(lustresf_src)
103
lustresf=/dev/null
104
lustresf_src=/dev/null
105

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

    
116
# Checking availability of path to regression tests
117
tests_path="../lustrec-tests/regression_tests"
118

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

    
138
# End of config
139

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

    
155
AC_DEFINE_DIR([abs_datadir], [datadir])
156

    
157
# Instanciation
158
AC_CONFIG_FILES([Makefile
159
		 src/Makefile
160
		 src/version.ml
161
		 src/pluginList.ml
162
		 src/_tags
163
		 src/ocaml_utils.ml
164
		 ])
165

    
166
AC_OUTPUT
167

    
168

    
169
# summary
170
AC_MSG_NOTICE(******** Configuration ********)
171
AC_MSG_NOTICE(bin path:     $prefix/bin)
172
AC_MSG_NOTICE(include path: $prefix/include)
173
AC_MSG_NOTICE(********    Plugins    ********)
174

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

    
181
  if (test "x$salsa" = xyes -a "x$enable_salsa" != xno); then
182
      AC_MSG_NOTICE([Salsa plugin enabled])
183
  else
184
      AC_MSG_NOTICE([Salsa plugin disabled])
185
  fi
186

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

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