| 1 |
# nl_langinfo.m4 |
| 2 |
# serial 11 |
| 3 |
dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. |
| 4 |
dnl This file is free software; the Free Software Foundation |
| 5 |
dnl gives unlimited permission to copy and/or distribute it, |
| 6 |
dnl with or without modifications, as long as this notice is preserved. |
| 7 |
dnl This file is offered as-is, without any warranty. |
| 8 |
|
| 9 |
AC_DEFUN([gl_FUNC_NL_LANGINFO], |
| 10 |
[ |
| 11 |
AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) |
| 12 |
AC_REQUIRE([gl_LANGINFO_H]) |
| 13 |
gl_CHECK_FUNCS_ANDROID([nl_langinfo], [[#include <langinfo.h>]]) |
| 14 |
AC_REQUIRE([AC_CANONICAL_HOST]) |
| 15 |
AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) |
| 16 |
AC_REQUIRE([gl_PTHREADLIB]) |
| 17 |
AC_CHECK_HEADERS_ONCE([threads.h]) |
| 18 |
if test $ac_cv_func_nl_langinfo = yes; then |
| 19 |
# On Irix 6.5, YESEXPR is defined, but nl_langinfo(YESEXPR) is broken. |
| 20 |
AC_CACHE_CHECK([whether YESEXPR works], |
| 21 |
[gl_cv_func_nl_langinfo_yesexpr_works], |
| 22 |
[AC_RUN_IFELSE( |
| 23 |
[AC_LANG_PROGRAM([[#include <langinfo.h> |
| 24 |
]], [[return !*nl_langinfo(YESEXPR); |
| 25 |
]])], |
| 26 |
[gl_cv_func_nl_langinfo_yesexpr_works=yes], |
| 27 |
[gl_cv_func_nl_langinfo_yesexpr_works=no], |
| 28 |
[ |
| 29 |
case "$host_os" in |
| 30 |
# Guess no on irix systems. |
| 31 |
irix*) gl_cv_func_nl_langinfo_yesexpr_works="guessing no";; |
| 32 |
# Guess yes elsewhere. |
| 33 |
*) gl_cv_func_nl_langinfo_yesexpr_works="guessing yes";; |
| 34 |
esac |
| 35 |
]) |
| 36 |
]) |
| 37 |
case $gl_cv_func_nl_langinfo_yesexpr_works in |
| 38 |
*yes) FUNC_NL_LANGINFO_YESEXPR_WORKS=1 ;; |
| 39 |
*) FUNC_NL_LANGINFO_YESEXPR_WORKS=0 ;; |
| 40 |
esac |
| 41 |
AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS], |
| 42 |
[$FUNC_NL_LANGINFO_YESEXPR_WORKS], |
| 43 |
[Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string.]) |
| 44 |
# On Solaris 10 and Solaris 11.3, nl_langinfo is not multithread-safe. |
| 45 |
case "$host_os" in |
| 46 |
solaris*) NL_LANGINFO_MTSAFE=0 ;; |
| 47 |
*) NL_LANGINFO_MTSAFE=1 ;; |
| 48 |
esac |
| 49 |
AC_DEFINE_UNQUOTED([NL_LANGINFO_MTSAFE], [$NL_LANGINFO_MTSAFE], |
| 50 |
[Define to 1 if nl_langinfo is multithread-safe.]) |
| 51 |
if test $HAVE_LANGINFO_CODESET = 1 \ |
| 52 |
&& test $HAVE_LANGINFO_T_FMT_AMPM = 1 \ |
| 53 |
&& test $HAVE_LANGINFO_ALTMON = 1 \ |
| 54 |
&& test $HAVE_LANGINFO_ERA = 1 \ |
| 55 |
&& test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1 \ |
| 56 |
&& test $NL_LANGINFO_MTSAFE = 1; then |
| 57 |
: |
| 58 |
else |
| 59 |
REPLACE_NL_LANGINFO=1 |
| 60 |
AC_DEFINE([REPLACE_NL_LANGINFO], [1], |
| 61 |
[Define if nl_langinfo exists but is overridden by gnulib.]) |
| 62 |
fi |
| 63 |
else |
| 64 |
HAVE_NL_LANGINFO=0 |
| 65 |
case "$gl_cv_onwards_func_nl_langinfo" in |
| 66 |
future*) REPLACE_NL_LANGINFO=1 ;; |
| 67 |
esac |
| 68 |
fi |
| 69 |
if test $HAVE_NL_LANGINFO = 0 || test $HAVE_LANGINFO_CODESET = 0; then |
| 70 |
LIB_NL_LANGINFO="$SETLOCALE_NULL_LIB" |
| 71 |
else |
| 72 |
LIB_NL_LANGINFO= |
| 73 |
fi |
| 74 |
dnl LIB_NL_LANGINFO is expected to be empty everywhere. |
| 75 |
AC_SUBST([LIB_NL_LANGINFO]) |
| 76 |
]) |
| 77 |
|
| 78 |
# Prerequisites of lib/nl_langinfo-lock.c. |
| 79 |
AC_DEFUN([gl_PREREQ_NL_LANGINFO_LOCK], |
| 80 |
[ |
| 81 |
gl_VISIBILITY |
| 82 |
]) |