iconv: Avoid compilation error when bootstrapping GNU libiconv.
authorBruno Haible <bruno@clisp.org>
Sat, 22 Oct 2016 21:04:03 +0000 (23:04 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 22 Oct 2016 21:05:19 +0000 (23:05 +0200)
* m4/iconv.m4 (AM_ICONV): When the system does not have an iconv()
declaration yet, define ICONV_CONST to empty.

ChangeLog
m4/iconv.m4

index cf20d69c16cb7918ad3ebc05dac0d0e200bc1f7c..2f318493988d586c47ee1104779c283d2da07cda 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-10-22  Bruno Haible  <bruno@clisp.org>
+
+       iconv: Avoid compilation error when bootstrapping GNU libiconv.
+       * m4/iconv.m4 (AM_ICONV): When the system does not have an iconv()
+       declaration yet, define ICONV_CONST to empty.
+
 2016-10-15  Bruno Haible  <bruno@clisp.org>
 
        Avoid gnulib-tool warnings about the dependencies of 'parse-datetime'.
index aa159c539a85c694780df0eff9ccfbc40946facd..bdafc54e3097fc9ac9638cebbd182b57b5c8522f 100644 (file)
@@ -1,4 +1,4 @@
-# iconv.m4 serial 19 (gettext-0.18.2)
+# iconv.m4 serial 20
 dnl Copyright (C) 2000-2002, 2007-2014, 2016 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -258,14 +258,18 @@ size_t iconv();
     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
     AC_MSG_RESULT([
          $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
-      ])
+  else
+    dnl When compiling GNU libiconv on a system that does not have iconv yet,
+    dnl pick the POSIX compliant declaration without 'const'.
+    am_cv_proto_iconv_arg1=""
   fi
+  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
+    ])
 ])