Blame m4/iconv_open.m4

Packit 8f70b4
# iconv_open.m4 serial 14
Packit 8f70b4
dnl Copyright (C) 2007-2018 Free Software Foundation, Inc.
Packit 8f70b4
dnl This file is free software; the Free Software Foundation
Packit 8f70b4
dnl gives unlimited permission to copy and/or distribute it,
Packit 8f70b4
dnl with or without modifications, as long as this notice is preserved.
Packit 8f70b4
Packit 8f70b4
AC_DEFUN([gl_FUNC_ICONV_OPEN],
Packit 8f70b4
[
Packit 8f70b4
  AC_REQUIRE([AM_ICONV])
Packit 8f70b4
  AC_REQUIRE([AC_CANONICAL_HOST])
Packit 8f70b4
  AC_REQUIRE([gl_ICONV_H_DEFAULTS])
Packit 8f70b4
  if test "$am_cv_func_iconv" = yes; then
Packit 8f70b4
    dnl Provide the <iconv.h> override, for the sake of the C++ aliases.
Packit 8f70b4
    gl_REPLACE_ICONV_H
Packit 8f70b4
    dnl Test whether iconv_open accepts standardized encoding names.
Packit 8f70b4
    dnl We know that GNU libiconv and GNU libc do.
Packit 8f70b4
    AC_EGREP_CPP([gnu_iconv], [
Packit 8f70b4
      #include <iconv.h>
Packit 8f70b4
      #if defined _LIBICONV_VERSION || (defined __GLIBC__ && !defined __UCLIBC__)
Packit 8f70b4
       gnu_iconv
Packit 8f70b4
      #endif
Packit 8f70b4
      ], [gl_func_iconv_gnu=yes], [gl_func_iconv_gnu=no])
Packit 8f70b4
    if test $gl_func_iconv_gnu = no; then
Packit 8f70b4
      iconv_flavor=
Packit 8f70b4
      case "$host_os" in
Packit 8f70b4
        aix*)     iconv_flavor=ICONV_FLAVOR_AIX ;;
Packit 8f70b4
        irix*)    iconv_flavor=ICONV_FLAVOR_IRIX ;;
Packit 8f70b4
        hpux*)    iconv_flavor=ICONV_FLAVOR_HPUX ;;
Packit 8f70b4
        osf*)     iconv_flavor=ICONV_FLAVOR_OSF ;;
Packit 8f70b4
        solaris*) iconv_flavor=ICONV_FLAVOR_SOLARIS ;;
Packit 8f70b4
      esac
Packit 8f70b4
      if test -n "$iconv_flavor"; then
Packit 8f70b4
        AC_DEFINE_UNQUOTED([ICONV_FLAVOR], [$iconv_flavor],
Packit 8f70b4
          [Define to a symbolic name denoting the flavor of iconv_open()
Packit 8f70b4
           implementation.])
Packit 8f70b4
        gl_REPLACE_ICONV_OPEN
Packit 8f70b4
      fi
Packit 8f70b4
    fi
Packit 8f70b4
    m4_ifdef([gl_FUNC_ICONV_OPEN_UTF_SUPPORT], [
Packit 8f70b4
      gl_FUNC_ICONV_OPEN_UTF_SUPPORT
Packit 8f70b4
      if test $gl_cv_func_iconv_supports_utf = no; then
Packit 8f70b4
        REPLACE_ICONV_UTF=1
Packit 8f70b4
        AC_DEFINE([REPLACE_ICONV_UTF], [1],
Packit 8f70b4
          [Define if the iconv() functions are enhanced to handle the UTF-{16,32}{BE,LE} encodings.])
Packit 8f70b4
        REPLACE_ICONV=1
Packit 8f70b4
        gl_REPLACE_ICONV_OPEN
Packit 8f70b4
      fi
Packit 8f70b4
    ])
Packit 8f70b4
  fi
Packit 8f70b4
])
Packit 8f70b4
Packit 8f70b4
AC_DEFUN([gl_REPLACE_ICONV_OPEN],
Packit 8f70b4
[
Packit 8f70b4
  gl_REPLACE_ICONV_H
Packit 8f70b4
  REPLACE_ICONV_OPEN=1
Packit 8f70b4
])