+2019-11-17 Bruno Haible <bruno@clisp.org>
+
+ locale, localename: Improve z/OS support.
+ Reported by Daniel Richard G. in
+ <https://lists.gnu.org/archive/html/bug-gnulib/2019-11/msg00001.html>.
+ * m4/locale_h.m4 (gl_LOCALE_T): New macro, partially extracted from
+ gl_LOCALE_H.
+ (gl_LOCALE_H): Require it.
+ * m4/localename.m4 (gl_LOCALENAME): Likewise. If locale_t is not
+ defined, don't even check for newlocale, duplocale, freelocale.
+ * m4/intl-thread-locale.m4 (gt_FUNC_USELOCALE): Make the test fail when
+ locale_t is not defined.
+
2019-11-17 Bruno Haible <bruno@clisp.org>
havelib: Make libdirstems processing more flexible.
-# intl-thread-locale.m4 serial 4
+# intl-thread-locale.m4 serial 5
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,
[
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- dnl Persuade Solaris <locale.h> to define 'locale_t'.
+ dnl Persuade glibc and Solaris <locale.h> to define 'locale_t'.
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
AC_CHECK_FUNCS_ONCE([uselocale])
dnl On AIX 7.2, the uselocale() function is not documented and leads to
dnl crashes in subsequent setlocale() invocations.
+ dnl In 2019, some versions of z/OS lack the locale_t type and have a broken
+ dnl uselocale function.
if test $ac_cv_func_uselocale = yes; then
AC_CHECK_HEADERS_ONCE([xlocale.h])
AC_CACHE_CHECK([whether uselocale works],
#if HAVE_XLOCALE_H
# include <xlocale.h>
#endif
+locale_t loc1;
int main ()
{
uselocale (NULL);
}]])],
[gt_cv_func_uselocale_works=yes],
[gt_cv_func_uselocale_works=no],
- [# Guess no on AIX, yes otherwise.
+ [# Guess no on AIX and z/OS, yes otherwise.
case "$host_os" in
- aix*) gt_cv_func_uselocale_works="guessing no" ;;
- *) gt_cv_func_uselocale_works="guessing yes" ;;
+ aix* | mvs*) gt_cv_func_uselocale_works="guessing no" ;;
+ *) gt_cv_func_uselocale_works="guessing yes" ;;
esac
])
])
-# locale_h.m4 serial 21
+# locale_h.m4 serial 22
dnl Copyright (C) 2007, 2009-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,
dnl If <stddef.h> is replaced, then <locale.h> must also be replaced.
AC_REQUIRE([gl_STDDEF_H])
+ AC_REQUIRE([gl_LOCALE_T])
+
dnl Solaris 11.0 defines the int_p_*, int_n_* members of 'struct lconv'
dnl only if _LCONV_C99 is defined.
AC_REQUIRE([AC_CANONICAL_HOST])
[gl_cv_header_locale_h_posix2001=yes],
[gl_cv_header_locale_h_posix2001=no])])
- dnl Check for <xlocale.h>.
- AC_CHECK_HEADERS_ONCE([xlocale.h])
- if test $ac_cv_header_xlocale_h = yes; then
- HAVE_XLOCALE_H=1
- dnl Check whether use of locale_t requires inclusion of <xlocale.h>,
- dnl e.g. on Mac OS X 10.5. If <locale.h> does not define locale_t by
- dnl itself, we assume that <xlocale.h> will do so.
- AC_CACHE_CHECK([whether locale.h defines locale_t],
- [gl_cv_header_locale_has_locale_t],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <locale.h>
- locale_t x;]],
- [[]])],
- [gl_cv_header_locale_has_locale_t=yes],
- [gl_cv_header_locale_has_locale_t=no])
- ])
- if test $gl_cv_header_locale_has_locale_t = yes; then
- gl_cv_header_locale_h_needs_xlocale_h=no
- else
- gl_cv_header_locale_h_needs_xlocale_h=yes
- fi
- else
- HAVE_XLOCALE_H=0
- gl_cv_header_locale_h_needs_xlocale_h=no
- fi
- AC_SUBST([HAVE_XLOCALE_H])
-
dnl Check whether 'struct lconv' is complete.
dnl Bionic libc's 'struct lconv' is just a dummy.
dnl On OpenBSD 4.9, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin 1.5.x,
[setlocale newlocale duplocale freelocale])
])
+dnl Checks to determine whether the system has the locale_t type,
+dnl and how to obtain it.
+AC_DEFUN([gl_LOCALE_T],
+[
+ dnl Persuade glibc and Solaris <locale.h> to define locale_t.
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+ dnl Check whether use of locale_t requires inclusion of <xlocale.h>,
+ dnl e.g. on Mac OS X 10.5. If <locale.h> does not define locale_t by
+ dnl itself, we assume that <xlocale.h> will do so.
+ AC_CACHE_CHECK([whether locale.h defines locale_t],
+ [gl_cv_header_locale_has_locale_t],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <locale.h>
+ locale_t x;]],
+ [[]])],
+ [gl_cv_header_locale_has_locale_t=yes],
+ [gl_cv_header_locale_has_locale_t=no])
+ ])
+
+ dnl Check for <xlocale.h>.
+ AC_CHECK_HEADERS_ONCE([xlocale.h])
+ if test $ac_cv_header_xlocale_h = yes; then
+ HAVE_XLOCALE_H=1
+ if test $gl_cv_header_locale_has_locale_t = yes; then
+ gl_cv_header_locale_h_needs_xlocale_h=no
+ else
+ gl_cv_header_locale_h_needs_xlocale_h=yes
+ fi
+ HAVE_LOCALE_T=1
+ else
+ HAVE_XLOCALE_H=0
+ gl_cv_header_locale_h_needs_xlocale_h=no
+ if test $gl_cv_header_locale_has_locale_t = yes; then
+ HAVE_LOCALE_T=1
+ else
+ HAVE_LOCALE_T=0
+ fi
+ fi
+ AC_SUBST([HAVE_XLOCALE_H])
+])
+
AC_DEFUN([gl_LOCALE_MODULE_INDICATOR],
[
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
-# localename.m4 serial 6
+# localename.m4 serial 7
dnl Copyright (C) 2007, 2009-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,
AC_DEFUN([gl_LOCALENAME],
[
AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
+ AC_REQUIRE([gl_LOCALE_T])
AC_REQUIRE([gt_LC_MESSAGES])
AC_REQUIRE([gt_INTL_THREAD_LOCALE_NAME])
AC_REQUIRE([gt_INTL_MACOSX])
AC_CHECK_HEADERS_ONCE([langinfo.h])
- AC_CHECK_FUNCS_ONCE([newlocale duplocale freelocale])
+ if test $HAVE_LOCALE_T = 1; then
+ AC_CHECK_FUNCS_ONCE([newlocale duplocale freelocale])
+ else
+ dnl In 2019, some versions of z/OS lack the locale_t type and have broken
+ dnl newlocale, duplocale, freelocale functions.
+ ac_cv_func_newlocale=no
+ ac_cv_func_duplocale=no
+ ac_cv_func_freelocale=no
+ fi
if test $ac_cv_func_newlocale != yes; then
HAVE_NEWLOCALE=0
fi