iconv_h.m4 2.4 KB

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