VirtualBox

source: kBuild/trunk/src/grep/m4/vasnprintf.m4

Last change on this file was 3529, checked in by bird, 3 years ago

Imported grep 3.7 from grep-3.7.tar.gz (sha256: c22b0cf2d4f6bbe599c902387e8058990e1eee99aef333a203829e5fd3dbb342), applying minimal auto-props.

  • Property svn:eol-style set to LF
File size: 8.9 KB
Line 
1# vasnprintf.m4 serial 38
2dnl Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_FUNC_VASNPRINTF],
8[
9 AC_CHECK_FUNCS_ONCE([vasnprintf])
10 if test $ac_cv_func_vasnprintf = no; then
11 gl_REPLACE_VASNPRINTF
12 fi
13])
14
15AC_DEFUN([gl_REPLACE_VASNPRINTF],
16[
17 AC_CHECK_FUNCS_ONCE([vasnprintf])
18 AC_LIBOBJ([vasnprintf])
19 AC_LIBOBJ([printf-args])
20 AC_LIBOBJ([printf-parse])
21 AC_LIBOBJ([asnprintf])
22 if test $ac_cv_func_vasnprintf = yes; then
23 AC_DEFINE([REPLACE_VASNPRINTF], [1],
24 [Define if vasnprintf exists but is overridden by gnulib.])
25 fi
26 gl_PREREQ_PRINTF_ARGS
27 gl_PREREQ_PRINTF_PARSE
28 gl_PREREQ_VASNPRINTF
29 gl_PREREQ_ASNPRINTF
30])
31
32# Prerequisites of lib/printf-args.h, lib/printf-args.c.
33AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
34[
35 AC_REQUIRE([gt_TYPE_WCHAR_T])
36 AC_REQUIRE([gt_TYPE_WINT_T])
37])
38
39# Prerequisites of lib/printf-parse.h, lib/printf-parse.c.
40AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
41[
42 AC_REQUIRE([gl_FEATURES_H])
43 AC_REQUIRE([gt_TYPE_WCHAR_T])
44 AC_REQUIRE([gt_TYPE_WINT_T])
45 AC_REQUIRE([AC_TYPE_SIZE_T])
46 AC_CHECK_TYPE([ptrdiff_t], ,
47 [AC_DEFINE([ptrdiff_t], [long],
48 [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
49 ])
50 AC_REQUIRE([gt_AC_TYPE_INTMAX_T])
51])
52
53# Prerequisites of lib/vasnprintf.c.
54AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF],
55[
56 AC_REQUIRE([AC_FUNC_ALLOCA])
57 AC_REQUIRE([gt_TYPE_WCHAR_T])
58 AC_REQUIRE([gt_TYPE_WINT_T])
59 AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb])
60 dnl Use the _snprintf function only if it is declared (because on NetBSD it
61 dnl is defined as a weak alias of snprintf; we prefer to use the latter).
62 AC_CHECK_DECLS([_snprintf], , , [[#include <stdio.h>]])
63 dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization
64 dnl in the code for NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE.
65 AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION])
66 dnl We can avoid a lot of code by assuming that snprintf's return value
67 dnl conforms to ISO C99. So check that.
68 AC_REQUIRE([gl_SNPRINTF_RETVAL_C99])
69 case "$gl_cv_func_snprintf_retval_c99" in
70 *yes)
71 AC_DEFINE([HAVE_SNPRINTF_RETVAL_C99], [1],
72 [Define if the return value of the snprintf function is the number of
73 of bytes (excluding the terminating NUL) that would have been produced
74 if the buffer had been large enough.])
75 ;;
76 esac
77 dnl Additionally, the use of %n can be eliminated by assuming that snprintf
78 dnl always produces NUL-terminated strings (no truncation).
79 AC_REQUIRE([gl_SNPRINTF_TRUNCATION_C99])
80 case "$gl_cv_func_snprintf_truncation_c99" in
81 *yes)
82 AC_DEFINE([HAVE_SNPRINTF_TRUNCATION_C99], [1],
83 [Define if the string produced by the snprintf function is always NUL
84 terminated.])
85 ;;
86 esac
87])
88
89# Extra prerequisites of lib/vasnprintf.c for supporting 'long double'
90# arguments.
91AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE],
92[
93 AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
94 case "$gl_cv_func_printf_long_double" in
95 *yes)
96 ;;
97 *)
98 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1],
99 [Define if the vasnprintf implementation needs special code for
100 'long double' arguments.])
101 ;;
102 esac
103])
104
105# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double'
106# arguments.
107AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE],
108[
109 AC_REQUIRE([gl_PRINTF_INFINITE])
110 case "$gl_cv_func_printf_infinite" in
111 *yes)
112 ;;
113 *)
114 AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], [1],
115 [Define if the vasnprintf implementation needs special code for
116 infinite 'double' arguments.])
117 ;;
118 esac
119])
120
121# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double'
122# arguments.
123AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE],
124[
125 AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
126 dnl There is no need to set NEED_PRINTF_INFINITE_LONG_DOUBLE if
127 dnl NEED_PRINTF_LONG_DOUBLE is already set.
128 AC_REQUIRE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE])
129 case "$gl_cv_func_printf_long_double" in
130 *yes)
131 case "$gl_cv_func_printf_infinite_long_double" in
132 *yes)
133 ;;
134 *)
135 AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], [1],
136 [Define if the vasnprintf implementation needs special code for
137 infinite 'long double' arguments.])
138 ;;
139 esac
140 ;;
141 esac
142])
143
144# Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive.
145AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A],
146[
147 AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
148 case "$gl_cv_func_printf_directive_a" in
149 *yes)
150 ;;
151 *)
152 AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], [1],
153 [Define if the vasnprintf implementation needs special code for
154 the 'a' and 'A' directives.])
155 AC_CHECK_FUNCS([nl_langinfo])
156 ;;
157 esac
158])
159
160# Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive.
161AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F],
162[
163 AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
164 case "$gl_cv_func_printf_directive_f" in
165 *yes)
166 ;;
167 *)
168 AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], [1],
169 [Define if the vasnprintf implementation needs special code for
170 the 'F' directive.])
171 ;;
172 esac
173])
174
175# Extra prerequisites of lib/vasnprintf.c for supporting the 'ls' directive.
176AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LS],
177[
178 AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
179 case "$gl_cv_func_printf_directive_ls" in
180 *yes)
181 ;;
182 *)
183 AC_DEFINE([NEED_PRINTF_DIRECTIVE_LS], [1],
184 [Define if the vasnprintf implementation needs special code for
185 the 'ls' directive.])
186 ;;
187 esac
188])
189
190# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag.
191AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
192[
193 AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
194 case "$gl_cv_func_printf_flag_grouping" in
195 *yes)
196 ;;
197 *)
198 AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1],
199 [Define if the vasnprintf implementation needs special code for the
200 ' flag.])
201 ;;
202 esac
203])
204
205# Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag.
206AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST],
207[
208 AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
209 case "$gl_cv_func_printf_flag_leftadjust" in
210 *yes)
211 ;;
212 *)
213 AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], [1],
214 [Define if the vasnprintf implementation needs special code for the
215 '-' flag.])
216 ;;
217 esac
218])
219
220# Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag.
221AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO],
222[
223 AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
224 case "$gl_cv_func_printf_flag_zero" in
225 *yes)
226 ;;
227 *)
228 AC_DEFINE([NEED_PRINTF_FLAG_ZERO], [1],
229 [Define if the vasnprintf implementation needs special code for the
230 0 flag.])
231 ;;
232 esac
233])
234
235# Extra prerequisites of lib/vasnprintf.c for supporting large precisions.
236AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION],
237[
238 AC_REQUIRE([gl_PRINTF_PRECISION])
239 case "$gl_cv_func_printf_precision" in
240 *yes)
241 ;;
242 *)
243 AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], [1],
244 [Define if the vasnprintf implementation needs special code for
245 supporting large precisions without arbitrary bounds.])
246 AC_DEFINE([NEED_PRINTF_DOUBLE], [1],
247 [Define if the vasnprintf implementation needs special code for
248 'double' arguments.])
249 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1],
250 [Define if the vasnprintf implementation needs special code for
251 'long double' arguments.])
252 ;;
253 esac
254])
255
256# Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory
257# conditions.
258AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM],
259[
260 AC_REQUIRE([gl_PRINTF_ENOMEM])
261 case "$gl_cv_func_printf_enomem" in
262 *yes)
263 ;;
264 *)
265 AC_DEFINE([NEED_PRINTF_ENOMEM], [1],
266 [Define if the vasnprintf implementation needs special code for
267 surviving out-of-memory conditions.])
268 AC_DEFINE([NEED_PRINTF_DOUBLE], [1],
269 [Define if the vasnprintf implementation needs special code for
270 'double' arguments.])
271 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1],
272 [Define if the vasnprintf implementation needs special code for
273 'long double' arguments.])
274 ;;
275 esac
276])
277
278# Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance.
279AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS],
280[
281 AC_REQUIRE([gl_PREREQ_VASNPRINTF])
282 gl_PREREQ_VASNPRINTF_LONG_DOUBLE
283 gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
284 gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
285 gl_PREREQ_VASNPRINTF_DIRECTIVE_A
286 gl_PREREQ_VASNPRINTF_DIRECTIVE_F
287 gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
288 gl_PREREQ_VASNPRINTF_FLAG_GROUPING
289 gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
290 gl_PREREQ_VASNPRINTF_FLAG_ZERO
291 gl_PREREQ_VASNPRINTF_PRECISION
292 gl_PREREQ_VASNPRINTF_ENOMEM
293])
294
295# Prerequisites of lib/asnprintf.c.
296AC_DEFUN([gl_PREREQ_ASNPRINTF],
297[
298])
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette