aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Leroy <xavierleroy@users.noreply.github.com>2020-02-05 18:36:08 +0100
committerGitHub <noreply@github.com>2020-02-05 18:36:08 +0100
commit6950ac8fb096768cb3811ae7f89d0db080bf965a (patch)
tree9070ec9c2d6bf1277de5df13366b538f7c381e80
parentb0fdbb0e88d6decd068709ea673dbe51fd6727b0 (diff)
downloadcompcert-kvx-6950ac8fb096768cb3811ae7f89d0db080bf965a.tar.gz
compcert-kvx-6950ac8fb096768cb3811ae7f89d0db080bf965a.zip
Revised menhirLib autoconfiguration (#331)
Since Menhir version 20200123, we need to link with menhirLib.cmxa instead of menhirLib.cmx. This commit chooses automatically the file to link with: menhirLib.cmxa if it exists in the menhirLib installation directory, menhirLib.cmx otherwise. To reliably find the installation directory, configure was changed to record the menhirLib directory in Makefile.config, variable MENHIR_DIR, instead of a pre-cooked command-line option MENHIR_INCLUDES. Makefile.extr was adapted accordingly. Fixes: #329 Closes: #330
-rw-r--r--Makefile.extr2
-rw-r--r--Makefile.menhir6
-rwxr-xr-xconfigure6
3 files changed, 9 insertions, 5 deletions
diff --git a/Makefile.extr b/Makefile.extr
index d375fd29..7b59ed24 100644
--- a/Makefile.extr
+++ b/Makefile.extr
@@ -55,7 +55,7 @@ extraction/%.cmo: WARNINGS +=-w -20-27-32..34-39-41-44..45-60
cparser/pre_parser.cmx: WARNINGS += -w -41
cparser/pre_parser.cmo: WARNINGS += -w -41
-COMPFLAGS+=-g $(INCLUDES) $(MENHIR_INCLUDES) $(WARNINGS)
+COMPFLAGS+=-g $(INCLUDES) -I "$(MENHIR_DIR)" $(WARNINGS)
# Using .opt compilers if available
diff --git a/Makefile.menhir b/Makefile.menhir
index 98bfc750..7909b2f6 100644
--- a/Makefile.menhir
+++ b/Makefile.menhir
@@ -41,7 +41,11 @@ MENHIR_FLAGS = -v --no-stdlib -la 1
# Using Menhir in --table mode requires MenhirLib.
ifeq ($(MENHIR_TABLE),true)
- MENHIR_LIBS = menhirLib.cmx
+ ifeq ($(wildcard $(MENHIR_DIR)/menhirLib.cmxa),)
+ MENHIR_LIBS = menhirLib.cmx
+ else
+ MENHIR_LIBS = menhirLib.cmxa
+ endif
else
MENHIR_LIBS =
endif
diff --git a/configure b/configure
index d91bfebf..a8efb551 100755
--- a/configure
+++ b/configure
@@ -582,8 +582,8 @@ case "$menhir_ver" in
20[0-9][0-9][0-9][0-9][0-9][0-9])
if test "$menhir_ver" -ge $MENHIR_REQUIRED; then
echo "version $menhir_ver -- good!"
- menhir_include_dir=$(menhir --suggest-menhirLib | tr -d '\r' | tr '\\' '/')
- if test -z "$menhir_include_dir"; then
+ menhir_dir=$(menhir --suggest-menhirLib | tr -d '\r' | tr '\\' '/')
+ if test -z "$menhir_dir"; then
echo "Error: cannot determine the location of the Menhir API library."
echo "This can be due to an incorrect Menhir package."
echo "Consider using the OPAM package for Menhir."
@@ -677,7 +677,7 @@ MANDIR=$sharedir/man
SHAREDIR=$sharedir
COQDEVDIR=$coqdevdir
OCAML_OPT_COMP=$ocaml_opt_comp
-MENHIR_INCLUDES=-I "$menhir_include_dir"
+MENHIR_DIR=$menhir_dir
COMPFLAGS=-bin-annot
EOF