Project

General

Profile

Download (6.37 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.6-gitversion, [ploc@garoche.net])
4
AC_SUBST(VERSION_CODENAME, "Xia/Zhu")
5
AC_SUBST(GITBRANCH, gitbranch)
6
# Next release will be
7
#AC_INIT([lustrec], [1.7], [ploc@garoche.net])
8
#AC_SUBST(VERSION_CODENAME, "Xia/Huai")
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
# Salsa
65
AC_ARG_ENABLE(salsa, [AS_HELP_STRING([--disable-salsa],
66
              [disable Salsa plugin. Enabled by default if available.])])
67

    
68
AC_MSG_CHECKING(salsa library)
69
AS_IF([ocamlfind query salsa >/dev/null 2>&1],
70
    [salsa=yes; AC_MSG_RESULT(yes)],[salsa=no; AC_MSG_WARN(no)]
71
)
72

    
73

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

    
81
# GMP
82
AC_CHECK_LIB(gmp, __gmpz_init,
83
      [gmp=yes],
84
      [AC_MSG_RESULT([GNU MP not found])
85
      gmp=no])
86

    
87
AC_CHECK_LIB(mpfr, mpfr_add, [mpfr=yes],
88
		   [AC_MSG_RESULT(
89
[MPFR not found])
90
mpfr=no])
91

    
92
# lustresf
93
AC_ARG_ENABLE(lustresf, [AS_HELP_STRING([--disable-lustresf],
94
              [disable lustresf compilation. Enabled by default.])])
95

    
96
AC_SUBST_FILE(lustresf)
97
AC_SUBST_FILE(lustresf_src)
98
lustresf=/dev/null
99
lustresf_src=/dev/null
100

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

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

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

    
133
# End of config
134

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

    
150
AC_DEFINE_DIR([abs_datadir], [datadir])
151

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

    
161
AC_OUTPUT
162

    
163

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

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

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

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

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