configure.ac 9.56 KB
Newer Older
POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
1 2
(**************************************************************************)
(*                                                                        *)
3 4 5 6
(*                 ACG development toolkit                                *)
(*                                                                        *)
(*                  Copyright 2008 INRIA                                  *)
(*                                                                        *)
7
(*  More information on "http://acg.gforge.inria.fr/"                     *)
8 9 10 11 12 13
(*  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           *)
(*                                                                        *)
(**************************************************************************)

20
VERSION="1.3.0-20160909"
21 22

AC_INIT([ACG DTK],[$VERSION],[sylvain.pogodalla@loria.fr])
POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
23 24

#AC_COPYRIGHT([Cecill])
25
m4_include(ac_lib_checking.m4)
POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
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 65 66 67

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

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

74 75 76 77 78 79
# Look for ocamlyacc
AC_CHECK_PROGS(OCAMLYACC,ocamlyacc.opt ocamlyacc,no)
if test "$OCAMLYACC" = no ; then
	AC_MSG_ERROR(Cannot find ocamlyac)
fi

80 81 82 83

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

84 85 86
# Look for opam
AC_PATH_PROG(OPAM,opam,no)

87
#Look for dypgen
88
DYPGEN_NEEDED=20080925
89 90 91 92
AC_ARG_VAR(DYPGEN_PATH,[Directory where to find dypgen if not in a standard location])
if test -n "$DYPGEN_PATH" ; then
   AC_CHECK_PROG(DYPGEN,dypgen,$DYPGEN_PATH/dypgen,no,$DYPGEN_PATH)
else
93
   AC_CHECK_PROGS(DYPGEN,dypgen.opt dypgen,no)
94
fi
95
if test "$DYPGEN" = no ; then
96
   AC_MSG_ERROR(Cannot find dypgen)
97 98 99 100
else
	DYPGEN_VERSION=`$DYPGEN --version | grep version | sed 's/^.* \(.*\)$/\1/'`
	AC_MSG_CHECKING([for $DYPGEN version])
	if test $DYPGEN_VERSION -ge $DYPGEN_NEEDED ; then
101
		   AC_MSG_RESULT($DYPGEN ($DYPGEN_VERSION) is ok)
102
		   AC_SUBST(DYPGEN)
103
	else
104
		   AC_MSG_ERROR($DYPGEN version $DYPGEN_VERSION found ; version $DYPGEN_NEEDED or greater is needed)
105
	fi
POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
106 107
fi

108
# Look for DYPGEN_LIB with or without ocamlfind
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
AC_ARG_VAR(DYPGENLIB_PATH,[Directory where to find the dypgen library if not in a standard location])
AC_LIB_CHECKING(dypgen,dyp,dyp,dyp,dypgen,Dyp,,true,$DYPGENLIB_PATH)

if test "$FOUND_LIB" != "no" ; then
   AC_SUBST(DYPGEN_INCLUDE,$LIB_INCLUDE)
fi

AC_ARG_ENABLE(
	[kaputt],
	[AS_HELP_STRING([--enable-kaputt], [Compile with kaputt for unit testing])],
	[with_kaputt=$enableval],
	[with_kaputt=no])
if test "$with_kaputt" != no ; then
   # Look for KAPUTT_LIB
   AC_LIB_CHECKING(kaputt,kaputt,kaputt,kaputt,kaputt,Kaputt,,false,,)
   if test "$FOUND_LIB" != "no" ; then
      if test -f $LIB_DIR/kaputt_pp.byte ; then
      	 KAPUTT_PP="$LIB_DIR/kaputt_pp.byte"
      	 AC_MSG_RESULT(kaputt_pp.byte preprocessor is $KAPUTT_PP)
      	 AC_SUBST(KAPUTT_INCLUDE,$LIB_INCLUDE)	
      	 AC_SUBST(KAPUTT_LIB,$LIB_FILE.cma)	
      	 AC_SUBST(KAPUTT_PP)
      else
	AC_MSG_ERROR(Could not find kaputt_pp.byte preprocessor in $LIB_DIR.)
      fi
134
   fi
135 136
fi

137 138 139 140 141 142 143 144 145 146
# Look for BOLT_LIB with ocamlfind
AC_ARG_VAR(BOLTLIB_PATH,[Directory where to find the bolt library if not in a standard location])
AC_LIB_CHECKING(bolt,bolt,bolt,bolt,bolt,Bolt,"unix.cma dynlink.cma",true,$BOLTLIB_PATH)
if test "$FOUND_LIB" != "no" ; then
   if test -f $LIB_DIR/bolt_pp.cmo ; then
      BOLT_PP="$LIB_DIR/bolt_pp.cmo -level \$(BOLT_LEVEL)"
      AC_MSG_RESULT(bolt_pp.byte preprocessor is $BOLT_PP)
      AC_SUBST(BOLT_INCLUDE,$LIB_INCLUDE)
      AC_SUBST(BOLT_LIB,$LIB_FILE.cma)
      AC_SUBST(BOLT_PP)
147
   else
148
      AC_MSG_ERROR(Could not find bolt_pp.byte preprocessor in $LIB_DIR.)
149 150 151
   fi
fi

152 153 154 155 156 157 158 159 160 161 162
AC_ARG_ENABLE(
	[log],
	[AS_HELP_STRING([--enable-log], [Enable log information to be produced by bolt])],
	[with_log=$enableval],
	[with_log=no])
if test "$with_log" = "no" ; then
   AC_SUBST(BOLT_LEVEL,NONE)
else
   AC_SUBST(BOLT_LEVEL,TRACE)
fi
AC_MSG_RESULT(Bolt log level is $BOLT_LEVEL.)
163 164


165 166 167 168 169 170 171 172 173
# Look for ANSITerminal with ocamlfind
AC_ARG_VAR(ANSITerminal_PATH,[Directory where to find the ANSITerminal library if not in a standard location])
AC_LIB_CHECKING(ANSITerminal,ANSITerminal,ANSITerminal,ANSITerminal,ANSITerminal,ANSITerminal,"unix.cma",true,$ANSITerminal_PATH)

if test "$FOUND_LIB" != "no" ; then
   AC_SUBST(ANSITerminal_INCLUDE,$LIB_INCLUDE)
fi


174 175 176 177 178 179 180 181
# Look for the OCaml Cairo bindings with ocamlfind
AC_ARG_VAR(OCamlCairo2_PATH,[Directory where to find the OCaml Cairo bindings if not in a standard location])
AC_LIB_CHECKING(ocaml-cairo2,cairo2,cairo2,cairo2,cairo2,Cairo,"bigarray.cma",true,$OCamlCairo2_PATH)

if test "$FOUND_LIB" != "no" ; then
   AC_SUBST(OCamlCairo2_INCLUDE,$LIB_INCLUDE)
fi

182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
# Look for Easy-format with ocamlfind
AC_ARG_VAR(EASY_FORMAT_PATH,[Directory where to find the Yojson library if not in a standard location])
AC_LIB_CHECKING(Easy-format,easy-format,easy_format,easy-format,easy-format,Easy_format,"",true,$EASY_FORMAT_PATH)

if test "$FOUND_LIB" != "no" ; then
   AC_SUBST(EASY_FORMAT_PATH,$LIB_PATH)
fi

# Look for biniou with ocamlfind
AC_ARG_VAR(BINIOU_PATH,[Directory where to find the biniou library if not in a standard location])
AC_LIB_CHECKING(Biniou,biniou,biniou,biniou,biniou,Bi_io,"",true,$BINIOU_PATH)

if test "$FOUND_LIB" != "no" ; then
   AC_SUBST(BINIOU_INCLUDE,$LIB_INCLUDE)
fi

# Look for Yojson with ocamlfind
AC_ARG_VAR(YOJSON_PATH,[Directory where to find the Yojson library if not in a standard location])
AC_LIB_CHECKING(Yojson,yojson,yojson,yojson,yojson,Yojson,"",true,$YOJSON_PATH)

if test "$FOUND_LIB" != "no" ; then
   AC_SUBST(YOJSON_PATH,$LIB_PATH)
fi

# Look for ocf with ocamlfind
AC_ARG_VAR(OCF_PATH,[Directory where to find the ocf library if not in a standard location])
AC_LIB_CHECKING(ocf,ocf,ocf,ocf,ocf,Ocf,"",true,$OCF_PATH)

if test "$FOUND_LIB" != "no" ; then
   AC_SUBST(OCF_INCLUDE,$LIB_INCLUDE)
fi
213

POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
214 215 216 217 218 219 220
# 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
221 222
DIR=$( cd "$( dirname "$0" )" && pwd )
ML_CHECK_FILE=$DIR/config/ml_check.ml
POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
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)

253 254 255 256 257 258 259 260
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
261 262 263 264 265
############################
# substitutions to perform
AC_SUBST(OCAMLC)
AC_SUBST(OCAMLCOPT)
AC_SUBST(OCAMLP4)
266
AC_SUBST(CAMLP4_LIB)
POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
267 268 269 270
AC_SUBST(OCAMLDOC)
AC_SUBST(OCAMLDEP)

AC_SUBST(OCAMLLEX)
271 272 273 274
AC_SUBST(OCAMLYACC)



POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
275 276 277 278 279 280 281

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

AC_SUBST(SET_MAKE)

POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
282
AC_CONFIG_FILES([./Makefile config/Makefile src/Makefile.master src/Makefile.common src/Makefile src/utils/Makefile src/logic/Makefile src/grammars/Makefile src/acg-data/Makefile src/scripting/Makefile src/datalog.prover/Makefile src/datalog.solver/Makefile])
POGODALLA Sylvain's avatar
POGODALLA Sylvain committed
283 284 285 286 287

AC_PROG_MAKE_SET

AC_OUTPUT