summaryrefslogtreecommitdiffstats
path: root/gl/m4/wchar_h.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/wchar_h.m4')
-rw-r--r--gl/m4/wchar_h.m433
1 files changed, 21 insertions, 12 deletions
diff --git a/gl/m4/wchar_h.m4 b/gl/m4/wchar_h.m4
index 8ec66193..42338a00 100644
--- a/gl/m4/wchar_h.m4
+++ b/gl/m4/wchar_h.m4
@@ -1,13 +1,14 @@
1dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. 1# wchar_h.m4
2 2# serial 66
3dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Written by Eric Blake. 9dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
9 10
10# wchar_h.m4 serial 55 11dnl Written by Eric Blake.
11 12
12AC_DEFUN_ONCE([gl_WCHAR_H], 13AC_DEFUN_ONCE([gl_WCHAR_H],
13[ 14[
@@ -64,8 +65,8 @@ dnl Check whether <wchar.h> is usable at all.
64AC_DEFUN([gl_WCHAR_H_INLINE_OK], 65AC_DEFUN([gl_WCHAR_H_INLINE_OK],
65[ 66[
66 dnl Test whether <wchar.h> suffers due to the transition from '__inline' to 67 dnl Test whether <wchar.h> suffers due to the transition from '__inline' to
67 dnl 'gnu_inline'. See <https://sourceware.org/bugzilla/show_bug.cgi?id=4022> 68 dnl 'gnu_inline'. See <https://sourceware.org/PR4022>
68 dnl and <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary, 69 dnl and <https://gcc.gnu.org/PR42440>. In summary,
69 dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and 70 dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and
70 dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>. 71 dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>.
71 AC_REQUIRE([AC_CANONICAL_HOST]) 72 AC_REQUIRE([AC_CANONICAL_HOST])
@@ -86,8 +87,8 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK],
86 dnl z/OS when using the XPLINK object format (due to duplicate 87 dnl z/OS when using the XPLINK object format (due to duplicate
87 dnl CSECT names). Instead, temporarily redefine $ac_compile so 88 dnl CSECT names). Instead, temporarily redefine $ac_compile so
88 dnl that the object file has the latter name from the start. 89 dnl that the object file has the latter name from the start.
89 save_ac_compile="$ac_compile" 90 saved_ac_compile="$ac_compile"
90 ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest1/` 91 ac_compile=`echo "$saved_ac_compile" | sed s/conftest/conftest1/`
91 if echo '#include "conftest.c"' >conftest1.c \ 92 if echo '#include "conftest.c"' >conftest1.c \
92 && AC_TRY_EVAL([ac_compile]); then 93 && AC_TRY_EVAL([ac_compile]); then
93 AC_LANG_CONFTEST([ 94 AC_LANG_CONFTEST([
@@ -97,7 +98,7 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK],
97 int zero (void) { return 0; } 98 int zero (void) { return 0; }
98 ]])]) 99 ]])])
99 dnl See note above about renaming object files. 100 dnl See note above about renaming object files.
100 ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest2/` 101 ac_compile=`echo "$saved_ac_compile" | sed s/conftest/conftest2/`
101 if echo '#include "conftest.c"' >conftest2.c \ 102 if echo '#include "conftest.c"' >conftest2.c \
102 && AC_TRY_EVAL([ac_compile]); then 103 && AC_TRY_EVAL([ac_compile]); then
103 if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then 104 if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then
@@ -107,7 +108,7 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK],
107 fi 108 fi
108 fi 109 fi
109 fi 110 fi
110 ac_compile="$save_ac_compile" 111 ac_compile="$saved_ac_compile"
111 rm -f conftest[12].c conftest[12].$ac_objext conftest$ac_exeext 112 rm -f conftest[12].c conftest[12].$ac_objext conftest$ac_exeext
112 ;; 113 ;;
113 esac 114 esac
@@ -147,6 +148,7 @@ AC_DEFUN([gl_WCHAR_H_REQUIRE_DEFAULTS],
147 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BTOWC]) 148 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BTOWC])
148 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTOB]) 149 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTOB])
149 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSINIT]) 150 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSINIT])
151 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSZERO])
150 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOWC]) 152 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOWC])
151 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRLEN]) 153 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRLEN])
152 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRTOWCS]) 154 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRTOWCS])
@@ -185,6 +187,7 @@ AC_DEFUN([gl_WCHAR_H_REQUIRE_DEFAULTS],
185 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSTOK]) 187 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSTOK])
186 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSWIDTH]) 188 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSWIDTH])
187 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSFTIME]) 189 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSFTIME])
190 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WGETCWD])
188 dnl Support Microsoft deprecated alias function names by default. 191 dnl Support Microsoft deprecated alias function names by default.
189 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WCSDUP], [1]) 192 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WCSDUP], [1])
190 ]) 193 ])
@@ -236,7 +239,7 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
236 HAVE_WCSTOK=1; AC_SUBST([HAVE_WCSTOK]) 239 HAVE_WCSTOK=1; AC_SUBST([HAVE_WCSTOK])
237 HAVE_WCSWIDTH=1; AC_SUBST([HAVE_WCSWIDTH]) 240 HAVE_WCSWIDTH=1; AC_SUBST([HAVE_WCSWIDTH])
238 HAVE_WCSFTIME=1; AC_SUBST([HAVE_WCSFTIME]) 241 HAVE_WCSFTIME=1; AC_SUBST([HAVE_WCSFTIME])
239 HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB]) 242 HAVE_WCTOB=1; AC_SUBST([HAVE_WCTOB])
240 HAVE_DECL_WCSDUP=1; AC_SUBST([HAVE_DECL_WCSDUP]) 243 HAVE_DECL_WCSDUP=1; AC_SUBST([HAVE_DECL_WCSDUP])
241 HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) 244 HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
242 REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T]) 245 REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T])
@@ -253,5 +256,11 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
253 REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) 256 REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH])
254 REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH]) 257 REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH])
255 REPLACE_WCSFTIME=0; AC_SUBST([REPLACE_WCSFTIME]) 258 REPLACE_WCSFTIME=0; AC_SUBST([REPLACE_WCSFTIME])
259 REPLACE_WCSCMP=0; AC_SUBST([REPLACE_WCSCMP])
260 REPLACE_WCSNCAT=0; AC_SUBST([REPLACE_WCSNCAT])
261 REPLACE_WCSNCMP=0; AC_SUBST([REPLACE_WCSNCMP])
262 REPLACE_WCSSTR=0; AC_SUBST([REPLACE_WCSSTR])
256 REPLACE_WCSTOK=0; AC_SUBST([REPLACE_WCSTOK]) 263 REPLACE_WCSTOK=0; AC_SUBST([REPLACE_WCSTOK])
264 REPLACE_WMEMCMP=0; AC_SUBST([REPLACE_WMEMCMP])
265 REPLACE_WMEMPCPY=0; AC_SUBST([REPLACE_WMEMPCPY])
257]) 266])