[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 01/01: iconv: avoid false detection of non-working iconv
From: |
Werner LEMBERG |
Subject: |
[groff] 01/01: iconv: avoid false detection of non-working iconv |
Date: |
Wed, 22 Oct 2014 05:24:34 +0000 |
wl pushed a commit to branch master
in repository groff.
commit b0333eca228d83646900b679ce8bc0d2cb5e8d82
Author: Daiki Ueno <address@hidden>
Date: Wed Oct 22 07:23:46 2014 +0200
iconv: avoid false detection of non-working iconv
The INBUF/OUTBUF arguments of iconv can be either 'const char **'
or 'char **'. If CC is g++, the difference causes a compile error
and thus leads to a false detection of non-working iconv.
Reported by Eli Zaretskii and Werner LEMBERG in:
<https://lists.gnu.org/archive/html/bug-gnulib/2014-10/msg00023.html>.
* m4/iconv.m4 (AM_ICONV_LINK): Try all possible argument types of
iconv. Bump serial number.
---
ChangeLog | 13 +++++++++++++
m4/iconv.m4 | 51 ++++++++++++++++++++++++++-------------------------
2 files changed, 39 insertions(+), 25 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 32f26c5..0e73397 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2014-10-21 Daiki Ueno <address@hidden>
+
+ iconv: avoid false detection of non-working iconv
+
+ The INBUF/OUTBUF arguments of iconv can be either 'const char **'
+ or 'char **'. If CC is g++, the difference causes a compile error
+ and thus leads to a false detection of non-working iconv.
+ Reported by Eli Zaretskii and Werner LEMBERG in:
+ <https://lists.gnu.org/archive/html/bug-gnulib/2014-10/msg00023.html>.
+
+ * m4/iconv.m4 (AM_ICONV_LINK): Try all possible argument types of
+ iconv. Bump serial number.
+
2014-10-20 Werner LEMBERG <address@hidden>
* src/libs/gnulib/lib/wctype.in.h: Include `config.h'.
diff --git a/m4/iconv.m4 b/m4/iconv.m4
index 4b29c5f..2c3085f 100644
--- a/m4/iconv.m4
+++ b/m4/iconv.m4
@@ -1,4 +1,4 @@
-# iconv.m4 serial 18 (gettext-0.18.2)
+# iconv.m4 serial 19 (gettext-0.18.2)
dnl Copyright (C) 2000-2002, 2007-2014 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -72,13 +72,17 @@ AC_DEFUN([AM_ICONV_LINK],
if test $am_cv_lib_iconv = yes; then
LIBS="$LIBS $LIBICONV"
fi
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[
+ am_cv_func_iconv_works=no
+ for ac_type in 'char **' 'const char **'; do
+ AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
#include <iconv.h>
#include <string.h>
-int main ()
-{
- int result = 0;
+
+typedef $ac_type gl_iconv_buf_t;
+ ]],
+ [[int result = 0;
/* Test against AIX 5.1 bug: Failures are not distinguishable from successful
returns. */
{
@@ -92,8 +96,8 @@ int main ()
char *outptr = buf;
size_t outbytesleft = sizeof (buf);
size_t res = iconv (cd_utf8_to_88591,
- (char **) &inptr, &inbytesleft,
- &outptr, &outbytesleft);
+ (gl_iconv_buf_t) &inptr, &inbytesleft,
+ (gl_iconv_buf_t) &outptr, &outbytesleft);
if (res == 0)
result |= 1;
iconv_close (cd_utf8_to_88591);
@@ -112,8 +116,8 @@ int main ()
char *outptr = buf;
size_t outbytesleft = sizeof (buf);
size_t res = iconv (cd_ascii_to_88591,
- (char **) &inptr, &inbytesleft,
- &outptr, &outbytesleft);
+ (gl_iconv_buf_t) &inptr, &inbytesleft,
+ (gl_iconv_buf_t) &outptr, &outbytesleft);
if (res == 0)
result |= 2;
iconv_close (cd_ascii_to_88591);
@@ -131,8 +135,8 @@ int main ()
char *outptr = buf;
size_t outbytesleft = 1;
size_t res = iconv (cd_88591_to_utf8,
- (char **) &inptr, &inbytesleft,
- &outptr, &outbytesleft);
+ (gl_iconv_buf_t) &inptr, &inbytesleft,
+ (gl_iconv_buf_t) &outptr, &outbytesleft);
if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
result |= 4;
iconv_close (cd_88591_to_utf8);
@@ -151,8 +155,8 @@ int main ()
char *outptr = buf;
size_t outbytesleft = sizeof (buf);
size_t res = iconv (cd_88591_to_utf8,
- (char **) &inptr, &inbytesleft,
- &outptr, &outbytesleft);
+ (gl_iconv_buf_t) &inptr, &inbytesleft,
+ (gl_iconv_buf_t) &outptr, &outbytesleft);
if ((int)res > 0)
result |= 8;
iconv_close (cd_88591_to_utf8);
@@ -171,17 +175,14 @@ int main ()
&& iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
result |= 16;
return result;
-}]])],
- [am_cv_func_iconv_works=yes],
- [am_cv_func_iconv_works=no],
- [
-changequote(,)dnl
- case "$host_os" in
- aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
- *) am_cv_func_iconv_works="guessing yes" ;;
- esac
-changequote([,])dnl
- ])
+]])],
+ [am_cv_func_iconv_works=yes], ,
+ [case "$host_os" in
+ aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
+ *) am_cv_func_iconv_works="guessing yes" ;;
+ esac])
+ test "$am_cv_func_iconv_works" = no || break
+ done
LIBS="$am_save_LIBS"
])
case "$am_cv_func_iconv_works" in
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 01/01: iconv: avoid false detection of non-working iconv,
Werner LEMBERG <=