]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Skip test of AC_SYS_YEAR2038_RECOMMENDED if system doesn’t support 64-bit time_t.
authorZack Weinberg <zack@owlfolio.org>
Tue, 19 Dec 2023 14:50:30 +0000 (09:50 -0500)
committerZack Weinberg <zack@owlfolio.org>
Tue, 19 Dec 2023 18:53:24 +0000 (13:53 -0500)
AC_SYS_YEAR2038_RECOMMENDED causes configure to fail if we can’t find
a way to activate support for 64-bit time_t.  This makes its
mktests.pl test fail on systems that don’t support 64-bit time_t.
Switch to a hand-written test that’s skipped on those systems.
While I was in there I added slightly more testing of the closely
related macros AC_SYS_LARGEFILE and AC_SYS_YEAR2038.

While testing this change I noticed that AC_SYS_LARGEFILE and
AC_SYS_YEAR2038 malfunction if AC_LANG([C++]) is in effect.
The cause is too hairy to fix before the release; add a mention
to NEWS instead.  (Bug <https://savannah.gnu.org/support/index.php?110983>.)

* tests/mktests.pl: Exclude AC_SYS_LARGEFILE, AC_SYS_YEAR2038, and
  AC_SYS_YEAR2038_RECOMMENDED from automatic test generation.
* tests/semantics.at: Add manual tests of those macros.

NEWS
tests/mktests.pl
tests/semantics.at

diff --git a/NEWS b/NEWS
index 14bfad6ec675b4f54d661c9bb6e8339aed4f81df..5c8a348c09f05fa3fd1de20787ef2f570c1488d9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,18 @@ GNU Autoconf NEWS - User visible changes.
 
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
+** Known bugs
+
+*** AC_SYS_LARGEFILE and AC_SYS_YEAR2038 only work correctly in C mode.
+
+  This is only a problem for configure scripts that invoke either
+  macro while AC_LANG([something other than C]) is in effect, and
+  will only be a *visible* problem on systems where support
+  for large files and/or time stamps after 2038 are *available*
+  but not enabled by default.
+
+  See <https://savannah.gnu.org/support/index.php?110983> for details
+  and a workaround.
 
 * Noteworthy changes in release 2.72d (2023-11-30) [beta]
 
index 81f63586cda2907e2dea8d8ab28196b79a51ac3a..8992b99bac9048e8d5461192c3b7403a963f7f8b 100644 (file)
@@ -88,6 +88,7 @@ my @ac_exclude_list = (
   # Checked in semantics.
   qr/^AC_(PROG_CC|C_CONST|C_VOLATILE)$/,
   qr/^AC_PATH_XTRA$/,
+  qr/^AC_SYS_(LARGEFILE|YEAR2038(_RECOMMENDED)?)$/,
 
   # Use without an argument is obsolete.
   # Checked in semantics.
index 3a0e946c05427553899eebe975ace4777f4fe69c..d21caa4913e2d038eb1dff4a7cee414dc33a36c2 100644 (file)
@@ -901,6 +901,57 @@ AT_CHECK_DEFINES(
 
 AT_CLEANUP
 
+## -------------------------------------------------------------------- ##
+## AC_SYS_LARGEFILE, AC_SYS_YEAR2038, and AC_SYS_YEAR2038_RECOMMENDED.  ##
+## -------------------------------------------------------------------- ##
+
+AT_CHECK_MACRO([AC_SYS_LARGEFILE], [],
+[AT_CHECK([./configure --help |
+    $EGREP -e '-(dis|en)able-(largefile|year2038)\>'],
+  [0],
+[  --disable-largefile     omit support for large files
+  --enable-year2038       support timestamps after 2038
+],
+[])])
+
+AT_CHECK_MACRO([AC_SYS_YEAR2038], [],
+[AT_CHECK([./configure --help |
+    $EGREP -e '-(dis|en)able-(largefile|year2038)\>'],
+  [0],
+[  --disable-largefile     omit support for large files
+  --disable-year2038      don't support timestamps after 2038
+],
+[])])
+
+AT_CHECK_MACRO([AC_SYS_YEAR2038_RECOMMENDED], [],
+[AT_CHECK([./configure --help |
+    $EGREP -e '-(dis|en)able-(largefile|year2038)\>'],
+  [0],
+[  --disable-largefile     omit support for large files
+  --disable-year2038      don't support timestamps after 2038
+],
+[])],
+[], [],
+[dnl Skip this test on systems that do not support 64-bit time_t at
+dnl all.  AC_SYS_YEAR2038_RECOMMENDED will make configure fail on
+dnl those systems.  I'd like to make this be a test that it *does*
+dnl make configure fail on those systems, but that would require
+dnl adding features to AT_CHECK_MACRO.
+AT_DATA([configure.ac],
+[[AC_INIT
+AC_PROG_CC
+AC_SYS_YEAR2038
+AC_COMPUTE_INT([sizeof_time_t], [sizeof(time_t)],
+  [@%:@include <time.h>],
+  [sizeof_time_t=0])
+AS@&t@_IF([test $sizeof_time_t -lt 8],
+  [AC_MSG_FAILURE([could not widen time_t])])
+AC_OUTPUT
+]])
+AT_CHECK_AUTOCONF
+AT_CAPTURE_FILE([config.log])
+AT_CHECK([./configure $configure_options || exit 77], [0], [ignore], [])
+])
 
 ## ------------------------------- ##
 ## Obsolete non-updatable macros.  ##