diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-05-18 19:54:00 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-05-18 19:54:00 +0000 |
commit | 5a8673341a80e189a8f166c079f531a580dd006d (patch) | |
tree | 65c153092910cbbf0b6155fb7b90b214c68f8397 /m4/iconv.m4 | |
parent | d432bca57dff61c4c07c133d9b660d2fae2f26b7 (diff) | |
download | gnunet-gtk-5a8673341a80e189a8f166c079f531a580dd006d.tar.gz gnunet-gtk-5a8673341a80e189a8f166c079f531a580dd006d.zip |
-libtool and gettext update
Diffstat (limited to 'm4/iconv.m4')
-rw-r--r-- | m4/iconv.m4 | 164 |
1 files changed, 126 insertions, 38 deletions
diff --git a/m4/iconv.m4 b/m4/iconv.m4 index 66bc76f4..4b29c5f2 100644 --- a/m4/iconv.m4 +++ b/m4/iconv.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # iconv.m4 serial AM6 (gettext-0.17) | 1 | # iconv.m4 serial 18 (gettext-0.18.2) |
2 | dnl Copyright (C) 2000-2002, 2007 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2000-2002, 2007-2014 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -30,44 +30,55 @@ AC_DEFUN([AM_ICONV_LINK], | |||
30 | dnl Add $INCICONV to CPPFLAGS before performing the following checks, | 30 | dnl Add $INCICONV to CPPFLAGS before performing the following checks, |
31 | dnl because if the user has installed libiconv and not disabled its use | 31 | dnl because if the user has installed libiconv and not disabled its use |
32 | dnl via --without-libiconv-prefix, he wants to use it. The first | 32 | dnl via --without-libiconv-prefix, he wants to use it. The first |
33 | dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. | 33 | dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed. |
34 | am_save_CPPFLAGS="$CPPFLAGS" | 34 | am_save_CPPFLAGS="$CPPFLAGS" |
35 | AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) | 35 | AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) |
36 | 36 | ||
37 | AC_CACHE_CHECK([for iconv], am_cv_func_iconv, [ | 37 | AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [ |
38 | am_cv_func_iconv="no, consider installing GNU libiconv" | 38 | am_cv_func_iconv="no, consider installing GNU libiconv" |
39 | am_cv_lib_iconv=no | 39 | am_cv_lib_iconv=no |
40 | AC_TRY_LINK([#include <stdlib.h> | 40 | AC_LINK_IFELSE( |
41 | #include <iconv.h>], | 41 | [AC_LANG_PROGRAM( |
42 | [iconv_t cd = iconv_open("",""); | 42 | [[ |
43 | iconv(cd,NULL,NULL,NULL,NULL); | 43 | #include <stdlib.h> |
44 | iconv_close(cd);], | 44 | #include <iconv.h> |
45 | am_cv_func_iconv=yes) | 45 | ]], |
46 | [[iconv_t cd = iconv_open("",""); | ||
47 | iconv(cd,NULL,NULL,NULL,NULL); | ||
48 | iconv_close(cd);]])], | ||
49 | [am_cv_func_iconv=yes]) | ||
46 | if test "$am_cv_func_iconv" != yes; then | 50 | if test "$am_cv_func_iconv" != yes; then |
47 | am_save_LIBS="$LIBS" | 51 | am_save_LIBS="$LIBS" |
48 | LIBS="$LIBS $LIBICONV" | 52 | LIBS="$LIBS $LIBICONV" |
49 | AC_TRY_LINK([#include <stdlib.h> | 53 | AC_LINK_IFELSE( |
50 | #include <iconv.h>], | 54 | [AC_LANG_PROGRAM( |
51 | [iconv_t cd = iconv_open("",""); | 55 | [[ |
52 | iconv(cd,NULL,NULL,NULL,NULL); | 56 | #include <stdlib.h> |
53 | iconv_close(cd);], | 57 | #include <iconv.h> |
54 | am_cv_lib_iconv=yes | 58 | ]], |
55 | am_cv_func_iconv=yes) | 59 | [[iconv_t cd = iconv_open("",""); |
60 | iconv(cd,NULL,NULL,NULL,NULL); | ||
61 | iconv_close(cd);]])], | ||
62 | [am_cv_lib_iconv=yes] | ||
63 | [am_cv_func_iconv=yes]) | ||
56 | LIBS="$am_save_LIBS" | 64 | LIBS="$am_save_LIBS" |
57 | fi | 65 | fi |
58 | ]) | 66 | ]) |
59 | if test "$am_cv_func_iconv" = yes; then | 67 | if test "$am_cv_func_iconv" = yes; then |
60 | AC_CACHE_CHECK([for working iconv], am_cv_func_iconv_works, [ | 68 | 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. | 69 | dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11, |
70 | dnl Solaris 10. | ||
62 | am_save_LIBS="$LIBS" | 71 | am_save_LIBS="$LIBS" |
63 | if test $am_cv_lib_iconv = yes; then | 72 | if test $am_cv_lib_iconv = yes; then |
64 | LIBS="$LIBS $LIBICONV" | 73 | LIBS="$LIBS $LIBICONV" |
65 | fi | 74 | fi |
66 | AC_TRY_RUN([ | 75 | AC_RUN_IFELSE( |
76 | [AC_LANG_SOURCE([[ | ||
67 | #include <iconv.h> | 77 | #include <iconv.h> |
68 | #include <string.h> | 78 | #include <string.h> |
69 | int main () | 79 | int main () |
70 | { | 80 | { |
81 | int result = 0; | ||
71 | /* Test against AIX 5.1 bug: Failures are not distinguishable from successful | 82 | /* Test against AIX 5.1 bug: Failures are not distinguishable from successful |
72 | returns. */ | 83 | returns. */ |
73 | { | 84 | { |
@@ -84,7 +95,47 @@ int main () | |||
84 | (char **) &inptr, &inbytesleft, | 95 | (char **) &inptr, &inbytesleft, |
85 | &outptr, &outbytesleft); | 96 | &outptr, &outbytesleft); |
86 | if (res == 0) | 97 | if (res == 0) |
87 | return 1; | 98 | result |= 1; |
99 | iconv_close (cd_utf8_to_88591); | ||
100 | } | ||
101 | } | ||
102 | /* Test against Solaris 10 bug: Failures are not distinguishable from | ||
103 | successful returns. */ | ||
104 | { | ||
105 | iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); | ||
106 | if (cd_ascii_to_88591 != (iconv_t)(-1)) | ||
107 | { | ||
108 | static const char input[] = "\263"; | ||
109 | char buf[10]; | ||
110 | const char *inptr = input; | ||
111 | size_t inbytesleft = strlen (input); | ||
112 | char *outptr = buf; | ||
113 | size_t outbytesleft = sizeof (buf); | ||
114 | size_t res = iconv (cd_ascii_to_88591, | ||
115 | (char **) &inptr, &inbytesleft, | ||
116 | &outptr, &outbytesleft); | ||
117 | if (res == 0) | ||
118 | result |= 2; | ||
119 | iconv_close (cd_ascii_to_88591); | ||
120 | } | ||
121 | } | ||
122 | /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ | ||
123 | { | ||
124 | iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); | ||
125 | if (cd_88591_to_utf8 != (iconv_t)(-1)) | ||
126 | { | ||
127 | static const char input[] = "\304"; | ||
128 | static char buf[2] = { (char)0xDE, (char)0xAD }; | ||
129 | const char *inptr = input; | ||
130 | size_t inbytesleft = 1; | ||
131 | char *outptr = buf; | ||
132 | size_t outbytesleft = 1; | ||
133 | size_t res = iconv (cd_88591_to_utf8, | ||
134 | (char **) &inptr, &inbytesleft, | ||
135 | &outptr, &outbytesleft); | ||
136 | if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) | ||
137 | result |= 4; | ||
138 | iconv_close (cd_88591_to_utf8); | ||
88 | } | 139 | } |
89 | } | 140 | } |
90 | #if 0 /* This bug could be worked around by the caller. */ | 141 | #if 0 /* This bug could be worked around by the caller. */ |
@@ -103,7 +154,8 @@ int main () | |||
103 | (char **) &inptr, &inbytesleft, | 154 | (char **) &inptr, &inbytesleft, |
104 | &outptr, &outbytesleft); | 155 | &outptr, &outbytesleft); |
105 | if ((int)res > 0) | 156 | if ((int)res > 0) |
106 | return 1; | 157 | result |= 8; |
158 | iconv_close (cd_88591_to_utf8); | ||
107 | } | 159 | } |
108 | } | 160 | } |
109 | #endif | 161 | #endif |
@@ -117,13 +169,19 @@ int main () | |||
117 | && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) | 169 | && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) |
118 | /* Try HP-UX names. */ | 170 | /* Try HP-UX names. */ |
119 | && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) | 171 | && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) |
120 | return 1; | 172 | result |= 16; |
121 | return 0; | 173 | return result; |
122 | }], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no], | 174 | }]])], |
123 | [case "$host_os" in | 175 | [am_cv_func_iconv_works=yes], |
176 | [am_cv_func_iconv_works=no], | ||
177 | [ | ||
178 | changequote(,)dnl | ||
179 | case "$host_os" in | ||
124 | aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; | 180 | aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; |
125 | *) am_cv_func_iconv_works="guessing yes" ;; | 181 | *) am_cv_func_iconv_works="guessing yes" ;; |
126 | esac]) | 182 | esac |
183 | changequote([,])dnl | ||
184 | ]) | ||
127 | LIBS="$am_save_LIBS" | 185 | LIBS="$am_save_LIBS" |
128 | ]) | 186 | ]) |
129 | case "$am_cv_func_iconv_works" in | 187 | case "$am_cv_func_iconv_works" in |
@@ -134,7 +192,7 @@ int main () | |||
134 | am_func_iconv=no am_cv_lib_iconv=no | 192 | am_func_iconv=no am_cv_lib_iconv=no |
135 | fi | 193 | fi |
136 | if test "$am_func_iconv" = yes; then | 194 | if test "$am_func_iconv" = yes; then |
137 | AC_DEFINE(HAVE_ICONV, 1, | 195 | AC_DEFINE([HAVE_ICONV], [1], |
138 | [Define if you have the iconv() function and it works.]) | 196 | [Define if you have the iconv() function and it works.]) |
139 | fi | 197 | fi |
140 | if test "$am_cv_lib_iconv" = yes; then | 198 | if test "$am_cv_lib_iconv" = yes; then |
@@ -147,34 +205,64 @@ int main () | |||
147 | LIBICONV= | 205 | LIBICONV= |
148 | LTLIBICONV= | 206 | LTLIBICONV= |
149 | fi | 207 | fi |
150 | AC_SUBST(LIBICONV) | 208 | AC_SUBST([LIBICONV]) |
151 | AC_SUBST(LTLIBICONV) | 209 | AC_SUBST([LTLIBICONV]) |
152 | ]) | 210 | ]) |
153 | 211 | ||
154 | AC_DEFUN([AM_ICONV], | 212 | dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to |
213 | dnl avoid warnings like | ||
214 | dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". | ||
215 | dnl This is tricky because of the way 'aclocal' is implemented: | ||
216 | dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN. | ||
217 | dnl Otherwise aclocal's initial scan pass would miss the macro definition. | ||
218 | dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions. | ||
219 | dnl Otherwise aclocal would emit many "Use of uninitialized value $1" | ||
220 | dnl warnings. | ||
221 | m4_define([gl_iconv_AC_DEFUN], | ||
222 | m4_version_prereq([2.64], | ||
223 | [[AC_DEFUN_ONCE( | ||
224 | [$1], [$2])]], | ||
225 | [m4_ifdef([gl_00GNULIB], | ||
226 | [[AC_DEFUN_ONCE( | ||
227 | [$1], [$2])]], | ||
228 | [[AC_DEFUN( | ||
229 | [$1], [$2])]])])) | ||
230 | gl_iconv_AC_DEFUN([AM_ICONV], | ||
155 | [ | 231 | [ |
156 | AM_ICONV_LINK | 232 | AM_ICONV_LINK |
157 | if test "$am_cv_func_iconv" = yes; then | 233 | if test "$am_cv_func_iconv" = yes; then |
158 | AC_MSG_CHECKING([for iconv declaration]) | 234 | AC_MSG_CHECKING([for iconv declaration]) |
159 | AC_CACHE_VAL(am_cv_proto_iconv, [ | 235 | AC_CACHE_VAL([am_cv_proto_iconv], [ |
160 | AC_TRY_COMPILE([ | 236 | AC_COMPILE_IFELSE( |
237 | [AC_LANG_PROGRAM( | ||
238 | [[ | ||
161 | #include <stdlib.h> | 239 | #include <stdlib.h> |
162 | #include <iconv.h> | 240 | #include <iconv.h> |
163 | extern | 241 | extern |
164 | #ifdef __cplusplus | 242 | #ifdef __cplusplus |
165 | "C" | 243 | "C" |
166 | #endif | 244 | #endif |
167 | #if defined(__STDC__) || defined(__cplusplus) | 245 | #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) |
168 | size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); | 246 | size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); |
169 | #else | 247 | #else |
170 | size_t iconv(); | 248 | size_t iconv(); |
171 | #endif | 249 | #endif |
172 | ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") | 250 | ]], |
251 | [[]])], | ||
252 | [am_cv_proto_iconv_arg1=""], | ||
253 | [am_cv_proto_iconv_arg1="const"]) | ||
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);"]) | 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);"]) |
174 | am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` | 255 | am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` |
175 | AC_MSG_RESULT([$]{ac_t:- | 256 | AC_MSG_RESULT([ |
176 | }[$]am_cv_proto_iconv) | 257 | $am_cv_proto_iconv]) |
177 | AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, | 258 | AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], |
178 | [Define as const if the declaration of iconv() needs const.]) | 259 | [Define as const if the declaration of iconv() needs const.]) |
260 | dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>. | ||
261 | m4_ifdef([gl_ICONV_H_DEFAULTS], | ||
262 | [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) | ||
263 | if test -n "$am_cv_proto_iconv_arg1"; then | ||
264 | ICONV_CONST="const" | ||
265 | fi | ||
266 | ]) | ||
179 | fi | 267 | fi |
180 | ]) | 268 | ]) |