Bump to m4 1.4.19
[platform/upstream/m4.git] / m4 / iconv_h.m4
1 # iconv_h.m4 serial 15
2 dnl Copyright (C) 2007-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_ONCE([gl_ICONV_H],
8 [
9   AC_REQUIRE([gl_ICONV_H_DEFAULTS])
10
11   dnl Execute this unconditionally, because ICONV_H may be set by other
12   dnl modules, after this code is executed.
13   gl_CHECK_NEXT_HEADERS([iconv.h])
14
15   dnl Check for declarations of anything we want to poison if the
16   dnl corresponding gnulib module is not in use, and which is not
17   dnl guaranteed by C89.
18   gl_WARN_ON_USE_PREPARE([[#include <iconv.h>
19     ]], [iconv iconv_open])
20
21   AC_REQUIRE([AC_C_RESTRICT])
22 ])
23
24 dnl Unconditionally enables the replacement of <iconv.h>.
25 AC_DEFUN([gl_REPLACE_ICONV_H],
26 [
27   gl_ICONV_H_REQUIRE_DEFAULTS
28   ICONV_H='iconv.h'
29   AM_CONDITIONAL([GL_GENERATE_ICONV_H], [test -n "$ICONV_H"])
30 ])
31
32 # gl_ICONV_MODULE_INDICATOR([modulename])
33 # sets the shell variable that indicates the presence of the given module
34 # to a C preprocessor expression that will evaluate to 1.
35 # This macro invocation must not occur in macros that are AC_REQUIREd.
36 AC_DEFUN([gl_ICONV_MODULE_INDICATOR],
37 [
38   dnl Ensure to expand the default settings once only.
39   gl_ICONV_H_REQUIRE_DEFAULTS
40   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
41 ])
42
43 # Initializes the default values for AC_SUBSTed shell variables.
44 # This macro must not be AC_REQUIREd.  It must only be invoked, and only
45 # outside of macros or in macros that are not AC_REQUIREd.
46 AC_DEFUN([gl_ICONV_H_REQUIRE_DEFAULTS],
47 [
48   m4_defun(GL_MODULE_INDICATOR_PREFIX[_ICONV_H_MODULE_INDICATOR_DEFAULTS], [
49     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ICONV])
50   ])
51   m4_require(GL_MODULE_INDICATOR_PREFIX[_ICONV_H_MODULE_INDICATOR_DEFAULTS])
52   AC_REQUIRE([gl_ICONV_H_DEFAULTS])
53 ])
54
55 AC_DEFUN([gl_ICONV_H_DEFAULTS],
56 [
57   m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
58   dnl Assume proper GNU behavior unless another module says otherwise.
59   ICONV_CONST=;         AC_SUBST([ICONV_CONST])
60   REPLACE_ICONV=0;      AC_SUBST([REPLACE_ICONV])
61   REPLACE_ICONV_OPEN=0; AC_SUBST([REPLACE_ICONV_OPEN])
62   REPLACE_ICONV_UTF=0;  AC_SUBST([REPLACE_ICONV_UTF])
63   ICONV_H='';           AC_SUBST([ICONV_H])
64   m4_ifdef([gl_POSIXCHECK],
65     [ICONV_H='iconv.h'],
66     [if m4_ifdef([gl_ANSI_CXX], [test "$CXX" != no], [false]); then
67        dnl Override <fnmatch.h> always, to support the C++ GNULIB_NAMESPACE.
68        ICONV_H='iconv.h'
69      fi
70     ])
71   AM_CONDITIONAL([GL_GENERATE_ICONV_H], [test -n "$ICONV_H"])
72 ])