lustrec / configure.ac @ bed8ea64
History | View | Annotate | Download (3.21 KB)
1 |
define([svnversion], esyscmd([sh -c "svnversion|sed "s/:.*//"|tr -d '\n'"]))dnl |
---|---|
2 |
AC_INIT([lustrec], [0.1-svnversion], [ploc@garoche.net]) |
3 |
|
4 |
|
5 |
AC_DEFINE(SVN_REVISION, "svnversion", [SVN Revision]) |
6 |
AC_SUBST(SVN_REVISION) |
7 |
|
8 |
AC_CONFIG_SRCDIR([src/main_lustre_compiler.ml]) |
9 |
|
10 |
# default prefix is /usr/local |
11 |
AC_PREFIX_DEFAULT(/usr/local) |
12 |
|
13 |
AC_ARG_WITH([ocamlgraph-path], |
14 |
[AS_HELP_STRING([--ocamlgraph-path], |
15 |
[specify the path of ocamlgraph library. graph.cmxa should be in ocamlgraph-path @<:@default=$(ocamlfind query ocamlgraph)@:>@])], |
16 |
[AS_IF([test "x$ocamlgraph_path" = xno], |
17 |
[AC_MSG_ERROR([ocamlgraph library is needed])], |
18 |
[test "x$ocamlgraph_path" = xyes], |
19 |
[OCAMLGRAPH_PATH=$(ocamlfind query ocamlgraph)], |
20 |
[OCAMLGRAPH_PATH=$ocamlgraph_path] |
21 |
)], |
22 |
[OCAMLGRAPH_PATH=$(ocamlfind query ocamlgraph)] |
23 |
) |
24 |
AC_SUBST(OCAMLGRAPH_PATH) |
25 |
|
26 |
|
27 |
AC_PATH_PROG([OCAMLC],[ocamlc],[:]) |
28 |
AC_MSG_CHECKING(OCaml version) |
29 |
ocamlc_version=`$OCAMLC -v | grep version | rev| cut -d \ -f 1 | rev` |
30 |
major=`echo $ocamlc_version | cut -d . -f 1` |
31 |
minor=`echo $ocamlc_version | cut -d . -f 2` |
32 |
if (test "$major" -lt 3 -a "$minor" -lt 11 ); then |
33 |
AC_MSG_ERROR([Ocaml version must be at least 3.11. You have version $ocamlc_version]) |
34 |
fi |
35 |
AC_MSG_RESULT(valid ocaml version detected: $ocamlc_version) |
36 |
|
37 |
AC_PATH_PROG([OCAMLBUILD],[ocamlbuild],[:]) |
38 |
|
39 |
|
40 |
# Checking libs |
41 |
|
42 |
# Checks for libraries. OCamlgraph |
43 |
AC_MSG_CHECKING(ocamlgraph library) |
44 |
ocamlgraph_lib=`find $OCAMLGRAPH_PATH -iname graph.cmxa -nowarn | grep -m 1 -o "graph.cmxa"` |
45 |
if (test "x$ocamlgraph_lib" = xgraph.cmxa ); then |
46 |
ocamlgraph_lib_full=`find $OCAMLGRAPH_PATH -iname graph.cmxa -nowarn | grep -m 1 "graph.cmxa"` |
47 |
AC_MSG_RESULT(library detected: $ocamlgraph_lib_full ) |
48 |
else |
49 |
AC_MSG_ERROR([ocamlgraph library not installed in $OCAMLGRAPH_PATH]) |
50 |
fi |
51 |
|
52 |
|
53 |
# Workaround to solve an issue with ocamlbuild and C libraries. |
54 |
oCFLAGS="$CFLAGS" |
55 |
CFLAGS="$FLAGS -Wl,--no-as-needed" |
56 |
AC_MSG_CHECKING([whether we need to add --no-as-needed linking option]) |
57 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], |
58 |
[[ |
59 |
int main(){ return 0; } |
60 |
]])], |
61 |
[AC_MSG_RESULT([yes]); CC_NOASNEEDED="true"], |
62 |
[AC_MSG_RESULT([no]); CC_NOASNEEDED="false"]) |
63 |
CFLAGS=$oCFLAGS |
64 |
AC_SUBST(CC_NOASNEEDED) |
65 |
|
66 |
|
67 |
# End of config |
68 |
|
69 |
AC_DEFUN([AC_DEFINE_DIR], [ |
70 |
prefix_NONE= |
71 |
exec_prefix_NONE= |
72 |
test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix |
73 |
test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix |
74 |
dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn |
75 |
dnl refers to ${prefix}. Thus we have to use `eval' twice. |
76 |
eval ac_define_dir="\"[$]$2\"" |
77 |
eval ac_define_dir="\"$ac_define_dir\"" |
78 |
AC_SUBST($1, "$ac_define_dir") |
79 |
AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3]) |
80 |
test "$prefix_NONE" && prefix=NONE |
81 |
test "$exec_prefix_NONE" && exec_prefix=NONE |
82 |
]) |
83 |
|
84 |
AC_DEFINE_DIR([abs_datadir], [datadir]) |
85 |
|
86 |
# Instanciation |
87 |
AC_CONFIG_FILES([Makefile |
88 |
src/Makefile |
89 |
src/myocamlbuild.ml |
90 |
src/version.ml]) |
91 |
|
92 |
AC_OUTPUT |
93 |
|
94 |
|
95 |
# summary |
96 |
dnl AC_MSG_NOTICE(******** Configuration ********) |
97 |
|