]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
dcomp-script: Reject D compilers with installation problems.
authorBruno Haible <bruno@clisp.org>
Thu, 12 Jun 2025 17:16:28 +0000 (19:16 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 12 Jun 2025 17:16:28 +0000 (19:16 +0200)
* 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.

ChangeLog
build-aux/dcomp.sh.in
m4/dcomp.m4

index acac176f6a16f509ce1944becbfe0e26e66aa608..5d6ccd6822f37d4781cd10ca991dcaf24ff6b2a4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-06-12  Bruno Haible  <bruno@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.
+
 2025-06-12  Bruno Haible  <bruno@clisp.org>
 
        gettext: Improve config.log traces.
index 52a6123d22504448da87c79fafc177a1a589c84b..7500f58c25ae833d23b2585c67ade0373ad984cc 100644 (file)
 #   -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
index 44813388130bc04cf963651e9f996805d7008b36..ff42db1a4dde078dd03f30eaeb01d2b9a31bb375 100644 (file)
@@ -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