]> Savannah Git Hosting - gnulib.git/commitdiff
localename: Fix link error with duplocale on AIX 7.2 (regr. 2019-12-18).
authorBruno Haible <bruno@clisp.org>
Thu, 7 Jan 2021 21:55:41 +0000 (22:55 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 7 Jan 2021 22:01:05 +0000 (23:01 +0100)
* m4/locale_h.m4 (gl_LOCALE_H_DEFAULTS): Initialize
LOCALENAME_ENHANCE_LOCALE_FUNCS.
* m4/intl-thread-locale.m4 (gt_FUNC_USELOCALE):
Set gt_working_uselocale.
(gt_INTL_THREAD_LOCALE_NAME): Set gt_fake_locales, gt_good_uselocale,
gt_localename_enhances_locale_funcs, LOCALENAME_ENHANCE_LOCALE_FUNCS.
Define HAVE_GOOD_USELOCALE, LOCALENAME_ENHANCE_LOCALE_FUNCS.
* m4/localename.m4 (gl_LOCALENAME): Test
gt_localename_enhances_locale_funcs instead of gt_nameless_locales.
* modules/locale (Makefile.am): Substitute
LOCALENAME_ENHANCE_LOCALE_FUNCS.
* lib/locale.in.h (newlocale, duplocale, freelocale): Don't override if
module 'localename' is in use but LOCALENAME_ENHANCE_LOCALE_FUNCS is 0.
* lib/localename.c (HAVE_GOOD_USELOCALE): Don't define here.
(get_locale_t_name, newlocale, duplocale, freelocale): Define if
LOCALENAME_ENHANCE_LOCALE_FUNCS.

ChangeLog
lib/locale.in.h
lib/localename.c
m4/intl-thread-locale.m4
m4/locale_h.m4
m4/localename.m4
modules/locale

index 0831c85e1cec6f70ac11f648b0f18b1485071c56..3eab13d2280bdea659ad901a45941d20fff45c9b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2021-01-07  Bruno Haible  <bruno@clisp.org>
+
+       localename: Fix link error with duplocale on AIX 7.2 (regr. 2019-12-18).
+       * m4/locale_h.m4 (gl_LOCALE_H_DEFAULTS): Initialize
+       LOCALENAME_ENHANCE_LOCALE_FUNCS.
+       * m4/intl-thread-locale.m4 (gt_FUNC_USELOCALE):
+       Set gt_working_uselocale.
+       (gt_INTL_THREAD_LOCALE_NAME): Set gt_fake_locales, gt_good_uselocale,
+       gt_localename_enhances_locale_funcs, LOCALENAME_ENHANCE_LOCALE_FUNCS.
+       Define HAVE_GOOD_USELOCALE, LOCALENAME_ENHANCE_LOCALE_FUNCS.
+       * m4/localename.m4 (gl_LOCALENAME): Test
+       gt_localename_enhances_locale_funcs instead of gt_nameless_locales.
+       * modules/locale (Makefile.am): Substitute
+       LOCALENAME_ENHANCE_LOCALE_FUNCS.
+       * lib/locale.in.h (newlocale, duplocale, freelocale): Don't override if
+       module 'localename' is in use but LOCALENAME_ENHANCE_LOCALE_FUNCS is 0.
+       * lib/localename.c (HAVE_GOOD_USELOCALE): Don't define here.
+       (get_locale_t_name, newlocale, duplocale, freelocale): Define if
+       LOCALENAME_ENHANCE_LOCALE_FUNCS.
+
 2021-01-06  Bruno Haible  <bruno@clisp.org>
 
        logb: Fix test failure on glibc/powerpc.
index df8474798c29f518ff45e4e8f771f41d09c12147..13d1cf2fe97b2e957eb706111d4cd8b9522393cd 100644 (file)
@@ -211,7 +211,7 @@ _GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - "
 # include "setlocale_null.h"
 #endif
 
-#if /*@GNULIB_NEWLOCALE@ ||*/ (@GNULIB_LOCALENAME@ && @HAVE_NEWLOCALE@)
+#if /*@GNULIB_NEWLOCALE@ ||*/ (@GNULIB_LOCALENAME@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_NEWLOCALE@)
 # if @REPLACE_NEWLOCALE@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef newlocale
@@ -244,7 +244,7 @@ _GL_WARN_ON_USE (newlocale, "newlocale is not portable");
 # endif
 #endif
 
-#if @GNULIB_DUPLOCALE@ || (@GNULIB_LOCALENAME@ && @HAVE_DUPLOCALE@)
+#if @GNULIB_DUPLOCALE@ || (@GNULIB_LOCALENAME@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_DUPLOCALE@)
 # if @REPLACE_DUPLOCALE@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef duplocale
@@ -274,7 +274,7 @@ _GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - "
 # endif
 #endif
 
-#if /*@GNULIB_FREELOCALE@ ||*/ (@GNULIB_LOCALENAME@ && @HAVE_FREELOCALE@)
+#if /*@GNULIB_FREELOCALE@ ||*/ (@GNULIB_LOCALENAME@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_FREELOCALE@)
 # if @REPLACE_FREELOCALE@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef freelocale
index 4c785f11f034c8d9deaf6729f6878313145be058..0e63da4d4b91bc668c6b2544f0f3691999923eb6 100644 (file)
 #include "setlocale_null.h"
 #include "thread-optim.h"
 
-/* We cannot support uselocale() on platforms where the locale_t type is fake.
-   See intl-thread-locale.m4 for details.  */
-#if HAVE_WORKING_USELOCALE && !HAVE_FAKE_LOCALES
-# define HAVE_GOOD_USELOCALE 1
-#endif
-
 #if HAVE_GOOD_USELOCALE
 /* Mac OS X 10.5 defines the locale_t type in <xlocale.h>.  */
 # if defined __APPLE__ && defined __MACH__
@@ -2726,7 +2720,7 @@ struniq (const char *string)
 #endif
 
 
-#if HAVE_GOOD_USELOCALE && HAVE_NAMELESS_LOCALES
+#if LOCALENAME_ENHANCE_LOCALE_FUNCS
 
 /* The 'locale_t' object does not contain the names of the locale categories.
    We have to associate them with the object through a hash table.
index 65ac371cd090965afa2bdccb4a5b1a42d0f589e2..890fec00ef2f5675c10575a0c9694bed2401d376 100644 (file)
@@ -1,4 +1,4 @@
-# intl-thread-locale.m4 serial 8
+# intl-thread-locale.m4 serial 9
 dnl Copyright (C) 2015-2021 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -72,9 +72,13 @@ int main ()
   esac
   case "$gt_cv_locale_fake" in
     *yes)
+      gt_fake_locales=yes
       AC_DEFINE([HAVE_FAKE_LOCALES], [1],
         [Define if the locale_t type contains insufficient information, as on OpenBSD.])
       ;;
+    *)
+      gt_fake_locales=no
+      ;;
   esac
 
   case "$gt_cv_func_uselocale_works" in
@@ -133,10 +137,33 @@ int main ()
         [Define if the locale_t type does not contain the name of each locale category.])
       ;;
   esac
+
+  dnl We cannot support uselocale() on platforms where the locale_t type is
+  dnl fake.  So, set
+  dnl   gt_good_uselocale = gt_working_uselocale && !gt_fake_locales.
+  if test $gt_working_uselocale = yes && test $gt_fake_locales = no; then
+    gt_good_uselocale=yes
+    AC_DEFINE([HAVE_GOOD_USELOCALE], [1],
+      [Define if the uselocale exists, may be safely called, and returns sufficient information.])
+  else
+    gt_good_uselocale=no
+  fi
+
+  dnl Set gt_localename_enhances_locale_funcs to indicate whether localename.c
+  dnl overrides newlocale(), duplocale(), freelocale() to keep track of locale
+  dnl names.
+  if test $gt_good_uselocale = yes && test $gt_nameless_locales = yes; then
+    gt_localename_enhances_locale_funcs=yes
+    LOCALENAME_ENHANCE_LOCALE_FUNCS=1
+    AC_DEFINE([LOCALENAME_ENHANCE_LOCALE_FUNCS], [1],
+      [Define if localename.c overrides newlocale(), duplocale(), freelocale().])
+  else
+    gt_localename_enhances_locale_funcs=no
+  fi
 ])
 
 dnl Tests whether uselocale() exists and is usable.
-dnl Sets gt_cv_func_uselocale_works. Defines HAVE_WORKING_USELOCALE.
+dnl Sets gt_working_uselocale and defines HAVE_WORKING_USELOCALE.
 AC_DEFUN([gt_FUNC_USELOCALE],
 [
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
@@ -181,8 +208,12 @@ int main ()
   fi
   case "$gt_cv_func_uselocale_works" in
     *yes)
+      gt_working_uselocale=yes
       AC_DEFINE([HAVE_WORKING_USELOCALE], [1],
-        [Define if the uselocale function exists any may safely be called.])
+        [Define if the uselocale function exists and may safely be called.])
+      ;;
+    *)
+      gt_working_uselocale=no
       ;;
   esac
 ])
index a95379a86eee0962e0b9b0094b93d03b9b83a65e..7b50aa7a8631996485e84bc9f2e848adeeca7acd 100644 (file)
@@ -1,4 +1,4 @@
-# locale_h.m4 serial 24
+# locale_h.m4 serial 25
 dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -155,4 +155,5 @@ AC_DEFUN([gl_LOCALE_H_DEFAULTS],
   REPLACE_DUPLOCALE=0;    AC_SUBST([REPLACE_DUPLOCALE])
   REPLACE_FREELOCALE=0;   AC_SUBST([REPLACE_FREELOCALE])
   REPLACE_STRUCT_LCONV=0; AC_SUBST([REPLACE_STRUCT_LCONV])
+  LOCALENAME_ENHANCE_LOCALE_FUNCS=0; AC_SUBST([LOCALENAME_ENHANCE_LOCALE_FUNCS])
 ])
index 5c1ea0e2c5419432a82308a1c108854346c142a9..2bff33d73591dab9974fdd74bf74f0d72047817f 100644 (file)
@@ -1,4 +1,4 @@
-# localename.m4 serial 7
+# localename.m4 serial 8
 dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -33,7 +33,7 @@ AC_DEFUN([gl_LOCALENAME],
   if test $gl_func_freelocale != yes; then
     HAVE_FREELOCALE=0
   fi
-  if test $gt_nameless_locales = yes; then
+  if test $gt_localename_enhances_locale_funcs = yes; then
     REPLACE_NEWLOCALE=1
     REPLACE_DUPLOCALE=1
     REPLACE_FREELOCALE=1
index aac463cd67decb2840b17de876601b9731adf9c9..cd045c3781c9994c2be1453d3d9230a078225ad1 100644 (file)
@@ -44,6 +44,7 @@ locale.h: locale.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \
              -e 's|@''REPLACE_FREELOCALE''@|$(REPLACE_FREELOCALE)|g' \
              -e 's|@''REPLACE_STRUCT_LCONV''@|$(REPLACE_STRUCT_LCONV)|g' \
+             -e 's|@''LOCALENAME_ENHANCE_LOCALE_FUNCS''@|$(LOCALENAME_ENHANCE_LOCALE_FUNCS)|g' \
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \