Skip to content

Commit 5b80eaa

Browse files
authored
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
1 parent d3edf6c commit 5b80eaa

File tree

1 file changed

+32
-5
lines changed

1 file changed

+32
-5
lines changed

configure

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ prefix='/usr/local'
2020
bindir='$(PREFIX)/bin'
2121
libdir='$(PREFIX)/lib/compcert'
2222
mandir='$(PREFIX)/share/man'
23+
sharedir='' # determined later based on $bindir and -sharedir option
2324
coqdevdir='$(PREFIX)/lib/compcert/coq'
2425
toolprefix=''
2526
target=''
@@ -88,6 +89,7 @@ Options:
8889
-prefix <dir> Install in <dir>/bin and <dir>/lib/compcert
8990
-bindir <dir> Install binaries in <dir>
9091
-libdir <dir> Install libraries in <dir>
92+
-sharedir <dir> Install configuration file in <dir>
9193
-mandir <dir> Install man pages in <dir>
9294
-coqdevdir <dir> Install Coq development (.vo files) in <dir>
9395
-toolprefix <pref> Prefix names of tools ("gcc", etc) with <pref>
@@ -120,6 +122,8 @@ while : ; do
120122
libdir="$2"; shift;;
121123
-mandir|--mandir)
122124
mandir="$2"; shift;;
125+
-sharedir|--sharedir)
126+
sharedir="$2"; shift;;
123127
-coqdevdir|--coqdevdir)
124128
coqdevdir="$2"; install_coqdev=true; shift;;
125129
-toolprefix|--toolprefix)
@@ -610,10 +614,36 @@ if $missingtools; then
610614
exit 2
611615
fi
612616

617+
#
618+
# Determine $sharedir or check that user-provided $sharedir is valid
619+
#
620+
621+
expandprefix() {
622+
echo "$1" | sed -e "s|\\\$(PREFIX)|$prefix|"
623+
}
624+
625+
if test -z "$sharedir"; then
626+
sharedir=$(dirname "$bindir")/share
627+
else
628+
expsharedir=$(expandprefix "$sharedir")
629+
expbindir=$(expandprefix "$bindir")
630+
expbindirshare=$(dirname "$expbindir")/share
631+
if test "$expsharedir" = "$expbindirshare/compcert" \
632+
|| test "$expsharedir" = "$expbindirshare" \
633+
|| test "$expsharedir" = "$expbindir"
634+
then : ; # ok!
635+
else
636+
echo "Wrong -sharedir option. The share directory must be one of"
637+
echo " $expbindirshare/compcert"
638+
echo " $expbindirshare"
639+
echo " $expbindir"
640+
exit 2
641+
fi
642+
fi
643+
613644
#
614645
# Generate Makefile.config
615646
#
616-
sharedir="$(dirname "$bindir")"/share
617647

618648
rm -f Makefile.config
619649
cat > Makefile.config <<EOF
@@ -805,10 +835,6 @@ Please finish the configuration by editing file ./Makefile.config.
805835
EOF
806836
else
807837

808-
expandprefix() {
809-
echo "$1" | sed -e "s|\\\$(PREFIX)|$prefix|"
810-
}
811-
812838
cat <<EOF
813839
814840
CompCert configuration:
@@ -830,6 +856,7 @@ CompCert configuration:
830856
The Flocq library............. $library_Flocq
831857
The MenhirLib library......... $library_MenhirLib
832858
Binaries installed in......... $(expandprefix $bindir)
859+
Shared config installed in.... $(expandprefix $sharedir)
833860
Runtime library provided...... $has_runtime_lib
834861
Library files installed in.... $(expandprefix $libdir)
835862
Man pages installed in........ $(expandprefix $mandir)

0 commit comments

Comments
 (0)