Project

General

Profile

Download (6 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(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
#Yojson
65
AC_MSG_CHECKING(yojson library)
66
AS_IF([ocamlfind query yojson >/dev/null 2>&1],
67
    [],[AC_MSG_ERROR(yojson required. opam install yojson should solve the issue)],
68
)
69
AC_MSG_RESULT(yes)
70

    
71
# logging and command line librairies
72
AC_MSG_CHECKING(cmdliner library)
73
AS_IF([ocamlfind query cmdliner >/dev/null 2>&1],
74
    [],[AC_MSG_ERROR(cmdliner required. opam install cmdliner should solve the issue)],
75
)
76
AC_MSG_RESULT(yes)
77

    
78
AC_MSG_CHECKING(fmt and logs library)
79
AS_IF([ocamlfind query fmt logs >/dev/null 2>&1],
80
    [],[AC_MSG_ERROR(fmt and logs required. opam install fmt logs should solve the issue)],
81
)
82
AC_MSG_RESULT(yes)
83

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

    
88

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

    
94

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

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

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

    
113

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

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

    
136
# End of config
137

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

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

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

    
164
AC_OUTPUT
165

    
166

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

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

    
179
  if (test "x$salsa" = xyes -a "x$enable_salsa" != xno); then
180
      AC_MSG_NOTICE([Salsa plugin enabled])
181
  else
182
      AC_MSG_NOTICE([Salsa plugin disabled])
183
  fi
184
AC_MSG_NOTICE(****** Regression Tests  ******)
185
if (test "x$valid_test_path" = xfalse); then
186
  AC_MSG_NOTICE(no valid tests path provided ($tests_path))
187
else
188
AC_MSG_NOTICE(tests path: $tests_path)
189
fi
190
AC_MSG_NOTICE(******** Configuration ********)
191
AC_MSG_NOTICE(Execute "make; make install" now)
(11-11/12)