283
|
1 # vasnprintf.m4 serial 25
|
|
2 dnl Copyright (C) 2002-2004, 2006-2008 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.
|
|
6
|
|
7 AC_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
|
|
15 AC_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 # Prequisites of lib/printf-args.h, lib/printf-args.c.
|
|
33 AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
|
|
34 [
|
|
35 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
|
|
36 AC_REQUIRE([gt_TYPE_WCHAR_T])
|
|
37 AC_REQUIRE([gt_TYPE_WINT_T])
|
|
38 ])
|
|
39
|
|
40 # Prequisites of lib/printf-parse.h, lib/printf-parse.c.
|
|
41 AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
|
|
42 [
|
|
43 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
|
|
44 AC_REQUIRE([gt_TYPE_WCHAR_T])
|
|
45 AC_REQUIRE([gt_TYPE_WINT_T])
|
|
46 AC_REQUIRE([AC_TYPE_SIZE_T])
|
|
47 AC_CHECK_TYPE([ptrdiff_t], ,
|
|
48 [AC_DEFINE([ptrdiff_t], [long],
|
|
49 [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
|
|
50 ])
|
|
51 AC_REQUIRE([gt_AC_TYPE_INTMAX_T])
|
|
52 ])
|
|
53
|
|
54 # Prerequisites of lib/vasnprintf.c.
|
|
55 AC_DEFUN([gl_PREREQ_VASNPRINTF],
|
|
56 [
|
|
57 AC_REQUIRE([AC_FUNC_ALLOCA])
|
|
58 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
|
|
59 AC_REQUIRE([gt_TYPE_WCHAR_T])
|
|
60 AC_REQUIRE([gt_TYPE_WINT_T])
|
|
61 AC_CHECK_FUNCS(snprintf wcslen)
|
|
62 dnl Use the _snprintf function only if it is declared (because on NetBSD it
|
|
63 dnl is defined as a weak alias of snprintf; we prefer to use the latter).
|
|
64 AC_CHECK_DECLS([_snprintf], , , [#include <stdio.h>])
|
|
65 ])
|
|
66
|
|
67 # Extra prerequisites of lib/vasnprintf.c for supporting 'long double'
|
|
68 # arguments.
|
|
69 AC_DEFUN([gl_PREREQ_VASNPRINTF_LONG_DOUBLE],
|
|
70 [
|
|
71 AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
|
|
72 case "$gl_cv_func_printf_long_double" in
|
|
73 *yes)
|
|
74 ;;
|
|
75 *)
|
|
76 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1,
|
|
77 [Define if the vasnprintf implementation needs special code for
|
|
78 'long double' arguments.])
|
|
79 ;;
|
|
80 esac
|
|
81 ])
|
|
82
|
|
83 # Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double'
|
|
84 # arguments.
|
|
85 AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE],
|
|
86 [
|
|
87 AC_REQUIRE([gl_PRINTF_INFINITE])
|
|
88 case "$gl_cv_func_printf_infinite" in
|
|
89 *yes)
|
|
90 ;;
|
|
91 *)
|
|
92 AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], 1,
|
|
93 [Define if the vasnprintf implementation needs special code for
|
|
94 infinite 'double' arguments.])
|
|
95 ;;
|
|
96 esac
|
|
97 ])
|
|
98
|
|
99 # Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double'
|
|
100 # arguments.
|
|
101 AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE],
|
|
102 [
|
|
103 AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
|
|
104 dnl There is no need to set NEED_PRINTF_INFINITE_LONG_DOUBLE if
|
|
105 dnl NEED_PRINTF_LONG_DOUBLE is already set.
|
|
106 AC_REQUIRE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE])
|
|
107 case "$gl_cv_func_printf_long_double" in
|
|
108 *yes)
|
|
109 case "$gl_cv_func_printf_infinite_long_double" in
|
|
110 *yes)
|
|
111 ;;
|
|
112 *)
|
|
113 AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], 1,
|
|
114 [Define if the vasnprintf implementation needs special code for
|
|
115 infinite 'long double' arguments.])
|
|
116 ;;
|
|
117 esac
|
|
118 ;;
|
|
119 esac
|
|
120 ])
|
|
121
|
|
122 # Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive.
|
|
123 AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A],
|
|
124 [
|
|
125 AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
|
|
126 case "$gl_cv_func_printf_directive_a" in
|
|
127 *yes)
|
|
128 ;;
|
|
129 *)
|
|
130 AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], 1,
|
|
131 [Define if the vasnprintf implementation needs special code for
|
|
132 the 'a' and 'A' directives.])
|
|
133 AC_CHECK_FUNCS([nl_langinfo])
|
|
134 ;;
|
|
135 esac
|
|
136 ])
|
|
137
|
|
138 # Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive.
|
|
139 AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F],
|
|
140 [
|
|
141 AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
|
|
142 case "$gl_cv_func_printf_directive_f" in
|
|
143 *yes)
|
|
144 ;;
|
|
145 *)
|
|
146 AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], 1,
|
|
147 [Define if the vasnprintf implementation needs special code for
|
|
148 the 'F' directive.])
|
|
149 ;;
|
|
150 esac
|
|
151 ])
|
|
152
|
|
153 # Extra prerequisites of lib/vasnprintf.c for supporting the ' flag.
|
|
154 AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
|
|
155 [
|
|
156 AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
|
|
157 case "$gl_cv_func_printf_flag_grouping" in
|
|
158 *yes)
|
|
159 ;;
|
|
160 *)
|
|
161 AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], 1,
|
|
162 [Define if the vasnprintf implementation needs special code for the
|
|
163 ' flag.])
|
|
164 ;;
|
|
165 esac
|
|
166 ])
|
|
167
|
|
168 # Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag.
|
|
169 AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST],
|
|
170 [
|
|
171 AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
|
|
172 case "$gl_cv_func_printf_flag_leftadjust" in
|
|
173 *yes)
|
|
174 ;;
|
|
175 *)
|
|
176 AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], 1,
|
|
177 [Define if the vasnprintf implementation needs special code for the
|
|
178 '-' flag.])
|
|
179 ;;
|
|
180 esac
|
|
181 ])
|
|
182
|
|
183 # Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag.
|
|
184 AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO],
|
|
185 [
|
|
186 AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
|
|
187 case "$gl_cv_func_printf_flag_zero" in
|
|
188 *yes)
|
|
189 ;;
|
|
190 *)
|
|
191 AC_DEFINE([NEED_PRINTF_FLAG_ZERO], 1,
|
|
192 [Define if the vasnprintf implementation needs special code for the
|
|
193 0 flag.])
|
|
194 ;;
|
|
195 esac
|
|
196 ])
|
|
197
|
|
198 # Extra prerequisites of lib/vasnprintf.c for supporting large precisions.
|
|
199 AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION],
|
|
200 [
|
|
201 AC_REQUIRE([gl_PRINTF_PRECISION])
|
|
202 case "$gl_cv_func_printf_precision" in
|
|
203 *yes)
|
|
204 ;;
|
|
205 *)
|
|
206 AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], 1,
|
|
207 [Define if the vasnprintf implementation needs special code for
|
|
208 supporting large precisions without arbitrary bounds.])
|
|
209 AC_DEFINE([NEED_PRINTF_DOUBLE], 1,
|
|
210 [Define if the vasnprintf implementation needs special code for
|
|
211 'double' arguments.])
|
|
212 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1,
|
|
213 [Define if the vasnprintf implementation needs special code for
|
|
214 'long double' arguments.])
|
|
215 ;;
|
|
216 esac
|
|
217 ])
|
|
218
|
|
219 # Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory
|
|
220 # conditions.
|
|
221 AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM],
|
|
222 [
|
|
223 AC_REQUIRE([gl_PRINTF_ENOMEM])
|
|
224 case "$gl_cv_func_printf_enomem" in
|
|
225 *yes)
|
|
226 ;;
|
|
227 *)
|
|
228 AC_DEFINE([NEED_PRINTF_ENOMEM], 1,
|
|
229 [Define if the vasnprintf implementation needs special code for
|
|
230 surviving out-of-memory conditions.])
|
|
231 AC_DEFINE([NEED_PRINTF_DOUBLE], 1,
|
|
232 [Define if the vasnprintf implementation needs special code for
|
|
233 'double' arguments.])
|
|
234 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1,
|
|
235 [Define if the vasnprintf implementation needs special code for
|
|
236 'long double' arguments.])
|
|
237 ;;
|
|
238 esac
|
|
239 ])
|
|
240
|
|
241 # Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance.
|
|
242 AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS],
|
|
243 [
|
|
244 AC_REQUIRE([gl_PREREQ_VASNPRINTF])
|
|
245 gl_PREREQ_VASNPRINTF_LONG_DOUBLE
|
|
246 gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
|
|
247 gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
|
|
248 gl_PREREQ_VASNPRINTF_DIRECTIVE_A
|
|
249 gl_PREREQ_VASNPRINTF_DIRECTIVE_F
|
|
250 gl_PREREQ_VASNPRINTF_FLAG_GROUPING
|
|
251 gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
|
|
252 gl_PREREQ_VASNPRINTF_FLAG_ZERO
|
|
253 gl_PREREQ_VASNPRINTF_PRECISION
|
|
254 gl_PREREQ_VASNPRINTF_ENOMEM
|
|
255 ])
|
|
256
|
|
257 # Prerequisites of lib/asnprintf.c.
|
|
258 AC_DEFUN([gl_PREREQ_ASNPRINTF],
|
|
259 [
|
|
260 ])
|