aboutsummaryrefslogtreecommitdiff
path: root/m4/iconv.m4
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-06-17 07:40:35 +0000
committerChristian Grothoff <christian@grothoff.org>2010-06-17 07:40:35 +0000
commit59b43b4b7398858b220c55b1b38101428f8a2c0b (patch)
treeb823a3c787c452ba70124cfb219e9c1bf759c171 /m4/iconv.m4
parenta0677cf8ba5ccf83f2a01fa831415717b6b4c244 (diff)
downloadgnunet-gtk-59b43b4b7398858b220c55b1b38101428f8a2c0b.tar.gz
gnunet-gtk-59b43b4b7398858b220c55b1b38101428f8a2c0b.zip
importing 0.9.x gnunet-gtk branch
Diffstat (limited to 'm4/iconv.m4')
-rw-r--r--m4/iconv.m495
1 files changed, 86 insertions, 9 deletions
diff --git a/m4/iconv.m4 b/m4/iconv.m4
index c5f35798..66bc76f4 100644
--- a/m4/iconv.m4
+++ b/m4/iconv.m4
@@ -1,10 +1,8 @@
1# iconv.m4 serial AM4 (gettext-0.11.3) 1# iconv.m4 serial AM6 (gettext-0.17)
2dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. 2dnl Copyright (C) 2000-2002, 2007 Free Software Foundation, Inc.
3dnl This file is free software, distributed under the terms of the GNU 3dnl This file is free software; the Free Software Foundation
4dnl General Public License. As a special exception to the GNU General 4dnl gives unlimited permission to copy and/or distribute it,
5dnl Public License, this file may be distributed as part of a program 5dnl with or without modifications, as long as this notice is preserved.
6dnl that contains a configuration script generated by Autoconf, under
7dnl the same distribution terms as the rest of that program.
8 6
9dnl From Bruno Haible. 7dnl From Bruno Haible.
10 8
@@ -23,6 +21,7 @@ AC_DEFUN([AM_ICONV_LINK],
23[ 21[
24 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and 22 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
25 dnl those with the standalone portable GNU libiconv installed). 23 dnl those with the standalone portable GNU libiconv installed).
24 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
26 25
27 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV 26 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
28 dnl accordingly. 27 dnl accordingly.
@@ -35,7 +34,7 @@ AC_DEFUN([AM_ICONV_LINK],
35 am_save_CPPFLAGS="$CPPFLAGS" 34 am_save_CPPFLAGS="$CPPFLAGS"
36 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) 35 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
37 36
38 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ 37 AC_CACHE_CHECK([for iconv], am_cv_func_iconv, [
39 am_cv_func_iconv="no, consider installing GNU libiconv" 38 am_cv_func_iconv="no, consider installing GNU libiconv"
40 am_cv_lib_iconv=no 39 am_cv_lib_iconv=no
41 AC_TRY_LINK([#include <stdlib.h> 40 AC_TRY_LINK([#include <stdlib.h>
@@ -58,7 +57,85 @@ AC_DEFUN([AM_ICONV_LINK],
58 fi 57 fi
59 ]) 58 ])
60 if test "$am_cv_func_iconv" = yes; then 59 if test "$am_cv_func_iconv" = yes; then
61 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.
62 am_save_LIBS="$LIBS"
63 if test $am_cv_lib_iconv = yes; then
64 LIBS="$LIBS $LIBICONV"
65 fi
66 AC_TRY_RUN([
67#include <iconv.h>
68#include <string.h>
69int main ()
70{
71 /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
72 returns. */
73 {
74 iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
75 if (cd_utf8_to_88591 != (iconv_t)(-1))
76 {
77 static const char input[] = "\342\202\254"; /* EURO SIGN */
78 char buf[10];
79 const char *inptr = input;
80 size_t inbytesleft = strlen (input);
81 char *outptr = buf;
82 size_t outbytesleft = sizeof (buf);
83 size_t res = iconv (cd_utf8_to_88591,
84 (char **) &inptr, &inbytesleft,
85 &outptr, &outbytesleft);
86 if (res == 0)
87 return 1;
88 }
89 }
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. */
92 {
93 iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
94 if (cd_88591_to_utf8 != (iconv_t)(-1))
95 {
96 static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
97 char buf[50];
98 const char *inptr = input;
99 size_t inbytesleft = strlen (input);
100 char *outptr = buf;
101 size_t outbytesleft = sizeof (buf);
102 size_t res = iconv (cd_88591_to_utf8,
103 (char **) &inptr, &inbytesleft,
104 &outptr, &outbytesleft);
105 if ((int)res > 0)
106 return 1;
107 }
108 }
109#endif
110 /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
111 provided. */
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)
116 /* Try AIX names. */
117 && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
118 /* Try HP-UX names. */
119 && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
120 return 1;
121 return 0;
122}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no],
123 [case "$host_os" in
124 aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
125 *) am_cv_func_iconv_works="guessing yes" ;;
126 esac])
127 LIBS="$am_save_LIBS"
128 ])
129 case "$am_cv_func_iconv_works" in
130 *no) am_func_iconv=no am_cv_lib_iconv=no ;;
131 *) am_func_iconv=yes ;;
132 esac
133 else
134 am_func_iconv=no am_cv_lib_iconv=no
135 fi
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.])
62 fi 139 fi
63 if test "$am_cv_lib_iconv" = yes; then 140 if test "$am_cv_lib_iconv" = yes; then
64 AC_MSG_CHECKING([how to link with libiconv]) 141 AC_MSG_CHECKING([how to link with libiconv])