year 2038 support: fix for mingw

Bruno Haible <[email protected]>
Newsgroups gmane.comp.lib.gnulib.bugs,gmane.comp.sysutils.autoconf.general
Message-ID <2637936.q0ZmV6gNhb@nimes>
When running a gnulib testdir of module 'year2038' on 32-bit mingw,
I see a 'configure' failure:

...
checking for i686-w64-mingw32-gcc option to enable large file support... -D_FILE_OFFSET_BITS=64
checking for i686-w64-mingw32-gcc option to enable timestamps after Jan 2038... -D__MINGW_USE_VC2005_COMPAT
configure: error: internal error: bad value for $ac_cv_sys_year2038_opts

The problem, as evidenced by running the configure script with 'set -x',
is that after the assignment
  ac_cv_sys_year2038_opts=-D__MINGW_USE_VC2005_COMPAT
the 'case' statement
  case $ac_cv_sys_year2038_opts in ...
does not find the value.

The attached proposed patches fix this. One for gnulib, one for autoconf.
I tested the patch for gnulib; the patch for autoconf is a trivial backport.

Bruno
0001-year2038-Fix-configure-failure-on-32-bit-mingw.patch (text/x-patch, 1.3 KB)
From 79855cc2c893d674e45fd35dc6d661deab5d077a Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Fri, 14 Apr 2023 16:16:57 +0200
Subject: [PATCH] year2038: Fix configure failure on 32-bit mingw.

* m4/largefile.m4 (_AC_SYS_YEAR2038_PROBE): Use the same option
spelling as in _AC_SYS_YEAR2038_OPTIONS.
---
 ChangeLog       | 6 ++++++
 m4/largefile.m4 | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index d547837fe1..6958f69c61 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-04-14  Bruno Haible  <[email protected]>
+
+	year2038: Fix configure failure on 32-bit mingw.
+	* m4/largefile.m4 (_AC_SYS_YEAR2038_PROBE): Use the same option
+	spelling as in _AC_SYS_YEAR2038_OPTIONS.
+
 2023-04-14  Bruno Haible  <[email protected]>
 
 	year2038: Add reminder to include <config.h> before time_t gets defined.
diff --git a/m4/largefile.m4 b/m4/largefile.m4
index 4bfff0d076..f741d0df6e 100644
--- a/m4/largefile.m4
+++ b/m4/largefile.m4
@@ -125,7 +125,7 @@ AC_DEFUN([_AC_SYS_YEAR2038_PROBE]
     [AC_DEFINE([_TIME_BITS], [64],
       [Number of bits in time_t, on hosts where this is settable.])],
 
-  ["-D__MINGW_USE_VC2005_COMPAT=1"],
+  ["-D__MINGW_USE_VC2005_COMPAT"],
     [AC_DEFINE([__MINGW_USE_VC2005_COMPAT], [1],
       [Define to 1 on platforms where this makes time_t a 64-bit type.])],
 
-- 
2.34.1
0001-AC_SYS_YEAR2038-Fix-configure-failure-on-32-bit-ming.patch (text/x-patch, 957 B)
From e32529d9b3500d3ced9be4ef201292c029028072 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Fri, 14 Apr 2023 16:18:35 +0200
Subject: [PATCH] AC_SYS_YEAR2038: Fix configure failure on 32-bit mingw.

* lib/autoconf/specific.m4 (_AC_SYS_YEAR2038_PROBE): Use the same option
spelling as in _AC_SYS_YEAR2038_OPTIONS.
---
 lib/autoconf/specific.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4
index 1a3f4a65..3bf1a0ed 100644
--- a/lib/autoconf/specific.m4
+++ b/lib/autoconf/specific.m4
@@ -182,7 +182,7 @@ AS_CASE([$ac_cv_sys_year2038_opts],
     [AC_DEFINE([_TIME_BITS], [64],
       [Number of bits in time_t, on hosts where this is settable.])],
 
-  ["-D__MINGW_USE_VC2005_COMPAT=1"],
+  ["-D__MINGW_USE_VC2005_COMPAT"],
     [AC_DEFINE([__MINGW_USE_VC2005_COMPAT], [1],
       [Define to 1 on platforms where this makes time_t a 64-bit type.])],
 
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.