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
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 ;;