avoid some overlong lines from posix urls, etc.
[gnulib.git] / m4 / iconv_open.m4
index 4bfcd41..60f62ca 100644 (file)
@@ -1,5 +1,5 @@
-# iconv_open.m4 serial 2
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# iconv_open.m4 serial 7
+dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -10,6 +10,8 @@ AC_DEFUN([gl_FUNC_ICONV_OPEN],
   AC_REQUIRE([AC_CANONICAL_HOST])
   AC_REQUIRE([gl_ICONV_H_DEFAULTS])
   if test "$am_cv_func_iconv" = yes; then
+    dnl Provide the <iconv.h> override, for the sake of the C++ aliases.
+    gl_REPLACE_ICONV_H
     dnl Test whether iconv_open accepts standardized encoding names.
     dnl We know that GNU libiconv and GNU libc do.
     AC_EGREP_CPP([gnu_iconv], [
@@ -21,10 +23,11 @@ AC_DEFUN([gl_FUNC_ICONV_OPEN],
     if test $gl_func_iconv_gnu = no; then
       iconv_flavor=
       case "$host_os" in
-        aix*)  iconv_flavor=ICONV_FLAVOR_AIX ;;
-        irix*) iconv_flavor=ICONV_FLAVOR_IRIX ;;
-        hpux*) iconv_flavor=ICONV_FLAVOR_HPUX ;;
-        osf*)  iconv_flavor=ICONV_FLAVOR_OSF ;;
+        aix*)     iconv_flavor=ICONV_FLAVOR_AIX ;;
+        irix*)    iconv_flavor=ICONV_FLAVOR_IRIX ;;
+        hpux*)    iconv_flavor=ICONV_FLAVOR_HPUX ;;
+        osf*)     iconv_flavor=ICONV_FLAVOR_OSF ;;
+        solaris*) iconv_flavor=ICONV_FLAVOR_SOLARIS ;;
       esac
       if test -n "$iconv_flavor"; then
         AC_DEFINE_UNQUOTED([ICONV_FLAVOR], [$iconv_flavor],
@@ -38,9 +41,9 @@ AC_DEFUN([gl_FUNC_ICONV_OPEN],
 
 AC_DEFUN([gl_REPLACE_ICONV_OPEN],
 [
+  gl_REPLACE_ICONV_H
   REPLACE_ICONV_OPEN=1
   AC_LIBOBJ([iconv_open])
-  ICONV_H='iconv.h'
 ])
 
 AC_DEFUN([gl_FUNC_ICONV_OPEN_UTF],
@@ -56,7 +59,7 @@ AC_DEFUN([gl_FUNC_ICONV_OPEN_UTF],
     fi
     AC_SUBST([ICONV_CONST])
     AC_CACHE_CHECK([whether iconv supports conversion between UTF-8 and UTF-{16,32}{BE,LE}],
-      [gl_func_iconv_supports_utf],
+      [gl_cv_func_iconv_supports_utf],
       [
         save_LIBS="$LIBS"
         LIBS="$LIBS $LIBICONV"
@@ -89,8 +92,8 @@ int main ()
     outptr = buf;
     outbytesleft = sizeof (buf);
     res = iconv (cd,
-                (ICONV_CONST char **) &inptr, &inbytesleft,
-                &outptr, &outbytesleft);
+                 (ICONV_CONST char **) &inptr, &inbytesleft,
+                 &outptr, &outbytesleft);
     ASSERT (res == 0 && inbytesleft == 0);
     ASSERT (outptr == buf + (sizeof (expected) - 1));
     ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0);
@@ -116,8 +119,8 @@ int main ()
     outptr = buf;
     outbytesleft = sizeof (buf);
     res = iconv (cd,
-                (ICONV_CONST char **) &inptr, &inbytesleft,
-                &outptr, &outbytesleft);
+                 (ICONV_CONST char **) &inptr, &inbytesleft,
+                 &outptr, &outbytesleft);
     ASSERT (res == 0 && inbytesleft == 0);
     ASSERT (outptr == buf + (sizeof (expected) - 1));
     ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0);
@@ -143,8 +146,8 @@ int main ()
     outptr = buf;
     outbytesleft = sizeof (buf);
     res = iconv (cd,
-                (ICONV_CONST char **) &inptr, &inbytesleft,
-                &outptr, &outbytesleft);
+                 (ICONV_CONST char **) &inptr, &inbytesleft,
+                 &outptr, &outbytesleft);
     ASSERT (res == 0 && inbytesleft == 0);
     ASSERT (outptr == buf + (sizeof (expected) - 1));
     ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0);
@@ -170,8 +173,8 @@ int main ()
     outptr = buf;
     outbytesleft = sizeof (buf);
     res = iconv (cd,
-                (ICONV_CONST char **) &inptr, &inbytesleft,
-                &outptr, &outbytesleft);
+                 (ICONV_CONST char **) &inptr, &inbytesleft,
+                 &outptr, &outbytesleft);
     ASSERT (res == 0 && inbytesleft == 0);
     ASSERT (outptr == buf + (sizeof (expected) - 1));
     ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0);
@@ -198,35 +201,35 @@ int main ()
     outptr = buf;
     outbytesleft = sizeof (buf);
     res = iconv (cd,
-                (ICONV_CONST char **) &inptr, &inbytesleft,
-                &outptr, &outbytesleft);
+                 (ICONV_CONST char **) &inptr, &inbytesleft,
+                 &outptr, &outbytesleft);
     ASSERT (res == 0 && inbytesleft == 0);
     ASSERT (outptr == buf + (sizeof (expected) - 1));
     ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0);
     ASSERT (iconv_close (cd) == 0);
   }
   return 0;
-}], [gl_func_iconv_supports_utf=yes], [gl_func_iconv_supports_utf=no],
+}], [gl_cv_func_iconv_supports_utf=yes], [gl_cv_func_iconv_supports_utf=no],
           [
            dnl We know that GNU libiconv, GNU libc, and Solaris >= 9 do.
            dnl OSF/1 5.1 has these encodings, but inserts a BOM in the "to"
            dnl direction.
-           gl_func_iconv_supports_utf=no
+           gl_cv_func_iconv_supports_utf=no
            if test $gl_func_iconv_gnu = yes; then
-             gl_func_iconv_supports_utf=yes
+             gl_cv_func_iconv_supports_utf=yes
            else
 changequote(,)dnl
              case "$host_os" in
-               solaris2.9 | solaris2.1[0-9]) gl_func_iconv_supports_utf=yes ;;
+               solaris2.9 | solaris2.1[0-9]) gl_cv_func_iconv_supports_utf=yes ;;
              esac
 changequote([,])dnl
            fi
           ])
         LIBS="$save_LIBS"
       ])
-    if test $gl_func_iconv_supports_utf = no; then
+    if test $gl_cv_func_iconv_supports_utf = no; then
       REPLACE_ICONV_UTF=1
-      AC_DEFINE([REPLACE_ICONV_UTF], 1,
+      AC_DEFINE([REPLACE_ICONV_UTF], [1],
         [Define if the iconv() functions are enhanced to handle the UTF-{16,32}{BE,LE} encodings.])
       REPLACE_ICONV=1
       gl_REPLACE_ICONV_OPEN