Subject: Re: bug#50666: 28.0.50; Fix native compilation on Cygwin

From: Ken Brown <[email-masked]>
Date: Fri, 29 Oct 2021 13:03:29 -0400

On 10/29/2021 1:55 AM, Eli Zaretskii wrote:
>> Date: Thu, 28 Oct 2021 18:22:28 -0400
>> From: Ken Brown <[email-masked]>
>> Eli, what do you think of the attached (assuming Achim agrees)?
> 
> Assuming this decision of the Cygwin developers is final, I don't
> mind.  But why do we want to depend on an environment variable for
> enabling the 32-bit build? why not a configure-time command-line
> option?

Thanks for the suggestion.  How's this?

Ken

From 084b03ae1f81c72a46d4f365c50851db3674b4c1 Mon Sep 17 00:00:00 2001
From: Ken Brown <[email-masked]>
Date: Fri, 29 Oct 2021 11:38:55 -0400
Subject: [PATCH] Drop support for native compilation on 32-bit Cygwin

* configure.ac (cygwin32-native-compilation): New option.
[i686-pc-cygwin]: Don't allow native compilation unless that
option is specified.  (Bug#50666)
---
 configure.ac | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/configure.ac b/configure.ac
index e6ffea0637..6bc194d792 100644
--- a/configure.ac
+++ b/configure.ac
@@ -485,6 +485,7 @@ AC_DEFUN
 OPTION_DEFAULT_ON([modules],[don't compile with dynamic modules support])
 OPTION_DEFAULT_ON([threads],[don't compile with elisp threading support])
 OPTION_DEFAULT_OFF([native-compilation],[compile with Emacs Lisp native compiler support])
+OPTION_DEFAULT_OFF([cygwin32-native-compilation],[use native compilation on 32-bit Cygwin])
 
 AC_ARG_WITH([file-notification],[AS_HELP_STRING([--with-file-notification=LIB],
  [use a file notification library (LIB one of: yes, inotify, kqueue, gfile, w32, no)])],
@@ -3814,6 +3815,16 @@ AC_DEFUN
 HAVE_NATIVE_COMP=no
 LIBGCCJIT_LIBS=
 LIBGCCJIT_CFLAGS=
+if test "$canonical" = i686-pc-cygwin; then
+  if test "${with_cygwin32_native_compilation}" = yes; then
+    with_native_compilation=yes
+  elif test "${with_native_compilation}" != no; then
+    AC_MSG_ERROR([Native compilation is not supported on 32-bit Cygwin.
+If you really want to try it anyway, use the configure option
+'--with-cygwin32-native-compilation'.])
+  fi
+fi
+
 if test "${with_native_compilation}" != "no"; then
     if test "${HAVE_PDUMPER}" = no; then
        AC_MSG_ERROR(['--with-native-compilation' requires '--with-dumping=pdumper'])
-- 
2.33.0