diff options
Diffstat (limited to 'gnulib-m4/btowc.m4')
-rw-r--r-- | gnulib-m4/btowc.m4 | 56 |
1 files changed, 12 insertions, 44 deletions
diff --git a/gnulib-m4/btowc.m4 b/gnulib-m4/btowc.m4 index d9dd7036..d224b156 100644 --- a/gnulib-m4/btowc.m4 +++ b/gnulib-m4/btowc.m4 @@ -1,17 +1,19 @@ # btowc.m4 -# serial 14 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +# serial 16 +dnl Copyright (C) 2008-2025 Free Software Foundation, 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. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_BTOWC], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) + AC_REQUIRE([gt_TYPE_WINT_T]) dnl Check whether <wchar.h> is usable at all, first. Otherwise the test dnl program below may lead to an endless loop. See - dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. + dnl <https://gcc.gnu.org/PR42440>. AC_REQUIRE([gl_WCHAR_H_INLINE_OK]) AC_CHECK_FUNCS_ONCE([btowc]) @@ -52,43 +54,6 @@ changequote([,])dnl ]) ]) - dnl IRIX 6.5 btowc(EOF) is 0xFF, not WEOF. - AC_CACHE_CHECK([whether btowc(EOF) is correct], - [gl_cv_func_btowc_eof], - [ - dnl Initial guess, used when cross-compiling or when no suitable locale - dnl is present. -changequote(,)dnl - case "$host_os" in - # Guess no on IRIX. - irix*) gl_cv_func_btowc_eof="guessing no" ;; - # Guess yes on native Windows. - mingw* | windows*) gl_cv_func_btowc_eof="guessing yes" ;; - # Guess yes otherwise. - *) gl_cv_func_btowc_eof="guessing yes" ;; - esac -changequote([,])dnl - if test $LOCALE_FR != none; then - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <locale.h> -#include <stdio.h> -#include <wchar.h> -int main () -{ - if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) - { - if (btowc (EOF) != WEOF) - return 1; - } - return 0; -}]])], - [gl_cv_func_btowc_eof=yes], - [gl_cv_func_btowc_eof=no], - [:]) - fi - ]) - dnl On mingw, in the C locale, btowc is inconsistent with mbrtowc: dnl mbrtowc avoids calling MultiByteToWideChar when MB_CUR_MAX is 1 and dnl ___lc_codepage_func() is 0, but btowc is lacking this special case. @@ -133,14 +98,17 @@ int main () ]) ]) + if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then + dnl On mingw/ucrt, we override the return type of btowc(). + dnl While the original wint_t (= unsigned short) and the overridden wint_t + dnl (= unsigned int) are equivalent in function parameters, this is not + dnl the case for function return types. + REPLACE_BTOWC=1 + fi case "$gl_cv_func_btowc_nul" in *yes) ;; *) REPLACE_BTOWC=1 ;; esac - case "$gl_cv_func_btowc_eof" in - *yes) ;; - *) REPLACE_BTOWC=1 ;; - esac case "$gl_cv_func_btowc_consistent" in *yes) ;; *) REPLACE_BTOWC=1 ;; |