From: Bruno Haible Date: Thu, 12 Jun 2025 17:16:28 +0000 (+0200) Subject: dcomp-script: Reject D compilers with installation problems. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0a987f4c8c4a96be4730f5b19bf840469dc6c0b;p=thirdparty%2Fgnulib.git 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/ChangeLog b/ChangeLog index acac176f6a..5d6ccd6822 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2025-06-12 Bruno Haible + + 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. + 2025-06-12 Bruno Haible gettext: Improve config.log traces. 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 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