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