]> Savannah Git Hosting - gnulib.git/commitdiff
localename: Fix test failure on AIX 7.2.
authorBruno Haible <bruno@clisp.org>
Thu, 19 Dec 2019 01:06:00 +0000 (02:06 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 19 Dec 2019 01:12:31 +0000 (02:12 +0100)
* m4/intl-thread-locale.m4 (gt_INTL_THREAD_LOCALE_NAME): Enable nameless
locales on AIX.
* lib/localename.c (gl_locale_name_thread_unsafe): Handle nameless
locales on AIX.

ChangeLog
lib/localename.c
m4/intl-thread-locale.m4

index 1f0792e95aa5859b5866f0456f348f3034150509..cd062159ae0c4724a5054f47093ea895b536f538 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2019-12-18  Bruno Haible  <bruno@clisp.org>
+
+       localename: Fix test failure on AIX 7.2.
+       * m4/intl-thread-locale.m4 (gt_INTL_THREAD_LOCALE_NAME): Enable nameless
+       locales on AIX.
+       * lib/localename.c (gl_locale_name_thread_unsafe): Handle nameless
+       locales on AIX.
+
 2019-12-18  Paul Eggert  <eggert@cs.ucla.edu>
 
        Improve port of AC_C_RESTRICT to Oracle C++
index 65dddeb3780aa78492977333da5b5a6e24b4c687..5e51201a9272012c25ebb6f8296fb5c196ba2fd3 100644 (file)
@@ -3191,6 +3191,8 @@ gl_locale_name_thread_unsafe (int category, const char *categoryname)
             return "";
           }
 #   endif
+#  elif defined _AIX && HAVE_NAMELESS_LOCALES
+        return get_locale_t_name (category, thread_locale);
 #  elif defined __CYGWIN__
         /* Cygwin < 2.6 lacks uselocale and thread-local locales altogether.
            Cygwin <= 2.6.1 lacks NL_LOCALE_NAME, requiring peeking inside
index e43f602dae1693cb8e41a9d40e612cce0baecd50..f74f11646d336aa00312a4e2a1aa66a7a765634d 100644 (file)
@@ -1,4 +1,4 @@
-# intl-thread-locale.m4 serial 5
+# intl-thread-locale.m4 serial 6
 dnl Copyright (C) 2015-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -17,7 +17,7 @@ dnl Check how to retrieve the name of a per-thread locale (POSIX locale_t).
 dnl Sets gt_nameless_locales.
 AC_DEFUN([gt_INTL_THREAD_LOCALE_NAME],
 [
-  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_REQUIRE([AC_CANONICAL_HOST])
 
   dnl Persuade Solaris <locale.h> to define 'locale_t'.
   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
@@ -119,18 +119,20 @@ int main ()
       ;;
   esac
 
-  dnl This code is for future use, in case we some day have to port to a
-  dnl platform where the locale_t type does not provide access to the name of
-  dnl each locale category.  This code has the drawback that it requires the
-  dnl gnulib overrides of 'newlocale', 'duplocale', 'freelocale', which is a
-  dnl problem for GNU libunistring.  Therefore try hard to avoid enabling this
-  dnl code!
+  dnl This code is for platforms where the locale_t type does not provide access
+  dnl to the name of each locale category.  This code has the drawback that it
+  dnl requires the gnulib overrides of 'newlocale', 'duplocale', 'freelocale',
+  dnl which is a problem for GNU libunistring.  Therefore try hard to avoid
+  dnl enabling this code!
   gt_nameless_locales=no
-  if false; then
-    gt_nameless_locales=yes
-    AC_DEFINE([HAVE_NAMELESS_LOCALES], [1],
-      [Define if the locale_t type does not contain the name of each locale category.])
-  fi
+  case "$host_os" in
+    dnl It's needed on AIX 7.2.
+    aix*)
+      gt_nameless_locales=yes
+      AC_DEFINE([HAVE_NAMELESS_LOCALES], [1],
+        [Define if the locale_t type does not contain the name of each locale category.])
+      ;;
+  esac
 ])
 
 dnl Tests whether uselocale() exists and is usable.