Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / configure.ac @ 3b2bd83d

History | View | Annotate | Download (4.03 KB)

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

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

    
9
#AC_DEFINE(SVN_REVISION, "svnversion", [SVN Revision])
10
#AC_SUBST(SVN_REVISION)
11

    
12
AC_CONFIG_SRCDIR([src/main_lustre_compiler.ml])
13

    
14
# default prefix is /usr/local
15
AC_PREFIX_DEFAULT(/usr/local)
16

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

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

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

    
42
AC_PATH_PROG([OCAMLBUILD],[ocamlbuild],[:])
43

    
44

    
45
# Checking libs
46

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

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

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

    
67

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

    
81

    
82
# End of config
83

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

    
99
AC_DEFINE_DIR([abs_datadir], [datadir])
100

    
101
# Instanciation
102
AC_CONFIG_FILES([Makefile
103
		 src/Makefile
104
                 src/myocamlbuild.ml
105
		 src/version.ml
106
		 test/test-compile.sh
107
		 ])
108

    
109
AC_OUTPUT
110

    
111

    
112
# summary
113
AC_MSG_NOTICE(******** Configuration ********)
114
AC_MSG_NOTICE(bin path:     $prefix/bin)
115
AC_MSG_NOTICE(include path: $prefix/include)
116
AC_MSG_NOTICE(********    Plugins    ********)
117

    
118
  if (test "x$gmp" = xyes -a "x$mpfr" = xyes ); then
119
       AC_MSG_NOTICE([-mpfr option enable])
120

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