1 # vasnprintf.m4 serial 24
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.
7 AC_DEFUN([gl_FUNC_VASNPRINTF],
9 AC_REQUIRE([gl_EOVERFLOW])
10 AC_CHECK_FUNCS_ONCE([vasnprintf])
11 if test $ac_cv_func_vasnprintf = no; then
16 AC_DEFUN([gl_REPLACE_VASNPRINTF],
18 AC_CHECK_FUNCS_ONCE([vasnprintf])
19 AC_LIBOBJ([vasnprintf])
20 AC_LIBOBJ([printf-args])
21 AC_LIBOBJ([printf-parse])
22 AC_LIBOBJ([asnprintf])
23 if test $ac_cv_func_vasnprintf = yes; then
24 AC_DEFINE([REPLACE_VASNPRINTF], 1,
25 [Define if vasnprintf exists but is overridden by gnulib.])
28 gl_PREREQ_PRINTF_PARSE
33 # Prequisites of lib/printf-args.h, lib/printf-args.c.
34 AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
36 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
37 AC_REQUIRE([gt_TYPE_WCHAR_T])
38 AC_REQUIRE([gt_TYPE_WINT_T])
41 # Prequisites of lib/printf-parse.h, lib/printf-parse.c.
42 AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
44 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
45 AC_REQUIRE([gt_TYPE_WCHAR_T])
46 AC_REQUIRE([gt_TYPE_WINT_T])
47 AC_REQUIRE([AC_TYPE_SIZE_T])
48 AC_CHECK_TYPE([ptrdiff_t], ,
49 [AC_DEFINE([ptrdiff_t], [long],
50 [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
52 AC_REQUIRE([gt_AC_TYPE_INTMAX_T])
55 # Prerequisites of lib/vasnprintf.c.
56 AC_DEFUN([gl_PREREQ_VASNPRINTF],
58 AC_REQUIRE([AC_FUNC_ALLOCA])
59 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
60 AC_REQUIRE([gt_TYPE_WCHAR_T])
61 AC_REQUIRE([gt_TYPE_WINT_T])
62 AC_CHECK_FUNCS(snprintf wcslen)
63 dnl Use the _snprintf function only if it is declared (because on NetBSD it
64 dnl is defined as a weak alias of snprintf; we prefer to use the latter).
65 AC_CHECK_DECLS([_snprintf], , , [#include <stdio.h>])
68 # Extra prerequisites of lib/vasnprintf.c for supporting 'long double'
70 AC_DEFUN([gl_PREREQ_VASNPRINTF_LONG_DOUBLE],
72 AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
73 case "$gl_cv_func_printf_long_double" in
77 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1,
78 [Define if the vasnprintf implementation needs special code for
79 'long double' arguments.])
84 # Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double'
86 AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE],
88 AC_REQUIRE([gl_PRINTF_INFINITE])
89 case "$gl_cv_func_printf_infinite" in
93 AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], 1,
94 [Define if the vasnprintf implementation needs special code for
95 infinite 'double' arguments.])
100 # Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double'
102 AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE],
104 AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
105 dnl There is no need to set NEED_PRINTF_INFINITE_LONG_DOUBLE if
106 dnl NEED_PRINTF_LONG_DOUBLE is already set.
107 AC_REQUIRE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE])
108 case "$gl_cv_func_printf_long_double" in
110 case "$gl_cv_func_printf_infinite_long_double" in
114 AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], 1,
115 [Define if the vasnprintf implementation needs special code for
116 infinite 'long double' arguments.])
123 # Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive.
124 AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A],
126 AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
127 case "$gl_cv_func_printf_directive_a" in
131 AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], 1,
132 [Define if the vasnprintf implementation needs special code for
133 the 'a' and 'A' directives.])
134 AC_CHECK_FUNCS([nl_langinfo])
139 # Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive.
140 AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F],
142 AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
143 case "$gl_cv_func_printf_directive_f" in
147 AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], 1,
148 [Define if the vasnprintf implementation needs special code for
154 # Extra prerequisites of lib/vasnprintf.c for supporting the ' flag.
155 AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
157 AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
158 case "$gl_cv_func_printf_flag_grouping" in
162 AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], 1,
163 [Define if the vasnprintf implementation needs special code for the
169 # Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag.
170 AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST],
172 AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
173 case "$gl_cv_func_printf_flag_leftadjust" in
177 AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], 1,
178 [Define if the vasnprintf implementation needs special code for the
184 # Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag.
185 AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO],
187 AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
188 case "$gl_cv_func_printf_flag_zero" in
192 AC_DEFINE([NEED_PRINTF_FLAG_ZERO], 1,
193 [Define if the vasnprintf implementation needs special code for the
199 # Extra prerequisites of lib/vasnprintf.c for supporting large precisions.
200 AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION],
202 AC_REQUIRE([gl_PRINTF_PRECISION])
203 case "$gl_cv_func_printf_precision" in
207 AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], 1,
208 [Define if the vasnprintf implementation needs special code for
209 supporting large precisions without arbitrary bounds.])
210 AC_DEFINE([NEED_PRINTF_DOUBLE], 1,
211 [Define if the vasnprintf implementation needs special code for
212 'double' arguments.])
213 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1,
214 [Define if the vasnprintf implementation needs special code for
215 'long double' arguments.])
220 # Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory
222 AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM],
224 AC_REQUIRE([gl_PRINTF_ENOMEM])
225 case "$gl_cv_func_printf_enomem" in
229 AC_DEFINE([NEED_PRINTF_ENOMEM], 1,
230 [Define if the vasnprintf implementation needs special code for
231 surviving out-of-memory conditions.])
232 AC_DEFINE([NEED_PRINTF_DOUBLE], 1,
233 [Define if the vasnprintf implementation needs special code for
234 'double' arguments.])
235 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1,
236 [Define if the vasnprintf implementation needs special code for
237 'long double' arguments.])
242 # Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance.
243 AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS],
245 AC_REQUIRE([gl_PREREQ_VASNPRINTF])
246 gl_PREREQ_VASNPRINTF_LONG_DOUBLE
247 gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
248 gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
249 gl_PREREQ_VASNPRINTF_DIRECTIVE_A
250 gl_PREREQ_VASNPRINTF_DIRECTIVE_F
251 gl_PREREQ_VASNPRINTF_FLAG_GROUPING
252 gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
253 gl_PREREQ_VASNPRINTF_FLAG_ZERO
254 gl_PREREQ_VASNPRINTF_PRECISION
255 gl_PREREQ_VASNPRINTF_ENOMEM
258 # Prerequisites of lib/asnprintf.c.
259 AC_DEFUN([gl_PREREQ_ASNPRINTF],