| 1 |
# iswpunct.m4 |
| 2 |
# serial 2 |
| 3 |
dnl Copyright (C) 2023-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([gl_FUNC_ISWPUNCT], |
| 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 |
|
| 15 |
if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then |
| 16 |
dnl <wctype.h> redefines iswpunct already. |
| 17 |
REPLACE_ISWPUNCT="$REPLACE_ISWCNTRL" |
| 18 |
else |
| 19 |
AC_CACHE_CHECK([whether iswpunct is consistent with ispunct], |
| 20 |
[gl_cv_func_iswpunct_works], |
| 21 |
[AC_RUN_IFELSE( |
| 22 |
[AC_LANG_SOURCE([[ |
| 23 |
#include <ctype.h> |
| 24 |
#include <wchar.h> |
| 25 |
#include <wctype.h> |
| 26 |
int |
| 27 |
main (int argc, char *argv[]) |
| 28 |
{ |
| 29 |
int result = 0; |
| 30 |
/* This fails on Android 11. */ |
| 31 |
if ((! iswpunct ('\`')) != (! ispunct ('\`'))) |
| 32 |
result |= 1; |
| 33 |
return result; |
| 34 |
}]])], |
| 35 |
[gl_cv_func_iswpunct_works=yes], |
| 36 |
[gl_cv_func_iswpunct_works=no], |
| 37 |
[case "$host_os" in |
| 38 |
# Guess no on Android. |
| 39 |
android*) gl_cv_func_iswpunct_works="guessing no" ;; |
| 40 |
# Guess yes otherwise. |
| 41 |
*) gl_cv_func_iswpunct_works="guessing yes" ;; |
| 42 |
esac |
| 43 |
]) |
| 44 |
]) |
| 45 |
case "$gl_cv_func_iswpunct_works" in |
| 46 |
*yes) ;; |
| 47 |
*) REPLACE_ISWPUNCT=1 ;; |
| 48 |
esac |
| 49 |
fi |
| 50 |
]) |