* lib/stdlib.in.h (mbtowc): Test also HAVE_MBTOWC.
* m4/mbtowc.m4 (gl_FUNC_MBTOWC): Test whether mbtowc exists. Set
HAVE_MBTOWC.
* m4/stdlib_h.m4 (gl_STDLIB_H): Test whether mbtowc is declared.
(gl_STDLIB_H_DEFAULTS): Initialize HAVE_MBTOWC.
* modules/stdlib (Makefile.am): Substitute HAVE_MBTOWC.
* modules/mbtowc (Depends-on, configure.ac): Test also HAVE_MBTOWC.
* doc/posix-functions/mbtowc.texi: Mention the change.
+2019-01-24 Bruno Haible <bruno@clisp.org>
+
+ mbtowc: Fix compilation error on Android 4.3.
+ * lib/stdlib.in.h (mbtowc): Test also HAVE_MBTOWC.
+ * m4/mbtowc.m4 (gl_FUNC_MBTOWC): Test whether mbtowc exists. Set
+ HAVE_MBTOWC.
+ * m4/stdlib_h.m4 (gl_STDLIB_H): Test whether mbtowc is declared.
+ (gl_STDLIB_H_DEFAULTS): Initialize HAVE_MBTOWC.
+ * modules/stdlib (Makefile.am): Substitute HAVE_MBTOWC.
+ * modules/mbtowc (Depends-on, configure.ac): Test also HAVE_MBTOWC.
+ * doc/posix-functions/mbtowc.texi: Mention the change.
+
2019-01-24 Bruno Haible <bruno@clisp.org>
fdatasync: Fix compilation error on Android 4.3.
Portability problems fixed by Gnulib:
@itemize
+@item
+This function is missing on some platforms:
+Android 4.4.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
-This function is missing on some platforms:
-Android 4.4.
-@item
This function accumulates hidden state on some platforms:
glibc 2.8 (see @url{https://sourceware.org/bugzilla/show_bug.cgi?id=9674}).
@item
_GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
_GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
# else
+# if !@HAVE_MBTOWC@
+_GL_FUNCDECL_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
+# endif
_GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
# endif
_GL_CXXALIASWARN (mbtowc);
+#elif defined GNULIB_POSIXCHECK
+# undef mbtowc
+# if HAVE_RAW_DECL_MBTOWC
+_GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
+ "use gnulib module mbtowc for portability");
+# endif
#endif
#if @GNULIB_MKDTEMP@
-# mbtowc.m4 serial 2
+# mbtowc.m4 serial 3
dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
- if false; then
- REPLACE_MBTOWC=1
+ AC_CHECK_FUNCS([mbtowc])
+ if test $ac_cv_func_mbtowc = no; then
+ HAVE_MBTOWC=0
+ else
+ if false; then
+ REPLACE_MBTOWC=1
+ fi
fi
])
-# stdlib_h.m4 serial 45
+# stdlib_h.m4 serial 46
dnl Copyright (C) 2007-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
# include <random.h>
#endif
]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt
- initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps
+ initstate initstate_r mbtowc mkdtemp mkostemp mkostemps mkstemp mkstemps
posix_openpt ptsname ptsname_r qsort_r random random_r reallocarray
realpath rpmatch secure_getenv setenv setstate setstate_r srandom
srandom_r strtod strtoll strtoull unlockpt unsetenv])
HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT])
HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT])
HAVE_DECL_INITSTATE=1; AC_SUBST([HAVE_DECL_INITSTATE])
+ HAVE_MBTOWC=1; AC_SUBST([HAVE_MBTOWC])
HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP])
HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP])
HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS])
Depends-on:
stdlib
-mbrtowc [test $REPLACE_MBTOWC = 1]
-wchar [test $REPLACE_MBTOWC = 1]
+mbrtowc [test $HAVE_MBTOWC = 0 || test $REPLACE_MBTOWC = 1]
+wchar [test $HAVE_MBTOWC = 0 || test $REPLACE_MBTOWC = 1]
configure.ac:
gl_FUNC_MBTOWC
-if test $REPLACE_MBTOWC = 1; then
+if test $HAVE_MBTOWC = 0 || test $REPLACE_MBTOWC = 1; then
AC_LIBOBJ([mbtowc])
gl_PREREQ_MBTOWC
fi
-e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
-e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \
-e 's|@''HAVE_DECL_INITSTATE''@|$(HAVE_DECL_INITSTATE)|g' \
+ -e 's|@''HAVE_MBTOWC''@|$(HAVE_MBTOWC)|g' \
-e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
-e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \
-e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \