Skip test of AC_SYS_YEAR2038_RECOMMENDED if system doesn’t support 64-bit time_t.

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.
This commit is contained in:
Zack Weinberg 2023-12-19 09:50:30 -05:00
parent 2d36f11a52
commit 226f37bdba
3 changed files with 64 additions and 0 deletions

12
NEWS
View File

@ -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]

View 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.

View 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. ##