Blame gnulib/m4/locale_h.m4

Packit Service a2ae7a
# locale_h.m4 serial 21
Packit Service a2ae7a
dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
Packit Service a2ae7a
dnl This file is free software; the Free Software Foundation
Packit Service a2ae7a
dnl gives unlimited permission to copy and/or distribute it,
Packit Service a2ae7a
dnl with or without modifications, as long as this notice is preserved.
Packit Service a2ae7a
Packit Service a2ae7a
AC_DEFUN([gl_LOCALE_H],
Packit Service a2ae7a
[
Packit Service a2ae7a
  dnl Use AC_REQUIRE here, so that the default behavior below is expanded
Packit Service a2ae7a
  dnl once only, before all statements that occur in other macros.
Packit Service a2ae7a
  AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
Packit Service a2ae7a
Packit Service a2ae7a
  dnl Persuade glibc <locale.h> to define locale_t and the int_p_*, int_n_*
Packit Service a2ae7a
  dnl members of 'struct lconv'.
Packit Service a2ae7a
  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
Packit Service a2ae7a
Packit Service a2ae7a
  dnl If <stddef.h> is replaced, then <locale.h> must also be replaced.
Packit Service a2ae7a
  AC_REQUIRE([gl_STDDEF_H])
Packit Service a2ae7a
Packit Service a2ae7a
  dnl Solaris 11.0 defines the int_p_*, int_n_* members of 'struct lconv'
Packit Service a2ae7a
  dnl only if _LCONV_C99 is defined.
Packit Service a2ae7a
  AC_REQUIRE([AC_CANONICAL_HOST])
Packit Service a2ae7a
  case "$host_os" in
Packit Service a2ae7a
    solaris*)
Packit Service a2ae7a
      AC_DEFINE([_LCONV_C99], [1], [Define to 1 on Solaris.])
Packit Service a2ae7a
      ;;
Packit Service a2ae7a
  esac
Packit Service a2ae7a
Packit Service a2ae7a
  AC_CACHE_CHECK([whether locale.h conforms to POSIX:2001],
Packit Service a2ae7a
    [gl_cv_header_locale_h_posix2001],
Packit Service a2ae7a
    [AC_COMPILE_IFELSE(
Packit Service a2ae7a
       [AC_LANG_PROGRAM(
Packit Service a2ae7a
          [[#include <locale.h>
Packit Service a2ae7a
            int x = LC_MESSAGES;
Packit Service a2ae7a
            int y = sizeof (((struct lconv *) 0)->decimal_point);]],
Packit Service a2ae7a
          [[]])],
Packit Service a2ae7a
       [gl_cv_header_locale_h_posix2001=yes],
Packit Service a2ae7a
       [gl_cv_header_locale_h_posix2001=no])])
Packit Service a2ae7a
Packit Service a2ae7a
  dnl Check for <xlocale.h>.
Packit Service a2ae7a
  AC_CHECK_HEADERS_ONCE([xlocale.h])
Packit Service a2ae7a
  if test $ac_cv_header_xlocale_h = yes; then
Packit Service a2ae7a
    HAVE_XLOCALE_H=1
Packit Service a2ae7a
    dnl Check whether use of locale_t requires inclusion of <xlocale.h>,
Packit Service a2ae7a
    dnl e.g. on Mac OS X 10.5. If <locale.h> does not define locale_t by
Packit Service a2ae7a
    dnl itself, we assume that <xlocale.h> will do so.
Packit Service a2ae7a
    AC_CACHE_CHECK([whether locale.h defines locale_t],
Packit Service a2ae7a
      [gl_cv_header_locale_has_locale_t],
Packit Service a2ae7a
      [AC_COMPILE_IFELSE(
Packit Service a2ae7a
         [AC_LANG_PROGRAM(
Packit Service a2ae7a
            [[#include <locale.h>
Packit Service a2ae7a
              locale_t x;]],
Packit Service a2ae7a
            [[]])],
Packit Service a2ae7a
         [gl_cv_header_locale_has_locale_t=yes],
Packit Service a2ae7a
         [gl_cv_header_locale_has_locale_t=no])
Packit Service a2ae7a
      ])
Packit Service a2ae7a
    if test $gl_cv_header_locale_has_locale_t = yes; then
Packit Service a2ae7a
      gl_cv_header_locale_h_needs_xlocale_h=no
Packit Service a2ae7a
    else
Packit Service a2ae7a
      gl_cv_header_locale_h_needs_xlocale_h=yes
Packit Service a2ae7a
    fi
Packit Service a2ae7a
  else
Packit Service a2ae7a
    HAVE_XLOCALE_H=0
Packit Service a2ae7a
    gl_cv_header_locale_h_needs_xlocale_h=no
Packit Service a2ae7a
  fi
Packit Service a2ae7a
  AC_SUBST([HAVE_XLOCALE_H])
Packit Service a2ae7a
Packit Service a2ae7a
  dnl Check whether 'struct lconv' is complete.
Packit Service a2ae7a
  dnl Bionic libc's 'struct lconv' is just a dummy.
Packit Service a2ae7a
  dnl On OpenBSD 4.9, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin 1.5.x,
Packit Service a2ae7a
  dnl mingw, MSVC 9, it lacks the int_p_* and int_n_* members.
Packit Service a2ae7a
  AC_CACHE_CHECK([whether struct lconv is properly defined],
Packit Service a2ae7a
    [gl_cv_sys_struct_lconv_ok],
Packit Service a2ae7a
    [AC_COMPILE_IFELSE(
Packit Service a2ae7a
       [AC_LANG_PROGRAM(
Packit Service a2ae7a
          [[#include <locale.h>
Packit Service a2ae7a
            struct lconv l;
Packit Service a2ae7a
            int x = sizeof (l.decimal_point);
Packit Service a2ae7a
            int y = sizeof (l.int_p_cs_precedes);]],
Packit Service a2ae7a
          [[]])],
Packit Service a2ae7a
       [gl_cv_sys_struct_lconv_ok=yes],
Packit Service a2ae7a
       [gl_cv_sys_struct_lconv_ok=no])
Packit Service a2ae7a
    ])
Packit Service a2ae7a
  if test $gl_cv_sys_struct_lconv_ok = no; then
Packit Service a2ae7a
    REPLACE_STRUCT_LCONV=1
Packit Service a2ae7a
  fi
Packit Service a2ae7a
Packit Service a2ae7a
  dnl <locale.h> is always overridden, because of GNULIB_POSIXCHECK.
Packit Service a2ae7a
  gl_NEXT_HEADERS([locale.h])
Packit Service a2ae7a
Packit Service a2ae7a
  dnl Check for declarations of anything we want to poison if the
Packit Service a2ae7a
  dnl corresponding gnulib module is not in use.
Packit Service a2ae7a
  gl_WARN_ON_USE_PREPARE([[#include <locale.h>
Packit Service a2ae7a
/* Some systems provide declarations in a non-standard header.  */
Packit Service a2ae7a
#if HAVE_XLOCALE_H
Packit Service a2ae7a
# include <xlocale.h>
Packit Service a2ae7a
#endif
Packit Service a2ae7a
    ]],
Packit Service a2ae7a
    [setlocale newlocale duplocale freelocale])
Packit Service a2ae7a
])
Packit Service a2ae7a
Packit Service a2ae7a
AC_DEFUN([gl_LOCALE_MODULE_INDICATOR],
Packit Service a2ae7a
[
Packit Service a2ae7a
  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
Packit Service a2ae7a
  AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
Packit Service a2ae7a
  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
Packit Service a2ae7a
  dnl Define it also as a C macro, for the benefit of the unit tests.
Packit Service a2ae7a
  gl_MODULE_INDICATOR_FOR_TESTS([$1])
Packit Service a2ae7a
])
Packit Service a2ae7a
Packit Service a2ae7a
AC_DEFUN([gl_LOCALE_H_DEFAULTS],
Packit Service a2ae7a
[
Packit Service a2ae7a
  GNULIB_LOCALECONV=0; AC_SUBST([GNULIB_LOCALECONV])
Packit Service a2ae7a
  GNULIB_SETLOCALE=0;  AC_SUBST([GNULIB_SETLOCALE])
Packit Service a2ae7a
  GNULIB_DUPLOCALE=0;  AC_SUBST([GNULIB_DUPLOCALE])
Packit Service a2ae7a
  GNULIB_LOCALENAME=0; AC_SUBST([GNULIB_LOCALENAME])
Packit Service a2ae7a
  dnl Assume proper GNU behavior unless another module says otherwise.
Packit Service a2ae7a
  HAVE_NEWLOCALE=1;       AC_SUBST([HAVE_NEWLOCALE])
Packit Service a2ae7a
  HAVE_DUPLOCALE=1;       AC_SUBST([HAVE_DUPLOCALE])
Packit Service a2ae7a
  HAVE_FREELOCALE=1;      AC_SUBST([HAVE_FREELOCALE])
Packit Service a2ae7a
  REPLACE_LOCALECONV=0;   AC_SUBST([REPLACE_LOCALECONV])
Packit Service a2ae7a
  REPLACE_SETLOCALE=0;    AC_SUBST([REPLACE_SETLOCALE])
Packit Service a2ae7a
  REPLACE_NEWLOCALE=0;    AC_SUBST([REPLACE_NEWLOCALE])
Packit Service a2ae7a
  REPLACE_DUPLOCALE=0;    AC_SUBST([REPLACE_DUPLOCALE])
Packit Service a2ae7a
  REPLACE_FREELOCALE=0;   AC_SUBST([REPLACE_FREELOCALE])
Packit Service a2ae7a
  REPLACE_STRUCT_LCONV=0; AC_SUBST([REPLACE_STRUCT_LCONV])
Packit Service a2ae7a
])