3 dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 AC_DEFUN([gl_FUNC_VSNPRINTF_POSIX],
10 AC_REQUIRE([gl_FUNC_VSNPRINTF_IS_POSIX])
11 if test $gl_cv_func_vsnprintf_posix = no; then
12 gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS
18 dnl Test whether vsnprintf exists and is POSIX compliant.
19 dnl Result is gl_cv_func_vsnprintf_posix.
20 AC_DEFUN([gl_FUNC_VSNPRINTF_IS_POSIX],
22 AC_REQUIRE([gl_PRINTF_SIZES_C99])
23 AC_REQUIRE([gl_PRINTF_SIZES_C23])
24 AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
25 AC_REQUIRE([gl_PRINTF_INFINITE])
26 AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
27 AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
28 AC_REQUIRE([gl_PRINTF_DIRECTIVE_B])
29 AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
30 m4_ifdef([gl_PRINTF_SUPPORT_N_DIRECTIVE],[AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])])
31 AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
32 AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC])
33 AC_REQUIRE([gl_PRINTF_POSITIONS])
34 AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
35 AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
36 AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
37 AC_REQUIRE([gl_PRINTF_FLAG_ALT_PRECISION_ZERO])
38 AC_REQUIRE([gl_PRINTF_PRECISION])
39 AC_REQUIRE([gl_PRINTF_ENOMEM])
40 gl_cv_func_vsnprintf_posix=no
41 AC_CHECK_FUNCS([vsnprintf])
42 if test $ac_cv_func_vsnprintf = yes; then
43 dnl These tests use vsnprintf() if snprintf() does not exist.
44 gl_SNPRINTF_TRUNCATION_C99
45 gl_SNPRINTF_RETVAL_C99
46 gl_SNPRINTF_DIRECTIVE_N
48 gl_VSNPRINTF_ZEROSIZE_C99
49 case "$gl_cv_func_printf_sizes_c99" in
51 case "$gl_cv_func_printf_sizes_c23" in
53 case "$gl_cv_func_printf_long_double" in
55 case "$gl_cv_func_printf_infinite" in
57 case "$gl_cv_func_printf_infinite_long_double" in
59 case "$gl_cv_func_printf_directive_a" in
61 case "$gl_cv_func_printf_directive_b" in
63 case "$gl_cv_func_printf_directive_f" in
65 case m4_ifdef([gl_PRINTF_SUPPORT_N_DIRECTIVE],["$gl_cv_func_printf_directive_n"],["yes"]) in
67 case "$gl_cv_func_printf_directive_ls" in
69 case "$gl_cv_func_printf_directive_lc" in
71 case "$gl_cv_func_printf_positions" in
73 case "$gl_cv_func_printf_flag_grouping" in
75 case "$gl_cv_func_printf_flag_leftadjust" in
77 case "$gl_cv_func_printf_flag_zero" in
79 case "$gl_cv_func_printf_flag_alt_precision_zero" in
81 case "$gl_cv_func_printf_precision" in
83 case "$gl_cv_func_printf_enomem" in
85 case "$gl_cv_func_snprintf_truncation_c99" in
87 case "$gl_cv_func_snprintf_retval_c99" in
89 case m4_ifdef([gl_PRINTF_SUPPORT_N_DIRECTIVE],["$gl_cv_func_snprintf_directive_n"],["yes"]) in
91 case "$gl_cv_func_snprintf_size1" in
93 case "$gl_cv_func_vsnprintf_zerosize_c99" in
95 # vsnprintf exists and is
96 # already POSIX compliant.
97 gl_cv_func_vsnprintf_posix=yes