configure.ac 6.03 KB
Newer Older
POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
1 2
(**************************************************************************)
(*                                                                        *)
3 4 5 6 7 8 9 10 11 12 13
(*                 ACG development toolkit                                *)
(*                                                                        *)
(*                  Copyright 2008 INRIA                                  *)
(*                                                                        *)
(*  More information on "http://acg.gforge.loria.fr/"                     *)
(*  License: CeCILL, see the LICENSE file or "http://www.cecill.info"     *)
(*  Authors: see the AUTHORS file                                         *)
(*                                                                        *)
(*                                                                        *)
(*                                                                        *)
(*                                                                        *)
POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
14 15 16 17 18 19
(*  $Rev::                              $:  Revision of last commit       *)
(*  $Author::                           $:  Author of last commit         *)
(*  $Date::                             $:  Date of last commit           *)
(*                                                                        *)
(**************************************************************************)

POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
AC_INIT([ACG DTK],[0.1],[sylvain.pogodalla@loria.fr])

#AC_COPYRIGHT([Cecill])

OCAML_REQUIRED=3.07

# First look for bytecode compilers (ocamlc.opt or ocamlc) in the path
# Fail if not present
AC_CHECK_PROGS(OCAMLC,ocamlc.opt ocamlc,no)
if test "$OCAMLC" = no ; then
        AC_MSG_ERROR(Cannot find ocamlc.)
fi

# Then look at native code compilers (ocamlopt.opt or ocamlopt) in the path
# Fail if not present
# we first look for ocaml in the path; if not present, we fail
AC_CHECK_PROGS(OCAMLCOPT,ocamlopt.opt ocamlopt,no)
if test "$OCAMLCOPT" = no ; then
        AC_MSG_ERROR(Cannot find ocamlc.opt.)
fi

# Look for the interpreter
AC_CHECK_PROG(OCAML,ocaml,ocaml,no)
if test "$OCAML" = no ; then
        AC_MSG_ERROR(Cannot find ocaml.)
fi

# Look for camlp4o
AC_CHECK_PROG(OCAMLP4,camlp4o,camlp4o,no)
if test "$OCAMLP4" = no ; then
        AC_MSG_ERROR(Cannot find camlp4o.)
fi

# Look for documentation generators (ocamldoc.opt or ocamldoc)
AC_CHECK_PROGS(OCAMLDOC,ocamldoc.opt ocamldoc,no)
if test "$OCAMLDOC" = no ; then
        AC_MSG_ERROR(Cannot find ocamldoc.)
fi

# Look for dependency generator (ocamldep.opt or ocamldep)
AC_CHECK_PROGS(OCAMLDEP,ocamldep.opt ocamldep,no)
if test "$OCAMLDEP" = no ; then
        AC_MSG_ERROR(Cannot find ocamldep.)
fi

65
# Look for camllex
POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
66 67 68 69 70
AC_CHECK_PROGS(OCAMLLEX,ocamllex.opt ocamllex,no)
if test "$OCAMLLEX" = no ; then
	AC_MSG_ERROR(Cannot find ocamllex)
fi

71 72 73 74

# Look for ocamlfind
AC_PATH_PROG(OCAMLFIND,ocamlfind,no)

75
#Look for dypgen
76
DYPGEN_NEEDED=20080925
POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
77
AC_CHECK_PROGS(DYPGEN,dypgen.opt dypgen,no)
78 79
if test "$DYPGEN" = no ; then
	AC_MSG_ERROR(Cannot find dypgen)
80 81 82 83 84 85 86 87
else
	DYPGEN_VERSION=`$DYPGEN --version | grep version | sed 's/^.* \(.*\)$/\1/'`
	AC_MSG_CHECKING([for $DYPGEN version])
	if test $DYPGEN_VERSION -ge $DYPGEN_NEEDED ; then
	   AC_MSG_RESULT($DYPGEN ($DYPGEN_VERSION) is ok)
	else
	   AC_MSG_ERROR($DYPGEN version $DYPGEN_VERSION found ; version $DYPGEN_NEEDED or greater is needed)
	fi
POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
88 89
fi

90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
# Look for DYPGEN_LIB with or without ocamlfind
AC_MSG_CHECKING([dypgen library])
if test "$OCAMLFIND" != no ; then
   if $OCAMLFIND query dypgen > /dev/null 2>&1 ; then
      DYPGEN_INCLUDE_DIR=`$OCAMLFIND query dypgen`
      DYPGEN_FINDLIB=yes
   else
      DYPGEN_FINDLIB=no
   fi
else
      DYPGEN_FINDLIB=no
fi
if test "$DYPGEN_FINDLIB" = no ; then
   DYPGEN_PLACE=`$OCAMLC -where`
   DYPGEN_INCLUDE=""
else
   DYPGEN_PLACE=$DYPGEN_INCLUDE_DIR
   DYPGEN_INCLUDE="-I $DYPGEN_INCLUDE_DIR"
fi
if test -f $DYPGEN_PLACE/dypgen/dyp.cma ; then
      AC_MSG_RESULT(dypgen library is $DYPGEN_PLACE/dypgen/dypgen.cma)
   else
	AC_MSG_ERROR(Could not find dypgen library in $DYPGEN_PLACE)
fi
114 115


POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
# What is the OCAML version  ?
# we extract Ocaml version number
OCAML_VERSION=`$OCAMLC -version`
AC_MSG_CHECKING([for $OCAMLC version])
AC_MSG_RESULT([$OCAMLC version is $OCAML_VERSION])

# Check whether the caml version checker is provided
ML_CHECK_FILE=config/ml_check.ml
AC_CHECK_FILE($ML_CHECK_FILE,,AC_MSG_ERROR(Cannot check versions))

# check that this version is at least the one we need
if ($OCAML $ML_CHECK_FILE -ref $OCAML_REQUIRED $OCAML_VERSION > /dev/null) ; then
        AC_MSG_RESULT($OCAMLC version $OCAMLVERSION is ok)
else
        AC_MSG_ERROR($OCAMLC version $OCAMLVERSION found ; version $OCAML_NEEDED or greater is needed)
fi

# check if the dtypes option is present
if ($OCAML $ML_CHECK_FILE -ref 3.07 $OCAML_VERSION> /dev/null) ; then
	AC_MSG_RESULT(Compilation will be done with the -dtypes option)
        TYPES=-dtypes
else
	AC_MSG_RESULT(Compilation will NOT be done with the -dtypes option)
	TYPES=
fi


# check if the -w yz option is present
# and set the _loc variable of campl4 to loc
if ($OCAML $ML_CHECK_FILE -ref 3.09 $OCAML_VERSION > /dev/null) ; then
        OCAML09WARNINGS="-w yz"
	OCAMLP4_LOC="-loc loc"
	AC_MSG_RESULT($OCAMLP4 calls will be done with the $OCAMLP4_LOC option)
else
	OCAML09WARNINGS=
fi
AC_MSG_RESULT(Compilation will be done with the $OCAML09WARNINGS option)

154 155 156 157 158 159 160 161
if ($OCAML $ML_CHECK_FILE -ref 3.10 $OCAML_VERSION > /dev/null) ; then
	CAMLP4_LIB="camlp4lib.cma"
else
	CAMLP4_LIB="camlp4.cma"
fi
AC_MSG_RESULT($OCAMLP4 calls will be done with the $CAMLP4_LIB library)


POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
162 163 164 165 166 167 168


############################
# substitutions to perform
AC_SUBST(OCAMLC)
AC_SUBST(OCAMLCOPT)
AC_SUBST(OCAMLP4)
169
AC_SUBST(CAMLP4_LIB)
POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
170 171 172 173
AC_SUBST(OCAMLDOC)
AC_SUBST(OCAMLDEP)

AC_SUBST(OCAMLLEX)
174 175
#AC_SUBST(OCAMLYACC)
AC_SUBST(DYPGEN)
176
AC_SUBST(DYPGEN_INCLUDE)
POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
177 178 179 180 181 182 183

AC_SUBST(TYPES)
AC_SUBST(OCAML09WARNINGS)
AC_SUBST(OCAMLP4_LOC)

AC_SUBST(SET_MAKE)

184
AC_CONFIG_FILES([./Makefile config/Makefile src/Makefile.master src/Makefile.common src/Makefile src/utils/Makefile src/logic/Makefile src/grammars/Makefile src/lambda/Makefile src/acg-data/Makefile src/scripting/Makefile src/datalog/Makefile])
POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
185 186 187 188 189

AC_PROG_MAKE_SET

AC_OUTPUT