From 1df887f5a275e4c31096018ff1a8fdfc39bca591 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 25 Mar 2019 13:56:14 +0100 Subject: 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`. --- configure | 10 ++++++++-- 1 file 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 -- cgit