Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / configure.ac @ bde99c3f

History | View | Annotate | Download (3.95 KB)

1
define([gitversion], esyscmd([sh -c "git log --oneline | wc -l | tr -d '\n'"]))
2

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

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

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

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

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

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

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

    
42

    
43
# Checking libs
44

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

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

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

    
65

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

    
79

    
80
# End of config
81

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

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

    
99
# Instanciation
100
AC_CONFIG_FILES([Makefile
101
		 src/Makefile
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