Debian Codegraph @

m4/nl_langinfo.m4

raw
1 # nl_langinfo.m4
2 # serial 12
3 dnl Copyright (C) 2009-2025 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_ABALTMON = 1 \
55 && test $HAVE_LANGINFO_ERA = 1 \
56 && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1 \
57 && test $NL_LANGINFO_MTSAFE = 1; then
58 :
59 else
60 REPLACE_NL_LANGINFO=1
61 AC_DEFINE([REPLACE_NL_LANGINFO], [1],
62 [Define if nl_langinfo exists but is overridden by gnulib.])
63 fi
64 else
65 HAVE_NL_LANGINFO=0
66 case "$gl_cv_onwards_func_nl_langinfo" in
67 future*) REPLACE_NL_LANGINFO=1 ;;
68 esac
69 fi
70 if test $HAVE_NL_LANGINFO = 0 || test $HAVE_LANGINFO_CODESET = 0; then
71 LIB_NL_LANGINFO="$SETLOCALE_NULL_LIB"
72 else
73 LIB_NL_LANGINFO=
74 fi
75 dnl LIB_NL_LANGINFO is expected to be empty everywhere.
76 AC_SUBST([LIB_NL_LANGINFO])
77 ])
78
79 # Prerequisites of lib/nl_langinfo-lock.c.
80 AC_DEFUN([gl_PREREQ_NL_LANGINFO_LOCK],
81 [
82 gl_VISIBILITY
83 ])