configure: accept a full path to the D compiler

This commit is contained in:
Jeremy Baxter 2024-08-02 20:02:21 +12:00
parent 76e39e9dc8
commit 76eb783a04

17
configure vendored
View file

@ -33,8 +33,10 @@ gen_DC () {
fi fi
if present ldc2; then if present ldc2; then
dc=ldc2 dc=ldc2
dcname="$dc"
elif present dmd; then elif present dmd; then
dc=dmd dc=dmd
dcname="$dc"
else else
throw "D compiler not found; install LDC or DMD" throw "D compiler not found; install LDC or DMD"
fi fi
@ -45,13 +47,13 @@ gen_DC () {
## flags used in the compilation step ## flags used in the compilation step
gen_CFLAGS () { gen_CFLAGS () {
if [ -z "$debug" ]; then if [ -z "$debug" ]; then
case "$dc" in case "$dcname" in
ldc2) cflags="-Oz";; ldc2) cflags="-Oz";;
dmd) cflags="-O";; dmd) cflags="-O";;
esac esac
else else
cflags="-g" cflags="-g"
case "$dc" in case "$dcname" in
ldc2) cflags="$cflags -O0 -d-debug";; ldc2) cflags="$cflags -O0 -d-debug";;
dmd) cflags="$cflags -debug";; dmd) cflags="$cflags -debug";;
esac esac
@ -64,7 +66,7 @@ gen_CFLAGS () {
## flags used in the linking step ## flags used in the linking step
gen_LDFLAGS () { gen_LDFLAGS () {
if [ "$dc" = ldc2 ]; then if [ "$dcname" = ldc2 ]; then
if present ld.lld; then if present ld.lld; then
ldflags="-linker=lld" ldflags="-linker=lld"
elif present ld.gold; then elif present ld.gold; then
@ -86,10 +88,11 @@ gen_LDFLAGS () {
while getopts c:dhr ch; do while getopts c:dhr ch; do
case "$ch" in case "$ch" in
c) c)
case "$OPTARG" in dcname="$(basename "$OPTARG")"
ldc2) dc="ldc2" ;; case "$dcname" in
dmd) dc="dmd" ;; ldc2) dc="$OPTARG" ;;
*) throw "unknown D compiler '$OPTARG' specified (valid options: ldc2, dmd)" ;; dmd) dc="$OPTARG" ;;
*) throw "unknown D compiler '$dcname' specified (valid options: ldc2, dmd)" ;;
esac esac
;; ;;
d) debug=1 ;; d) debug=1 ;;