summaryrefslogtreecommitdiff
path: root/gnulib-m4/wctype_h.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gnulib-m4/wctype_h.m4')
-rw-r--r--gnulib-m4/wctype_h.m494
1 files changed, 41 insertions, 53 deletions
diff --git a/gnulib-m4/wctype_h.m4 b/gnulib-m4/wctype_h.m4
index 15d1ef32..702cb39c 100644
--- a/gnulib-m4/wctype_h.m4
+++ b/gnulib-m4/wctype_h.m4
@@ -1,15 +1,15 @@
-# wctype_h.m4 serial 21
+# wctype_h.m4 serial 30
dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
-dnl Copyright (C) 2006-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2022 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 Written by Paul Eggert.
-AC_DEFUN([gl_WCTYPE_H],
+AC_DEFUN_ONCE([gl_WCTYPE_H],
[
AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
AC_REQUIRE([AC_PROG_CC])
@@ -41,13 +41,6 @@ AC_DEFUN([gl_WCTYPE_H],
[
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
- /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be
- included before <wchar.h>.
- BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h>
- must be included before <wchar.h>. */
- #include <stddef.h>
- #include <stdio.h>
- #include <time.h>
#include <wchar.h>
#include <wctype.h>
int main () { return iswprint ('x') == 0; }
@@ -57,7 +50,7 @@ AC_DEFUN([gl_WCTYPE_H],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
#if __GNU_LIBRARY__ == 1
Linux libc5 i18n is broken.
- #endif]], [])],
+ #endif]], [[]])],
[gl_cv_func_iswcntrl_works="guessing yes"],
[gl_cv_func_iswcntrl_works="guessing no"])
])
@@ -69,10 +62,14 @@ AC_DEFUN([gl_WCTYPE_H],
fi
AC_SUBST([HAVE_WCTYPE_H])
- case "$gl_cv_func_iswcntrl_works" in
- *yes) REPLACE_ISWCNTRL=0 ;;
- *) REPLACE_ISWCNTRL=1 ;;
- esac
+ if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then
+ REPLACE_ISWCNTRL=1
+ else
+ case "$gl_cv_func_iswcntrl_works" in
+ *yes) REPLACE_ISWCNTRL=0 ;;
+ *) REPLACE_ISWCNTRL=1 ;;
+ esac
+ fi
AC_SUBST([REPLACE_ISWCNTRL])
if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then
@@ -88,14 +85,7 @@ AC_DEFUN([gl_WCTYPE_H],
REPLACE_TOWLOWER=0
else
AC_CHECK_DECLS([towlower],,,
- [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be
- included before <wchar.h>.
- BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h>
- must be included before <wchar.h>. */
- #include <stddef.h>
- #include <stdio.h>
- #include <time.h>
- #include <wchar.h>
+ [[#include <wchar.h>
#if HAVE_WCTYPE_H
# include <wctype.h>
#endif
@@ -124,14 +114,7 @@ AC_DEFUN([gl_WCTYPE_H],
AC_CACHE_CHECK([for wctype_t], [gl_cv_type_wctype_t],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
- [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be
- included before <wchar.h>.
- BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h>
- must be included before <wchar.h>. */
- #include <stddef.h>
- #include <stdio.h>
- #include <time.h>
- #include <wchar.h>
+ [[#include <wchar.h>
#if HAVE_WCTYPE_H
# include <wctype.h>
#endif
@@ -150,14 +133,7 @@ AC_DEFUN([gl_WCTYPE_H],
AC_CACHE_CHECK([for wctrans_t], [gl_cv_type_wctrans_t],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
- [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be
- included before <wchar.h>.
- BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h>
- must be included before <wchar.h>. */
- #include <stddef.h>
- #include <stdio.h>
- #include <time.h>
- #include <wchar.h>
+ [[#include <wchar.h>
#include <wctype.h>
wctrans_t a;
]],
@@ -172,14 +148,7 @@ AC_DEFUN([gl_WCTYPE_H],
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[
-/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
- <wchar.h>.
- BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
- included before <wchar.h>. */
#if !(defined __GLIBC__ && !defined __UCLIBC__)
-# include <stddef.h>
-# include <stdio.h>
-# include <time.h>
# include <wchar.h>
#endif
#include <wctype.h>
@@ -188,25 +157,44 @@ AC_DEFUN([gl_WCTYPE_H],
])
])
+# gl_WCTYPE_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_WCTYPE_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_WCTYPE_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_WCTYPE_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_WCTYPE_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWBLANK])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWDIGIT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWXDIGIT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTYPE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWCTYPE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTRANS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOWCTRANS])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_WCTYPE_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
+])
+
AC_DEFUN([gl_WCTYPE_H_DEFAULTS],
[
- GNULIB_ISWBLANK=0; AC_SUBST([GNULIB_ISWBLANK])
- GNULIB_WCTYPE=0; AC_SUBST([GNULIB_WCTYPE])
- GNULIB_ISWCTYPE=0; AC_SUBST([GNULIB_ISWCTYPE])
- GNULIB_WCTRANS=0; AC_SUBST([GNULIB_WCTRANS])
- GNULIB_TOWCTRANS=0; AC_SUBST([GNULIB_TOWCTRANS])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_ISWBLANK=1; AC_SUBST([HAVE_ISWBLANK])
HAVE_WCTYPE_T=1; AC_SUBST([HAVE_WCTYPE_T])
HAVE_WCTRANS_T=1; AC_SUBST([HAVE_WCTRANS_T])
REPLACE_ISWBLANK=0; AC_SUBST([REPLACE_ISWBLANK])
+ REPLACE_ISWDIGIT=0; AC_SUBST([REPLACE_ISWDIGIT])
+ REPLACE_ISWXDIGIT=0; AC_SUBST([REPLACE_ISWXDIGIT])
])