+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.
# 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
# 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
# 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
#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__
#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.
-# 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,
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
[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
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
])
-# 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,
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])
])
-# 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,
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
-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)' \