]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
nstrftime: Handle non-Gregorian calendars the same way on all platforms.
authorBruno Haible <bruno@clisp.org>
Tue, 29 Jul 2025 20:31:13 +0000 (22:31 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 29 Jul 2025 20:31:13 +0000 (22:31 +0200)
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).

ChangeLog
lib/strftime.c
modules/nstrftime
modules/nstrftime-limited [new file with mode: 0644]
modules/nstrftime-tests

index 31c4d8a0369f25005e20e0470338ed77ecc617a6..19e715b1fd571d15d0000b4abdb5e2e5e39da273 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2025-07-29  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        git-merge-changelog: Fix upstream/downstream heuristic for "git pull".
index 6495a6847e0e813d3ae591f077323a377e9fc360..537172d8be654ca4b34c1aa88a237664f138747b 100644 (file)
@@ -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
index c61fb1e84a6ed07b7f652f7a35e64f2247fed3f1..aa1740ebc41ede8d029073f642f8946f2fb4e327 100644 (file)
@@ -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 (file)
index 0000000..9f53b62
--- /dev/null
@@ -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
index 91c21edf77bc873a279931c9bd2cd10cf33f5d21..addd3049331d57e9fe36af1733dd4282c1c5bcad 100644 (file)
@@ -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)