Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / configure.ac @ a837b379

History | View | Annotate | Download (4 KB)

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

    
3
#AC_INIT([lustrec], [1.2-gitversion], [ploc@garoche.net])
4
#AC_SUBST(VERSION_CODENAME, "dev")
5
AC_INIT([lustrec], [1.2], [ploc@garoche.net])
6
AC_SUBST(VERSION_CODENAME, "Xia/Tai-Kang")
7

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

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

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

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

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

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

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

    
43

    
44
# Checking libs
45

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

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

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

    
66

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

    
80

    
81
# End of config
82

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

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

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

    
108
AC_OUTPUT
109

    
110

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

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

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