From 5b80eaa2d5141eb4f157d3296b8d92e022386777 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 14 Nov 2022 10:24:10 +0100 Subject: configure: add option -sharedir to specify where to put compcert.ini (#460) Make sure that it's one of the three locations where the ccomp executable looks for compcert.ini. Closes: #450 --- configure | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 891cbfe7..df132dcf 100755 --- a/configure +++ b/configure @@ -20,6 +20,7 @@ prefix='/usr/local' bindir='$(PREFIX)/bin' libdir='$(PREFIX)/lib/compcert' mandir='$(PREFIX)/share/man' +sharedir='' # determined later based on $bindir and -sharedir option coqdevdir='$(PREFIX)/lib/compcert/coq' toolprefix='' target='' @@ -88,6 +89,7 @@ Options: -prefix Install in /bin and /lib/compcert -bindir Install binaries in -libdir Install libraries in + -sharedir Install configuration file in -mandir Install man pages in -coqdevdir Install Coq development (.vo files) in -toolprefix Prefix names of tools ("gcc", etc) with @@ -120,6 +122,8 @@ while : ; do libdir="$2"; shift;; -mandir|--mandir) mandir="$2"; shift;; + -sharedir|--sharedir) + sharedir="$2"; shift;; -coqdevdir|--coqdevdir) coqdevdir="$2"; install_coqdev=true; shift;; -toolprefix|--toolprefix) @@ -610,10 +614,36 @@ if $missingtools; then exit 2 fi +# +# Determine $sharedir or check that user-provided $sharedir is valid +# + +expandprefix() { + echo "$1" | sed -e "s|\\\$(PREFIX)|$prefix|" +} + +if test -z "$sharedir"; then + sharedir=$(dirname "$bindir")/share +else + expsharedir=$(expandprefix "$sharedir") + expbindir=$(expandprefix "$bindir") + expbindirshare=$(dirname "$expbindir")/share + if test "$expsharedir" = "$expbindirshare/compcert" \ + || test "$expsharedir" = "$expbindirshare" \ + || test "$expsharedir" = "$expbindir" + then : ; # ok! + else + echo "Wrong -sharedir option. The share directory must be one of" + echo " $expbindirshare/compcert" + echo " $expbindirshare" + echo " $expbindir" + exit 2 + fi +fi + # # Generate Makefile.config # -sharedir="$(dirname "$bindir")"/share rm -f Makefile.config cat > Makefile.config <