1 # vasnprintf.m4 serial 29
2 dnl Copyright (C) 2002-2004, 2006-2009 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_CHECK_FUNCS_ONCE([vasnprintf])
10 if test $ac_cv_func_vasnprintf = no; then
15 AC_DEFUN([gl_REPLACE_VASNPRINTF],
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.])
27 gl_PREREQ_PRINTF_PARSE
32 # Prequisites of lib/printf-args.h, lib/printf-args.c.
33 AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
35 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
36 AC_REQUIRE([gt_TYPE_WCHAR_T])
37 AC_REQUIRE([gt_TYPE_WINT_T])
40 # Prequisites of lib/printf-parse.h, lib/printf-parse.c.
41 AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
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.])
51 AC_REQUIRE([gt_AC_TYPE_INTMAX_T])
54 # Prerequisites of lib/vasnprintf.c.
55 AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF],
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 strnlen wcslen wcsnlen mbrtowc wcrtomb])
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>])
67 # Extra prerequisites of lib/vasnprintf.c for supporting 'long double'
69 AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE],
71 AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
72 case "$gl_cv_func_printf_long_double" in
76 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1],
77 [Define if the vasnprintf implementation needs special code for
78 'long double' arguments.])
83 # Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double'
85 AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE],
87 AC_REQUIRE([gl_PRINTF_INFINITE])
88 case "$gl_cv_func_printf_infinite" in
92 AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], [1],
93 [Define if the vasnprintf implementation needs special code for
94 infinite 'double' arguments.])
99 # Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double'
101 AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE],
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
109 case "$gl_cv_func_printf_infinite_long_double" in
113 AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], [1],
114 [Define if the vasnprintf implementation needs special code for
115 infinite 'long double' arguments.])
122 # Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive.
123 AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A],
125 AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
126 case "$gl_cv_func_printf_directive_a" in
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])
138 # Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive.
139 AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F],
141 AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
142 case "$gl_cv_func_printf_directive_f" in
146 AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], [1],
147 [Define if the vasnprintf implementation needs special code for
153 # Extra prerequisites of lib/vasnprintf.c for supporting the 'ls' directive.
154 AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LS],
156 AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
157 case "$gl_cv_func_printf_directive_ls" in
161 AC_DEFINE([NEED_PRINTF_DIRECTIVE_LS], [1],
162 [Define if the vasnprintf implementation needs special code for
163 the 'ls' directive.])
168 # Extra prerequisites of lib/vasnprintf.c for supporting the ' flag.
169 AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
171 AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
172 case "$gl_cv_func_printf_flag_grouping" in
176 AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1],
177 [Define if the vasnprintf implementation needs special code for the
183 # Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag.
184 AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST],
186 AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
187 case "$gl_cv_func_printf_flag_leftadjust" in
191 AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], [1],
192 [Define if the vasnprintf implementation needs special code for the
198 # Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag.
199 AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO],
201 AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
202 case "$gl_cv_func_printf_flag_zero" in
206 AC_DEFINE([NEED_PRINTF_FLAG_ZERO], [1],
207 [Define if the vasnprintf implementation needs special code for the
213 # Extra prerequisites of lib/vasnprintf.c for supporting large precisions.
214 AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION],
216 AC_REQUIRE([gl_PRINTF_PRECISION])
217 case "$gl_cv_func_printf_precision" in
221 AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], [1],
222 [Define if the vasnprintf implementation needs special code for
223 supporting large precisions without arbitrary bounds.])
224 AC_DEFINE([NEED_PRINTF_DOUBLE], [1],
225 [Define if the vasnprintf implementation needs special code for
226 'double' arguments.])
227 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1],
228 [Define if the vasnprintf implementation needs special code for
229 'long double' arguments.])
234 # Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory
236 AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM],
238 AC_REQUIRE([gl_PRINTF_ENOMEM])
239 case "$gl_cv_func_printf_enomem" in
243 AC_DEFINE([NEED_PRINTF_ENOMEM], [1],
244 [Define if the vasnprintf implementation needs special code for
245 surviving out-of-memory conditions.])
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.])
256 # Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance.
257 AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS],
259 AC_REQUIRE([gl_PREREQ_VASNPRINTF])
260 gl_PREREQ_VASNPRINTF_LONG_DOUBLE
261 gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
262 gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
263 gl_PREREQ_VASNPRINTF_DIRECTIVE_A
264 gl_PREREQ_VASNPRINTF_DIRECTIVE_F
265 gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
266 gl_PREREQ_VASNPRINTF_FLAG_GROUPING
267 gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
268 gl_PREREQ_VASNPRINTF_FLAG_ZERO
269 gl_PREREQ_VASNPRINTF_PRECISION
270 gl_PREREQ_VASNPRINTF_ENOMEM
273 # Prerequisites of lib/asnprintf.c.
274 AC_DEFUN([gl_PREREQ_ASNPRINTF],