groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 01/01: * m4/iconv.m4: Really avoid false detection of non-workin


From: Werner LEMBERG
Subject: [groff] 01/01: * m4/iconv.m4: Really avoid false detection of non-working iconv.
Date: Thu, 23 Oct 2014 17:45:04 +0000

wl pushed a commit to branch master
in repository groff.

commit 6d4aa2e3bddc10aff60455da0bc5b751a2e776a3
Author: Daiki Ueno <address@hidden>
Date:   Thu Oct 23 19:44:36 2014 +0200

    * m4/iconv.m4: Really avoid false detection of non-working iconv.
---
 ChangeLog   |    4 ++++
 m4/iconv.m4 |   38 ++++++++++++++++++++------------------
 2 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0e73397..5633a95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-23  Daiki Ueno  <address@hidden>
+
+       * m4/iconv.m4: Really avoid false detection of non-working iconv.
+
 2014-10-21  Daiki Ueno  <address@hidden>
 
        iconv: avoid false detection of non-working iconv
diff --git a/m4/iconv.m4 b/m4/iconv.m4
index 2c3085f..4e37363 100644
--- a/m4/iconv.m4
+++ b/m4/iconv.m4
@@ -73,14 +73,16 @@ AC_DEFUN([AM_ICONV_LINK],
         LIBS="$LIBS $LIBICONV"
       fi
       am_cv_func_iconv_works=no
-      for ac_type in 'char **' 'const char **'; do
+      for ac_iconv_const in '' 'const'; do
         AC_RUN_IFELSE(
           [AC_LANG_PROGRAM(
              [[
 #include <iconv.h>
 #include <string.h>
 
-typedef $ac_type gl_iconv_buf_t;
+#ifndef ICONV_CONST
+# define ICONV_CONST $ac_iconv_const
+#endif
              ]],
              [[int result = 0;
   /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
@@ -89,15 +91,15 @@ typedef $ac_type gl_iconv_buf_t;
     iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
     if (cd_utf8_to_88591 != (iconv_t)(-1))
       {
-        static const char input[] = "\342\202\254"; /* EURO SIGN */
+        static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */
         char buf[10];
-        const char *inptr = input;
+        ICONV_CONST char *inptr = input;
         size_t inbytesleft = strlen (input);
         char *outptr = buf;
         size_t outbytesleft = sizeof (buf);
         size_t res = iconv (cd_utf8_to_88591,
-                            (gl_iconv_buf_t) &inptr, &inbytesleft,
-                            (gl_iconv_buf_t) &outptr, &outbytesleft);
+                            &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
         if (res == 0)
           result |= 1;
         iconv_close (cd_utf8_to_88591);
@@ -109,15 +111,15 @@ typedef $ac_type gl_iconv_buf_t;
     iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
     if (cd_ascii_to_88591 != (iconv_t)(-1))
       {
-        static const char input[] = "\263";
+        static ICONV_CONST char input[] = "\263";
         char buf[10];
-        const char *inptr = input;
+        ICONV_CONST char *inptr = input;
         size_t inbytesleft = strlen (input);
         char *outptr = buf;
         size_t outbytesleft = sizeof (buf);
         size_t res = iconv (cd_ascii_to_88591,
-                            (gl_iconv_buf_t) &inptr, &inbytesleft,
-                            (gl_iconv_buf_t) &outptr, &outbytesleft);
+                            &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
         if (res == 0)
           result |= 2;
         iconv_close (cd_ascii_to_88591);
@@ -128,15 +130,15 @@ typedef $ac_type gl_iconv_buf_t;
     iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
     if (cd_88591_to_utf8 != (iconv_t)(-1))
       {
-        static const char input[] = "\304";
+        static ICONV_CONST char input[] = "\304";
         static char buf[2] = { (char)0xDE, (char)0xAD };
-        const char *inptr = input;
+        ICONV_CONST char *inptr = input;
         size_t inbytesleft = 1;
         char *outptr = buf;
         size_t outbytesleft = 1;
         size_t res = iconv (cd_88591_to_utf8,
-                            (gl_iconv_buf_t) &inptr, &inbytesleft,
-                            (gl_iconv_buf_t) &outptr, &outbytesleft);
+                            &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
         if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
           result |= 4;
         iconv_close (cd_88591_to_utf8);
@@ -148,15 +150,15 @@ typedef $ac_type gl_iconv_buf_t;
     iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
     if (cd_88591_to_utf8 != (iconv_t)(-1))
       {
-        static const char input[] = "\304rger mit b\366sen B\374bchen ohne 
Augenma\337";
+        static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen 
ohne Augenma\337";
         char buf[50];
-        const char *inptr = input;
+        ICONV_CONST char *inptr = input;
         size_t inbytesleft = strlen (input);
         char *outptr = buf;
         size_t outbytesleft = sizeof (buf);
         size_t res = iconv (cd_88591_to_utf8,
-                            (gl_iconv_buf_t) &inptr, &inbytesleft,
-                            (gl_iconv_buf_t) &outptr, &outbytesleft);
+                            &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
         if ((int)res > 0)
           result |= 8;
         iconv_close (cd_88591_to_utf8);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]