patch from Roumen Petrov to detect if iconv() needs a const for the second

* config.h.in configure.in encoding.c: patch from Roumen Petrov
  to detect if iconv() needs a const for the second parameter
Daniel

svn path=/trunk/; revision=3693
diff --git a/configure.in b/configure.in
index 699232f..f46505c 100644
--- a/configure.in
+++ b/configure.in
@@ -1224,6 +1224,29 @@
 		AC_MSG_RESULT(no)
 		LIBS="${_libs}"
 		LDFLAGS="${_ldflags}"])]))
+
+	if test "$WITH_ICONV" = "1" ; then
+		AC_MSG_CHECKING([for iconv declaration])
+		AC_CACHE_VAL(xml_cv_iconv_arg2, [
+			AC_TRY_COMPILE([#include <stdlib.h>
+#include <iconv.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+#if defined(__STDC__) || defined(__cplusplus)
+size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
+#else
+size_t iconv();
+#endif
+], [], xml_cv_iconv_arg2="", xml_cv_iconv_arg2="const")])
+
+		xml_cv_iconv_decl="extern size_t iconv (iconv_t cd, $xml_cv_iconv_arg2 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"
+		AC_MSG_RESULT([${xml_xxx:-
+	}$xml_cv_iconv_decl])
+		AC_DEFINE_UNQUOTED(ICONV_CONST, $xml_cv_iconv_arg2,
+			[Define as const if the declaration of iconv() needs const.])
+	fi
 fi
 case "$host" in
 	*mingw*) M_LIBS=""