From: Bruno Haible Date: Tue, 29 Jul 2025 20:31:13 +0000 (+0200) Subject: nstrftime: Handle non-Gregorian calendars the same way on all platforms. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca5ebe4b5724fb57a34c7002467ce931cbf96b45;p=thirdparty%2Fgnulib.git nstrftime: Handle non-Gregorian calendars the same way on all platforms. Suggested by Collin Funk. * modules/nstrftime-limited: New file, based on modules/nstrftime. * modules/nstrftime (Depends-on): Add nstrftime-limited. Add localename-unsafe. Remove localename-unsafe-limited. (configure.ac): Invoke gl_MODULE_INDICATOR. (Makefile.am): Don't add nstrftime.c to lib_SOURCES; this would conflict with modules/nstrftime-limited. (Link): Add $(LIBTHREAD). * lib/strftime.c (SUPPORT_NON_GREG_CALENDARS_IN_STRFTIME): Don't force to false if GNULIB_NSTRFTIME is defined. * modules/nstrftime-tests (Makefile.am): Link test-nstrftime, test-nstrftime-?? with $(LIBTHREAD). --- diff --git a/ChangeLog b/ChangeLog index 31c4d8a036..19e715b1fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2025-07-29 Bruno Haible + + nstrftime: Handle non-Gregorian calendars the same way on all platforms. + Suggested by Collin Funk. + * modules/nstrftime-limited: New file, based on modules/nstrftime. + * modules/nstrftime (Depends-on): Add nstrftime-limited. + Add localename-unsafe. Remove localename-unsafe-limited. + (configure.ac): Invoke gl_MODULE_INDICATOR. + (Makefile.am): Don't add nstrftime.c to lib_SOURCES; this would conflict + with modules/nstrftime-limited. + (Link): Add $(LIBTHREAD). + * lib/strftime.c (SUPPORT_NON_GREG_CALENDARS_IN_STRFTIME): Don't force + to false if GNULIB_NSTRFTIME is defined. + * modules/nstrftime-tests (Makefile.am): Link test-nstrftime, + test-nstrftime-?? with $(LIBTHREAD). + 2025-07-29 Bruno Haible git-merge-changelog: Fix upstream/downstream heuristic for "git pull". diff --git a/lib/strftime.c b/lib/strftime.c index 6495a6847e..537172d8be 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -76,7 +76,8 @@ # define SUPPORT_NON_GREG_CALENDARS_IN_STRFTIME true #endif #if defined _LIBC || (HAVE_ONLY_C_LOCALE || USE_C_LOCALE) \ - || (defined __OpenBSD__ || defined _AIX || defined __ANDROID__) + || ((defined __OpenBSD__ || defined _AIX || defined __ANDROID__) \ + && !GNULIB_NSTRFTIME) # undef SUPPORT_NON_GREG_CALENDARS_IN_STRFTIME # define SUPPORT_NON_GREG_CALENDARS_IN_STRFTIME false #endif diff --git a/modules/nstrftime b/modules/nstrftime index c61fb1e84a..aa1740ebc4 100644 --- a/modules/nstrftime +++ b/modules/nstrftime @@ -13,6 +13,7 @@ m4/nstrftime.m4 m4/tm_gmtoff.m4 Depends-on: +nstrftime-limited attribute c-ctype c99 @@ -21,22 +22,23 @@ extensions intprops libc-config localcharset -localename-unsafe-limited +localename-unsafe bool stdckdint-h time_rz configure.ac: gl_FUNC_GNU_STRFTIME +gl_MODULE_INDICATOR([nstrftime]) Makefile.am: -lib_SOURCES += nstrftime.c Include: "strftime.h" Link: @INTL_MACOSX_LIBS@ +$(LIBTHREAD) License: LGPL diff --git a/modules/nstrftime-limited b/modules/nstrftime-limited new file mode 100644 index 0000000000..9f53b621a7 --- /dev/null +++ b/modules/nstrftime-limited @@ -0,0 +1,47 @@ +Description: +nstrftime() function: convert date and time to string, with GNU extensions. +Supports non-Gregorian calendars on a limited set of platforms: +all except OpenBSD, AIX, Android. + +Files: +lib/strftime.h +lib/nstrftime.c +lib/strftime.c +lib/calendars.h +lib/calendar-thai.h +lib/calendar-persian.h +lib/calendar-ethiopian.h +m4/nstrftime.m4 +m4/tm_gmtoff.m4 + +Depends-on: +attribute +c-ctype +c99 +errno-h +extensions +intprops +libc-config +localcharset +localename-unsafe-limited +bool +stdckdint-h +time_rz + +configure.ac: +gl_FUNC_GNU_STRFTIME + +Makefile.am: +lib_SOURCES += nstrftime.c + +Include: +"strftime.h" + +Link: +@INTL_MACOSX_LIBS@ + +License: +LGPL + +Maintainer: +Jim Meyering, glibc diff --git a/modules/nstrftime-tests b/modules/nstrftime-tests index 91c21edf77..addd304933 100644 --- a/modules/nstrftime-tests +++ b/modules/nstrftime-tests @@ -43,8 +43,8 @@ check_PROGRAMS += \ test-nstrftime-TH \ test-nstrftime-IR \ test-nstrftime-ET -test_nstrftime_LDADD = $(LDADD) $(SETLOCALE_LIB) @INTL_MACOSX_LIBS@ -test_nstrftime_DE_LDADD = $(LDADD) $(SETLOCALE_LIB) @INTL_MACOSX_LIBS@ -test_nstrftime_TH_LDADD = $(LDADD) $(SETLOCALE_LIB) @INTL_MACOSX_LIBS@ -test_nstrftime_IR_LDADD = $(LDADD) $(SETLOCALE_LIB) @INTL_MACOSX_LIBS@ -test_nstrftime_ET_LDADD = $(LDADD) $(SETLOCALE_LIB) @INTL_MACOSX_LIBS@ +test_nstrftime_LDADD = $(LDADD) $(SETLOCALE_LIB) @INTL_MACOSX_LIBS@ $(LIBTHREAD) +test_nstrftime_DE_LDADD = $(LDADD) $(SETLOCALE_LIB) @INTL_MACOSX_LIBS@ $(LIBTHREAD) +test_nstrftime_TH_LDADD = $(LDADD) $(SETLOCALE_LIB) @INTL_MACOSX_LIBS@ $(LIBTHREAD) +test_nstrftime_IR_LDADD = $(LDADD) $(SETLOCALE_LIB) @INTL_MACOSX_LIBS@ $(LIBTHREAD) +test_nstrftime_ET_LDADD = $(LDADD) $(SETLOCALE_LIB) @INTL_MACOSX_LIBS@ $(LIBTHREAD)