@@ -35,7 +35,7 @@ if test "$PHP_ICONV" != "no"; then
3535 PHP_ICONV_H_PATH="$PHP_ICONV_PREFIX/include/giconv.h"
3636 else
3737 PHP_ICONV_H_PATH="$PHP_ICONV_PREFIX/include/iconv.h"
38- fi
38+ fi
3939
4040 AC_MSG_CHECKING ( [ if iconv is glibc's] )
4141 AC_TRY_LINK ( [ #include <gnu/libc-version.h>] ,[ gnu_get_libc_version();] ,
@@ -53,8 +53,8 @@ if test "$PHP_ICONV" != "no"; then
5353 AC_TRY_RUN ( [
5454#include <$PHP_ICONV_H_PATH>
5555int main() {
56- printf("%d", _libiconv_version);
57- return 0;
56+ printf("%d", _libiconv_version);
57+ return 0;
5858}
5959 ] ,[
6060 AC_MSG_RESULT ( yes )
@@ -138,7 +138,7 @@ int main() {
138138 if (cd == (iconv_t)(-1)) {
139139 if (errno == EINVAL) {
140140 return 0;
141- } else {
141+ } else {
142142 return 1;
143143 }
144144 }
@@ -159,6 +159,37 @@ int main() {
159159 AC_DEFINE ( [ ICONV_SUPPORTS_ERRNO] ,0 ,[ Whether iconv supports error no or not] )
160160 ] )
161161
162+ AC_MSG_CHECKING ( [ if iconv supports //IGNORE] )
163+ AC_TRY_RUN ( [
164+ #include <$PHP_ICONV_H_PATH>
165+ #include <stdlib.h>
166+
167+ int main() {
168+ iconv_t cd = iconv_open( "UTF-8//IGNORE", "UTF-8" );
169+ char *in_p = "\xC3\xC3\xC3\xB8";
170+ size_t in_left = 4, out_left = 4096;
171+ char *out = malloc(out_left);
172+ char *out_p = out;
173+ size_t result = iconv(cd, (char **) &in_p, &in_left, (char **) &out_p, &out_left);
174+ if(result == (size_t)-1) {
175+ return 1;
176+ }
177+ return 0;
178+ }
179+ ] ,[
180+ AC_MSG_RESULT ( yes )
181+ PHP_DEFINE([ ICONV_BROKEN_IGNORE] ,0,[ ext/iconv] )
182+ AC_DEFINE ( [ ICONV_BROKEN_IGNORE] ,0 ,[ Whether iconv supports IGNORE] )
183+ ] ,[
184+ AC_MSG_RESULT ( no )
185+ PHP_DEFINE([ ICONV_BROKEN_IGNORE] ,1,[ ext/iconv] )
186+ AC_DEFINE ( [ ICONV_BROKEN_IGNORE] ,1 ,[ Whether iconv supports IGNORE] )
187+ ] ,[
188+ AC_MSG_RESULT ( no , cross-compiling )
189+ PHP_DEFINE([ ICONV_SUPPORTS_ERRNO] ,0,[ ext/iconv] )
190+ AC_DEFINE ( [ ICONV_SUPPORTS_ERRNO] ,0 ,[ Whether iconv supports IGNORE] )
191+ ] )
192+
162193 AC_MSG_CHECKING ( [ if your cpp allows macro usage in include lines] )
163194 AC_TRY_COMPILE ( [
164195#define FOO <$PHP_ICONV_H_PATH>
0 commit comments