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