Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / configure.ac @ d21f00de

History | View | Annotate | Download (5.77 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
# 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

    
26
# default prefix is /usr/local
27
AC_PREFIX_DEFAULT(/usr/local)
28

    
29
dnl AC_ARG_WITH([ocamlgraph-path],
30
dnl         [AS_HELP_STRING([--ocamlgraph-path],
31
dnl               [specify the path of ocamlgraph library. graph.cmxa should be in ocamlgraph-path @<:@default=$(ocamlfind query ocamlgraph)@:>@])],
32
dnl         [AS_IF([test "x$ocamlgraph_path" = xno],
33
dnl                 [AC_MSG_ERROR([ocamlgraph library is needed])],
34
dnl                 [test "x$ocamlgraph_path" = xyes],
35
dnl                 [OCAMLGRAPH_PATH=$(ocamlfind query ocamlgraph)],
36
dnl                 [OCAMLGRAPH_PATH=$ocamlgraph_path]
37
dnl         )],
38
dnl         [OCAMLGRAPH_PATH=$(ocamlfind query ocamlgraph)]
39
dnl )
40
dnl AC_SUBST(OCAMLGRAPH_PATH)
41

    
42

    
43
# Checking libs
44
AC_CHECK_PROG(FINDLIB_CHECK,ocamlfind,yes)
45
if test x"$FINDLIB_CHECK" != x"yes" ; then
46
   AC_MSG_ERROR(ocamlfind required!)
47
fi
48
dnl AC_MSG_RESULT(Hourrah: ocamlfind found!)
49

    
50
# Checks for libraries.
51
# OCamlgraph
52
AC_MSG_CHECKING(ocamlgraph library)
53
AS_IF([ocamlfind query ocamlgraph >/dev/null 2>&1],
54
    [],[AC_MSG_ERROR(ocamlgraph required. opam install ocamlgraph should solve the issue)],
55
)
56
AC_MSG_RESULT(yes)
57

    
58
#Yojson
59
AC_MSG_CHECKING(yojson library)
60
AS_IF([ocamlfind query yojson >/dev/null 2>&1],
61
    [],[AC_MSG_ERROR(yojson required. opam install yojson should solve the issue)],
62
)
63
AC_MSG_RESULT(yes)
64

    
65
# logging and command line librairies
66
AC_MSG_CHECKING(cmdliner library)
67
AS_IF([ocamlfind query cmdliner >/dev/null 2>&1],
68
    [],[AC_MSG_ERROR(cmdliner required. opam install cmdliner should solve the issue)],
69
)
70
AC_MSG_RESULT(yes)
71

    
72
AC_MSG_CHECKING(fmt and logs library)
73
AS_IF([ocamlfind query fmt logs >/dev/null 2>&1],
74
    [],[AC_MSG_ERROR(fmt and logs required. opam install fmt logs should solve the issue)],
75
)
76
AC_MSG_RESULT(yes)
77

    
78
# Salsa
79
AC_ARG_ENABLE(salsa, [AS_HELP_STRING([--disable-salsa],
80
              [disable Salsa plugin. Enabled by default if available.])])
81

    
82

    
83
AC_MSG_CHECKING(salsa library)
84
AS_IF([ocamlfind query salsa >/dev/null 2>&1],
85
    [salsa=yes; AC_MSG_RESULT(yes)],[salsa=no; AC_MSG_WARN(no)]
86
)
87

    
88

    
89
AS_IF([test "x$enable_salsa" != "xno"], [
90
  if (test "x$salsa" = xyes ); then
91
   AC_SUBST(SALSA, "(module Salsa_plugin.Plugin : PluginType.PluginType);")
92
   AC_SUBST(SALSA_TAG, "<**/*.native> or <plugins/salsa/*.cm?> : package(salsa)")
93
  fi
94
])
95

    
96
# GMP
97
AC_CHECK_LIB(gmp, __gmpz_init,
98
      [gmp=yes],
99
      [AC_MSG_RESULT([GNU MP not found])
100
      gmp=no])
101

    
102
AC_CHECK_LIB(mpfr, mpfr_add, [mpfr=yes],
103
		   [AC_MSG_RESULT(
104
[MPFR not found])
105
mpfr=no])
106

    
107

    
108
# Checking availability of path to regression tests
109
tests_path="../lustrec-tests/regression_tests"
110

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

    
130
# End of config
131

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

    
147
AC_DEFINE_DIR([abs_datadir], [datadir])
148

    
149
# Instanciation
150
AC_CONFIG_FILES([Makefile
151
		 src/Makefile
152
		 src/version.ml
153
		 src/pluginList.ml
154
		 src/_tags
155
		 ])
156

    
157
AC_OUTPUT
158

    
159

    
160
# summary
161
AC_MSG_NOTICE(******** Configuration ********)
162
AC_MSG_NOTICE(bin path:     $prefix/bin)
163
AC_MSG_NOTICE(include path: $prefix/include)
164
AC_MSG_NOTICE(********    Plugins    ********)
165

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

    
172
  if (test "x$salsa" = xyes -a "x$enable_salsa" != xno); then
173
      AC_MSG_NOTICE([Salsa plugin enabled])
174
  else
175
      AC_MSG_NOTICE([Salsa plugin disabled])
176
  fi
177
AC_MSG_NOTICE(****** Regression Tests  ******)
178
if (test "x$valid_test_path" = xfalse); then
179
  AC_MSG_NOTICE(no valid tests path provided ($tests_path))
180
else
181
AC_MSG_NOTICE(tests path: $tests_path)
182
fi
183
AC_MSG_NOTICE(******** Configuration ********)
184
AC_MSG_NOTICE(Execute "make; make install" now)