iconv_open.m4 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # iconv_open.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([gl_FUNC_ICONV_OPEN],
  7. [
  8. AC_REQUIRE([AM_ICONV])
  9. AC_REQUIRE([AC_CANONICAL_HOST])
  10. AC_REQUIRE([gl_ICONV_H_DEFAULTS])
  11. if test "$am_cv_func_iconv" = yes; then
  12. dnl Provide the <iconv.h> override, for the sake of the C++ aliases.
  13. gl_REPLACE_ICONV_H
  14. dnl Test whether iconv_open accepts standardized encoding names.
  15. dnl We know that GNU libiconv and GNU libc do.
  16. AC_EGREP_CPP([gnu_iconv], [
  17. #include <iconv.h>
  18. #if defined _LIBICONV_VERSION || (defined __GLIBC__ && !defined __UCLIBC__)
  19. gnu_iconv
  20. #endif
  21. ], [gl_func_iconv_gnu=yes], [gl_func_iconv_gnu=no])
  22. if test $gl_func_iconv_gnu = no; then
  23. iconv_flavor=
  24. case "$host_os" in
  25. aix*) iconv_flavor=ICONV_FLAVOR_AIX ;;
  26. irix*) iconv_flavor=ICONV_FLAVOR_IRIX ;;
  27. hpux*) iconv_flavor=ICONV_FLAVOR_HPUX ;;
  28. osf*) iconv_flavor=ICONV_FLAVOR_OSF ;;
  29. solaris*) iconv_flavor=ICONV_FLAVOR_SOLARIS ;;
  30. openedition*) iconv_flavor=ICONV_FLAVOR_ZOS ;;
  31. esac
  32. if test -n "$iconv_flavor"; then
  33. AC_DEFINE_UNQUOTED([ICONV_FLAVOR], [$iconv_flavor],
  34. [Define to a symbolic name denoting the flavor of iconv_open()
  35. implementation.])
  36. gl_REPLACE_ICONV_OPEN
  37. fi
  38. fi
  39. m4_ifdef([gl_FUNC_ICONV_OPEN_UTF_SUPPORT], [
  40. gl_FUNC_ICONV_OPEN_UTF_SUPPORT
  41. case "$gl_cv_func_iconv_supports_utf" in
  42. *yes) ;;
  43. *)
  44. REPLACE_ICONV_UTF=1
  45. AC_DEFINE([REPLACE_ICONV_UTF], [1],
  46. [Define if the iconv() functions are enhanced to handle the UTF-{16,32}{BE,LE} encodings.])
  47. REPLACE_ICONV=1
  48. gl_REPLACE_ICONV_OPEN
  49. ;;
  50. esac
  51. ])
  52. fi
  53. ])
  54. AC_DEFUN([gl_REPLACE_ICONV_OPEN],
  55. [
  56. gl_REPLACE_ICONV_H
  57. REPLACE_ICONV_OPEN=1
  58. ])