Commit 87c856ea authored by Guillaume Melquiond's avatar Guillaume Melquiond

Make menhirLib mandatory (fix issue #118).

Menhir 20151112 can, in fact, be used to compile Why3. The actual issue
was that the error reporting module depends on Menhir's table-based
backend, which requires menhirLib. So, the latter is no longer an optional
dependency.
parent 726e91e8
...@@ -55,12 +55,7 @@ OCAMLVERSION = @OCAMLVERSION@ ...@@ -55,12 +55,7 @@ OCAMLVERSION = @OCAMLVERSION@
COQC = @COQC@ COQC = @COQC@
COQDEP = @COQDEP@ COQDEP = @COQDEP@
FRAMAC_LIBDIR = $(DESTDIR)@FRAMAC_LIBDIR@ FRAMAC_LIBDIR = $(DESTDIR)@FRAMAC_LIBDIR@
ifeq (@enable_menhirLib@,yes)
MENHIR = @MENHIR@ --table
else
MENHIR = @MENHIR@ MENHIR = @MENHIR@
endif
DEPFLAGS = -slash DEPFLAGS = -slash
...@@ -117,7 +112,7 @@ CMIHACK = -intf-suffix .cmi ...@@ -117,7 +112,7 @@ CMIHACK = -intf-suffix .cmi
# external libraries common to all binaries # external libraries common to all binaries
EXTOBJS = @MENHIRLIB@ EXTOBJS = menhirLib
EXTLIBS = str unix nums dynlink @ZIPLIB@ @WHY3LIB@ EXTLIBS = str unix nums dynlink @ZIPLIB@ @WHY3LIB@
EXTCMA = $(addsuffix .cmo,$(EXTOBJS)) $(addsuffix .cma,$(EXTLIBS)) EXTCMA = $(addsuffix .cmo,$(EXTOBJS)) $(addsuffix .cma,$(EXTLIBS))
...@@ -2143,7 +2138,7 @@ src/tools/why3extract.cmx: %.cmx: %.ml ...@@ -2143,7 +2138,7 @@ src/tools/why3extract.cmx: %.cmx: %.ml
%.ml %.mli: %.mly %.ml %.mli: %.mly
$(SHOW) 'Menhir $<' $(SHOW) 'Menhir $<'
$(HIDE)$(MENHIR) --explain --strict $< $(HIDE)$(MENHIR) --table --explain --strict $<
%.dep: %.ml %.mli %.dep: %.ml %.mli
$(SHOW) 'Ocamldep $<' $(SHOW) 'Ocamldep $<'
......
...@@ -76,12 +76,6 @@ AC_ARG_ENABLE(js_of_ocaml, ...@@ -76,12 +76,6 @@ AC_ARG_ENABLE(js_of_ocaml,
AS_HELP_STRING([--disable-js-of-ocaml], [do not use js-of-ocaml]),, AS_HELP_STRING([--disable-js-of-ocaml], [do not use js-of-ocaml]),,
enable_js_of_ocaml=yes) enable_js_of_ocaml=yes)
# menhirLib
AC_ARG_ENABLE(menhirLib,
AS_HELP_STRING([--disable-menhirLib], [do not use MenhirLib parsing library]),,
enable_menhirLib=yes)
# IDE # IDE
AC_ARG_ENABLE(ide, AC_ARG_ENABLE(ide,
...@@ -295,8 +289,8 @@ if test "$MENHIR" = no ; then ...@@ -295,8 +289,8 @@ if test "$MENHIR" = no ; then
fi fi
MENHIRVERSION=`$MENHIR --version | sed -n -e 's,.*version *\(.*\)$,\1,p'` MENHIRVERSION=`$MENHIR --version | sed -n -e 's,.*version *\(.*\)$,\1,p'`
AX_VERSION_GE([$MENHIRVERSION], 20160303, [], AX_VERSION_GE([$MENHIRVERSION], 20151112, [],
[AC_MSG_ERROR(You need Menhir 20160303 or higher.)]) [AC_MSG_ERROR(You need Menhir 20151112 or higher.)])
## Where are the library we need ## Where are the library we need
# we look for ocamlfind; if not present, we just don't use it to find # we look for ocamlfind; if not present, we just don't use it to find
...@@ -500,32 +494,23 @@ else ...@@ -500,32 +494,23 @@ else
fi fi
# checking for menhirlib # checking for menhirlib
if test "$enable_menhirLib" = yes; then found_menhirlib=yes
DIR= DIR=
if test "$USEOCAMLFIND" = yes; then if test "$USEOCAMLFIND" = yes; then
DIR=$(ocamlfind query menhirLib) DIR=$(ocamlfind query menhirLib)
if test -n "$DIR"; then if test -n "$DIR"; then
echo "ocamlfind found menhirLib in $DIR" echo "ocamlfind found menhirLib in $DIR"
MENHIRINCLUDE="-I $DIR" MENHIRINCLUDE="-I $DIR"
fi
fi
if test -z "$DIR"; then
MENHIRINCLUDE="-I +menhirLib"
DIR="$OCAMLLIB/menhirLib"
AC_CHECK_FILE($DIR/menhirLib.cmx,,enable_menhirLib=no)
fi
AC_CHECK_FILE($DIR/menhirLib.cmi,,enable_menhirLib=no)
if test "$enable_menhirLib" = no; then
AC_MSG_WARN([Lib menhirLib not found, parser source files will be bigger.])
reason_menhirLib=" (menhirLib not found)"
fi fi
fi fi
if test -z "$DIR"; then
if test "$enable_menhirLib" = yes; then MENHIRINCLUDE="-I +menhirLib"
MENHIRLIB=menhirLib DIR="$OCAMLLIB/menhirLib"
else AC_CHECK_FILE($DIR/menhirLib.cmx,,found_menhirlib=no)
MENHIRLIB= fi
MENHIRINCLUDE= AC_CHECK_FILE($DIR/menhirLib.cmi,,found_menhirlib=no)
if test "$found_menhirlib" = no; then
AC_MSG_ERROR([Library menhirLib not found.])
fi fi
# checking for lablgtk2 # checking for lablgtk2
...@@ -896,9 +881,7 @@ AC_SUBST(enable_zip) ...@@ -896,9 +881,7 @@ AC_SUBST(enable_zip)
AC_SUBST(ZIPINCLUDE) AC_SUBST(ZIPINCLUDE)
AC_SUBST(ZIPLIB) AC_SUBST(ZIPLIB)
AC_SUBST(enable_menhirLib)
AC_SUBST(MENHIRINCLUDE) AC_SUBST(MENHIRINCLUDE)
AC_SUBST(MENHIRLIB)
AC_SUBST(enable_coq_libs) AC_SUBST(enable_coq_libs)
AC_SUBST(enable_coq_fp_libs) AC_SUBST(enable_coq_fp_libs)
...@@ -989,7 +972,6 @@ echo " GTK IDE : $enable_ide$reason_ide" ...@@ -989,7 +972,6 @@ echo " GTK IDE : $enable_ide$reason_ide"
echo " Web IDE : $enable_web_ide$reason_web_ide" echo " Web IDE : $enable_web_ide$reason_web_ide"
echo " GMP arithmetic : $enable_zarith$reason_zarith" echo " GMP arithmetic : $enable_zarith$reason_zarith"
echo " Compressed sessions : $enable_zip$reason_zip" echo " Compressed sessions : $enable_zip$reason_zip"
echo " MenhirLib support : $enable_menhirLib$reason_menhirLib"
echo " Hypothesis selection : $enable_hypothesis_selection$reason_hypothesis_selection" echo " Hypothesis selection : $enable_hypothesis_selection$reason_hypothesis_selection"
echo " Frama-C support : $enable_frama_c$reason_frama_c" echo " Frama-C support : $enable_frama_c$reason_frama_c"
if test "$enable_frama_c" = yes ; then if test "$enable_frama_c" = yes ; then
......
...@@ -3,7 +3,7 @@ version = "@VERSION@" ...@@ -3,7 +3,7 @@ version = "@VERSION@"
archive(byte) = "why3.cma" archive(byte) = "why3.cma"
archive(native) = "why3.cmxa" archive(native) = "why3.cmxa"
plugin(native) = "why3.cmxs" plugin(native) = "why3.cmxs"
requires = "str unix num dynlink @ZIPLIB@ @MENHIRLIB@" requires = "str unix num dynlink menhirLib @ZIPLIB@"
package "extract" ( package "extract" (
description = "Why3 support library for extracted code" description = "Why3 support library for extracted code"
......
...@@ -21,13 +21,13 @@ literals.ml: literals.mll ...@@ -21,13 +21,13 @@ literals.ml: literals.mll
$(OCAMLLEX) $< $(OCAMLLEX) $<
Jessie3.cma: $(addsuffix .cmo, $(MODULES)) Jessie3.cma: $(addsuffix .cmo, $(MODULES))
ocamlc.opt -a $(FLAGS) $(INCLUDE) -o $@ nums.cma unix.cma dynlink.cma str.cma $(addsuffix .cmo, @MENHIRLIB@) $(addsuffix .cma, @ZIPLIB@) $(WHYLIB)/why3.cma $^ ocamlc.opt -a $(FLAGS) $(INCLUDE) -o $@ nums.cma unix.cma dynlink.cma str.cma menhirLib.cmo $(addsuffix .cma, @ZIPLIB@) $(WHYLIB)/why3.cma $^
Jessie3.cmx: $(addsuffix .cmx, $(MODULES)) Jessie3.cmx: $(addsuffix .cmx, $(MODULES))
ocamlopt.opt $(FLAGS) $(INCLUDE) -o $@ -pack $^ ocamlopt.opt $(FLAGS) $(INCLUDE) -o $@ -pack $^
Jessie3.cmxs: Jessie3.cmx Jessie3.cmxs: Jessie3.cmx
ocamlopt.opt -shared $(FLAGS) $(INCLUDE) -o $@ nums.cmxa $(addsuffix .cmx, @MENHIRLIB@) $(addsuffix .cmxa, @ZIPLIB@) $(WHYLIB)/why3.cmxa $^ ocamlopt.opt -shared $(FLAGS) $(INCLUDE) -o $@ nums.cmxa menhirLib.cmx $(addsuffix .cmxa, @ZIPLIB@) $(WHYLIB)/why3.cmxa $^
%.cmi: %.mli %.cmi: %.mli
ocamlc.opt $(FLAGS) $(INCLUDE) -c $^ ocamlc.opt $(FLAGS) $(INCLUDE) -c $^
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment