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.
8 AC_DEFUN([gl_FUNC_NL_LANGINFO],
10 AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
11 AC_REQUIRE([gl_LANGINFO_H])
12 gl_CHECK_FUNCS_ANDROID([nl_langinfo], [[#include <langinfo.h>]])
13 AC_REQUIRE([AC_CANONICAL_HOST])
14 AC_REQUIRE([gl_FUNC_SETLOCALE_NULL])
15 AC_REQUIRE([gl_PTHREADLIB])
16 AC_CHECK_HEADERS_ONCE([threads.h])
17 if test $ac_cv_func_nl_langinfo = yes; then
18 # On Irix 6.5, YESEXPR is defined, but nl_langinfo(YESEXPR) is broken.
19 AC_CACHE_CHECK([whether YESEXPR works],
20 [gl_cv_func_nl_langinfo_yesexpr_works],
22 [AC_LANG_PROGRAM([[#include <langinfo.h>
23 ]], [[return !*nl_langinfo(YESEXPR);
25 [gl_cv_func_nl_langinfo_yesexpr_works=yes],
26 [gl_cv_func_nl_langinfo_yesexpr_works=no],
29 # Guess no on irix systems.
30 irix*) gl_cv_func_nl_langinfo_yesexpr_works="guessing no";;
31 # Guess yes elsewhere.
32 *) gl_cv_func_nl_langinfo_yesexpr_works="guessing yes";;
36 case $gl_cv_func_nl_langinfo_yesexpr_works in
37 *yes) FUNC_NL_LANGINFO_YESEXPR_WORKS=1 ;;
38 *) FUNC_NL_LANGINFO_YESEXPR_WORKS=0 ;;
40 AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS],
41 [$FUNC_NL_LANGINFO_YESEXPR_WORKS],
42 [Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string.])
43 # On Solaris 10 and Solaris 11.3, nl_langinfo is not multithread-safe.
45 solaris*) NL_LANGINFO_MTSAFE=0 ;;
46 *) NL_LANGINFO_MTSAFE=1 ;;
48 AC_DEFINE_UNQUOTED([NL_LANGINFO_MTSAFE], [$NL_LANGINFO_MTSAFE],
49 [Define to 1 if nl_langinfo is multithread-safe.])
50 if test $HAVE_LANGINFO_CODESET = 1 \
51 && test $HAVE_LANGINFO_T_FMT_AMPM = 1 \
52 && test $HAVE_LANGINFO_ALTMON = 1 \
53 && test $HAVE_LANGINFO_ERA = 1 \
54 && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1 \
55 && test $NL_LANGINFO_MTSAFE = 1; then
59 AC_DEFINE([REPLACE_NL_LANGINFO], [1],
60 [Define if nl_langinfo exists but is overridden by gnulib.])
64 case "$gl_cv_onwards_func_nl_langinfo" in
65 future*) REPLACE_NL_LANGINFO=1 ;;
68 if test $HAVE_NL_LANGINFO = 0 || test $HAVE_LANGINFO_CODESET = 0; then
69 LIB_NL_LANGINFO="$SETLOCALE_NULL_LIB"
73 dnl LIB_NL_LANGINFO is expected to be empty everywhere.
74 AC_SUBST([LIB_NL_LANGINFO])
77 # Prerequisites of lib/nl_langinfo-lock.c.
78 AC_DEFUN([gl_PREREQ_NL_LANGINFO_LOCK],