On Cygwin, the GNU D compiler (gdc) is installed without its standard library. As a consequence, it cannot compile anything. This leads to build errors later in GNU gettext.
It is better if the configure test catches this situation and treats it like if no D compiler is installed. This patch does it. 2025-06-12 Bruno Haible <br...@clisp.org> dcomp-script: Reject D compilers with installation problems. * m4/dcomp.m4 (gt_DCOMP): Try each candidate program, seeing whether it can compile a trivial program. * build-aux/dcomp.sh.in: Fix typos in comment. diff --git a/build-aux/dcomp.sh.in b/build-aux/dcomp.sh.in index 52a6123d22..7500f58c25 100644 --- a/build-aux/dcomp.sh.in +++ b/build-aux/dcomp.sh.in @@ -23,11 +23,11 @@ # -c # -g # -O (mapped to -O or -O2, depending on implementation) -# -o FILE (for libtool compatility) -# -lLIBRARY (for libtool compatility) -# -LDIR (for libtool compatility) -# -pthread (for libtool compatility) -# -Wl,OPTION (for libtool compatility) +# -o FILE (for libtool compatibility) +# -lLIBRARY (for libtool compatibility) +# -LDIR (for libtool compatibility) +# -pthread (for libtool compatibility) +# -Wl,OPTION (for libtool compatibility) # Find out which implementation we are using. case `@DC@ --version | sed -e 's/ .*//' -e 1q` in diff --git a/m4/dcomp.m4 b/m4/dcomp.m4 index 4481338813..ff42db1a4d 100644 --- a/m4/dcomp.m4 +++ b/m4/dcomp.m4 @@ -1,5 +1,5 @@ # dcomp.m4 -# serial 2 +# serial 3 dnl Copyright (C) 2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -31,7 +31,55 @@ AC_DEFUN([gt_DCOMP] AC_ARG_VAR([DC], [D compiler command]) AC_ARG_VAR([DFLAGS], [D compiler options]) dnl On OpenBSD, gdc is called 'egdc' and works less well than dmd. - AC_CHECK_TOOLS([DC], [gdc ldc2 dmd egdc]) + dnl Like AC_CHECK_TOOLS([DC], [gdc ldc2 dmd egdc]) but check whether the + dnl compiler can actually compile a trivial program. We may simplify this + dnl once <https://savannah.gnu.org/support/index.php?111256> is implemented. + if test -z "$DC"; then + echo > empty.d + if test -n "${host_alias}"; then + if test -z "$DC"; then + DC="${host_alias}-gdc" + echo "$as_me:${as_lineno-$LINENO}: trying ${DC}..." >&AS_MESSAGE_LOG_FD + if ${DC} -c empty.d 2>&AS_MESSAGE_LOG_FD; then :; else DC= ; fi + fi + if test -z "$DC"; then + DC="${host_alias}-ldc2" + echo "$as_me:${as_lineno-$LINENO}: trying ${DC}..." >&AS_MESSAGE_LOG_FD + if ${DC} -c empty.d 2>&AS_MESSAGE_LOG_FD; then :; else DC= ; fi + fi + if test -z "$DC"; then + DC="${host_alias}-dmd" + echo "$as_me:${as_lineno-$LINENO}: trying ${DC}..." >&AS_MESSAGE_LOG_FD + if ${DC} -c empty.d 2>&AS_MESSAGE_LOG_FD; then :; else DC= ; fi + fi + if test -z "$DC"; then + DC="${host_alias}-egdc" + echo "$as_me:${as_lineno-$LINENO}: trying ${DC}..." >&AS_MESSAGE_LOG_FD + if ${DC} -c empty.d 2>&AS_MESSAGE_LOG_FD; then :; else DC= ; fi + fi + fi + if test -z "$DC"; then + DC="gdc" + echo "$as_me:${as_lineno-$LINENO}: trying ${DC}..." >&AS_MESSAGE_LOG_FD + if ${DC} -c empty.d 2>&AS_MESSAGE_LOG_FD; then :; else DC= ; fi + fi + if test -z "$DC"; then + DC="ldc2" + echo "$as_me:${as_lineno-$LINENO}: trying ${DC}..." >&AS_MESSAGE_LOG_FD + if ${DC} -c empty.d 2>&AS_MESSAGE_LOG_FD; then :; else DC= ; fi + fi + if test -z "$DC"; then + DC="dmd" + echo "$as_me:${as_lineno-$LINENO}: trying ${DC}..." >&AS_MESSAGE_LOG_FD + if ${DC} -c empty.d 2>&AS_MESSAGE_LOG_FD; then :; else DC= ; fi + fi + if test -z "$DC"; then + DC="egdc" + echo "$as_me:${as_lineno-$LINENO}: trying ${DC}..." >&AS_MESSAGE_LOG_FD + if ${DC} -c empty.d 2>&AS_MESSAGE_LOG_FD; then :; else DC= ; fi + fi + rm -f empty.d empty.o empty.obj + fi popdef([AC_MSG_RESULT])dnl popdef([AC_CHECKING])dnl popdef([AC_MSG_CHECKING])dnl