1 # stdlib_h.m4 serial 66
2 dnl Copyright (C) 2007-2022 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 AC_DEFUN_ONCE([gl_STDLIB_H],
9 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
10 gl_NEXT_HEADERS([stdlib.h])
12 dnl Check for declarations of anything we want to poison if the
13 dnl corresponding gnulib module is not in use, and which is not
14 dnl guaranteed by C89.
15 gl_WARN_ON_USE_PREPARE([[#include <stdlib.h>
16 #if HAVE_SYS_LOADAVG_H
17 /* OpenIndiana has a bug: <sys/time.h> must be included before
19 # include <sys/time.h>
20 # include <sys/loadavg.h>
25 ]], [_Exit aligned_alloc atoll canonicalize_file_name free
26 getloadavg getsubopt grantpt
27 initstate initstate_r mbtowc mkdtemp mkostemp mkostemps mkstemp mkstemps
28 posix_memalign posix_openpt ptsname ptsname_r qsort_r
29 random random_r reallocarray realpath rpmatch secure_getenv setenv
30 setstate setstate_r srandom srandom_r
31 strtod strtol strtold strtoll strtoul strtoull unlockpt unsetenv])
33 AC_REQUIRE([AC_C_RESTRICT])
35 AC_CHECK_DECLS_ONCE([ecvt])
36 if test $ac_cv_have_decl_ecvt = no; then
39 AC_CHECK_DECLS_ONCE([fcvt])
40 if test $ac_cv_have_decl_fcvt = no; then
43 AC_CHECK_DECLS_ONCE([gcvt])
44 if test $ac_cv_have_decl_gcvt = no; then
49 # gl_STDLIB_MODULE_INDICATOR([modulename])
50 # sets the shell variable that indicates the presence of the given module
51 # to a C preprocessor expression that will evaluate to 1.
52 # This macro invocation must not occur in macros that are AC_REQUIREd.
53 AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
55 dnl Ensure to expand the default settings once only.
56 gl_STDLIB_H_REQUIRE_DEFAULTS
57 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
58 dnl Define it also as a C macro, for the benefit of the unit tests.
59 gl_MODULE_INDICATOR_FOR_TESTS([$1])
62 # Initializes the default values for AC_SUBSTed shell variables.
63 # This macro must not be AC_REQUIREd. It must only be invoked, and only
64 # outside of macros or in macros that are not AC_REQUIREd.
65 AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS],
67 m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS], [
68 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB__EXIT])
69 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALIGNED_ALLOC])
70 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATOLL])
71 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_GNU])
72 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_POSIX])
73 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CANONICALIZE_FILE_NAME])
74 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREE_POSIX])
75 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOADAVG])
76 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSUBOPT])
77 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GRANTPT])
78 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_GNU])
79 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_POSIX])
80 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBTOWC])
81 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDTEMP])
82 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMP])
83 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMPS])
84 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKSTEMP])
85 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKSTEMPS])
86 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POSIX_MEMALIGN])
87 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POSIX_OPENPT])
88 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME])
89 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME_R])
90 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTENV])
91 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_QSORT_R])
92 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM])
93 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R])
94 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY])
95 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_GNU])
96 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_POSIX])
97 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALPATH])
98 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RPMATCH])
99 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV])
100 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV])
101 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD])
102 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL])
103 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLD])
104 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLL])
105 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOUL])
106 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOULL])
107 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYSTEM_POSIX])
108 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLOCKPT])
109 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNSETENV])
110 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTOMB])
111 dnl Support Microsoft deprecated alias function names by default.
112 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ECVT], [1])
113 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCVT], [1])
114 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GCVT], [1])
115 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MKTEMP], [1])
116 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_PUTENV], [1])
118 m4_require(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS])
119 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
122 AC_DEFUN([gl_STDLIB_H_DEFAULTS],
124 dnl Assume proper GNU behavior unless another module says otherwise.
125 HAVE__EXIT=1; AC_SUBST([HAVE__EXIT])
126 HAVE_ALIGNED_ALLOC=1; AC_SUBST([HAVE_ALIGNED_ALLOC])
127 HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL])
128 HAVE_CANONICALIZE_FILE_NAME=1; AC_SUBST([HAVE_CANONICALIZE_FILE_NAME])
129 HAVE_DECL_ECVT=1; AC_SUBST([HAVE_DECL_ECVT])
130 HAVE_DECL_FCVT=1; AC_SUBST([HAVE_DECL_FCVT])
131 HAVE_DECL_GCVT=1; AC_SUBST([HAVE_DECL_GCVT])
132 HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG])
133 HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT])
134 HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT])
135 HAVE_INITSTATE=1; AC_SUBST([HAVE_INITSTATE])
136 HAVE_DECL_INITSTATE=1; AC_SUBST([HAVE_DECL_INITSTATE])
137 HAVE_MBTOWC=1; AC_SUBST([HAVE_MBTOWC])
138 HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP])
139 HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP])
140 HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS])
141 HAVE_MKSTEMP=1; AC_SUBST([HAVE_MKSTEMP])
142 HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS])
143 HAVE_POSIX_MEMALIGN=1; AC_SUBST([HAVE_POSIX_MEMALIGN])
144 HAVE_POSIX_OPENPT=1; AC_SUBST([HAVE_POSIX_OPENPT])
145 HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME])
146 HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R])
147 HAVE_QSORT_R=1; AC_SUBST([HAVE_QSORT_R])
148 HAVE_RANDOM=1; AC_SUBST([HAVE_RANDOM])
149 HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H])
150 HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R])
151 HAVE_REALLOCARRAY=1; AC_SUBST([HAVE_REALLOCARRAY])
152 HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH])
153 HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH])
154 HAVE_SECURE_GETENV=1; AC_SUBST([HAVE_SECURE_GETENV])
155 HAVE_SETENV=1; AC_SUBST([HAVE_SETENV])
156 HAVE_DECL_SETENV=1; AC_SUBST([HAVE_DECL_SETENV])
157 HAVE_SETSTATE=1; AC_SUBST([HAVE_SETSTATE])
158 HAVE_DECL_SETSTATE=1; AC_SUBST([HAVE_DECL_SETSTATE])
159 HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD])
160 HAVE_STRTOL=1; AC_SUBST([HAVE_STRTOL])
161 HAVE_STRTOLD=1; AC_SUBST([HAVE_STRTOLD])
162 HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL])
163 HAVE_STRTOUL=1; AC_SUBST([HAVE_STRTOUL])
164 HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL])
165 HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA])
166 HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H])
167 HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT])
168 HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV])
169 REPLACE_ALIGNED_ALLOC=0; AC_SUBST([REPLACE_ALIGNED_ALLOC])
170 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])
172 REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME])
173 REPLACE_FREE=0; AC_SUBST([REPLACE_FREE])
174 REPLACE_INITSTATE=0; AC_SUBST([REPLACE_INITSTATE])
175 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])
177 REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC])
178 REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
179 REPLACE_POSIX_MEMALIGN=0; AC_SUBST([REPLACE_POSIX_MEMALIGN])
180 REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME])
181 REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R])
182 REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
183 REPLACE_QSORT_R=0; AC_SUBST([REPLACE_QSORT_R])
184 REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM])
185 REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R])
186 REPLACE_REALLOC_FOR_REALLOC_GNU=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_GNU])
187 REPLACE_REALLOC_FOR_REALLOC_POSIX=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_POSIX])
188 REPLACE_REALLOCARRAY=0; AC_SUBST([REPLACE_REALLOCARRAY])
189 REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH])
190 REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV])
191 REPLACE_SETSTATE=0; AC_SUBST([REPLACE_SETSTATE])
192 REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD])
193 REPLACE_STRTOL=0; AC_SUBST([REPLACE_STRTOL])
194 REPLACE_STRTOLD=0; AC_SUBST([REPLACE_STRTOLD])
195 REPLACE_STRTOLL=0; AC_SUBST([REPLACE_STRTOLL])
196 REPLACE_STRTOUL=0; AC_SUBST([REPLACE_STRTOUL])
197 REPLACE_STRTOULL=0; AC_SUBST([REPLACE_STRTOULL])
198 REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV])
199 REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB])