view m4/intlsolaris.m4 @ 39917:5f0e12c5ef27

localename: Add support for per-thread locales on Solaris 11.4. * lib/locale.in.h (newlocale, freelocale): New declarations. (duplocale): Declare also when the 'localename' module requests it. * lib/localename.c (struniq_hash_node): Renamed from hash_node. (STRUNIQ_HASH_TABLE_SIZE): Renamed from HASH_TABLE_SIZE. (struniq): Update. (struct locale_categories_names, struct locale_hash_node): New types. (LOCALE_HASH_TABLE_SIZE): New constant. (locale_hash_table, locale_lock): New variables. (pointer_hash, get_locale_t_name): New functions. (newlocale, duplocale, freelocale): New overridden functions. (gl_locale_name_thread_unsafe): Use get_locale_t_name. * m4/intlsolaris.m4: New file. * m4/localename.m4 (gl_LOCALENAME): Require gl_LOCALE_H_DEFAULTS. Invoke gt_INTL_SOLARIS. Set HAVE_NEWLOCALE, HAVE_DUPLOCALE, HAVE_FREELOCALE, REPLACE_NEWLOCALE, REPLACE_DUPLOCALE, REPLACE_FREELOCALE. * m4/locale_h.m4 (gl_LOCALE_H): Test whether newlocale, freelocale are declared. (gl_LOCALE_H_DEFAULTS): Initialize GNULIB_LOCALENAME, HAVE_NEWLOCALE, HAVE_FREELOCALE, REPLACE_NEWLOCALE, REPLACE_FREELOCALE. * modules/locale (Makefile.am): Substitute GNULIB_LOCALENAME, HAVE_NEWLOCALE, HAVE_FREELOCALE, REPLACE_NEWLOCALE, REPLACE_FREELOCALE. * modules/localename (Files): Add intlsolaris.m4. (Depends-on): Add 'locale'. (configure.ac): Invoke gl_LOCALE_MODULE_INDICATOR. * tests/test-locale-c++.cc (newlocale, freelocale): Prepare for checking the signatures.
author Bruno Haible <bruno@clisp.org>
date Sun, 14 Oct 2018 17:03:01 +0200
parents
children 1ebb12ec25e0
line wrap: on
line source

# intlsolaris.m4 serial 1
dnl Copyright (C) 2015-2018 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 with or without modifications, as long as this notice is preserved.
dnl
dnl This file can be used in projects which are not available under
dnl the GNU General Public License or the GNU Library General Public
dnl License but which still want to provide support for the GNU gettext
dnl functionality.
dnl Please note that the actual code of the GNU gettext library is covered
dnl by the GNU Library General Public License, and the rest of the GNU
dnl gettext package is covered by the GNU General Public License.
dnl They are *not* in the public domain.

dnl Checks for special localename support needed on Solaris.
dnl Sets gt_nameless_locales.
AC_DEFUN([gt_INTL_SOLARIS],
[
  dnl Persuade Solaris <locale.h> to define 'locale_t'.
  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])

  AC_CHECK_FUNCS_ONCE([uselocale])

  gt_nameless_locales=no
  dnl Solaris 12 provides getlocalename_l, while Illumos doesn't have
  dnl it nor the equivalent.
  if test $ac_cv_func_uselocale = yes; then
    AC_CHECK_FUNCS([getlocalename_l])
    if test $ac_cv_func_getlocalename_l != yes; then
      AC_CACHE_CHECK([for Solaris 11.4 locale system],
        [gt_cv_locale_solaris114],
        [dnl Test whether <locale.h> defines locale_t as a typedef of
         dnl 'struct _LC_locale_t **' (whereas Illumos defines it as a
         dnl typedef of 'struct _locale *').
         AC_COMPILE_IFELSE(
           [AC_LANG_PROGRAM([[
              #include <locale.h>
              struct _LC_locale_t *x;
              locale_t y;
            ]],
            [[*y = x;]])],
           [gt_cv_locale_solaris114=yes],
           [gt_cv_locale_solaris114=no])
        ])
      if test $gt_cv_locale_solaris114 = yes; 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
    fi
  fi
])