summaryrefslogtreecommitdiffstats
path: root/gl/m4/iswpunct.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/iswpunct.m4')
-rw-r--r--gl/m4/iswpunct.m450
1 files changed, 50 insertions, 0 deletions
diff --git a/gl/m4/iswpunct.m4 b/gl/m4/iswpunct.m4
new file mode 100644
index 00000000..d8e8d712
--- /dev/null
+++ b/gl/m4/iswpunct.m4
@@ -0,0 +1,50 @@
1# iswpunct.m4
2# serial 2
3dnl Copyright (C) 2023-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_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>
26int
27main (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])