Mercurial > libpst
annotate m4/iconv.m4 @ 345:a8577226f7a9
fixes from AJ Shankar for attachment processing and body encodings that contain embedded null chars
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 09 Mar 2015 10:47:58 -0700 |
parents | 0b1766da9be8 |
children |
rev | line source |
---|---|
153
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
1 # iconv.m4 serial AM7 (gettext-0.18) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
2 dnl Copyright (C) 2000-2002, 2007-2009 Free Software Foundation, Inc. |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
3 dnl This file is free software; the Free Software Foundation |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
4 dnl gives unlimited permission to copy and/or distribute it, |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
5 dnl with or without modifications, as long as this notice is preserved. |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
6 |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
7 dnl From Bruno Haible. |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
8 |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
9 AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
10 [ |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
11 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
12 AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
13 AC_REQUIRE([AC_LIB_RPATH]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
14 |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
15 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
16 dnl accordingly. |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
17 AC_LIB_LINKFLAGS_BODY([iconv]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
18 ]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
19 |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
20 AC_DEFUN([AM_ICONV_LINK], |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
21 [ |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
22 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
23 dnl those with the standalone portable GNU libiconv installed). |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
24 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
25 |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
26 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
27 dnl accordingly. |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
28 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
29 |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
30 dnl Add $INCICONV to CPPFLAGS before performing the following checks, |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
31 dnl because if the user has installed libiconv and not disabled its use |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
32 dnl via --without-libiconv-prefix, he wants to use it. The first |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
33 dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
34 am_save_CPPFLAGS="$CPPFLAGS" |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
35 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
36 |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
37 AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [ |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
38 am_cv_func_iconv="no, consider installing GNU libiconv" |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
39 am_cv_lib_iconv=no |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
40 AC_TRY_LINK([#include <stdlib.h> |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
41 #include <iconv.h>], |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
42 [iconv_t cd = iconv_open("",""); |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
43 iconv(cd,NULL,NULL,NULL,NULL); |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
44 iconv_close(cd);], |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
45 [am_cv_func_iconv=yes]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
46 if test "$am_cv_func_iconv" != yes; then |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
47 am_save_LIBS="$LIBS" |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
48 LIBS="$LIBS $LIBICONV" |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
49 AC_TRY_LINK([#include <stdlib.h> |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
50 #include <iconv.h>], |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
51 [iconv_t cd = iconv_open("",""); |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
52 iconv(cd,NULL,NULL,NULL,NULL); |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
53 iconv_close(cd);], |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
54 [am_cv_lib_iconv=yes] |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
55 [am_cv_func_iconv=yes]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
56 LIBS="$am_save_LIBS" |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
57 fi |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
58 ]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
59 if test "$am_cv_func_iconv" = yes; then |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
60 AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
61 dnl This tests against bugs in AIX 5.1 and HP-UX 11.11. |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
62 am_save_LIBS="$LIBS" |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
63 if test $am_cv_lib_iconv = yes; then |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
64 LIBS="$LIBS $LIBICONV" |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
65 fi |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
66 AC_TRY_RUN([ |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
67 #include <iconv.h> |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
68 #include <string.h> |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
69 int main () |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
70 { |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
71 /* Test against AIX 5.1 bug: Failures are not distinguishable from successful |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
72 returns. */ |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
73 { |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
74 iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
75 if (cd_utf8_to_88591 != (iconv_t)(-1)) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
76 { |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
77 static const char input[] = "\342\202\254"; /* EURO SIGN */ |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
78 char buf[10]; |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
79 const char *inptr = input; |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
80 size_t inbytesleft = strlen (input); |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
81 char *outptr = buf; |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
82 size_t outbytesleft = sizeof (buf); |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
83 size_t res = iconv (cd_utf8_to_88591, |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
84 (char **) &inptr, &inbytesleft, |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
85 &outptr, &outbytesleft); |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
86 if (res == 0) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
87 return 1; |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
88 } |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
89 } |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
90 #if 0 /* This bug could be worked around by the caller. */ |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
91 /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
92 { |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
93 iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
94 if (cd_88591_to_utf8 != (iconv_t)(-1)) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
95 { |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
96 static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
97 char buf[50]; |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
98 const char *inptr = input; |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
99 size_t inbytesleft = strlen (input); |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
100 char *outptr = buf; |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
101 size_t outbytesleft = sizeof (buf); |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
102 size_t res = iconv (cd_88591_to_utf8, |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
103 (char **) &inptr, &inbytesleft, |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
104 &outptr, &outbytesleft); |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
105 if ((int)res > 0) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
106 return 1; |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
107 } |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
108 } |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
109 #endif |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
110 /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
111 provided. */ |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
112 if (/* Try standardized names. */ |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
113 iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
114 /* Try IRIX, OSF/1 names. */ |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
115 && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
116 /* Try AIX names. */ |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
117 && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
118 /* Try HP-UX names. */ |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
119 && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
120 return 1; |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
121 return 0; |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
122 }], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no], |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
123 [case "$host_os" in |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
124 aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
125 *) am_cv_func_iconv_works="guessing yes" ;; |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
126 esac]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
127 LIBS="$am_save_LIBS" |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
128 ]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
129 case "$am_cv_func_iconv_works" in |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
130 *no) am_func_iconv=no am_cv_lib_iconv=no ;; |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
131 *) am_func_iconv=yes ;; |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
132 esac |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
133 else |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
134 am_func_iconv=no am_cv_lib_iconv=no |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
135 fi |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
136 if test "$am_func_iconv" = yes; then |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
137 AC_DEFINE([HAVE_ICONV], [1], |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
138 [Define if you have the iconv() function and it works.]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
139 fi |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
140 if test "$am_cv_lib_iconv" = yes; then |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
141 AC_MSG_CHECKING([how to link with libiconv]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
142 AC_MSG_RESULT([$LIBICONV]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
143 else |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
144 dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
145 dnl either. |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
146 CPPFLAGS="$am_save_CPPFLAGS" |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
147 LIBICONV= |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
148 LTLIBICONV= |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
149 fi |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
150 AC_SUBST([LIBICONV]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
151 AC_SUBST([LTLIBICONV]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
152 ]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
153 |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
154 AC_DEFUN([AM_ICONV], |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
155 [ |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
156 AM_ICONV_LINK |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
157 if test "$am_cv_func_iconv" = yes; then |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
158 AC_MSG_CHECKING([for iconv declaration]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
159 AC_CACHE_VAL([am_cv_proto_iconv], [ |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
160 AC_TRY_COMPILE([ |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
161 #include <stdlib.h> |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
162 #include <iconv.h> |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
163 extern |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
164 #ifdef __cplusplus |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
165 "C" |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
166 #endif |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
167 #if defined(__STDC__) || defined(__cplusplus) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
168 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
169 #else |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
170 size_t iconv(); |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
171 #endif |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
172 ], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
173 am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
174 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
175 AC_MSG_RESULT([${ac_t:- |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
176 }$am_cv_proto_iconv]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
177 AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
178 [Define as const if the declaration of iconv() needs const.]) |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
179 fi |
0b1766da9be8
use AM_ICONV for better portability of the library location.
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
180 ]) |