diff options
Diffstat (limited to 'pcp/m4/iconv.m4')
| -rw-r--r-- | pcp/m4/iconv.m4 | 57 | 
1 files changed, 37 insertions, 20 deletions
diff --git a/pcp/m4/iconv.m4 b/pcp/m4/iconv.m4 index aa159c5..e593b72 100644 --- a/pcp/m4/iconv.m4 +++ b/pcp/m4/iconv.m4 @@ -1,5 +1,6 @@ -# iconv.m4 serial 19 (gettext-0.18.2) -dnl Copyright (C) 2000-2002, 2007-2014, 2016 Free Software Foundation, Inc. +# iconv.m4 serial 21 +dnl Copyright (C) 2000-2002, 2007-2014, 2016-2020 Free Software Foundation, +dnl 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. @@ -167,15 +168,27 @@ AC_DEFUN([AM_ICONV_LINK],  #endif    /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is       provided.  */ -  if (/* Try standardized names.  */ -      iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) -      /* Try IRIX, OSF/1 names.  */ -      && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) -      /* Try AIX names.  */ -      && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) -      /* Try HP-UX names.  */ -      && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) -    result |= 16; +  { +    /* Try standardized names.  */ +    iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP"); +    /* Try IRIX, OSF/1 names.  */ +    iconv_t cd2 = iconv_open ("UTF-8", "eucJP"); +    /* Try AIX names.  */ +    iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP"); +    /* Try HP-UX names.  */ +    iconv_t cd4 = iconv_open ("utf8", "eucJP"); +    if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1) +        && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1)) +      result |= 16; +    if (cd1 != (iconv_t)(-1)) +      iconv_close (cd1); +    if (cd2 != (iconv_t)(-1)) +      iconv_close (cd2); +    if (cd3 != (iconv_t)(-1)) +      iconv_close (cd3); +    if (cd4 != (iconv_t)(-1)) +      iconv_close (cd4); +  }    return result;  ]])],            [am_cv_func_iconv_works=yes], , @@ -258,14 +271,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 +    ])  ])  | 
