mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-02-05 12:53:16 +08:00
5e8754f90a
This reverts commit 7a6dbc2fdb
("Update
gnulib to current upstream master"). It is needed because the gnulib
update caused problems with people using old GCC compilers (version
4.8, for example), which support C99 but don't default to using it.
Unfortunately this broke GDB for these users. A more detailed report
of what happened can be found at:
https://lists.gnu.org/archive/html/bug-gnulib/2018-08/msg00157.html
The reason for updating our gnulib copy was to fix PR gdb/23558.
Reverting this patch reintroduces the bug, so in order to fix it I
will submit a subsequent patch which cherry-picks the fix from gnulib.
gdb/ChangeLog:
2018-09-10 Sergio Durigan Junior <sergiodj@redhat.com>
Revert:
2018-08-29 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/23555
PR gdb/23558
* gnulib/aclocal.m4: Regenerate.
* gnulib/config.in: Regenerate.
* gnulib/configure: Regenerate.
* gnulib/import/Makefile.am: Update.
* gnulib/import/Makefile.in: Update.
* gnulib/import/extra/snippet/_Noreturn.h: Rename to...
* gnulib/import/_Noreturn.h: ... this.
* gnulib/import/alloca.in.h: Update.
* gnulib/import/extra/snippet/arg-nonnull.h: Rename to...
* gnulib/import/arg-nonnull.h: ... this.
* gnulib/import/assure.h: Update.
* gnulib/import/at-func.c: Update.
* gnulib/import/basename-lgpl.c: Update.
* gnulib/import/extra/snippet/c++defs.h: Rename to...
* gnulib/import/c++defs.h: ... this.
* gnulib/import/canonicalize-lgpl.c: Update.
* gnulib/import/cdefs.h: Update.
* gnulib/import/chdir-long.c: Update.
* gnulib/import/chdir-long.h: Update.
* gnulib/import/cloexec.c: Update.
* gnulib/import/cloexec.h: Update.
* gnulib/import/close.c: Update.
* gnulib/import/closedir.c: Update.
* gnulib/import/config.charset: Update.
* gnulib/import/dirent-private.h: Update.
* gnulib/import/dirent.in.h: Update.
* gnulib/import/dirfd.c: Update.
* gnulib/import/dirname-lgpl.c: Update.
* gnulib/import/dirname.h: Update.
* gnulib/import/dosname.h: Update.
* gnulib/import/dup-safer-flag.c: Update.
* gnulib/import/dup-safer.c: Update.
* gnulib/import/dup.c: Update.
* gnulib/import/dup2.c: Update.
* gnulib/import/errno.in.h: Update.
* gnulib/import/error.c: Update.
* gnulib/import/error.h: Update.
* gnulib/import/exitfail.c: Update.
* gnulib/import/exitfail.h: Update.
* gnulib/import/extra/update-copyright: Update.
* gnulib/import/fchdir.c: Update.
* gnulib/import/fcntl.c: Update.
* gnulib/import/fcntl.in.h: Update.
* gnulib/import/fd-hook.c: Update.
* gnulib/import/fd-hook.h: Update.
* gnulib/import/fd-safer-flag.c: Update.
* gnulib/import/fd-safer.c: Update.
* gnulib/import/fdopendir.c: Update.
* gnulib/import/filename.h: Update.
* gnulib/import/filenamecat-lgpl.c: Update.
* gnulib/import/filenamecat.h: Update.
* gnulib/import/flexmember.h: Update.
* gnulib/import/float+.h: Update.
* gnulib/import/float.c: Update.
* gnulib/import/float.in.h: Update.
* gnulib/import/fnmatch.c: Update.
* gnulib/import/fnmatch.in.h: Update.
* gnulib/import/fnmatch_loop.c: Update.
* gnulib/import/fpucw.h: Update.
* gnulib/import/frexp.c: Update.
* gnulib/import/frexpl.c: Update.
* gnulib/import/fstat.c: Update.
* gnulib/import/fstatat.c: Update.
* gnulib/import/getcwd-lgpl.c: Update.
* gnulib/import/getcwd.c: Update.
* gnulib/import/getdtablesize.c: Update.
* gnulib/import/getlogin_r.c: Update.
* gnulib/import/getprogname.c: Update.
* gnulib/import/getprogname.h: Update.
* gnulib/import/gettext.h: Update.
* gnulib/import/gettimeofday.c: Update.
* gnulib/import/glob-libc.h: Update.
* gnulib/import/glob.c: Update.
* gnulib/import/glob.in.h: Update.
* gnulib/import/glob_internal.h: Update.
* gnulib/import/glob_pattern_p.c: Update.
* gnulib/import/globfree.c: Update.
* gnulib/import/hard-locale.c: Update.
* gnulib/import/hard-locale.h: Update.
* gnulib/import/intprops.h: Update.
* gnulib/import/inttypes.in.h: Update.
* gnulib/import/isnan.c: Update.
* gnulib/import/isnand-nolibm.h: Update.
* gnulib/import/isnand.c: Update.
* gnulib/import/isnanl-nolibm.h: Update.
* gnulib/import/isnanl.c: Update.
* gnulib/import/itold.c: Update.
* gnulib/import/libc-config.h: Update.
* gnulib/import/limits.in.h: Update.
* gnulib/import/localcharset.c: Update.
* gnulib/import/localcharset.h: Update.
* gnulib/import/localtime-buffer.c: Update.
* gnulib/import/localtime-buffer.h: Update.
* gnulib/import/lstat.c: Update.
* gnulib/import/m4/00gnulib.m4: Update.
* gnulib/import/m4/__inline.m4: Update.
* gnulib/import/m4/absolute-header.m4: Update.
* gnulib/import/m4/alloca.m4: Update.
* gnulib/import/m4/builtin-expect.m4: Update.
* gnulib/import/m4/canonicalize.m4: Update.
* gnulib/import/m4/chdir-long.m4: Update.
* gnulib/import/m4/close.m4: Update.
* gnulib/import/m4/closedir.m4: Update.
* gnulib/import/m4/configmake.m4: Update.
* gnulib/import/m4/d-ino.m4: Update.
* gnulib/import/m4/d-type.m4: Update.
* gnulib/import/m4/dirent_h.m4: Update.
* gnulib/import/m4/dirfd.m4: Update.
* gnulib/import/m4/dirname.m4: Update.
* gnulib/import/m4/double-slash-root.m4: Update.
* gnulib/import/m4/dup.m4: Update.
* gnulib/import/m4/dup2.m4: Update.
* gnulib/import/m4/eealloc.m4: Update.
* gnulib/import/m4/environ.m4: Update.
* gnulib/import/m4/errno_h.m4: Update.
* gnulib/import/m4/error.m4: Update.
* gnulib/import/m4/exponentd.m4: Update.
* gnulib/import/m4/exponentl.m4: Update.
* gnulib/import/m4/extensions.m4: Update.
* gnulib/import/m4/extern-inline.m4: Update.
* gnulib/import/m4/fchdir.m4: Update.
* gnulib/import/m4/fcntl-o.m4: Update.
* gnulib/import/m4/fcntl.m4: Update.
* gnulib/import/m4/fcntl_h.m4: Update.
* gnulib/import/m4/fdopendir.m4: Update.
* gnulib/import/m4/filenamecat.m4: Update.
* gnulib/import/m4/flexmember.m4: Update.
* gnulib/import/m4/float_h.m4: Update.
* gnulib/import/m4/fnmatch.m4: Update.
* gnulib/import/m4/fnmatch_h.m4: Update.
* gnulib/import/m4/fpieee.m4: Update.
* gnulib/import/m4/frexp.m4: Update.
* gnulib/import/m4/frexpl.m4: Update.
* gnulib/import/m4/fstat.m4: Update.
* gnulib/import/m4/fstatat.m4: Update.
* gnulib/import/m4/getcwd-abort-bug.m4: Update.
* gnulib/import/m4/getcwd-path-max.m4: Update.
* gnulib/import/m4/getcwd.m4: Update.
* gnulib/import/m4/getdtablesize.m4: Update.
* gnulib/import/m4/getlogin.m4: Update.
* gnulib/import/m4/getlogin_r.m4: Update.
* gnulib/import/m4/getpagesize.m4: Update.
* gnulib/import/m4/getprogname.m4: Update.
* gnulib/import/m4/gettimeofday.m4: Update.
* gnulib/import/m4/glibc21.m4: Update.
* gnulib/import/m4/glob.m4: Update.
* gnulib/import/m4/glob_h.m4: Update.
* gnulib/import/m4/gnulib-cache.m4: Update.
* gnulib/import/m4/gnulib-common.m4: Update.
* gnulib/import/m4/gnulib-comp.m4: Update.
* gnulib/import/m4/gnulib-tool.m4: Update.
* gnulib/import/m4/hard-locale.m4: Update.
* gnulib/import/m4/include_next.m4: Update.
* gnulib/import/m4/inttypes-pri.m4: Update.
* gnulib/import/m4/inttypes.m4: Update.
* gnulib/import/m4/isnand.m4: Update.
* gnulib/import/m4/isnanl.m4: Update.
* gnulib/import/m4/largefile.m4: Update.
* gnulib/import/m4/limits-h.m4: Update.
* gnulib/import/m4/localcharset.m4: Update.
* gnulib/import/m4/locale-fr.m4: Update.
* gnulib/import/m4/locale-ja.m4: Update.
* gnulib/import/m4/locale-zh.m4: Update.
* gnulib/import/m4/localtime-buffer.m4: Update.
* gnulib/import/m4/longlong.m4: Update.
* gnulib/import/m4/lstat.m4: Update.
* gnulib/import/m4/malloc.m4: Update.
* gnulib/import/m4/malloca.m4: Update.
* gnulib/import/m4/math_h.m4: Update.
* gnulib/import/m4/mbrtowc.m4: Update.
* gnulib/import/m4/mbsinit.m4: Update.
* gnulib/import/m4/mbsrtowcs.m4: Update.
* gnulib/import/m4/mbstate_t.m4: Update.
* gnulib/import/m4/memchr.m4: Update.
* gnulib/import/m4/memmem.m4: Update.
* gnulib/import/m4/mempcpy.m4: Update.
* gnulib/import/m4/memrchr.m4: Update.
* gnulib/import/m4/mkdir.m4: Update.
* gnulib/import/m4/mkstemp.m4: Update.
* gnulib/import/m4/mmap-anon.m4: Update.
* gnulib/import/m4/mode_t.m4: Update.
* gnulib/import/m4/msvc-inval.m4: Update.
* gnulib/import/m4/msvc-nothrow.m4: Update.
* gnulib/import/m4/multiarch.m4: Update.
* gnulib/import/m4/nocrash.m4: Update.
* gnulib/import/m4/off_t.m4: Update.
* gnulib/import/m4/onceonly.m4: Update.
* gnulib/import/m4/open-cloexec.m4: Update.
* gnulib/import/m4/open.m4: Update.
* gnulib/import/m4/openat.m4: Update.
* gnulib/import/m4/opendir.m4: Update.
* gnulib/import/m4/pathmax.m4: Update.
* gnulib/import/m4/rawmemchr.m4: Update.
* gnulib/import/m4/readdir.m4: Update.
* gnulib/import/m4/readlink.m4: Update.
* gnulib/import/m4/realloc.m4: Update.
* gnulib/import/m4/rename.m4: Update.
* gnulib/import/m4/rewinddir.m4: Update.
* gnulib/import/m4/rmdir.m4: Update.
* gnulib/import/m4/save-cwd.m4: Update.
* gnulib/import/m4/secure_getenv.m4: Update.
* gnulib/import/m4/setenv.m4: Update.
* gnulib/import/m4/signal_h.m4: Update.
* gnulib/import/m4/ssize_t.m4: Update.
* gnulib/import/m4/stat-time.m4: Update.
* gnulib/import/m4/stat.m4: Update.
* gnulib/import/m4/std-gnu11.m4: Update.
* gnulib/import/m4/stdbool.m4: Update.
* gnulib/import/m4/stddef_h.m4: Update.
* gnulib/import/m4/stdint.m4: Update.
* gnulib/import/m4/stdio_h.m4: Update.
* gnulib/import/m4/stdlib_h.m4: Update.
* gnulib/import/m4/strchrnul.m4: Update.
* gnulib/import/m4/strdup.m4: Update.
* gnulib/import/m4/strerror.m4: Update.
* gnulib/import/m4/string_h.m4: Update.
* gnulib/import/m4/strstr.m4: Update.
* gnulib/import/m4/strtok_r.m4: Update.
* gnulib/import/m4/sys_socket_h.m4: Update.
* gnulib/import/m4/sys_stat_h.m4: Update.
* gnulib/import/m4/sys_time_h.m4: Update.
* gnulib/import/m4/sys_types_h.m4: Update.
* gnulib/import/m4/tempname.m4: Update.
* gnulib/import/m4/time_h.m4: Update.
* gnulib/import/m4/unistd-safer.m4: Update.
* gnulib/import/m4/unistd_h.m4: Update.
* gnulib/import/m4/warn-on-use.m4: Update.
* gnulib/import/m4/wchar_h.m4: Update.
* gnulib/import/m4/wchar_t.m4: Update.
* gnulib/import/m4/wctype_h.m4: Update.
* gnulib/import/m4/wint_t.m4: Update.
* gnulib/import/malloc.c: Update.
* gnulib/import/malloc/scratch_buffer.h: Update.
* gnulib/import/malloc/scratch_buffer_grow.c: Update.
* gnulib/import/malloc/scratch_buffer_grow_preserve.c: Update.
* gnulib/import/malloc/scratch_buffer_set_array_size.c: Update.
* gnulib/import/malloca.c: Update.
* gnulib/import/malloca.h: Update.
* gnulib/import/malloca.valgrind: Update.
* gnulib/import/math.in.h: Update.
* gnulib/import/mbrtowc.c: Update.
* gnulib/import/mbsinit.c: Update.
* gnulib/import/mbsrtowcs-impl.h: Update.
* gnulib/import/mbsrtowcs-state.c: Update.
* gnulib/import/mbsrtowcs.c: Update.
* gnulib/import/memchr.c: Update.
* gnulib/import/memmem.c: Update.
* gnulib/import/mempcpy.c: Update.
* gnulib/import/memrchr.c: Update.
* gnulib/import/mkdir.c: Update.
* gnulib/import/mkstemp.c: Update.
* gnulib/import/msvc-inval.c: Update.
* gnulib/import/msvc-inval.h: Update.
* gnulib/import/msvc-nothrow.c: Update.
* gnulib/import/msvc-nothrow.h: Update.
* gnulib/import/open.c: Update.
* gnulib/import/openat-die.c: Update.
* gnulib/import/openat-priv.h: Update.
* gnulib/import/openat-proc.c: Update.
* gnulib/import/openat.c: Update.
* gnulib/import/openat.h: Update.
* gnulib/import/opendir.c: Update.
* gnulib/import/pathmax.h: Update.
* gnulib/import/pipe-safer.c: Update.
* gnulib/import/rawmemchr.c: Update.
* gnulib/import/readdir.c: Update.
* gnulib/import/readlink.c: Update.
* gnulib/import/realloc.c: Update.
* gnulib/import/ref-add.sin: Update.
* gnulib/import/ref-del.sin: Update.
* gnulib/import/rename.c: Update.
* gnulib/import/rewinddir.c: Update.
* gnulib/import/rmdir.c: Update.
* gnulib/import/same-inode.h: Update.
* gnulib/import/save-cwd.c: Update.
* gnulib/import/save-cwd.h: Update.
* gnulib/import/scratch_buffer.h: Update.
* gnulib/import/secure_getenv.c: Update.
* gnulib/import/setenv.c: Update.
* gnulib/import/signal.in.h: Update.
* gnulib/import/stat-time.c: Update.
* gnulib/import/stat-time.h: Update.
* gnulib/import/stat-w32.c: Update.
* gnulib/import/stat-w32.h: Update.
* gnulib/import/stat.c: Update.
* gnulib/import/stdbool.in.h: Update.
* gnulib/import/stddef.in.h: Update.
* gnulib/import/stdint.in.h: Update.
* gnulib/import/stdio.in.h: Update.
* gnulib/import/stdlib.in.h: Update.
* gnulib/import/str-two-way.h: Update.
* gnulib/import/strchrnul.c: Update.
* gnulib/import/strdup.c: Update.
* gnulib/import/streq.h: Update.
* gnulib/import/strerror-override.c: Update.
* gnulib/import/strerror-override.h: Update.
* gnulib/import/strerror.c: Update.
* gnulib/import/string.in.h: Update.
* gnulib/import/stripslash.c: Update.
* gnulib/import/strnlen1.c: Update.
* gnulib/import/strnlen1.h: Update.
* gnulib/import/strstr.c: Update.
* gnulib/import/strtok_r.c: Update.
* gnulib/import/sys_stat.in.h: Update.
* gnulib/import/sys_time.in.h: Update.
* gnulib/import/sys_types.in.h: Update.
* gnulib/import/tempname.c: Update.
* gnulib/import/tempname.h: Update.
* gnulib/import/time.in.h: Update.
* gnulib/import/unistd--.h: Update.
* gnulib/import/unistd-safer.h: Update.
* gnulib/import/unistd.in.h: Update.
* gnulib/import/unsetenv.c: Update.
* gnulib/import/verify.h: Update.
* gnulib/import/extra/snippet/warn-on-use.h: Update.
* gnulib/import/wchar.in.h: Update.
* gnulib/import/wctype.in.h: Update.
* gnulib/import/xalloc-oversized.h: Update.
* gnulib/update-gnulib.sh (GNULIB_COMMIT_SHA1): Set to
"53e2c179f26a890fa6685af4b6c1397ee370433b".
665 lines
20 KiB
Plaintext
665 lines
20 KiB
Plaintext
# mbrtowc.m4 serial 27 -*- coding: utf-8 -*-
|
|
dnl Copyright (C) 2001-2002, 2004-2005, 2008-2016 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.
|
|
|
|
AC_DEFUN([gl_FUNC_MBRTOWC],
|
|
[
|
|
AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
|
|
|
|
AC_REQUIRE([AC_TYPE_MBSTATE_T])
|
|
gl_MBSTATE_T_BROKEN
|
|
|
|
AC_CHECK_FUNCS_ONCE([mbrtowc])
|
|
if test $ac_cv_func_mbrtowc = no; then
|
|
HAVE_MBRTOWC=0
|
|
AC_CHECK_DECLS([mbrtowc],,, [[
|
|
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
|
|
<wchar.h>.
|
|
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
|
|
included before <wchar.h>. */
|
|
#include <stddef.h>
|
|
#include <stdio.h>
|
|
#include <time.h>
|
|
#include <wchar.h>
|
|
]])
|
|
if test $ac_cv_have_decl_mbrtowc = yes; then
|
|
dnl On Minix 3.1.8, the system's <wchar.h> declares mbrtowc() although
|
|
dnl it does not have the function. Avoid a collision with gnulib's
|
|
dnl replacement.
|
|
REPLACE_MBRTOWC=1
|
|
fi
|
|
else
|
|
if test $REPLACE_MBSTATE_T = 1; then
|
|
REPLACE_MBRTOWC=1
|
|
else
|
|
gl_MBRTOWC_NULL_ARG1
|
|
gl_MBRTOWC_NULL_ARG2
|
|
gl_MBRTOWC_RETVAL
|
|
gl_MBRTOWC_NUL_RETVAL
|
|
gl_MBRTOWC_EMPTY_INPUT
|
|
gl_MBRTOWC_C_LOCALE
|
|
case "$gl_cv_func_mbrtowc_null_arg1" in
|
|
*yes) ;;
|
|
*) AC_DEFINE([MBRTOWC_NULL_ARG1_BUG], [1],
|
|
[Define if the mbrtowc function has the NULL pwc argument bug.])
|
|
REPLACE_MBRTOWC=1
|
|
;;
|
|
esac
|
|
case "$gl_cv_func_mbrtowc_null_arg2" in
|
|
*yes) ;;
|
|
*) AC_DEFINE([MBRTOWC_NULL_ARG2_BUG], [1],
|
|
[Define if the mbrtowc function has the NULL string argument bug.])
|
|
REPLACE_MBRTOWC=1
|
|
;;
|
|
esac
|
|
case "$gl_cv_func_mbrtowc_retval" in
|
|
*yes) ;;
|
|
*) AC_DEFINE([MBRTOWC_RETVAL_BUG], [1],
|
|
[Define if the mbrtowc function returns a wrong return value.])
|
|
REPLACE_MBRTOWC=1
|
|
;;
|
|
esac
|
|
case "$gl_cv_func_mbrtowc_nul_retval" in
|
|
*yes) ;;
|
|
*) AC_DEFINE([MBRTOWC_NUL_RETVAL_BUG], [1],
|
|
[Define if the mbrtowc function does not return 0 for a NUL character.])
|
|
REPLACE_MBRTOWC=1
|
|
;;
|
|
esac
|
|
case "$gl_cv_func_mbrtowc_empty_input" in
|
|
*yes) ;;
|
|
*) AC_DEFINE([MBRTOWC_EMPTY_INPUT_BUG], [1],
|
|
[Define if the mbrtowc function does not return (size_t) -2
|
|
for empty input.])
|
|
REPLACE_MBRTOWC=1
|
|
;;
|
|
esac
|
|
case $gl_cv_C_locale_sans_EILSEQ in
|
|
*yes) ;;
|
|
*) AC_DEFINE([C_LOCALE_MAYBE_EILSEQ], [1],
|
|
[Define to 1 if the C locale may have encoding errors.])
|
|
REPLACE_MBRTOWC=1
|
|
;;
|
|
esac
|
|
fi
|
|
fi
|
|
])
|
|
|
|
dnl Test whether mbsinit() and mbrtowc() need to be overridden in a way that
|
|
dnl redefines the semantics of the given mbstate_t type.
|
|
dnl Result is REPLACE_MBSTATE_T.
|
|
dnl When this is set to 1, we replace both mbsinit() and mbrtowc(), in order to
|
|
dnl avoid inconsistencies.
|
|
|
|
AC_DEFUN([gl_MBSTATE_T_BROKEN],
|
|
[
|
|
AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
|
|
|
|
AC_REQUIRE([AC_TYPE_MBSTATE_T])
|
|
AC_CHECK_FUNCS_ONCE([mbsinit])
|
|
AC_CHECK_FUNCS_ONCE([mbrtowc])
|
|
if test $ac_cv_func_mbsinit = yes && test $ac_cv_func_mbrtowc = yes; then
|
|
gl_MBRTOWC_INCOMPLETE_STATE
|
|
gl_MBRTOWC_SANITYCHECK
|
|
REPLACE_MBSTATE_T=0
|
|
case "$gl_cv_func_mbrtowc_incomplete_state" in
|
|
*yes) ;;
|
|
*) REPLACE_MBSTATE_T=1 ;;
|
|
esac
|
|
case "$gl_cv_func_mbrtowc_sanitycheck" in
|
|
*yes) ;;
|
|
*) REPLACE_MBSTATE_T=1 ;;
|
|
esac
|
|
else
|
|
REPLACE_MBSTATE_T=1
|
|
fi
|
|
])
|
|
|
|
dnl Test whether mbrtowc puts the state into non-initial state when parsing an
|
|
dnl incomplete multibyte character.
|
|
dnl Result is gl_cv_func_mbrtowc_incomplete_state.
|
|
|
|
AC_DEFUN([gl_MBRTOWC_INCOMPLETE_STATE],
|
|
[
|
|
AC_REQUIRE([AC_PROG_CC])
|
|
AC_REQUIRE([gt_LOCALE_JA])
|
|
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
|
|
AC_CACHE_CHECK([whether mbrtowc handles incomplete characters],
|
|
[gl_cv_func_mbrtowc_incomplete_state],
|
|
[
|
|
dnl Initial guess, used when cross-compiling or when no suitable locale
|
|
dnl is present.
|
|
changequote(,)dnl
|
|
case "$host_os" in
|
|
# Guess no on AIX and OSF/1.
|
|
aix* | osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;;
|
|
# Guess yes otherwise.
|
|
*) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;;
|
|
esac
|
|
changequote([,])dnl
|
|
if test $LOCALE_JA != none; then
|
|
AC_RUN_IFELSE(
|
|
[AC_LANG_SOURCE([[
|
|
#include <locale.h>
|
|
#include <string.h>
|
|
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
|
|
<wchar.h>.
|
|
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
|
|
included before <wchar.h>. */
|
|
#include <stddef.h>
|
|
#include <stdio.h>
|
|
#include <time.h>
|
|
#include <wchar.h>
|
|
int main ()
|
|
{
|
|
if (setlocale (LC_ALL, "$LOCALE_JA") != NULL)
|
|
{
|
|
const char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */
|
|
mbstate_t state;
|
|
wchar_t wc;
|
|
|
|
memset (&state, '\0', sizeof (mbstate_t));
|
|
if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2))
|
|
if (mbsinit (&state))
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}]])],
|
|
[gl_cv_func_mbrtowc_incomplete_state=yes],
|
|
[gl_cv_func_mbrtowc_incomplete_state=no],
|
|
[:])
|
|
fi
|
|
])
|
|
])
|
|
|
|
dnl Test whether mbrtowc works not worse than mbtowc.
|
|
dnl Result is gl_cv_func_mbrtowc_sanitycheck.
|
|
|
|
AC_DEFUN([gl_MBRTOWC_SANITYCHECK],
|
|
[
|
|
AC_REQUIRE([AC_PROG_CC])
|
|
AC_REQUIRE([gt_LOCALE_ZH_CN])
|
|
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
|
|
AC_CACHE_CHECK([whether mbrtowc works as well as mbtowc],
|
|
[gl_cv_func_mbrtowc_sanitycheck],
|
|
[
|
|
dnl Initial guess, used when cross-compiling or when no suitable locale
|
|
dnl is present.
|
|
changequote(,)dnl
|
|
case "$host_os" in
|
|
# Guess no on Solaris 8.
|
|
solaris2.8) gl_cv_func_mbrtowc_sanitycheck="guessing no" ;;
|
|
# Guess yes otherwise.
|
|
*) gl_cv_func_mbrtowc_sanitycheck="guessing yes" ;;
|
|
esac
|
|
changequote([,])dnl
|
|
if test $LOCALE_ZH_CN != none; then
|
|
AC_RUN_IFELSE(
|
|
[AC_LANG_SOURCE([[
|
|
#include <locale.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
|
|
<wchar.h>.
|
|
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
|
|
included before <wchar.h>. */
|
|
#include <stddef.h>
|
|
#include <stdio.h>
|
|
#include <time.h>
|
|
#include <wchar.h>
|
|
int main ()
|
|
{
|
|
/* This fails on Solaris 8:
|
|
mbrtowc returns 2, and sets wc to 0x00F0.
|
|
mbtowc returns 4 (correct) and sets wc to 0x5EDC. */
|
|
if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
|
|
{
|
|
char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */
|
|
mbstate_t state;
|
|
wchar_t wc;
|
|
|
|
memset (&state, '\0', sizeof (mbstate_t));
|
|
if (mbrtowc (&wc, input + 3, 6, &state) != 4
|
|
&& mbtowc (&wc, input + 3, 6) == 4)
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}]])],
|
|
[gl_cv_func_mbrtowc_sanitycheck=yes],
|
|
[gl_cv_func_mbrtowc_sanitycheck=no],
|
|
[:])
|
|
fi
|
|
])
|
|
])
|
|
|
|
dnl Test whether mbrtowc supports a NULL pwc argument correctly.
|
|
dnl Result is gl_cv_func_mbrtowc_null_arg1.
|
|
|
|
AC_DEFUN([gl_MBRTOWC_NULL_ARG1],
|
|
[
|
|
AC_REQUIRE([AC_PROG_CC])
|
|
AC_REQUIRE([gt_LOCALE_FR_UTF8])
|
|
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
|
|
AC_CACHE_CHECK([whether mbrtowc handles a NULL pwc argument],
|
|
[gl_cv_func_mbrtowc_null_arg1],
|
|
[
|
|
dnl Initial guess, used when cross-compiling or when no suitable locale
|
|
dnl is present.
|
|
changequote(,)dnl
|
|
case "$host_os" in
|
|
# Guess no on Solaris.
|
|
solaris*) gl_cv_func_mbrtowc_null_arg1="guessing no" ;;
|
|
# Guess yes otherwise.
|
|
*) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;;
|
|
esac
|
|
changequote([,])dnl
|
|
if test $LOCALE_FR_UTF8 != none; then
|
|
AC_RUN_IFELSE(
|
|
[AC_LANG_SOURCE([[
|
|
#include <locale.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
|
|
<wchar.h>.
|
|
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
|
|
included before <wchar.h>. */
|
|
#include <stddef.h>
|
|
#include <stdio.h>
|
|
#include <time.h>
|
|
#include <wchar.h>
|
|
int main ()
|
|
{
|
|
int result = 0;
|
|
|
|
if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
|
|
{
|
|
char input[] = "\303\237er";
|
|
mbstate_t state;
|
|
wchar_t wc;
|
|
size_t ret;
|
|
|
|
memset (&state, '\0', sizeof (mbstate_t));
|
|
wc = (wchar_t) 0xBADFACE;
|
|
ret = mbrtowc (&wc, input, 5, &state);
|
|
if (ret != 2)
|
|
result |= 1;
|
|
if (!mbsinit (&state))
|
|
result |= 2;
|
|
|
|
memset (&state, '\0', sizeof (mbstate_t));
|
|
ret = mbrtowc (NULL, input, 5, &state);
|
|
if (ret != 2) /* Solaris 7 fails here: ret is -1. */
|
|
result |= 4;
|
|
if (!mbsinit (&state))
|
|
result |= 8;
|
|
}
|
|
return result;
|
|
}]])],
|
|
[gl_cv_func_mbrtowc_null_arg1=yes],
|
|
[gl_cv_func_mbrtowc_null_arg1=no],
|
|
[:])
|
|
fi
|
|
])
|
|
])
|
|
|
|
dnl Test whether mbrtowc supports a NULL string argument correctly.
|
|
dnl Result is gl_cv_func_mbrtowc_null_arg2.
|
|
|
|
AC_DEFUN([gl_MBRTOWC_NULL_ARG2],
|
|
[
|
|
AC_REQUIRE([AC_PROG_CC])
|
|
AC_REQUIRE([gt_LOCALE_FR_UTF8])
|
|
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
|
|
AC_CACHE_CHECK([whether mbrtowc handles a NULL string argument],
|
|
[gl_cv_func_mbrtowc_null_arg2],
|
|
[
|
|
dnl Initial guess, used when cross-compiling or when no suitable locale
|
|
dnl is present.
|
|
changequote(,)dnl
|
|
case "$host_os" in
|
|
# Guess no on OSF/1.
|
|
osf*) gl_cv_func_mbrtowc_null_arg2="guessing no" ;;
|
|
# Guess yes otherwise.
|
|
*) gl_cv_func_mbrtowc_null_arg2="guessing yes" ;;
|
|
esac
|
|
changequote([,])dnl
|
|
if test $LOCALE_FR_UTF8 != none; then
|
|
AC_RUN_IFELSE(
|
|
[AC_LANG_SOURCE([[
|
|
#include <locale.h>
|
|
#include <string.h>
|
|
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
|
|
<wchar.h>.
|
|
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
|
|
included before <wchar.h>. */
|
|
#include <stddef.h>
|
|
#include <stdio.h>
|
|
#include <time.h>
|
|
#include <wchar.h>
|
|
int main ()
|
|
{
|
|
if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
|
|
{
|
|
mbstate_t state;
|
|
wchar_t wc;
|
|
int ret;
|
|
|
|
memset (&state, '\0', sizeof (mbstate_t));
|
|
wc = (wchar_t) 0xBADFACE;
|
|
mbrtowc (&wc, NULL, 5, &state);
|
|
/* Check that wc was not modified. */
|
|
if (wc != (wchar_t) 0xBADFACE)
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}]])],
|
|
[gl_cv_func_mbrtowc_null_arg2=yes],
|
|
[gl_cv_func_mbrtowc_null_arg2=no],
|
|
[:])
|
|
fi
|
|
])
|
|
])
|
|
|
|
dnl Test whether mbrtowc, when parsing the end of a multibyte character,
|
|
dnl correctly returns the number of bytes that were needed to complete the
|
|
dnl character (not the total number of bytes of the multibyte character).
|
|
dnl Result is gl_cv_func_mbrtowc_retval.
|
|
|
|
AC_DEFUN([gl_MBRTOWC_RETVAL],
|
|
[
|
|
AC_REQUIRE([AC_PROG_CC])
|
|
AC_REQUIRE([gt_LOCALE_FR_UTF8])
|
|
AC_REQUIRE([gt_LOCALE_JA])
|
|
AC_REQUIRE([AC_CANONICAL_HOST])
|
|
AC_CACHE_CHECK([whether mbrtowc has a correct return value],
|
|
[gl_cv_func_mbrtowc_retval],
|
|
[
|
|
dnl Initial guess, used when cross-compiling or when no suitable locale
|
|
dnl is present.
|
|
changequote(,)dnl
|
|
case "$host_os" in
|
|
# Guess no on HP-UX, Solaris, native Windows.
|
|
hpux* | solaris* | mingw*) gl_cv_func_mbrtowc_retval="guessing no" ;;
|
|
# Guess yes otherwise.
|
|
*) gl_cv_func_mbrtowc_retval="guessing yes" ;;
|
|
esac
|
|
changequote([,])dnl
|
|
if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none \
|
|
|| { case "$host_os" in mingw*) true;; *) false;; esac; }; then
|
|
AC_RUN_IFELSE(
|
|
[AC_LANG_SOURCE([[
|
|
#include <locale.h>
|
|
#include <string.h>
|
|
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
|
|
<wchar.h>.
|
|
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
|
|
included before <wchar.h>. */
|
|
#include <stddef.h>
|
|
#include <stdio.h>
|
|
#include <time.h>
|
|
#include <wchar.h>
|
|
int main ()
|
|
{
|
|
int result = 0;
|
|
int found_some_locale = 0;
|
|
/* This fails on Solaris. */
|
|
if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
|
|
{
|
|
char input[] = "B\303\274\303\237er"; /* "Büßer" */
|
|
mbstate_t state;
|
|
wchar_t wc;
|
|
|
|
memset (&state, '\0', sizeof (mbstate_t));
|
|
if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2))
|
|
{
|
|
input[1] = '\0';
|
|
if (mbrtowc (&wc, input + 2, 5, &state) != 1)
|
|
result |= 1;
|
|
}
|
|
found_some_locale = 1;
|
|
}
|
|
/* This fails on HP-UX 11.11. */
|
|
if (setlocale (LC_ALL, "$LOCALE_JA") != NULL)
|
|
{
|
|
char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */
|
|
mbstate_t state;
|
|
wchar_t wc;
|
|
|
|
memset (&state, '\0', sizeof (mbstate_t));
|
|
if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2))
|
|
{
|
|
input[1] = '\0';
|
|
if (mbrtowc (&wc, input + 2, 5, &state) != 2)
|
|
result |= 2;
|
|
}
|
|
found_some_locale = 1;
|
|
}
|
|
/* This fails on native Windows. */
|
|
if (setlocale (LC_ALL, "Japanese_Japan.932") != NULL)
|
|
{
|
|
char input[] = "<\223\372\226\173\214\352>"; /* "<日本語>" */
|
|
mbstate_t state;
|
|
wchar_t wc;
|
|
|
|
memset (&state, '\0', sizeof (mbstate_t));
|
|
if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2))
|
|
{
|
|
input[3] = '\0';
|
|
if (mbrtowc (&wc, input + 4, 4, &state) != 1)
|
|
result |= 4;
|
|
}
|
|
found_some_locale = 1;
|
|
}
|
|
if (setlocale (LC_ALL, "Chinese_Taiwan.950") != NULL)
|
|
{
|
|
char input[] = "<\244\351\245\273\273\171>"; /* "<日本語>" */
|
|
mbstate_t state;
|
|
wchar_t wc;
|
|
|
|
memset (&state, '\0', sizeof (mbstate_t));
|
|
if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2))
|
|
{
|
|
input[3] = '\0';
|
|
if (mbrtowc (&wc, input + 4, 4, &state) != 1)
|
|
result |= 8;
|
|
}
|
|
found_some_locale = 1;
|
|
}
|
|
if (setlocale (LC_ALL, "Chinese_China.936") != NULL)
|
|
{
|
|
char input[] = "<\310\325\261\276\325\132>"; /* "<日本語>" */
|
|
mbstate_t state;
|
|
wchar_t wc;
|
|
|
|
memset (&state, '\0', sizeof (mbstate_t));
|
|
if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2))
|
|
{
|
|
input[3] = '\0';
|
|
if (mbrtowc (&wc, input + 4, 4, &state) != 1)
|
|
result |= 16;
|
|
}
|
|
found_some_locale = 1;
|
|
}
|
|
return (found_some_locale ? result : 77);
|
|
}]])],
|
|
[gl_cv_func_mbrtowc_retval=yes],
|
|
[if test $? != 77; then
|
|
gl_cv_func_mbrtowc_retval=no
|
|
fi
|
|
],
|
|
[:])
|
|
fi
|
|
])
|
|
])
|
|
|
|
dnl Test whether mbrtowc, when parsing a NUL character, correctly returns 0.
|
|
dnl Result is gl_cv_func_mbrtowc_nul_retval.
|
|
|
|
AC_DEFUN([gl_MBRTOWC_NUL_RETVAL],
|
|
[
|
|
AC_REQUIRE([AC_PROG_CC])
|
|
AC_REQUIRE([gt_LOCALE_ZH_CN])
|
|
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
|
|
AC_CACHE_CHECK([whether mbrtowc returns 0 when parsing a NUL character],
|
|
[gl_cv_func_mbrtowc_nul_retval],
|
|
[
|
|
dnl Initial guess, used when cross-compiling or when no suitable locale
|
|
dnl is present.
|
|
changequote(,)dnl
|
|
case "$host_os" in
|
|
# Guess no on Solaris 8 and 9.
|
|
solaris2.[89]) gl_cv_func_mbrtowc_nul_retval="guessing no" ;;
|
|
# Guess yes otherwise.
|
|
*) gl_cv_func_mbrtowc_nul_retval="guessing yes" ;;
|
|
esac
|
|
changequote([,])dnl
|
|
if test $LOCALE_ZH_CN != none; then
|
|
AC_RUN_IFELSE(
|
|
[AC_LANG_SOURCE([[
|
|
#include <locale.h>
|
|
#include <string.h>
|
|
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
|
|
<wchar.h>.
|
|
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
|
|
included before <wchar.h>. */
|
|
#include <stddef.h>
|
|
#include <stdio.h>
|
|
#include <time.h>
|
|
#include <wchar.h>
|
|
int main ()
|
|
{
|
|
/* This fails on Solaris 8 and 9. */
|
|
if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
|
|
{
|
|
mbstate_t state;
|
|
wchar_t wc;
|
|
|
|
memset (&state, '\0', sizeof (mbstate_t));
|
|
if (mbrtowc (&wc, "", 1, &state) != 0)
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}]])],
|
|
[gl_cv_func_mbrtowc_nul_retval=yes],
|
|
[gl_cv_func_mbrtowc_nul_retval=no],
|
|
[:])
|
|
fi
|
|
])
|
|
])
|
|
|
|
dnl Test whether mbrtowc returns the correct value on empty input.
|
|
|
|
AC_DEFUN([gl_MBRTOWC_EMPTY_INPUT],
|
|
[
|
|
AC_REQUIRE([AC_PROG_CC])
|
|
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
|
|
AC_CACHE_CHECK([whether mbrtowc works on empty input],
|
|
[gl_cv_func_mbrtowc_empty_input],
|
|
[
|
|
dnl Initial guess, used when cross-compiling or when no suitable locale
|
|
dnl is present.
|
|
changequote(,)dnl
|
|
case "$host_os" in
|
|
# Guess no on AIX and glibc systems.
|
|
aix* | *-gnu*)
|
|
gl_cv_func_mbrtowc_empty_input="guessing no" ;;
|
|
*) gl_cv_func_mbrtowc_empty_input="guessing yes" ;;
|
|
esac
|
|
changequote([,])dnl
|
|
AC_RUN_IFELSE(
|
|
[AC_LANG_SOURCE([[
|
|
#include <wchar.h>
|
|
static wchar_t wc;
|
|
static mbstate_t mbs;
|
|
int
|
|
main (void)
|
|
{
|
|
return mbrtowc (&wc, "", 0, &mbs) != (size_t) -2;
|
|
}]])],
|
|
[gl_cv_func_mbrtowc_empty_input=yes],
|
|
[gl_cv_func_mbrtowc_empty_input=no],
|
|
[:])
|
|
])
|
|
])
|
|
|
|
dnl Test whether mbrtowc reports encoding errors in the C locale.
|
|
dnl Although POSIX was never intended to allow this, the GNU C Library
|
|
dnl and other implementations do it. See:
|
|
dnl https://sourceware.org/bugzilla/show_bug.cgi?id=19932
|
|
|
|
AC_DEFUN([gl_MBRTOWC_C_LOCALE],
|
|
[
|
|
AC_CACHE_CHECK([whether the C locale is free of encoding errors],
|
|
[gl_cv_C_locale_sans_EILSEQ],
|
|
[
|
|
dnl Initial guess, used when cross-compiling or when no suitable locale
|
|
dnl is present.
|
|
gl_cv_C_locale_sans_EILSEQ="guessing no"
|
|
|
|
AC_RUN_IFELSE(
|
|
[AC_LANG_PROGRAM(
|
|
[[#include <limits.h>
|
|
#include <locale.h>
|
|
#include <wchar.h>
|
|
]], [[
|
|
int i;
|
|
char *locale = setlocale (LC_ALL, "C");
|
|
if (! locale)
|
|
return 1;
|
|
for (i = CHAR_MIN; i <= CHAR_MAX; i++)
|
|
{
|
|
char c = i;
|
|
wchar_t wc;
|
|
mbstate_t mbs = { 0, };
|
|
size_t ss = mbrtowc (&wc, &c, 1, &mbs);
|
|
if (1 < ss)
|
|
return 1;
|
|
}
|
|
return 0;
|
|
]])],
|
|
[gl_cv_C_locale_sans_EILSEQ=yes],
|
|
[gl_cv_C_locale_sans_EILSEQ=no],
|
|
[:])])
|
|
])
|
|
|
|
# Prerequisites of lib/mbrtowc.c.
|
|
AC_DEFUN([gl_PREREQ_MBRTOWC], [
|
|
:
|
|
])
|
|
|
|
|
|
dnl From Paul Eggert
|
|
|
|
dnl This is an override of an autoconf macro.
|
|
|
|
AC_DEFUN([AC_FUNC_MBRTOWC],
|
|
[
|
|
dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60.
|
|
AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
|
|
gl_cv_func_mbrtowc,
|
|
[AC_LINK_IFELSE(
|
|
[AC_LANG_PROGRAM(
|
|
[[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be
|
|
included before <wchar.h>.
|
|
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h>
|
|
must be included before <wchar.h>. */
|
|
#include <stddef.h>
|
|
#include <stdio.h>
|
|
#include <time.h>
|
|
#include <wchar.h>]],
|
|
[[wchar_t wc;
|
|
char const s[] = "";
|
|
size_t n = 1;
|
|
mbstate_t state;
|
|
return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])],
|
|
gl_cv_func_mbrtowc=yes,
|
|
gl_cv_func_mbrtowc=no)])
|
|
if test $gl_cv_func_mbrtowc = yes; then
|
|
AC_DEFINE([HAVE_MBRTOWC], [1],
|
|
[Define to 1 if mbrtowc and mbstate_t are properly declared.])
|
|
fi
|
|
])
|