Project

General

Profile

Download (3.8 KB) Statistics
| Branch: | Tag: | Revision:
1
dnl define([svnversion], esyscmd([sh -c "svnversion|sed "s/:.*//"|tr -d '\n'"]))
2
AC_INIT([lustrec], [1.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
AC_PATH_PROG([OCAMLC],[ocamlc],[:])
11
AC_MSG_CHECKING(OCaml version)
12
ocamlc_version=`$OCAMLC -v | grep version | rev| cut -d \  -f 1 | rev`
13
major=`echo $ocamlc_version | cut -d . -f 1`
14
minor=`echo $ocamlc_version | cut -d . -f 2`
15
if (test "$major" -lt 3 -a "$minor" -lt 12 ); then
16
  AC_MSG_ERROR([Ocaml version must be at least 3.12. You have version $ocamlc_version])
17
fi
18
AC_MSG_RESULT(valid ocaml version detected: $ocamlc_version)
19

    
20
AC_PATH_PROG([OCAMLBUILD],[ocamlbuild],[:])
21

    
22

    
23
# default prefix is /usr/local
24
AC_PREFIX_DEFAULT(/usr/local)
25

    
26
# Checking libs
27

    
28
AC_ARG_WITH([ocamlgraph-path],
29
        [AS_HELP_STRING([--ocamlgraph-path],
30
              [specify the path of ocamlgraph library. graph.cmxa should be in ocamlgraph-path @<:@default=$(ocamlfind query ocamlgraph)@:>@])],
31
        [AS_IF([test "x$ocamlgraph_path" = xno],
32
                [AC_MSG_ERROR([ocamlgraph library is needed])],
33
                [test "x$ocamlgraph_path" = xyes],
34
                [OCAMLGRAPH_PATH=$(ocamlfind query ocamlgraph)],
35
                [OCAMLGRAPH_PATH=$ocamlgraph_path]
36
        )],
37
        [OCAMLGRAPH_PATH=$(ocamlfind query ocamlgraph)]
38
)
39
AC_SUBST(OCAMLGRAPH_PATH)
40

    
41
AC_MSG_CHECKING(ocamlgraph library)
42
   ocamlgraph_lib=`find $OCAMLGRAPH_PATH -iname graph.cmxa -nowarn | grep -m 1 -o "graph.cmxa"`
43
   if (test "x$ocamlgraph_lib" = xgraph.cmxa ); then
44
	ocamlgraph_lib_full=`find $OCAMLGRAPH_PATH -iname graph.cmxa -nowarn | grep -m 1 "graph.cmxa"`
45
      AC_MSG_RESULT($ocamlgraph_lib_full )
46
   else 
47
      AC_MSG_ERROR([ocamlgraph library not installed in $OCAMLGRAPH_PATH])
48
   fi
49

    
50
AC_CHECK_LIB(gmp, __gmpz_init, 
51
      [gmp=yes],
52
      [AC_MSG_RESULT([GNU MP not found])
53
      gmp=no])
54

    
55
AC_CHECK_LIB(mpfr, mpfr_add, [mpfr=yes], 
56
		   [AC_MSG_RESULT(
57
[MPFR not found])
58
mpfr=no])
59

    
60

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

    
74

    
75
# End of config
76

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

    
92
AC_DEFINE_DIR([abs_datadir], [datadir])
93

    
94
# Instanciation
95
AC_CONFIG_FILES([Makefile
96
		 src/Makefile
97
                 src/myocamlbuild.ml
98
		 src/version.ml])
99

    
100
AC_OUTPUT
101

    
102

    
103
# summary
104
AC_MSG_NOTICE(******** Configuration ********)
105
AC_MSG_NOTICE(bin path:     $prefix/bin)
106
AC_MSG_NOTICE(include path: $prefix/include)
107
AC_MSG_NOTICE(********    Plugins    ********)
108

    
109
  if (test "x$gmp" = xyes -a "x$mpfr" = xyes ); then
110
       AC_MSG_NOTICE([-mpfr option enable])
111

    
112
   else 
113
       AC_MSG_WARN([MPFR option cannot be activated. Requires GMP and MPFR libs])
114
      
115
   fi
116
 
117
AC_MSG_NOTICE
118
AC_MSG_NOTICE(******** Configuration ********)
119
AC_MSG_NOTICE(******** Configuration ********)
120

    
(8-8/10)