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