configure.ac: Support more basename formats for DC (#3273)

Don't restrict the basename of DC to only be dmd, ldc2, or, gdc. This
adds support for values like:
- ldc2-1.40
- dmd-2.110
- x86_64-pc-linux-gnu-gdc

Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
Co-authored-by: abraunegg <alex.braunegg@gmail.com>
This commit is contained in:
Andrei Horodniceanu 2025-05-12 23:58:56 +03:00 committed by GitHub
commit 5a0b941a7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 30 deletions

34
configure vendored
View file

@ -605,13 +605,13 @@ sqlite_LIBS
sqlite_CFLAGS
curl_LIBS
curl_CFLAGS
PACKAGE_DATE
WERROR_DCFLAG
OUTPUT_DCFLAG
LINKER_DCFLAG
VERSION_DCFLAG
RELEASE_DCFLAGS
DEBUG_DCFLAGS
PACKAGE_DATE
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
PKG_CONFIG
@ -2014,6 +2014,9 @@ $as_echo "no" >&6; }
fi
fi
PACKAGE_DATE="April 2025"
for ac_prog in dmd ldmd2 ldc2 gdmd gdc
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
@ -2059,9 +2062,9 @@ test -n "$DC" || DC="NOT_FOUND"
DC_TYPE=
case $(basename $DC) in
dmd|ldmd2|gdmd) DC_TYPE=dmd ;;
ldc2) DC_TYPE=ldc ;;
gdc) DC_TYPE=gdc ;;
*ldc2*) DC_TYPE=ldc ;;
*gdc*) DC_TYPE=gdc ;;
*dmd*) DC_TYPE=dmd ;;
NOT_FOUND) as_fn_error 1 "Could not find any compatible D compiler" "$LINENO" 5
esac
@ -2132,7 +2135,7 @@ if test "$DO_VERSION_CHECK" = "1"; then :
$as_echo_n "checking version of D compiler... " >&6; }
# check for valid versions
case $(basename $DC) in
ldmd2|ldc2)
*ldmd2*|*ldc2*)
# LDC - the LLVM D compiler (1.12.0): ...
VERSION=`$DC --version`
# remove everything up to first (
@ -2142,15 +2145,7 @@ case $(basename $DC) in
# now version should be something like L.M.N
MINVERSION=1.18.0
;;
dmd)
# DMD64 D Compiler v2.085.1\n...
VERSION=`$DC --version | tr '\n' ' '`
VERSION=${VERSION#*Compiler v}
VERSION=${VERSION%% *}
# now version should be something like L.M.N
MINVERSION=2.088.0
;;
gdmd|gdc)
*gdmd*|*gdc*)
# Both gdmd and gdc print the same version information
VERSION=`${DC} --version | head -n1`
# Some examples of output:
@ -2165,6 +2160,14 @@ case $(basename $DC) in
VERSION=${VERSION%% *}
MINVERSION=15
;;
*dmd*)
# DMD64 D Compiler v2.085.1\n...
VERSION=`$DC --version | tr '\n' ' '`
VERSION=${VERSION#*Compiler v}
VERSION=${VERSION%% *}
# now version should be something like L.M.N
MINVERSION=2.088.0
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $VERSION" >&5
@ -2216,9 +2219,6 @@ esac
PACKAGE_DATE="April 2025"
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for curl" >&5

View file

@ -31,9 +31,9 @@ dnl Makefile so that we can adjust command line arguments
AC_CHECK_PROGS([DC], [dmd ldmd2 ldc2 gdmd gdc], NOT_FOUND)
DC_TYPE=
case $(basename $DC) in
dmd|ldmd2|gdmd) DC_TYPE=dmd ;;
ldc2) DC_TYPE=ldc ;;
gdc) DC_TYPE=gdc ;;
*ldc2*) DC_TYPE=ldc ;;
*gdc*) DC_TYPE=gdc ;;
*dmd*) DC_TYPE=dmd ;;
NOT_FOUND) AC_MSG_ERROR(Could not find any compatible D compiler, 1)
esac
@ -100,7 +100,7 @@ AS_IF([test "$DO_VERSION_CHECK" = "1"],
AC_MSG_CHECKING([version of D compiler])
# check for valid versions
case $(basename $DC) in
ldmd2|ldc2)
*ldmd2*|*ldc2*)
# LDC - the LLVM D compiler (1.12.0): ...
VERSION=`$DC --version`
# remove everything up to first (
@ -110,15 +110,7 @@ case $(basename $DC) in
# now version should be something like L.M.N
MINVERSION=1.18.0
;;
dmd)
# DMD64 D Compiler v2.085.1\n...
VERSION=`$DC --version | tr '\n' ' '`
VERSION=${VERSION#*Compiler v}
VERSION=${VERSION%% *}
# now version should be something like L.M.N
MINVERSION=2.088.0
;;
gdmd|gdc)
*gdmd*|*gdc*)
# Both gdmd and gdc print the same version information
VERSION=`${DC} --version | head -n1`
# Some examples of output:
@ -133,6 +125,14 @@ case $(basename $DC) in
VERSION=${VERSION%% *}
MINVERSION=15
;;
*dmd*)
# DMD64 D Compiler v2.085.1\n...
VERSION=`$DC --version | tr '\n' ' '`
VERSION=${VERSION#*Compiler v}
VERSION=${VERSION%% *}
# now version should be something like L.M.N
MINVERSION=2.088.0
;;
esac
AC_MSG_RESULT([$VERSION])