Project

General

Profile

Download (6.4 KB) Statistics
| Branch: | Tag: | Revision:
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(ocaml libraries required)
59
AS_IF([ocamlfind query ocamlgraph cmdliner fmt logs num >/dev/null 2>&1],
60
    [],[AC_MSG_ERROR(A few ocaml library required. opam install ocamlgraph cmdliner fmt logs num should solve the issue)],
61
)
62
AC_MSG_RESULT(yes)
63

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

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

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

    
79

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

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

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

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

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

    
107
AS_IF([test "x$enable_lustresf" != "xno" -a "x$yojson" = "xyes"], [
108
  lustresf=Makefile-lustresf.in
109
  lustresf_src=src/Makefile-lustresf.in
110
  AC_SUBST(lustresf_target, "lustresf")
111
])
112

    
113
# Checking availability of path to regression tests
114
tests_path="../lustrec-tests/regression_tests"
115

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

    
135
# End of config
136

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

    
152
AC_DEFINE_DIR([abs_datadir], [datadir])
153

    
154
# Instanciation
155
AC_CONFIG_FILES([Makefile
156
		 src/Makefile
157
		 src/version.ml
158
		 src/pluginList.ml
159
		 src/_tags
160
		 src/ocaml_utils.ml
161
		 ])
162

    
163
AC_OUTPUT
164

    
165

    
166
# summary
167
AC_MSG_NOTICE(******** Configuration ********)
168
AC_MSG_NOTICE(bin path:     $prefix/bin)
169
AC_MSG_NOTICE(include path: $prefix/include)
170
AC_MSG_NOTICE(********    Plugins    ********)
171

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

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

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

    
194
AC_MSG_NOTICE(****** Regression Tests  ******)
195
if (test "x$valid_test_path" = xfalse); then
196
  AC_MSG_NOTICE(no valid tests path provided ($tests_path))
197
else
198
AC_MSG_NOTICE(tests path: $tests_path)
199
fi
200
AC_MSG_NOTICE(******** Configuration ********)
201
AC_MSG_NOTICE(Execute "make; make install" now)
(12-12/13)