immutable: Add tests.
[gnulib.git] / m4 / monetary_h.m4
blob5afa1f629027aaad1565938ad60d676b6791f6df
1 # monetary_h.m4 serial 5
2 dnl Copyright (C) 2017-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.
7 AC_DEFUN_ONCE([gl_MONETARY_H],
9   AC_REQUIRE([gl_MONETARY_H_DEFAULTS])
10   m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
12   AC_CHECK_HEADERS_ONCE([monetary.h])
13   dnl For now, we provide a <monetary.h> wrapper only if
14   dnl - module 'posixcheck' is present, or
15   dnl - C++ GNULIB_NAMESPACE support may be requested, or
16   dnl - the system already has a <monetary.h>.
17   if m4_ifdef([gl_POSIXCHECK], [true], [m4_ifdef([gl_ANSI_CXX], [test "$CXX" != no], [false]) || test $ac_cv_header_monetary_h = yes]); then
18     MONETARY_H='monetary.h'
20     gl_CHECK_NEXT_HEADERS([monetary.h])
21     if test $ac_cv_header_monetary_h = yes; then
22       HAVE_MONETARY_H=1
23     else
24       HAVE_MONETARY_H=0
25     fi
26     AC_SUBST([HAVE_MONETARY_H])
28     AC_CHECK_HEADERS_ONCE([xlocale.h])
29     if test $ac_cv_header_xlocale_h = yes; then
30       HAVE_XLOCALE_H=1
31     else
32       HAVE_XLOCALE_H=0
33     fi
34     AC_SUBST([HAVE_XLOCALE_H])
36     dnl Check for declarations of anything we want to poison if the
37     dnl corresponding gnulib module is not in use.
38     gl_WARN_ON_USE_PREPARE([[
39       #include <monetary.h>
40       ]], [strfmon_l])
42     AC_REQUIRE([AC_C_RESTRICT])
43   else
44     MONETARY_H=''
45   fi
46   AC_SUBST([MONETARY_H])
47   AM_CONDITIONAL([GL_GENERATE_MONETARY_H], [test -n "$MONETARY_H"])
50 AC_DEFUN([gl_MONETARY_MODULE_INDICATOR],
52   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
53   AC_REQUIRE([gl_MONETARY_H_DEFAULTS])
54   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
57 AC_DEFUN([gl_MONETARY_H_DEFAULTS],
59   GNULIB_STRFMON_L=0;      AC_SUBST([GNULIB_STRFMON_L])
60   dnl Assume proper GNU behavior unless another module says otherwise.
61   HAVE_STRFMON_L=1;        AC_SUBST([HAVE_STRFMON_L])
62   REPLACE_STRFMON_L=0;     AC_SUBST([REPLACE_STRFMON_L])