| 1 |
# wctype.m4 |
| 2 |
# serial 6 |
| 3 |
dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. |
| 4 |
dnl This file is free software; the Free Software Foundation |
| 5 |
dnl gives unlimited permission to copy and/or distribute it, |
| 6 |
dnl with or without modifications, as long as this notice is preserved. |
| 7 |
dnl This file is offered as-is, without any warranty. |
| 8 |
|
| 9 |
AC_DEFUN_ONCE([gl_FUNC_WCTYPE], |
| 10 |
[ |
| 11 |
AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) |
| 12 |
AC_REQUIRE([gl_WCTYPE_H]) |
| 13 |
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
| 14 |
HAVE_WCTYPE=$HAVE_WCTYPE_T |
| 15 |
if test $HAVE_WCTYPE = 1; then |
| 16 |
AC_CACHE_CHECK([whether wctype supports the "blank" and "punct" character classes], |
| 17 |
[gl_cv_func_wctype_works], |
| 18 |
[AC_RUN_IFELSE( |
| 19 |
[AC_LANG_SOURCE([[ |
| 20 |
#include <ctype.h> |
| 21 |
#include <wchar.h> |
| 22 |
#include <wctype.h> |
| 23 |
int main () |
| 24 |
{ |
| 25 |
/* This test fails on mingw. */ |
| 26 |
if (wctype ("blank") == (wctype_t)0) |
| 27 |
return 1; |
| 28 |
/* This test fails on MSVC 14. */ |
| 29 |
if ((! iswctype ('\t', wctype ("blank"))) != (! iswblank ('\t'))) |
| 30 |
return 2; |
| 31 |
/* This test fails on Android 11. */ |
| 32 |
if ((! iswctype ('\`', wctype ("punct"))) != (! ispunct ('\`'))) |
| 33 |
return 4; |
| 34 |
return 0; |
| 35 |
} |
| 36 |
]])], |
| 37 |
[gl_cv_func_wctype_works=yes], [gl_cv_func_wctype_works=no], |
| 38 |
[case "$host_os" in |
| 39 |
# Guess no on native Windows. |
| 40 |
mingw* | windows*) gl_cv_func_wctype_works="guessing no" ;; |
| 41 |
# Guess no on Android. |
| 42 |
android*) gl_cv_func_wctype_works="guessing no" ;; |
| 43 |
# Guess yes otherwise. |
| 44 |
*) gl_cv_func_wctype_works="guessing yes" ;; |
| 45 |
esac |
| 46 |
]) |
| 47 |
]) |
| 48 |
case "$gl_cv_func_wctype_works" in |
| 49 |
*yes) ;; |
| 50 |
*) REPLACE_WCTYPE=1 ;; |
| 51 |
esac |
| 52 |
fi |
| 53 |
]) |