Skip to content

Commit bfb7ece

Browse files
committed
In compcert.ini, use a relative path for stdlib if possible
With a default installation we can set `stdlib=../lib/compcert`. This enables relocating a CompCert installation without changing compcert.ini. This can be useful for binary distributions such as the Coq platform for Windows.
1 parent b4fd05c commit bfb7ece

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ latexdoc:
315315
@chmod a-w $*.v
316316

317317
compcert.ini: Makefile.config
318-
(echo "stdlib_path=$(LIBDIR)"; \
318+
(echo "stdlib_path=$(RELLIBDIR)"; \
319319
echo "prepro=$(CPREPRO)"; \
320320
echo "linker=$(CLINKER)"; \
321321
echo "asm=$(CASM)"; \

configure

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,16 @@ else
638638
fi
639639
fi
640640

641+
#
642+
# See if $libdir can be accessed with a relative path from $sharedir
643+
#
644+
parentdir=$(dirname "$sharedir")
645+
if test "$libdir" = "$parentdir/lib/compcert"; then
646+
rellibdir="../lib/compcert"
647+
else
648+
rellibdir="$libdir"
649+
fi
650+
641651
#
642652
# Generate Makefile.config
643653
#
@@ -647,6 +657,7 @@ cat > Makefile.config <<EOF
647657
PREFIX=$prefix
648658
BINDIR=$bindir
649659
LIBDIR=$libdir
660+
RELLIBDIR=$rellibdir
650661
MANDIR=$mandir
651662
SHAREDIR=$sharedir
652663
COQDEVDIR=$coqdevdir
@@ -856,6 +867,15 @@ CompCert configuration:
856867
Shared config installed in.... $(expandprefix $sharedir)
857868
Runtime library provided...... $has_runtime_lib
858869
Library files installed in.... $(expandprefix $libdir)
870+
EOF
871+
872+
if test "$rellibdir" = "$libdir"; then :; else
873+
cat <<EOF
874+
($rellibdir relative to compcert.ini)
875+
EOF
876+
fi
877+
878+
cat <<EOF
859879
Man pages installed in........ $(expandprefix $mandir)
860880
Standard headers provided..... $has_standard_headers
861881
Standard headers installed in. $(expandprefix $libdir)/include

0 commit comments

Comments
 (0)