Skip to content

Commit 6950ac8

Browse files
authored
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
1 parent b0fdbb0 commit 6950ac8

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

Makefile.extr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ extraction/%.cmo: WARNINGS +=-w -20-27-32..34-39-41-44..45-60
5555
cparser/pre_parser.cmx: WARNINGS += -w -41
5656
cparser/pre_parser.cmo: WARNINGS += -w -41
5757

58-
COMPFLAGS+=-g $(INCLUDES) $(MENHIR_INCLUDES) $(WARNINGS)
58+
COMPFLAGS+=-g $(INCLUDES) -I "$(MENHIR_DIR)" $(WARNINGS)
5959

6060
# Using .opt compilers if available
6161

Makefile.menhir

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ MENHIR_FLAGS = -v --no-stdlib -la 1
4141
# Using Menhir in --table mode requires MenhirLib.
4242

4343
ifeq ($(MENHIR_TABLE),true)
44-
MENHIR_LIBS = menhirLib.cmx
44+
ifeq ($(wildcard $(MENHIR_DIR)/menhirLib.cmxa),)
45+
MENHIR_LIBS = menhirLib.cmx
46+
else
47+
MENHIR_LIBS = menhirLib.cmxa
48+
endif
4549
else
4650
MENHIR_LIBS =
4751
endif

configure

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,8 @@ case "$menhir_ver" in
582582
20[0-9][0-9][0-9][0-9][0-9][0-9])
583583
if test "$menhir_ver" -ge $MENHIR_REQUIRED; then
584584
echo "version $menhir_ver -- good!"
585-
menhir_include_dir=$(menhir --suggest-menhirLib | tr -d '\r' | tr '\\' '/')
586-
if test -z "$menhir_include_dir"; then
585+
menhir_dir=$(menhir --suggest-menhirLib | tr -d '\r' | tr '\\' '/')
586+
if test -z "$menhir_dir"; then
587587
echo "Error: cannot determine the location of the Menhir API library."
588588
echo "This can be due to an incorrect Menhir package."
589589
echo "Consider using the OPAM package for Menhir."
@@ -677,7 +677,7 @@ MANDIR=$sharedir/man
677677
SHAREDIR=$sharedir
678678
COQDEVDIR=$coqdevdir
679679
OCAML_OPT_COMP=$ocaml_opt_comp
680-
MENHIR_INCLUDES=-I "$menhir_include_dir"
680+
MENHIR_DIR=$menhir_dir
681681
COMPFLAGS=-bin-annot
682682
EOF
683683

0 commit comments

Comments
 (0)