]> Savannah Git Hosting - gnulib.git/commitdiff
localename-unsafe-limited: New module.
authorBruno Haible <bruno@clisp.org>
Thu, 15 Feb 2024 19:47:28 +0000 (20:47 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 15 Feb 2024 21:30:54 +0000 (22:30 +0100)
* m4/localename.m4 (gl_LOCALENAME_UNSAFE_LIMITED): New macro.
* modules/localename-unsafe-limited: New file.
* modules/localename-unsafe (Depends-on): Add localename-unsafe-limited.
(Makefile.am): Compile localename-unsafe.c only if the module
localename-unsafe-limited does not already do it.

ChangeLog
m4/localename.m4
modules/localename-unsafe
modules/localename-unsafe-limited [new file with mode: 0644]

index 68a0050a6886a80ce3560f6d0cce7f4afd4e3302..0550e82a0461ebf5249143876173e310f31d3739 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-02-15  Bruno Haible  <bruno@clisp.org>
+
+       localename-unsafe-limited: New module.
+       * m4/localename.m4 (gl_LOCALENAME_UNSAFE_LIMITED): New macro.
+       * modules/localename-unsafe-limited: New file.
+       * modules/localename-unsafe (Depends-on): Add localename-unsafe-limited.
+       (Makefile.am): Compile localename-unsafe.c only if the module
+       localename-unsafe-limited does not already do it.
+
 2024-02-15  Bruno Haible  <bruno@clisp.org>
 
        nstrftime, fprintftime: Optimize.
index 189aee6346e28b3fa1c78553e9a7582ecd2fd962..d91fd5deb48116fd79dc74552bfb383064e4d8df 100644 (file)
@@ -1,4 +1,4 @@
-# localename.m4 serial 11
+# localename.m4 serial 12
 dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -53,3 +53,9 @@ AC_DEFUN([gl_LOCALENAME_UNSAFE],
     REPLACE_FREELOCALE=1
   fi
 ])
+
+AC_DEFUN([gl_LOCALENAME_UNSAFE_LIMITED],
+[
+  AC_REQUIRE([gt_LC_MESSAGES])
+  AC_REQUIRE([gt_INTL_THREAD_LOCALE_NAME])
+])
index 4b8ad0279b97f108d0a5384202e0ed3d8e3a0fae..3bcdbcad7bc68a45b161458042a9270dcc1c9c34 100644 (file)
@@ -15,6 +15,7 @@ m4/lcmessage.m4
 m4/musl.m4
 
 Depends-on:
+localename-unsafe-limited
 extensions
 stdbool
 locale
@@ -33,7 +34,10 @@ gl_LOCALE_MODULE_INDICATOR([localename-unsafe])
 gl_MUSL_LIBC
 
 Makefile.am:
-lib_SOURCES += localename-unsafe.c localename-table.c
+if !GL_COND_OBJ_LOCALENAME_UNSAFE_LIMITED
+lib_SOURCES += localename-unsafe.c
+endif
+lib_SOURCES += localename-table.c
 
 Include:
 "localename.h"
diff --git a/modules/localename-unsafe-limited b/modules/localename-unsafe-limited
new file mode 100644 (file)
index 0000000..b9f845b
--- /dev/null
@@ -0,0 +1,39 @@
+Description:
+Return current locale's name, according to glibc naming conventions,
+in thread-local (unsafe) storage.
+Only works on a limited set of platforms: on NetBSD and Solaris.
+
+Files:
+lib/localename.h
+lib/localename-unsafe.c
+m4/localename.m4
+m4/intl-thread-locale.m4
+m4/lcmessage.m4
+
+Depends-on:
+extensions
+locale
+setlocale-null-unlocked
+
+configure.ac:
+gl_LOCALENAME_UNSAFE_LIMITED
+AC_REQUIRE([AC_CANONICAL_HOST])
+gl_CONDITIONAL([GL_COND_OBJ_LOCALENAME_UNSAFE_LIMITED],
+               [case "$host_os" in netbsd* | solaris*) true;; *) false;; esac])
+
+Makefile.am:
+if GL_COND_OBJ_LOCALENAME_UNSAFE_LIMITED
+lib_SOURCES += localename-unsafe.c
+endif
+
+Include:
+"localename.h"
+
+Link:
+$(LIBTHREAD)
+
+License:
+LGPLv2+
+
+Maintainer:
+all