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.m449
1 files changed, 49 insertions, 0 deletions
diff --git a/gl/m4/iswpunct.m4 b/gl/m4/iswpunct.m4
new file mode 100644
index 0000000..1edf58a
--- /dev/null
+++ b/gl/m4/iswpunct.m4
@@ -0,0 +1,49 @@
1# iswpunct.m4
2# serial 2
3dnl Copyright (C) 2023-2024 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.
7
8AC_DEFUN([gl_FUNC_ISWPUNCT],
9[
10 AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
11 AC_REQUIRE([gl_WCTYPE_H])
12 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13
14 if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then
15 dnl <wctype.h> redefines iswpunct already.
16 REPLACE_ISWPUNCT="$REPLACE_ISWCNTRL"
17 else
18 AC_CACHE_CHECK([whether iswpunct is consistent with ispunct],
19 [gl_cv_func_iswpunct_works],
20 [AC_RUN_IFELSE(
21 [AC_LANG_SOURCE([[
22#include <ctype.h>
23#include <wchar.h>
24#include <wctype.h>
25int
26main (int argc, char *argv[])
27{
28 int result = 0;
29 /* This fails on Android 11. */
30 if ((! iswpunct ('\`')) != (! ispunct ('\`')))
31 result |= 1;
32 return result;
33}]])],
34 [gl_cv_func_iswpunct_works=yes],
35 [gl_cv_func_iswpunct_works=no],
36 [case "$host_os" in
37 # Guess no on Android.
38 android*) gl_cv_func_iswpunct_works="guessing no" ;;
39 # Guess yes otherwise.
40 *) gl_cv_func_iswpunct_works="guessing yes" ;;
41 esac
42 ])
43 ])
44 case "$gl_cv_func_iswpunct_works" in
45 *yes) ;;
46 *) REPLACE_ISWPUNCT=1 ;;
47 esac
48 fi
49])