immutable: Add tests.
[gnulib.git] / m4 / iconv_h.m4
blobab8e2837acfdae34fe8ee11cd86f5836049d5f3c
1 # iconv_h.m4 serial 12
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.
7 AC_DEFUN([gl_ICONV_H],
9   AC_REQUIRE([gl_ICONV_H_DEFAULTS])
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])
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])
21   AC_REQUIRE([AC_C_RESTRICT])
24 dnl Unconditionally enables the replacement of <iconv.h>.
25 AC_DEFUN([gl_REPLACE_ICONV_H],
27   AC_REQUIRE([gl_ICONV_H_DEFAULTS])
28   ICONV_H='iconv.h'
29   AM_CONDITIONAL([GL_GENERATE_ICONV_H], [test -n "$ICONV_H"])
32 AC_DEFUN([gl_ICONV_MODULE_INDICATOR],
34   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
35   AC_REQUIRE([gl_ICONV_H_DEFAULTS])
36   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
39 AC_DEFUN([gl_ICONV_H_DEFAULTS],
41   m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
42   GNULIB_ICONV=0;       AC_SUBST([GNULIB_ICONV])
43   dnl Assume proper GNU behavior unless another module says otherwise.
44   ICONV_CONST=;         AC_SUBST([ICONV_CONST])
45   REPLACE_ICONV=0;      AC_SUBST([REPLACE_ICONV])
46   REPLACE_ICONV_OPEN=0; AC_SUBST([REPLACE_ICONV_OPEN])
47   REPLACE_ICONV_UTF=0;  AC_SUBST([REPLACE_ICONV_UTF])
48   ICONV_H='';           AC_SUBST([ICONV_H])
49   m4_ifdef([gl_POSIXCHECK],
50     [ICONV_H='iconv.h'],
51     [if m4_ifdef([gl_ANSI_CXX], [test "$CXX" != no], [false]); then
52        dnl Override <fnmatch.h> always, to support the C++ GNULIB_NAMESPACE.
53        ICONV_H='iconv.h'
54      fi
55     ])
56   AM_CONDITIONAL([GL_GENERATE_ICONV_H], [test -n "$ICONV_H"])