1
# iconv.m4 serial AM4 (gettext-0.11.3)
2
dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
1
# iconv.m4 serial AM6 (gettext-0.17)
2
dnl Copyright (C) 2000-2002, 2007 Free Software Foundation, Inc.
3
3
dnl This file is free software; the Free Software Foundation
4
4
dnl gives unlimited permission to copy and/or distribute it,
5
5
dnl with or without modifications, as long as this notice is preserved.
33
34
am_save_CPPFLAGS="$CPPFLAGS"
34
35
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
36
AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
37
AC_CACHE_CHECK([for iconv], am_cv_func_iconv, [
37
38
am_cv_func_iconv="no, consider installing GNU libiconv"
39
40
AC_TRY_LINK([#include <stdlib.h>
58
59
if test "$am_cv_func_iconv" = yes; then
59
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
60
AC_CACHE_CHECK([for working iconv], am_cv_func_iconv_works, [
61
dnl This tests against bugs in AIX 5.1 and HP-UX 11.11.
63
if test $am_cv_lib_iconv = yes; then
64
LIBS="$LIBS $LIBICONV"
71
/* Test against AIX 5.1 bug: Failures are not distinguishable from successful
74
iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
75
if (cd_utf8_to_88591 != (iconv_t)(-1))
77
static const char input[] = "\342\202\254"; /* EURO SIGN */
79
const char *inptr = input;
80
size_t inbytesleft = strlen (input);
82
size_t outbytesleft = sizeof (buf);
83
size_t res = iconv (cd_utf8_to_88591,
84
(char **) &inptr, &inbytesleft,
85
&outptr, &outbytesleft);
90
#if 0 /* This bug could be worked around by the caller. */
91
/* Test against HP-UX 11.11 bug: Positive return value instead of 0. */
93
iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
94
if (cd_88591_to_utf8 != (iconv_t)(-1))
96
static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
98
const char *inptr = input;
99
size_t inbytesleft = strlen (input);
101
size_t outbytesleft = sizeof (buf);
102
size_t res = iconv (cd_88591_to_utf8,
103
(char **) &inptr, &inbytesleft,
104
&outptr, &outbytesleft);
110
/* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
112
if (/* Try standardized names. */
113
iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
114
/* Try IRIX, OSF/1 names. */
115
&& iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
117
&& iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
118
/* Try HP-UX names. */
119
&& iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
122
}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no],
124
aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
125
*) am_cv_func_iconv_works="guessing yes" ;;
129
case "$am_cv_func_iconv_works" in
130
*no) am_func_iconv=no am_cv_lib_iconv=no ;;
131
*) am_func_iconv=yes ;;
134
am_func_iconv=no am_cv_lib_iconv=no
136
if test "$am_func_iconv" = yes; then
137
AC_DEFINE(HAVE_ICONV, 1,
138
[Define if you have the iconv() function and it works.])
61
140
if test "$am_cv_lib_iconv" = yes; then
62
141
AC_MSG_CHECKING([how to link with libiconv])