Mercurial > hg > octave-jordi > gnulib-hg
annotate m4/iconv.m4 @ 15426:60c6b6da0198
ffs: avoid undefined behavior
* lib/ffs.c (ffs): Provide fallback for non-32-bit int.
* tests/test-ffs.c (naive, main): Avoid signed shifts.
Reported by Bruno Haible.
Signed-off-by: Eric Blake <eblake@redhat.com>
author | Eric Blake <eblake@redhat.com> |
---|---|
date | Fri, 15 Jul 2011 14:26:43 -0600 |
parents | 97fc9a21a8fb |
children | e36ea7b17143 |
rev | line source |
---|---|
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13898
diff
changeset
|
1 # iconv.m4 serial 17 (gettext-0.18.2) |
14079
97fc9a21a8fb
maint: update almost all copyright ranges to include 2011
Jim Meyering <meyering@redhat.com>
parents:
13918
diff
changeset
|
2 dnl Copyright (C) 2000-2002, 2007-2011 Free Software Foundation, Inc. |
5585
adff74659d81
Use an all-permissive copyright notice, recommended by RMS.
Bruno Haible <bruno@clisp.org>
parents:
4536
diff
changeset
|
3 dnl This file is free software; the Free Software Foundation |
adff74659d81
Use an all-permissive copyright notice, recommended by RMS.
Bruno Haible <bruno@clisp.org>
parents:
4536
diff
changeset
|
4 dnl gives unlimited permission to copy and/or distribute it, |
adff74659d81
Use an all-permissive copyright notice, recommended by RMS.
Bruno Haible <bruno@clisp.org>
parents:
4536
diff
changeset
|
5 dnl with or without modifications, as long as this notice is preserved. |
4107
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6 |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
7 dnl From Bruno Haible. |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8 |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
9 AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
10 [ |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
11 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
12 AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
13 AC_REQUIRE([AC_LIB_RPATH]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
14 |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
15 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
16 dnl accordingly. |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
17 AC_LIB_LINKFLAGS_BODY([iconv]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
18 ]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
19 |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
20 AC_DEFUN([AM_ICONV_LINK], |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
21 [ |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
22 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
23 dnl those with the standalone portable GNU libiconv installed). |
8591
5cba81876885
Detect broken AIX iconv() function.
Bruno Haible <bruno@clisp.org>
parents:
5585
diff
changeset
|
24 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
4107
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
25 |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
26 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
27 dnl accordingly. |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
28 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
29 |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
30 dnl Add $INCICONV to CPPFLAGS before performing the following checks, |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
31 dnl because if the user has installed libiconv and not disabled its use |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
32 dnl via --without-libiconv-prefix, he wants to use it. The first |
13578
1e26f884665f
Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents:
13577
diff
changeset
|
33 dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed. |
4107
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
34 am_save_CPPFLAGS="$CPPFLAGS" |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
35 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
36 |
10979
03e819eea554
More systematic m4 argument quoting.
Bruno Haible <bruno@clisp.org>
parents:
9457
diff
changeset
|
37 AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [ |
4107
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
38 am_cv_func_iconv="no, consider installing GNU libiconv" |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
39 am_cv_lib_iconv=no |
13578
1e26f884665f
Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents:
13577
diff
changeset
|
40 AC_LINK_IFELSE( |
1e26f884665f
Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents:
13577
diff
changeset
|
41 [AC_LANG_PROGRAM( |
1e26f884665f
Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents:
13577
diff
changeset
|
42 [[ |
1e26f884665f
Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents:
13577
diff
changeset
|
43 #include <stdlib.h> |
1e26f884665f
Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents:
13577
diff
changeset
|
44 #include <iconv.h> |
1e26f884665f
Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents:
13577
diff
changeset
|
45 ]], |
1e26f884665f
Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents:
13577
diff
changeset
|
46 [[iconv_t cd = iconv_open("",""); |
1e26f884665f
Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents:
13577
diff
changeset
|
47 iconv(cd,NULL,NULL,NULL,NULL); |
1e26f884665f
Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents:
13577
diff
changeset
|
48 iconv_close(cd);]])], |
10979
03e819eea554
More systematic m4 argument quoting.
Bruno Haible <bruno@clisp.org>
parents:
9457
diff
changeset
|
49 [am_cv_func_iconv=yes]) |
4107
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
50 if test "$am_cv_func_iconv" != yes; then |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
51 am_save_LIBS="$LIBS" |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
52 LIBS="$LIBS $LIBICONV" |
13578
1e26f884665f
Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents:
13577
diff
changeset
|
53 AC_LINK_IFELSE( |
1e26f884665f
Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents:
13577
diff
changeset
|
54 [AC_LANG_PROGRAM( |
1e26f884665f
Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents:
13577
diff
changeset
|
55 [[ |
1e26f884665f
Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents:
13577
diff
changeset
|
56 #include <stdlib.h> |
1e26f884665f
Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents:
13577
diff
changeset
|
57 #include <iconv.h> |
1e26f884665f
Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents:
13577
diff
changeset
|
58 ]], |
1e26f884665f
Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents:
13577
diff
changeset
|
59 [[iconv_t cd = iconv_open("",""); |
1e26f884665f
Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents:
13577
diff
changeset
|
60 iconv(cd,NULL,NULL,NULL,NULL); |
1e26f884665f
Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents:
13577
diff
changeset
|
61 iconv_close(cd);]])], |
10979
03e819eea554
More systematic m4 argument quoting.
Bruno Haible <bruno@clisp.org>
parents:
9457
diff
changeset
|
62 [am_cv_lib_iconv=yes] |
03e819eea554
More systematic m4 argument quoting.
Bruno Haible <bruno@clisp.org>
parents:
9457
diff
changeset
|
63 [am_cv_func_iconv=yes]) |
4107
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
64 LIBS="$am_save_LIBS" |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
65 fi |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
66 ]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
67 if test "$am_cv_func_iconv" = yes; then |
10979
03e819eea554
More systematic m4 argument quoting.
Bruno Haible <bruno@clisp.org>
parents:
9457
diff
changeset
|
68 AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ |
13512
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
69 dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11, |
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
70 dnl Solaris 10. |
8591
5cba81876885
Detect broken AIX iconv() function.
Bruno Haible <bruno@clisp.org>
parents:
5585
diff
changeset
|
71 am_save_LIBS="$LIBS" |
5cba81876885
Detect broken AIX iconv() function.
Bruno Haible <bruno@clisp.org>
parents:
5585
diff
changeset
|
72 if test $am_cv_lib_iconv = yes; then |
5cba81876885
Detect broken AIX iconv() function.
Bruno Haible <bruno@clisp.org>
parents:
5585
diff
changeset
|
73 LIBS="$LIBS $LIBICONV" |
5cba81876885
Detect broken AIX iconv() function.
Bruno Haible <bruno@clisp.org>
parents:
5585
diff
changeset
|
74 fi |
13579
da9779900713
Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents:
13578
diff
changeset
|
75 AC_RUN_IFELSE( |
da9779900713
Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents:
13578
diff
changeset
|
76 [AC_LANG_SOURCE([[ |
8599
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
77 #include <iconv.h> |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
78 #include <string.h> |
8591
5cba81876885
Detect broken AIX iconv() function.
Bruno Haible <bruno@clisp.org>
parents:
5585
diff
changeset
|
79 int main () |
5cba81876885
Detect broken AIX iconv() function.
Bruno Haible <bruno@clisp.org>
parents:
5585
diff
changeset
|
80 { |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13898
diff
changeset
|
81 int result = 0; |
8599
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
82 /* Test against AIX 5.1 bug: Failures are not distinguishable from successful |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
83 returns. */ |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
84 { |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
85 iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
86 if (cd_utf8_to_88591 != (iconv_t)(-1)) |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
87 { |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
88 static const char input[] = "\342\202\254"; /* EURO SIGN */ |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
89 char buf[10]; |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
90 const char *inptr = input; |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
91 size_t inbytesleft = strlen (input); |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
92 char *outptr = buf; |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
93 size_t outbytesleft = sizeof (buf); |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
94 size_t res = iconv (cd_utf8_to_88591, |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
95 (char **) &inptr, &inbytesleft, |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
96 &outptr, &outbytesleft); |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
97 if (res == 0) |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13898
diff
changeset
|
98 result |= 1; |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13898
diff
changeset
|
99 iconv_close (cd_utf8_to_88591); |
8599
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
100 } |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
101 } |
12551
a46bd192256f
iconv: Reject native Solaris iconv.
Bruno Haible <bruno@clisp.org>
parents:
11770
diff
changeset
|
102 /* Test against Solaris 10 bug: Failures are not distinguishable from |
a46bd192256f
iconv: Reject native Solaris iconv.
Bruno Haible <bruno@clisp.org>
parents:
11770
diff
changeset
|
103 successful returns. */ |
a46bd192256f
iconv: Reject native Solaris iconv.
Bruno Haible <bruno@clisp.org>
parents:
11770
diff
changeset
|
104 { |
a46bd192256f
iconv: Reject native Solaris iconv.
Bruno Haible <bruno@clisp.org>
parents:
11770
diff
changeset
|
105 iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); |
a46bd192256f
iconv: Reject native Solaris iconv.
Bruno Haible <bruno@clisp.org>
parents:
11770
diff
changeset
|
106 if (cd_ascii_to_88591 != (iconv_t)(-1)) |
a46bd192256f
iconv: Reject native Solaris iconv.
Bruno Haible <bruno@clisp.org>
parents:
11770
diff
changeset
|
107 { |
a46bd192256f
iconv: Reject native Solaris iconv.
Bruno Haible <bruno@clisp.org>
parents:
11770
diff
changeset
|
108 static const char input[] = "\263"; |
a46bd192256f
iconv: Reject native Solaris iconv.
Bruno Haible <bruno@clisp.org>
parents:
11770
diff
changeset
|
109 char buf[10]; |
a46bd192256f
iconv: Reject native Solaris iconv.
Bruno Haible <bruno@clisp.org>
parents:
11770
diff
changeset
|
110 const char *inptr = input; |
a46bd192256f
iconv: Reject native Solaris iconv.
Bruno Haible <bruno@clisp.org>
parents:
11770
diff
changeset
|
111 size_t inbytesleft = strlen (input); |
a46bd192256f
iconv: Reject native Solaris iconv.
Bruno Haible <bruno@clisp.org>
parents:
11770
diff
changeset
|
112 char *outptr = buf; |
a46bd192256f
iconv: Reject native Solaris iconv.
Bruno Haible <bruno@clisp.org>
parents:
11770
diff
changeset
|
113 size_t outbytesleft = sizeof (buf); |
a46bd192256f
iconv: Reject native Solaris iconv.
Bruno Haible <bruno@clisp.org>
parents:
11770
diff
changeset
|
114 size_t res = iconv (cd_ascii_to_88591, |
a46bd192256f
iconv: Reject native Solaris iconv.
Bruno Haible <bruno@clisp.org>
parents:
11770
diff
changeset
|
115 (char **) &inptr, &inbytesleft, |
a46bd192256f
iconv: Reject native Solaris iconv.
Bruno Haible <bruno@clisp.org>
parents:
11770
diff
changeset
|
116 &outptr, &outbytesleft); |
a46bd192256f
iconv: Reject native Solaris iconv.
Bruno Haible <bruno@clisp.org>
parents:
11770
diff
changeset
|
117 if (res == 0) |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13898
diff
changeset
|
118 result |= 2; |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13898
diff
changeset
|
119 iconv_close (cd_ascii_to_88591); |
12551
a46bd192256f
iconv: Reject native Solaris iconv.
Bruno Haible <bruno@clisp.org>
parents:
11770
diff
changeset
|
120 } |
a46bd192256f
iconv: Reject native Solaris iconv.
Bruno Haible <bruno@clisp.org>
parents:
11770
diff
changeset
|
121 } |
13512
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
122 /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ |
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
123 { |
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
124 iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); |
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
125 if (cd_88591_to_utf8 != (iconv_t)(-1)) |
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
126 { |
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
127 static const char input[] = "\304"; |
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
128 static char buf[2] = { (char)0xDE, (char)0xAD }; |
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
129 const char *inptr = input; |
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
130 size_t inbytesleft = 1; |
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
131 char *outptr = buf; |
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
132 size_t outbytesleft = 1; |
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
133 size_t res = iconv (cd_88591_to_utf8, |
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
134 (char **) &inptr, &inbytesleft, |
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
135 &outptr, &outbytesleft); |
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
136 if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13898
diff
changeset
|
137 result |= 4; |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13898
diff
changeset
|
138 iconv_close (cd_88591_to_utf8); |
13512
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
139 } |
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
140 } |
8599
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
141 #if 0 /* This bug could be worked around by the caller. */ |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
142 /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
143 { |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
144 iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
145 if (cd_88591_to_utf8 != (iconv_t)(-1)) |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
146 { |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
147 static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
148 char buf[50]; |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
149 const char *inptr = input; |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
150 size_t inbytesleft = strlen (input); |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
151 char *outptr = buf; |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
152 size_t outbytesleft = sizeof (buf); |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
153 size_t res = iconv (cd_88591_to_utf8, |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
154 (char **) &inptr, &inbytesleft, |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
155 &outptr, &outbytesleft); |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
156 if ((int)res > 0) |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13898
diff
changeset
|
157 result |= 8; |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13898
diff
changeset
|
158 iconv_close (cd_88591_to_utf8); |
8599
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
159 } |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
160 } |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
161 #endif |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
162 /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
163 provided. */ |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
164 if (/* Try standardized names. */ |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
165 iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
166 /* Try IRIX, OSF/1 names. */ |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
167 && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
168 /* Try AIX names. */ |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
169 && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
170 /* Try HP-UX names. */ |
1ef5d8ed2636
Check against unusable HP-UX iconv.
Bruno Haible <bruno@clisp.org>
parents:
8591
diff
changeset
|
171 && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13898
diff
changeset
|
172 result |= 16; |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13898
diff
changeset
|
173 return result; |
13579
da9779900713
Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents:
13578
diff
changeset
|
174 }]])], |
da9779900713
Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents:
13578
diff
changeset
|
175 [am_cv_func_iconv_works=yes], |
da9779900713
Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents:
13578
diff
changeset
|
176 [am_cv_func_iconv_works=no], |
13494
91b50a4d7659
iconv: Update regarding AIX.
Bruno Haible <bruno@clisp.org>
parents:
13383
diff
changeset
|
177 [ |
91b50a4d7659
iconv: Update regarding AIX.
Bruno Haible <bruno@clisp.org>
parents:
13383
diff
changeset
|
178 changequote(,)dnl |
91b50a4d7659
iconv: Update regarding AIX.
Bruno Haible <bruno@clisp.org>
parents:
13383
diff
changeset
|
179 case "$host_os" in |
13512
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
180 aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; |
2bc3108ae3f1
iconv: Work around AIX 6.1..7.1 bug.
Bruno Haible <bruno@clisp.org>
parents:
13494
diff
changeset
|
181 *) am_cv_func_iconv_works="guessing yes" ;; |
13494
91b50a4d7659
iconv: Update regarding AIX.
Bruno Haible <bruno@clisp.org>
parents:
13383
diff
changeset
|
182 esac |
91b50a4d7659
iconv: Update regarding AIX.
Bruno Haible <bruno@clisp.org>
parents:
13383
diff
changeset
|
183 changequote([,])dnl |
91b50a4d7659
iconv: Update regarding AIX.
Bruno Haible <bruno@clisp.org>
parents:
13383
diff
changeset
|
184 ]) |
8591
5cba81876885
Detect broken AIX iconv() function.
Bruno Haible <bruno@clisp.org>
parents:
5585
diff
changeset
|
185 LIBS="$am_save_LIBS" |
5cba81876885
Detect broken AIX iconv() function.
Bruno Haible <bruno@clisp.org>
parents:
5585
diff
changeset
|
186 ]) |
5cba81876885
Detect broken AIX iconv() function.
Bruno Haible <bruno@clisp.org>
parents:
5585
diff
changeset
|
187 case "$am_cv_func_iconv_works" in |
5cba81876885
Detect broken AIX iconv() function.
Bruno Haible <bruno@clisp.org>
parents:
5585
diff
changeset
|
188 *no) am_func_iconv=no am_cv_lib_iconv=no ;; |
5cba81876885
Detect broken AIX iconv() function.
Bruno Haible <bruno@clisp.org>
parents:
5585
diff
changeset
|
189 *) am_func_iconv=yes ;; |
5cba81876885
Detect broken AIX iconv() function.
Bruno Haible <bruno@clisp.org>
parents:
5585
diff
changeset
|
190 esac |
5cba81876885
Detect broken AIX iconv() function.
Bruno Haible <bruno@clisp.org>
parents:
5585
diff
changeset
|
191 else |
5cba81876885
Detect broken AIX iconv() function.
Bruno Haible <bruno@clisp.org>
parents:
5585
diff
changeset
|
192 am_func_iconv=no am_cv_lib_iconv=no |
5cba81876885
Detect broken AIX iconv() function.
Bruno Haible <bruno@clisp.org>
parents:
5585
diff
changeset
|
193 fi |
5cba81876885
Detect broken AIX iconv() function.
Bruno Haible <bruno@clisp.org>
parents:
5585
diff
changeset
|
194 if test "$am_func_iconv" = yes; then |
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
10979
diff
changeset
|
195 AC_DEFINE([HAVE_ICONV], [1], |
8591
5cba81876885
Detect broken AIX iconv() function.
Bruno Haible <bruno@clisp.org>
parents:
5585
diff
changeset
|
196 [Define if you have the iconv() function and it works.]) |
4107
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
197 fi |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
198 if test "$am_cv_lib_iconv" = yes; then |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
199 AC_MSG_CHECKING([how to link with libiconv]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
200 AC_MSG_RESULT([$LIBICONV]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
201 else |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
202 dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
203 dnl either. |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
204 CPPFLAGS="$am_save_CPPFLAGS" |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
205 LIBICONV= |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
206 LTLIBICONV= |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
207 fi |
10979
03e819eea554
More systematic m4 argument quoting.
Bruno Haible <bruno@clisp.org>
parents:
9457
diff
changeset
|
208 AC_SUBST([LIBICONV]) |
03e819eea554
More systematic m4 argument quoting.
Bruno Haible <bruno@clisp.org>
parents:
9457
diff
changeset
|
209 AC_SUBST([LTLIBICONV]) |
4107
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
210 ]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
211 |
13348
417aae33eae3
Avoid autoconf warnings about AM_ICONV.
Bruno Haible <bruno@clisp.org>
parents:
12551
diff
changeset
|
212 dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to |
417aae33eae3
Avoid autoconf warnings about AM_ICONV.
Bruno Haible <bruno@clisp.org>
parents:
12551
diff
changeset
|
213 dnl avoid warnings like |
417aae33eae3
Avoid autoconf warnings about AM_ICONV.
Bruno Haible <bruno@clisp.org>
parents:
12551
diff
changeset
|
214 dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". |
13383
27aa5a0e75a5
Choose among AC_DEFUN_ONCE, AC_DEFUN in a way that aclocal understands.
Bruno Haible <bruno@clisp.org>
parents:
13348
diff
changeset
|
215 dnl This is tricky because of the way 'aclocal' is implemented: |
27aa5a0e75a5
Choose among AC_DEFUN_ONCE, AC_DEFUN in a way that aclocal understands.
Bruno Haible <bruno@clisp.org>
parents:
13348
diff
changeset
|
216 dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN. |
27aa5a0e75a5
Choose among AC_DEFUN_ONCE, AC_DEFUN in a way that aclocal understands.
Bruno Haible <bruno@clisp.org>
parents:
13348
diff
changeset
|
217 dnl Otherwise aclocal's initial scan pass would miss the macro definition. |
27aa5a0e75a5
Choose among AC_DEFUN_ONCE, AC_DEFUN in a way that aclocal understands.
Bruno Haible <bruno@clisp.org>
parents:
13348
diff
changeset
|
218 dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions. |
27aa5a0e75a5
Choose among AC_DEFUN_ONCE, AC_DEFUN in a way that aclocal understands.
Bruno Haible <bruno@clisp.org>
parents:
13348
diff
changeset
|
219 dnl Otherwise aclocal would emit many "Use of uninitialized value $1" |
27aa5a0e75a5
Choose among AC_DEFUN_ONCE, AC_DEFUN in a way that aclocal understands.
Bruno Haible <bruno@clisp.org>
parents:
13348
diff
changeset
|
220 dnl warnings. |
27aa5a0e75a5
Choose among AC_DEFUN_ONCE, AC_DEFUN in a way that aclocal understands.
Bruno Haible <bruno@clisp.org>
parents:
13348
diff
changeset
|
221 m4_define([gl_iconv_AC_DEFUN], |
27aa5a0e75a5
Choose among AC_DEFUN_ONCE, AC_DEFUN in a way that aclocal understands.
Bruno Haible <bruno@clisp.org>
parents:
13348
diff
changeset
|
222 m4_version_prereq([2.64], |
27aa5a0e75a5
Choose among AC_DEFUN_ONCE, AC_DEFUN in a way that aclocal understands.
Bruno Haible <bruno@clisp.org>
parents:
13348
diff
changeset
|
223 [[AC_DEFUN_ONCE( |
27aa5a0e75a5
Choose among AC_DEFUN_ONCE, AC_DEFUN in a way that aclocal understands.
Bruno Haible <bruno@clisp.org>
parents:
13348
diff
changeset
|
224 [$1], [$2])]], |
13589
eb2d6ffe06bc
Prefer using AC_DEFUN_ONCE over AC_DEFUN in projects with gnulib.
Bruno Haible <bruno@clisp.org>
parents:
13579
diff
changeset
|
225 [m4_ifdef([gl_00GNULIB], |
eb2d6ffe06bc
Prefer using AC_DEFUN_ONCE over AC_DEFUN in projects with gnulib.
Bruno Haible <bruno@clisp.org>
parents:
13579
diff
changeset
|
226 [[AC_DEFUN_ONCE( |
eb2d6ffe06bc
Prefer using AC_DEFUN_ONCE over AC_DEFUN in projects with gnulib.
Bruno Haible <bruno@clisp.org>
parents:
13579
diff
changeset
|
227 [$1], [$2])]], |
eb2d6ffe06bc
Prefer using AC_DEFUN_ONCE over AC_DEFUN in projects with gnulib.
Bruno Haible <bruno@clisp.org>
parents:
13579
diff
changeset
|
228 [[AC_DEFUN( |
eb2d6ffe06bc
Prefer using AC_DEFUN_ONCE over AC_DEFUN in projects with gnulib.
Bruno Haible <bruno@clisp.org>
parents:
13579
diff
changeset
|
229 [$1], [$2])]])])) |
13383
27aa5a0e75a5
Choose among AC_DEFUN_ONCE, AC_DEFUN in a way that aclocal understands.
Bruno Haible <bruno@clisp.org>
parents:
13348
diff
changeset
|
230 gl_iconv_AC_DEFUN([AM_ICONV], |
4107
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
231 [ |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
232 AM_ICONV_LINK |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
233 if test "$am_cv_func_iconv" = yes; then |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
234 AC_MSG_CHECKING([for iconv declaration]) |
10979
03e819eea554
More systematic m4 argument quoting.
Bruno Haible <bruno@clisp.org>
parents:
9457
diff
changeset
|
235 AC_CACHE_VAL([am_cv_proto_iconv], [ |
13577
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13512
diff
changeset
|
236 AC_COMPILE_IFELSE( |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13512
diff
changeset
|
237 [AC_LANG_PROGRAM( |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13512
diff
changeset
|
238 [[ |
4107
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
239 #include <stdlib.h> |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
240 #include <iconv.h> |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
241 extern |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
242 #ifdef __cplusplus |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
243 "C" |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
244 #endif |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
245 #if defined(__STDC__) || defined(__cplusplus) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
246 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
247 #else |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
248 size_t iconv(); |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
249 #endif |
13577
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13512
diff
changeset
|
250 ]], |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13512
diff
changeset
|
251 [[]])], |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13512
diff
changeset
|
252 [am_cv_proto_iconv_arg1=""], |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13512
diff
changeset
|
253 [am_cv_proto_iconv_arg1="const"]) |
4107
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
254 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);"]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
255 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` |
11770
b1f6784b66bd
Fix displayed message of AM_ICONV with autoconf-2.64.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
256 AC_MSG_RESULT([ |
b1f6784b66bd
Fix displayed message of AM_ICONV with autoconf-2.64.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
257 $am_cv_proto_iconv]) |
10979
03e819eea554
More systematic m4 argument quoting.
Bruno Haible <bruno@clisp.org>
parents:
9457
diff
changeset
|
258 AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], |
4107
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
259 [Define as const if the declaration of iconv() needs const.]) |
13898
9e1ca99d049e
iconv-h: Fix test-iconv-h-c++ failure on Solaris 11 2010-11.
Bruno Haible <bruno@clisp.org>
parents:
13589
diff
changeset
|
260 dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>. |
9e1ca99d049e
iconv-h: Fix test-iconv-h-c++ failure on Solaris 11 2010-11.
Bruno Haible <bruno@clisp.org>
parents:
13589
diff
changeset
|
261 m4_ifdef([gl_ICONV_H_DEFAULTS], |
9e1ca99d049e
iconv-h: Fix test-iconv-h-c++ failure on Solaris 11 2010-11.
Bruno Haible <bruno@clisp.org>
parents:
13589
diff
changeset
|
262 [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) |
9e1ca99d049e
iconv-h: Fix test-iconv-h-c++ failure on Solaris 11 2010-11.
Bruno Haible <bruno@clisp.org>
parents:
13589
diff
changeset
|
263 if test -n "$am_cv_proto_iconv_arg1"; then |
9e1ca99d049e
iconv-h: Fix test-iconv-h-c++ failure on Solaris 11 2010-11.
Bruno Haible <bruno@clisp.org>
parents:
13589
diff
changeset
|
264 ICONV_CONST="const" |
9e1ca99d049e
iconv-h: Fix test-iconv-h-c++ failure on Solaris 11 2010-11.
Bruno Haible <bruno@clisp.org>
parents:
13589
diff
changeset
|
265 fi |
9e1ca99d049e
iconv-h: Fix test-iconv-h-c++ failure on Solaris 11 2010-11.
Bruno Haible <bruno@clisp.org>
parents:
13589
diff
changeset
|
266 ]) |
4107
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
267 fi |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
268 ]) |