xstrtol, xstrtoll tests: Fix test failures.
[gnulib.git] / m4 / nl_langinfo.m4
blobf38f11bbd3c36d7eef8da1005fafc5b094a40f87
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.
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],
21       [AC_RUN_IFELSE(
22          [AC_LANG_PROGRAM([[#include <langinfo.h>
23 ]], [[return !*nl_langinfo(YESEXPR);
24 ]])],
25          [gl_cv_func_nl_langinfo_yesexpr_works=yes],
26          [gl_cv_func_nl_langinfo_yesexpr_works=no],
27          [
28          case "$host_os" in
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";;
33          esac
34          ])
35       ])
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 ;;
39     esac
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.
44     case "$host_os" in
45       solaris*) NL_LANGINFO_MTSAFE=0 ;;
46       *)        NL_LANGINFO_MTSAFE=1 ;;
47     esac
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
56       :
57     else
58       REPLACE_NL_LANGINFO=1
59       AC_DEFINE([REPLACE_NL_LANGINFO], [1],
60         [Define if nl_langinfo exists but is overridden by gnulib.])
61     fi
62   else
63     HAVE_NL_LANGINFO=0
64     case "$gl_cv_onwards_func_nl_langinfo" in
65       future*) REPLACE_NL_LANGINFO=1 ;;
66     esac
67   fi
68   if test $HAVE_NL_LANGINFO = 0 || test $HAVE_LANGINFO_CODESET = 0; then
69     LIB_NL_LANGINFO="$SETLOCALE_NULL_LIB"
70   else
71     LIB_NL_LANGINFO=
72   fi
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],
80   gl_VISIBILITY