From 76eb783a048d9e685a512a8cf68a7aefcb065fee Mon Sep 17 00:00:00 2001 From: Jeremy Baxter Date: Fri, 2 Aug 2024 20:02:21 +1200 Subject: [PATCH] configure: accept a full path to the D compiler --- configure | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/configure b/configure index cd4de31..8e2f82a 100755 --- a/configure +++ b/configure @@ -33,8 +33,10 @@ gen_DC () { fi if present ldc2; then dc=ldc2 + dcname="$dc" elif present dmd; then dc=dmd + dcname="$dc" else throw "D compiler not found; install LDC or DMD" fi @@ -45,13 +47,13 @@ gen_DC () { ## flags used in the compilation step gen_CFLAGS () { if [ -z "$debug" ]; then - case "$dc" in + case "$dcname" in ldc2) cflags="-Oz";; dmd) cflags="-O";; esac else cflags="-g" - case "$dc" in + case "$dcname" in ldc2) cflags="$cflags -O0 -d-debug";; dmd) cflags="$cflags -debug";; esac @@ -64,7 +66,7 @@ gen_CFLAGS () { ## flags used in the linking step gen_LDFLAGS () { - if [ "$dc" = ldc2 ]; then + if [ "$dcname" = ldc2 ]; then if present ld.lld; then ldflags="-linker=lld" elif present ld.gold; then @@ -86,10 +88,11 @@ gen_LDFLAGS () { while getopts c:dhr ch; do case "$ch" in c) - case "$OPTARG" in - ldc2) dc="ldc2" ;; - dmd) dc="dmd" ;; - *) throw "unknown D compiler '$OPTARG' specified (valid options: ldc2, dmd)" ;; + dcname="$(basename "$OPTARG")" + case "$dcname" in + ldc2) dc="$OPTARG" ;; + dmd) dc="$OPTARG" ;; + *) throw "unknown D compiler '$dcname' specified (valid options: ldc2, dmd)" ;; esac ;; d) debug=1 ;;