iconv-h: Fix test-iconv-h-c++ failure on Solaris 11 2010-11.
authorBruno Haible <bruno@clisp.org>
Sat, 27 Nov 2010 03:08:53 +0000 (04:08 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 27 Nov 2010 03:08:53 +0000 (04:08 +0100)
* lib/iconv.in.h (iconv_open, iconv, iconv_close): Define only if the
'iconv' module is present.
(ICONV_CONST): New macro.
* m4/iconv_h.m4 (gl_ICONV_H_DEFAULTS): Initialize GNULIB_ICONV and
ICONV_CONST.
* m4/iconv.m4 (AM_ICONV): If the gnulib module 'iconv-h' is present,
set ICONV_CONST.
* m4/iconv_open.m4 (gl_FUNC_ICONV_OPEN_UTF): Don't set ICONV_CONST
here.
* modules/iconv (configure.ac): Invoke gl_ICONV_MODULE_INDICATOR.
* modules/iconv-h (Makefile.am): Substitute GNULIB_ICONV.
* tests/test-iconv-h.c (ICONV_CONST): Don't define here.
* tests/test-iconv-h-c++.cc (ICONV_CONST): Don't define here.
(iconv_open, iconv, iconv_close): Test only if the 'iconv' module is
present.

ChangeLog
lib/iconv.in.h
m4/iconv.m4
m4/iconv_h.m4
m4/iconv_open.m4
modules/iconv
modules/iconv-h
tests/test-iconv-h-c++.cc
tests/test-iconv-h.c

index ef8ca49..5f32d44 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2010-11-26  Bruno Haible  <bruno@clisp.org>
+
+       iconv-h: Fix test-iconv-h-c++ failure on Solaris 11 2010-11.
+       * lib/iconv.in.h (iconv_open, iconv, iconv_close): Define only if the
+       'iconv' module is present.
+       (ICONV_CONST): New macro.
+       * m4/iconv_h.m4 (gl_ICONV_H_DEFAULTS): Initialize GNULIB_ICONV and
+       ICONV_CONST.
+       * m4/iconv.m4 (AM_ICONV): If the gnulib module 'iconv-h' is present,
+       set ICONV_CONST.
+       * m4/iconv_open.m4 (gl_FUNC_ICONV_OPEN_UTF): Don't set ICONV_CONST
+       here.
+       * modules/iconv (configure.ac): Invoke gl_ICONV_MODULE_INDICATOR.
+       * modules/iconv-h (Makefile.am): Substitute GNULIB_ICONV.
+       * tests/test-iconv-h.c (ICONV_CONST): Don't define here.
+       * tests/test-iconv-h-c++.cc (ICONV_CONST): Don't define here.
+       (iconv_open, iconv, iconv_close): Test only if the 'iconv' module is
+       present.
+
 2010-11-25  Paul Eggert  <eggert@cs.ucla.edu>
 
        ftoastr: comment fix
index 6d0d912..1e452cf 100644 (file)
 /* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
-#if @REPLACE_ICONV_OPEN@
+#if @GNULIB_ICONV@
+# if @REPLACE_ICONV_OPEN@
 /* An iconv_open wrapper that supports the IANA standardized encoding names
    ("ISO-8859-1" etc.) as far as possible.  */
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#  define iconv_open rpl_iconv_open
-# endif
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define iconv_open rpl_iconv_open
+#  endif
 _GL_FUNCDECL_RPL (iconv_open, iconv_t,
                   (const char *tocode, const char *fromcode)
                   _GL_ARG_NONNULL ((1, 2)));
 _GL_CXXALIAS_RPL (iconv_open, iconv_t,
                   (const char *tocode, const char *fromcode));
-#else
+# else
 _GL_CXXALIAS_SYS (iconv_open, iconv_t,
                   (const char *tocode, const char *fromcode));
-#endif
+# endif
 _GL_CXXALIASWARN (iconv_open);
+#endif
 
 #if @REPLACE_ICONV_UTF@
 /* Special constants for supporting UTF-{16,32}{BE,LE} encodings.
@@ -66,10 +68,11 @@ _GL_CXXALIASWARN (iconv_open);
 # define _ICONV_UTF32LE_UTF8 (iconv_t)(-168)
 #endif
 
-#if @REPLACE_ICONV@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#  define iconv rpl_iconv
-# endif
+#if @GNULIB_ICONV@
+# if @REPLACE_ICONV@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define iconv rpl_iconv
+#  endif
 _GL_FUNCDECL_RPL (iconv, size_t,
                   (iconv_t cd,
                    @ICONV_CONST@ char **inbuf, size_t *inbytesleft,
@@ -78,24 +81,30 @@ _GL_CXXALIAS_RPL (iconv, size_t,
                   (iconv_t cd,
                    @ICONV_CONST@ char **inbuf, size_t *inbytesleft,
                    char **outbuf, size_t *outbytesleft));
-#else
+# else
 _GL_CXXALIAS_SYS (iconv, size_t,
                   (iconv_t cd,
                    @ICONV_CONST@ char **inbuf, size_t *inbytesleft,
                    char **outbuf, size_t *outbytesleft));
-#endif
+# endif
 _GL_CXXALIASWARN (iconv);
-
-#if @REPLACE_ICONV@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#  define iconv_close rpl_iconv_close
+# ifndef ICONV_CONST
+#  define ICONV_CONST @ICONV_CONST@
 # endif
+#endif
+
+#if @GNULIB_ICONV@
+# if @REPLACE_ICONV@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define iconv_close rpl_iconv_close
+#  endif
 _GL_FUNCDECL_RPL (iconv_close, int, (iconv_t cd));
 _GL_CXXALIAS_RPL (iconv_close, int, (iconv_t cd));
-#else
+# else
 _GL_CXXALIAS_SYS (iconv_close, int, (iconv_t cd));
-#endif
+# endif
 _GL_CXXALIASWARN (iconv_close);
+#endif
 
 
 #endif /* _GL_ICONV_H */
index 425145c..7d19594 100644 (file)
@@ -1,4 +1,4 @@
-# iconv.m4 serial 15 (gettext-0.18.2)
+# iconv.m4 serial 16 (gettext-0.18.2)
 dnl Copyright (C) 2000-2002, 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,
@@ -252,5 +252,12 @@ size_t iconv();
          $am_cv_proto_iconv])
     AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
       [Define as const if the declaration of iconv() needs const.])
+    dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
+    m4_ifdef([gl_ICONV_H_DEFAULTS],
+      [AC_REQUIRE([gl_ICONV_H_DEFAULTS])
+       if test -n "$am_cv_proto_iconv_arg1"; then
+         ICONV_CONST="const"
+       fi
+      ])
   fi
 ])
index 7366cb9..3b9987b 100644 (file)
@@ -1,4 +1,4 @@
-# iconv_h.m4 serial 6
+# iconv_h.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,
@@ -29,7 +29,9 @@ AC_DEFUN([gl_ICONV_MODULE_INDICATOR],
 
 AC_DEFUN([gl_ICONV_H_DEFAULTS],
 [
+  GNULIB_ICONV=0;       AC_SUBST([GNULIB_ICONV])
   dnl Assume proper GNU behavior unless another module says otherwise.
+  ICONV_CONST=;         AC_SUBST([ICONV_CONST])
   REPLACE_ICONV=0;      AC_SUBST([REPLACE_ICONV])
   REPLACE_ICONV_OPEN=0; AC_SUBST([REPLACE_ICONV_OPEN])
   REPLACE_ICONV_UTF=0;  AC_SUBST([REPLACE_ICONV_UTF])
index 7b24880..1016718 100644 (file)
@@ -1,4 +1,4 @@
-# iconv_open.m4 serial 9
+# iconv_open.m4 serial 10
 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,
@@ -52,12 +52,6 @@ AC_DEFUN([gl_FUNC_ICONV_OPEN_UTF],
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_REQUIRE([gl_ICONV_H_DEFAULTS])
   if test "$am_cv_func_iconv" = yes; then
-    if test -n "$am_cv_proto_iconv_arg1"; then
-      ICONV_CONST="const"
-    else
-      ICONV_CONST=
-    fi
-    AC_SUBST([ICONV_CONST])
     AC_CACHE_CHECK([whether iconv supports conversion between UTF-8 and UTF-{16,32}{BE,LE}],
       [gl_cv_func_iconv_supports_utf],
       [
index 5d81aa3..ca8b048 100644 (file)
@@ -9,6 +9,7 @@ havelib
 
 configure.ac:
 AM_ICONV
+gl_ICONV_MODULE_INDICATOR([iconv])
 
 Makefile.am:
 
index 46399cd..df0e070 100644 (file)
@@ -26,6 +26,7 @@ iconv.h: iconv.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
              -e 's|@''NEXT_ICONV_H''@|$(NEXT_ICONV_H)|g' \
+             -e 's|@''GNULIB_ICONV''@|$(GNULIB_ICONV)|g' \
              -e 's|@''ICONV_CONST''@|$(ICONV_CONST)|g' \
              -e 's|@''REPLACE_ICONV''@|$(REPLACE_ICONV)|g' \
              -e 's|@''REPLACE_ICONV_OPEN''@|$(REPLACE_ICONV_OPEN)|g' \
index f007582..5fc4966 100644 (file)
 #if HAVE_ICONV
 # include <iconv.h>
 
-# ifndef ICONV_CONST
-#  define ICONV_CONST /* empty */
-# endif
-
 # include "signature.h"
 
 
+#if GNULIB_TEST_ICONV
 SIGNATURE_CHECK (GNULIB_NAMESPACE::iconv_open, iconv_t,
                  (const char *, const char *));
+#endif
 
+#if GNULIB_TEST_ICONV
 SIGNATURE_CHECK (GNULIB_NAMESPACE::iconv, size_t,
                  (iconv_t, ICONV_CONST char **, size_t *, char **, size_t *));
+#endif
 
+#if GNULIB_TEST_ICONV
 SIGNATURE_CHECK (GNULIB_NAMESPACE::iconv_close, int, (iconv_t));
+#endif
 
 #endif
 
index 10a8e3d..c27c9ba 100644 (file)
 
 #if HAVE_ICONV
 # include <iconv.h>
-
-# ifndef ICONV_CONST
-#  define ICONV_CONST /* empty */
-# endif
 #endif
 
 int