Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / configure.ac @ 3471cb4d

History | View | Annotate | Download (6.46 KB)

1
AC_INIT([lustrec], 1.5-gitversion, [ploc@garoche.net])
2

    
3
gitbranch=`git branch | grep \* | sed "s/\*[ ]*//"`
4
define([gitversion], esyscmd([sh -c "git log --oneline | wc -l | tr -d '\n'"]))
5
#define([gitbranch], esyscmd([sh -c "git branch | grep \* | cut -d ' ' -f2"]))
6

    
7
AC_SUBST(VERSION_CODENAME, "Xia/Shao Kang-dev")
8
AC_SUBST(GITBRANCH, "$gitbranch")
9
# Next release will be
10
#AC_INIT([lustrec], [1.6], [ploc@garoche.net])
11
#AC_SUBST(VERSION_CODENAME, "Xia/Zhu")
12
AC_MSG_NOTICE(Git branch: ${GITBRANCH})
13
AC_CONFIG_SRCDIR([src/main_lustre_compiler.ml])
14
AC_CONFIG_SRCDIR([src/main_lustre_testgen.ml])
15

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

    
26
AC_PATH_PROG([OCAMLBUILD],[ocamlbuild],[:])
27

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

    
35
# default prefix is /usr/local
36
AC_PREFIX_DEFAULT(/usr/local)
37

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

    
51

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

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

    
67
#Yojson
68
AC_MSG_CHECKING(yojson library (optional))
69
AS_IF([ocamlfind query yojson >/dev/null 2>&1],
70
    [yojson=yes; AC_MSG_RESULT(yes)],[yojson=no; AC_MSG_WARN(Yojson required for lustresf. opam install yojson should solve the issue)],
71
)
72

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

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

    
82

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

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

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

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

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

    
110
AS_IF([test "x$enable_lustresf" != "xno" -a "x$yojson" = "xyes"], [
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)