From 226f37bdbaf76ab3e6ee0546909f08eb2acfb43f Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Tue, 19 Dec 2023 09:50:30 -0500 Subject: [PATCH] =?UTF-8?q?Skip=20test=20of=20AC=5FSYS=5FYEAR2038=5FRECOMM?= =?UTF-8?q?ENDED=20if=20system=20doesn=E2=80=99t=20support=2064-bit=20time?= =?UTF-8?q?=5Ft.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 .) * 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 | 12 +++++++++++ tests/mktests.pl | 1 + tests/semantics.at | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) diff --git a/NEWS b/NEWS index 14bfad6e..5c8a348c 100644 --- 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 for details + and a workaround. * Noteworthy changes in release 2.72d (2023-11-30) [beta] diff --git a/tests/mktests.pl b/tests/mktests.pl index 81f63586..8992b99b 100644 --- a/tests/mktests.pl +++ b/tests/mktests.pl @@ -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. diff --git a/tests/semantics.at b/tests/semantics.at index 3a0e946c..d21caa49 100644 --- a/tests/semantics.at +++ b/tests/semantics.at @@ -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 ], + [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. ##