aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2019-03-25 13:56:14 +0100
committerXavier Leroy <xavier.leroy@inria.fr>2019-03-25 13:56:14 +0100
commit1df887f5a275e4c31096018ff1a8fdfc39bca591 (patch)
tree6e4f2535bb5ef0cbb057c07b09e732d826c64c1a
parentf7a4a67784b97013cd314fb4c50bd94abdb9c55e (diff)
downloadcompcert-1df887f5a275e4c31096018ff1a8fdfc39bca591.tar.gz
compcert-1df887f5a275e4c31096018ff1a8fdfc39bca591.zip
Harden configure against weird Menhir installations
As reported in #281, the Menhir packages in Fedora 29 and perhaps in other distributions can cause `menhir --suggest-menhirLib` to fail and return an empty path. This commit detects this situation and aborts configurations. Also, it hardens the generated Makefile against spaces and special characters in the path returned by `menhir --suggest-menhirLib`.
-rwxr-xr-xconfigure10
1 files changed, 8 insertions, 2 deletions
diff --git a/configure b/configure
index 49e68946..db2556a0 100755
--- a/configure
+++ b/configure
@@ -563,7 +563,13 @@ case "$menhir_ver" in
20[0-9][0-9][0-9][0-9][0-9][0-9])
if test "$menhir_ver" -ge $MENHIR_REQUIRED -a "$menhir_ver" -le $MENHIR_MAX; then
echo "version $menhir_ver -- good!"
- menhir_includes="-I `menhir --suggest-menhirLib`"
+ menhir_include_dir=`menhir --suggest-menhirLib`
+ if test -z "$menhir_include_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."
+ missingtools=true
+ fi
if test "$menhir_ver" -ge $MENHIR_NEW_API; then
menhir_flags="--coq-lib-path compcert.cparser.MenhirLib"
fi
@@ -654,7 +660,7 @@ MANDIR=$sharedir/man
SHAREDIR=$sharedir
COQDEVDIR=$coqdevdir
OCAML_OPT_COMP=$ocaml_opt_comp
-MENHIR_INCLUDES=$menhir_includes
+MENHIR_INCLUDES=-I "$menhir_include_dir"
MENHIR_FLAGS=$menhir_flags
COMPFLAGS=-bin-annot
EOF