Project

General

Profile

Download (5.38 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. OCamlgraph
57
AC_MSG_CHECKING(ocamlgraph library)
58
AS_IF([ocamlfind query ocamlgraph >/dev/null 2>&1],
59
    [],[AC_MSG_ERROR(ocamlgraph required. opam install ocamlgraph should solve the issue)],
60
)
61
AC_MSG_RESULT(yes)
62

    
63

    
64
AC_ARG_ENABLE(salsa, [AS_HELP_STRING([--disable-salsa],
65
              [disable Salsa plugin. Enabled by default if available.])])
66

    
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

    
82

    
83

    
84

    
85

    
86

    
87

    
88

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

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

    
99

    
100
# Checking availability of path to regression tests
101
tests_path="../lustrec-tests/regression_tests"
102

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

    
122
# End of config
123

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

    
139
AC_DEFINE_DIR([abs_datadir], [datadir])
140

    
141
# Instanciation
142
AC_CONFIG_FILES([Makefile
143
		 src/Makefile
144
		 src/version.ml
145
		 src/pluginList.ml
146
		 src/_tags
147
		 src/ocaml_utils.ml
148
		 ])
149

    
150
AC_OUTPUT
151

    
152

    
153
# summary
154
AC_MSG_NOTICE(******** Configuration ********)
155
AC_MSG_NOTICE(bin path:     $prefix/bin)
156
AC_MSG_NOTICE(include path: $prefix/include)
157
AC_MSG_NOTICE(********    Plugins    ********)
158

    
159
  if (test "x$gmp" = xyes -a "x$mpfr" = xyes ); then
160
      AC_MSG_NOTICE([MPFR option enabled])
161
  else 
162
      AC_MSG_WARN([MPFR option cannot be activated. Requires GMP and MPFR libs])
163
  fi
164

    
165
  if (test "x$salsa" = xyes -a "x$enable_salsa" != xno); then
166
      AC_MSG_NOTICE([Salsa plugin enabled])
167
  else 
168
      AC_MSG_NOTICE([Salsa plugin disabled])
169
  fi
170
AC_MSG_NOTICE(****** Regression Tests  ******)
171
if (test "x$valid_test_path" = xfalse); then
172
  AC_MSG_NOTICE(no valid tests path provided ($tests_path))
173
else
174
AC_MSG_NOTICE(tests path: $tests_path)
175
fi
176
AC_MSG_NOTICE(******** Configuration ********)
177
AC_MSG_NOTICE(Execute "make; make install" now)
(11-11/12)