Blame m4/iconv_open.m4

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