Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / configure.ac @ 93119c3f

History | View | Annotate | Download (5.15 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. OCamlgraph
51
AC_MSG_CHECKING(ocamlgraph library)
52
AS_IF([ocamlfind query ocamlgraph >/dev/null 2>&1],
53
    [],[AC_MSG_ERROR(ocamlgraph required. opam install ocamlgraph should solve the issue)],
54
)
55
AC_MSG_RESULT(yes)
56

    
57

    
58
AC_ARG_ENABLE(salsa, [AS_HELP_STRING([--disable-salsa],
59
              [disable Salsa plugin. Enabled by default if available.])])
60

    
61

    
62
AC_MSG_CHECKING(salsa library)
63
AS_IF([ocamlfind query salsa >/dev/null 2>&1],
64
    [salsa=yes; AC_MSG_RESULT(yes)],[salsa=no; AC_MSG_WARN(no)]
65
)
66

    
67

    
68
AS_IF([test "x$enable_salsa" != "xno"], [
69
  if (test "x$salsa" = xyes ); then
70
   AC_SUBST(SALSA, "(module Salsa_plugin.Plugin : PluginType.PluginType);")
71
   AC_SUBST(SALSA_TAG, "<**/*.native> or <plugins/salsa/*.cm?> : package(salsa)")
72
  fi	
73
])
74

    
75

    
76

    
77

    
78

    
79

    
80

    
81

    
82

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

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

    
93

    
94
# Checking availability of path to regression tests
95
tests_path="../lustrec-tests/regression_tests"
96

    
97
AC_ARG_WITH([tests-path],
98
            [AS_HELP_STRING([--with-tests-path],
99
               [provides path to test suite (default is ../lustrec-test if available)])],
100
            [tests_path="$withval";
101
	     if (test "x$tests_path" = xyes); then
102
	       AC_MSG_ERROR(Option --with-tests-path requires a parameter: eg. --with-tests-path=value);
103
	     fi],
104
            )
105
AC_MSG_NOTICE($tests_path)
106
AC_CHECK_FILE(${tests_path}/CMakeLists.txt,
107
              [
108
	      valid_test_path=true	
109
	      ],
110
	      [
111
	      valid_test_path=false
112
	        AC_SUBST(PATH_TO_TESTS, $tests_path)	      ])
113
AC_SUBST(PATH_TO_TESTS_DEFINED, $valid_test_path)
114
AC_SUBST(PATH_TO_TESTS, $tests_path)
115

    
116
# End of config
117

    
118
AC_DEFUN([AC_DEFINE_DIR], [
119
  prefix_NONE=
120
  exec_prefix_NONE=
121
  test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
122
  test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
123
dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
124
dnl refers to ${prefix}.  Thus we have to use `eval' twice.
125
  eval ac_define_dir="\"[$]$2\""
126
  eval ac_define_dir="\"$ac_define_dir\""
127
  AC_SUBST($1, "$ac_define_dir")
128
  AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3])
129
  test "$prefix_NONE" && prefix=NONE
130
  test "$exec_prefix_NONE" && exec_prefix=NONE
131
])
132

    
133
AC_DEFINE_DIR([abs_datadir], [datadir])
134

    
135
# Instanciation
136
AC_CONFIG_FILES([Makefile
137
		 src/Makefile
138
		 src/version.ml
139
		 src/pluginList.ml
140
		 src/_tags
141
		 ])
142

    
143
AC_OUTPUT
144

    
145

    
146
# summary
147
AC_MSG_NOTICE(******** Configuration ********)
148
AC_MSG_NOTICE(bin path:     $prefix/bin)
149
AC_MSG_NOTICE(include path: $prefix/include)
150
AC_MSG_NOTICE(********    Plugins    ********)
151

    
152
  if (test "x$gmp" = xyes -a "x$mpfr" = xyes ); then
153
      AC_MSG_NOTICE([MPFR option enabled])
154
  else 
155
      AC_MSG_WARN([MPFR option cannot be activated. Requires GMP and MPFR libs])
156
  fi
157

    
158
  if (test "x$salsa" = xyes -a "x$enable_salsa" != xno); then
159
      AC_MSG_NOTICE([Salsa plugin enabled])
160
  else 
161
      AC_MSG_NOTICE([Salsa plugin disabled])
162
  fi
163
AC_MSG_NOTICE(****** Regression Tests  ******)
164
if (test "x$valid_test_path" = xfalse); then
165
  AC_MSG_NOTICE(no valid tests path provided ($tests_path))
166
else
167
AC_MSG_NOTICE(tests path: $tests_path)
168
fi
169
AC_MSG_NOTICE(******** Configuration ********)
170
AC_MSG_NOTICE(Execute "make; make install" now)