Project

General

Profile

Download (3.95 KB) Statistics
| Branch: | Tag: | Revision:
1
define([gitversion], esyscmd([sh -c "git log --oneline | wc -l | tr -d '\n'"]))
2

    
3
# Next release will be
4
#AC_INIT([lustrec], [1.4-gitversion], [ploc@garoche.net])
5
#AC_SUBST(VERSION_CODENAME, "Xia/Xiang-dev")
6
AC_INIT([lustrec], [1.3], [ploc@garoche.net])
7
AC_SUBST(VERSION_CODENAME, "Xia/Zhong-Kang")
8

    
9
AC_CONFIG_SRCDIR([src/main_lustre_compiler.ml])
10

    
11
# default prefix is /usr/local
12
AC_PREFIX_DEFAULT(/usr/local)
13

    
14
AC_ARG_WITH([ocamlgraph-path],
15
        [AS_HELP_STRING([--ocamlgraph-path],
16
              [specify the path of ocamlgraph library. graph.cmxa should be in ocamlgraph-path @<:@default=$(ocamlfind query ocamlgraph)@:>@])],
17
        [AS_IF([test "x$ocamlgraph_path" = xno],
18
                [AC_MSG_ERROR([ocamlgraph library is needed])],
19
                [test "x$ocamlgraph_path" = xyes],
20
                [OCAMLGRAPH_PATH=$(ocamlfind query ocamlgraph)],
21
                [OCAMLGRAPH_PATH=$ocamlgraph_path]
22
        )],
23
        [OCAMLGRAPH_PATH=$(ocamlfind query ocamlgraph)]
24
)
25
AC_SUBST(OCAMLGRAPH_PATH)
26

    
27
AC_SUBST(SRC_PATH, esyscmd([sh -c "pwd" | tr -d '\n']))
28

    
29
AC_PATH_PROG([OCAMLC],[ocamlc],[:])
30
AC_MSG_CHECKING(OCaml version)
31
ocamlc_version=`$OCAMLC -v | grep version | rev| cut -d \  -f 1 | rev`
32
major=`echo $ocamlc_version | cut -d . -f 1`
33
minor=`echo $ocamlc_version | cut -d . -f 2`
34
if (test "$major" -lt 4 -a "$minor" -lt 0 ); then
35
  AC_MSG_ERROR([Ocaml version must be at least 4.0. You have version $ocamlc_version])
36
fi
37
AC_MSG_RESULT(valid ocaml version detected: $ocamlc_version)
38

    
39
AC_PATH_PROG([OCAMLBUILD],[ocamlbuild],[:])
40

    
41

    
42
# Checking libs
43

    
44
# Checks for libraries. OCamlgraph
45
AC_MSG_CHECKING(ocamlgraph library)
46
   ocamlgraph_lib=`find $OCAMLGRAPH_PATH -iname graph.cmxa | grep -m 1 -o "graph.cmxa"`
47
   if (test "x$ocamlgraph_lib" = xgraph.cmxa ); then
48
	ocamlgraph_lib_full=`find $OCAMLGRAPH_PATH -iname graph.cmxa | grep -m 1 "graph.cmxa"`
49
      AC_MSG_RESULT(library detected: $ocamlgraph_lib_full )
50
   else
51
      AC_MSG_ERROR([ocamlgraph library not installed in $OCAMLGRAPH_PATH])
52
   fi
53

    
54
AC_CHECK_LIB(gmp, __gmpz_init, 
55
      [gmp=yes],
56
      [AC_MSG_RESULT([GNU MP not found])
57
      gmp=no])
58

    
59
AC_CHECK_LIB(mpfr, mpfr_add, [mpfr=yes], 
60
		   [AC_MSG_RESULT(
61
[MPFR not found])
62
mpfr=no])
63

    
64

    
65
# Workaround to solve an issue with ocamlbuild and C libraries.
66
# oCFLAGS="$CFLAGS"
67
# CFLAGS="$FLAGS -Wl,--no-as-needed"
68
# AC_MSG_CHECKING([whether we need to add --no-as-needed linking option])
69
# AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],
70
#                                      [[
71
#                                         int main(){ return 0; }
72
#                                     ]])],
73
#                   [AC_MSG_RESULT([yes]); CC_NOASNEEDED="true"],
74
#                   [AC_MSG_RESULT([no]); CC_NOASNEEDED="false"])
75
# CFLAGS=$oCFLAGS
76
# AC_SUBST(CC_NOASNEEDED)
77

    
78

    
79
# End of config
80

    
81
AC_DEFUN([AC_DEFINE_DIR], [
82
  prefix_NONE=
83
  exec_prefix_NONE=
84
  test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
85
  test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
86
dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
87
dnl refers to ${prefix}.  Thus we have to use `eval' twice.
88
  eval ac_define_dir="\"[$]$2\""
89
  eval ac_define_dir="\"$ac_define_dir\""
90
  AC_SUBST($1, "$ac_define_dir")
91
  AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3])
92
  test "$prefix_NONE" && prefix=NONE
93
  test "$exec_prefix_NONE" && exec_prefix=NONE
94
])
95

    
96
AC_DEFINE_DIR([abs_datadir], [datadir])
97

    
98
# Instanciation
99
AC_CONFIG_FILES([Makefile
100
		 src/Makefile
101
                 src/myocamlbuild.ml
102
		 src/version.ml
103
		 test/test-compile.sh
104
		 ])
105

    
106
AC_OUTPUT
107

    
108

    
109
# summary
110
AC_MSG_NOTICE(******** Configuration ********)
111
AC_MSG_NOTICE(bin path:     $prefix/bin)
112
AC_MSG_NOTICE(include path: $prefix/include)
113
AC_MSG_NOTICE(********    Plugins    ********)
114

    
115
  if (test "x$gmp" = xyes -a "x$mpfr" = xyes ); then
116
       AC_MSG_NOTICE([-mpfr option enable])
117

    
118
   else 
119
       AC_MSG_WARN([MPFR option cannot be activated. Requires GMP and MPFR libs])
120
      
121
   fi
122
 
123
AC_MSG_NOTICE
124
AC_MSG_NOTICE(******** Configuration ********)
125

    
(8-8/11)