diff options
Diffstat (limited to 'gl/m4/stdlib_h.m4')
-rw-r--r-- | gl/m4/stdlib_h.m4 | 72 |
1 files changed, 67 insertions, 5 deletions
diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4 index e96be22..a4662f2 100644 --- a/gl/m4/stdlib_h.m4 +++ b/gl/m4/stdlib_h.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # stdlib_h.m4 serial 66 | 1 | # stdlib_h.m4 |
2 | dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. | 2 | # serial 77 |
3 | dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -23,15 +24,58 @@ AC_DEFUN_ONCE([gl_STDLIB_H], | |||
23 | # include <random.h> | 24 | # include <random.h> |
24 | #endif | 25 | #endif |
25 | ]], [_Exit aligned_alloc atoll canonicalize_file_name free | 26 | ]], [_Exit aligned_alloc atoll canonicalize_file_name free |
26 | getloadavg getsubopt grantpt | 27 | getloadavg getprogname getsubopt grantpt |
27 | initstate initstate_r mbtowc mkdtemp mkostemp mkostemps mkstemp mkstemps | 28 | initstate initstate_r mbstowcs mbtowc mkdtemp mkostemp mkostemps mkstemp |
28 | posix_memalign posix_openpt ptsname ptsname_r qsort_r | 29 | mkstemps posix_memalign posix_openpt ptsname ptsname_r qsort_r |
29 | random random_r reallocarray realpath rpmatch secure_getenv setenv | 30 | random random_r reallocarray realpath rpmatch secure_getenv setenv |
30 | setstate setstate_r srandom srandom_r | 31 | setstate setstate_r srandom srandom_r |
31 | strtod strtol strtold strtoll strtoul strtoull unlockpt unsetenv]) | 32 | strtod strtol strtold strtoll strtoul strtoull unlockpt unsetenv]) |
32 | 33 | ||
33 | AC_REQUIRE([AC_C_RESTRICT]) | 34 | AC_REQUIRE([AC_C_RESTRICT]) |
34 | 35 | ||
36 | dnl Test whether MB_CUR_MAX needs to be overridden. | ||
37 | dnl On Solaris 10, in UTF-8 locales, its value is 3 but needs to be 4. | ||
38 | dnl Fortunately, we can do this because on this platform MB_LEN_MAX is 5. | ||
39 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
40 | AC_REQUIRE([gt_LOCALE_FR_UTF8]) | ||
41 | AC_CACHE_CHECK([whether MB_CUR_MAX is correct], | ||
42 | [gl_cv_macro_MB_CUR_MAX_good], | ||
43 | [ | ||
44 | dnl Initial guess, used when cross-compiling or when no suitable locale | ||
45 | dnl is present. | ||
46 | changequote(,)dnl | ||
47 | case "$host_os" in | ||
48 | # Guess no on Solaris. | ||
49 | solaris*) gl_cv_macro_MB_CUR_MAX_good="guessing no" ;; | ||
50 | # Guess yes otherwise. | ||
51 | *) gl_cv_macro_MB_CUR_MAX_good="guessing yes" ;; | ||
52 | esac | ||
53 | changequote([,])dnl | ||
54 | if test $LOCALE_FR_UTF8 != none; then | ||
55 | AC_RUN_IFELSE( | ||
56 | [AC_LANG_SOURCE([[ | ||
57 | #include <locale.h> | ||
58 | #include <stdlib.h> | ||
59 | int main () | ||
60 | { | ||
61 | int result = 0; | ||
62 | if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) | ||
63 | { | ||
64 | if (MB_CUR_MAX < 4) | ||
65 | result |= 1; | ||
66 | } | ||
67 | return result; | ||
68 | }]])], | ||
69 | [gl_cv_macro_MB_CUR_MAX_good=yes], | ||
70 | [gl_cv_macro_MB_CUR_MAX_good=no], | ||
71 | [:]) | ||
72 | fi | ||
73 | ]) | ||
74 | case "$gl_cv_macro_MB_CUR_MAX_good" in | ||
75 | *yes) ;; | ||
76 | *) REPLACE_MB_CUR_MAX=1 ;; | ||
77 | esac | ||
78 | |||
35 | AC_CHECK_DECLS_ONCE([ecvt]) | 79 | AC_CHECK_DECLS_ONCE([ecvt]) |
36 | if test $ac_cv_have_decl_ecvt = no; then | 80 | if test $ac_cv_have_decl_ecvt = no; then |
37 | HAVE_DECL_ECVT=0 | 81 | HAVE_DECL_ECVT=0 |
@@ -73,10 +117,12 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], | |||
73 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CANONICALIZE_FILE_NAME]) | 117 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CANONICALIZE_FILE_NAME]) |
74 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREE_POSIX]) | 118 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREE_POSIX]) |
75 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOADAVG]) | 119 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOADAVG]) |
120 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPROGNAME]) | ||
76 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSUBOPT]) | 121 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSUBOPT]) |
77 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GRANTPT]) | 122 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GRANTPT]) |
78 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_GNU]) | 123 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_GNU]) |
79 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_POSIX]) | 124 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_POSIX]) |
125 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOWCS]) | ||
80 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBTOWC]) | 126 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBTOWC]) |
81 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDTEMP]) | 127 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDTEMP]) |
82 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMP]) | 128 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMP]) |
@@ -89,6 +135,7 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], | |||
89 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME_R]) | 135 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME_R]) |
90 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTENV]) | 136 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTENV]) |
91 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_QSORT_R]) | 137 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_QSORT_R]) |
138 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAND]) | ||
92 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM]) | 139 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM]) |
93 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R]) | 140 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R]) |
94 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY]) | 141 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY]) |
@@ -99,6 +146,7 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], | |||
99 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV]) | 146 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV]) |
100 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV]) | 147 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV]) |
101 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD]) | 148 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD]) |
149 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOF]) | ||
102 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL]) | 150 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL]) |
103 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLD]) | 151 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLD]) |
104 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLL]) | 152 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLL]) |
@@ -130,6 +178,8 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], | |||
130 | HAVE_DECL_FCVT=1; AC_SUBST([HAVE_DECL_FCVT]) | 178 | HAVE_DECL_FCVT=1; AC_SUBST([HAVE_DECL_FCVT]) |
131 | HAVE_DECL_GCVT=1; AC_SUBST([HAVE_DECL_GCVT]) | 179 | HAVE_DECL_GCVT=1; AC_SUBST([HAVE_DECL_GCVT]) |
132 | HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) | 180 | HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) |
181 | HAVE_DECL_PROGRAM_INVOCATION_NAME=1; AC_SUBST([HAVE_DECL_PROGRAM_INVOCATION_NAME]) | ||
182 | HAVE_GETPROGNAME=1; AC_SUBST([HAVE_GETPROGNAME]) | ||
133 | HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) | 183 | HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) |
134 | HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) | 184 | HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) |
135 | HAVE_INITSTATE=1; AC_SUBST([HAVE_INITSTATE]) | 185 | HAVE_INITSTATE=1; AC_SUBST([HAVE_INITSTATE]) |
@@ -157,6 +207,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], | |||
157 | HAVE_SETSTATE=1; AC_SUBST([HAVE_SETSTATE]) | 207 | HAVE_SETSTATE=1; AC_SUBST([HAVE_SETSTATE]) |
158 | HAVE_DECL_SETSTATE=1; AC_SUBST([HAVE_DECL_SETSTATE]) | 208 | HAVE_DECL_SETSTATE=1; AC_SUBST([HAVE_DECL_SETSTATE]) |
159 | HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) | 209 | HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) |
210 | HAVE_STRTOF=1; AC_SUBST([HAVE_STRTOF]) | ||
160 | HAVE_STRTOL=1; AC_SUBST([HAVE_STRTOL]) | 211 | HAVE_STRTOL=1; AC_SUBST([HAVE_STRTOL]) |
161 | HAVE_STRTOLD=1; AC_SUBST([HAVE_STRTOLD]) | 212 | HAVE_STRTOLD=1; AC_SUBST([HAVE_STRTOLD]) |
162 | HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) | 213 | HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) |
@@ -166,21 +217,31 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], | |||
166 | HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) | 217 | HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) |
167 | HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) | 218 | HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) |
168 | HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) | 219 | HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) |
220 | REPLACE__EXIT=0; AC_SUBST([REPLACE__EXIT]) | ||
169 | REPLACE_ALIGNED_ALLOC=0; AC_SUBST([REPLACE_ALIGNED_ALLOC]) | 221 | REPLACE_ALIGNED_ALLOC=0; AC_SUBST([REPLACE_ALIGNED_ALLOC]) |
170 | REPLACE_CALLOC_FOR_CALLOC_GNU=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_GNU]) | 222 | REPLACE_CALLOC_FOR_CALLOC_GNU=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_GNU]) |
171 | REPLACE_CALLOC_FOR_CALLOC_POSIX=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_POSIX]) | 223 | REPLACE_CALLOC_FOR_CALLOC_POSIX=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_POSIX]) |
172 | REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) | 224 | REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) |
173 | REPLACE_FREE=0; AC_SUBST([REPLACE_FREE]) | 225 | REPLACE_FREE=0; AC_SUBST([REPLACE_FREE]) |
226 | REPLACE_GETLOADAVG=0; AC_SUBST([REPLACE_GETLOADAVG]) | ||
227 | REPLACE_GETPROGNAME=0; AC_SUBST([REPLACE_GETPROGNAME]) | ||
228 | REPLACE_GETSUBOPT=0; AC_SUBST([REPLACE_GETSUBOPT]) | ||
174 | REPLACE_INITSTATE=0; AC_SUBST([REPLACE_INITSTATE]) | 229 | REPLACE_INITSTATE=0; AC_SUBST([REPLACE_INITSTATE]) |
175 | REPLACE_MALLOC_FOR_MALLOC_GNU=0; AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_GNU]) | 230 | REPLACE_MALLOC_FOR_MALLOC_GNU=0; AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_GNU]) |
176 | REPLACE_MALLOC_FOR_MALLOC_POSIX=0; AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_POSIX]) | 231 | REPLACE_MALLOC_FOR_MALLOC_POSIX=0; AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_POSIX]) |
232 | REPLACE_MB_CUR_MAX=0; AC_SUBST([REPLACE_MB_CUR_MAX]) | ||
233 | REPLACE_MBSTOWCS=0; AC_SUBST([REPLACE_MBSTOWCS]) | ||
177 | REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) | 234 | REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) |
235 | REPLACE_MKOSTEMP=0; AC_SUBST([REPLACE_MKOSTEMP]) | ||
236 | REPLACE_MKOSTEMPS=0; AC_SUBST([REPLACE_MKOSTEMPS]) | ||
178 | REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) | 237 | REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) |
179 | REPLACE_POSIX_MEMALIGN=0; AC_SUBST([REPLACE_POSIX_MEMALIGN]) | 238 | REPLACE_POSIX_MEMALIGN=0; AC_SUBST([REPLACE_POSIX_MEMALIGN]) |
239 | REPLACE_POSIX_OPENPT=0; AC_SUBST([REPLACE_POSIX_OPENPT]) | ||
180 | REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME]) | 240 | REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME]) |
181 | REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) | 241 | REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) |
182 | REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) | 242 | REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) |
183 | REPLACE_QSORT_R=0; AC_SUBST([REPLACE_QSORT_R]) | 243 | REPLACE_QSORT_R=0; AC_SUBST([REPLACE_QSORT_R]) |
244 | REPLACE_RAND=0; AC_SUBST([REPLACE_RAND]) | ||
184 | REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM]) | 245 | REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM]) |
185 | REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) | 246 | REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) |
186 | REPLACE_REALLOC_FOR_REALLOC_GNU=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_GNU]) | 247 | REPLACE_REALLOC_FOR_REALLOC_GNU=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_GNU]) |
@@ -190,6 +251,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], | |||
190 | REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) | 251 | REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) |
191 | REPLACE_SETSTATE=0; AC_SUBST([REPLACE_SETSTATE]) | 252 | REPLACE_SETSTATE=0; AC_SUBST([REPLACE_SETSTATE]) |
192 | REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) | 253 | REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) |
254 | REPLACE_STRTOF=0; AC_SUBST([REPLACE_STRTOF]) | ||
193 | REPLACE_STRTOL=0; AC_SUBST([REPLACE_STRTOL]) | 255 | REPLACE_STRTOL=0; AC_SUBST([REPLACE_STRTOL]) |
194 | REPLACE_STRTOLD=0; AC_SUBST([REPLACE_STRTOLD]) | 256 | REPLACE_STRTOLD=0; AC_SUBST([REPLACE_STRTOLD]) |
195 | REPLACE_STRTOLL=0; AC_SUBST([REPLACE_STRTOLL]) | 257 | REPLACE_STRTOLL=0; AC_SUBST([REPLACE_STRTOLL]) |