diff options
author | Bruno Haible <bruno@clisp.org> | 2019-11-18 01:17:49 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2019-11-18 01:17:49 +0100 |
commit | a2342a9b531d5c603da86335636fd86789e56f61 (patch) | |
tree | b11f4015df829a2b79f6a12523e0951b615bb1db | |
parent | f79253a9753cf35616474ffb6d6b73c5525d2a7a (diff) | |
download | gnulib-a2342a9b531d5c603da86335636fd86789e56f61.tar.gz |
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.
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | m4/intl-thread-locale.m4 | 13 | ||||
-rw-r--r-- | m4/locale_h.m4 | 75 | ||||
-rw-r--r-- | m4/localename.m4 | 13 |
4 files changed, 78 insertions, 36 deletions
@@ -1,5 +1,18 @@ 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. * m4/lib-prefix.m4 (AC_LIB_PREPARE_MULTILIB): Set 3 libdirstem variables: Consider 'lib' always, also on Solaris. Look for lib32 in diff --git a/m4/intl-thread-locale.m4 b/m4/intl-thread-locale.m4 index 3ecba86aff..e43f602dae 100644 --- a/m4/intl-thread-locale.m4 +++ b/m4/intl-thread-locale.m4 @@ -1,4 +1,4 @@ -# 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, @@ -139,13 +139,15 @@ AC_DEFUN([gt_FUNC_USELOCALE], [ 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], @@ -156,6 +158,7 @@ AC_DEFUN([gt_FUNC_USELOCALE], #if HAVE_XLOCALE_H # include <xlocale.h> #endif +locale_t loc1; int main () { uselocale (NULL); @@ -164,10 +167,10 @@ int main () }]])], [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 ]) ]) diff --git a/m4/locale_h.m4 b/m4/locale_h.m4 index d28ba0c2df..380e40b00e 100644 --- a/m4/locale_h.m4 +++ b/m4/locale_h.m4 @@ -1,4 +1,4 @@ -# 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, @@ -17,6 +17,8 @@ AC_DEFUN([gl_LOCALE_H], 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]) @@ -37,34 +39,6 @@ AC_DEFUN([gl_LOCALE_H], [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, @@ -99,6 +73,49 @@ AC_DEFUN([gl_LOCALE_H], [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. diff --git a/m4/localename.m4 b/m4/localename.m4 index a9f629dd17..8e8d249c1c 100644 --- a/m4/localename.m4 +++ b/m4/localename.m4 @@ -1,4 +1,4 @@ -# 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, @@ -7,11 +7,20 @@ dnl with or without modifications, as long as this notice is preserved. 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 |