autoupdate
[gnulib.git] / m4 / vasprintf-posix.m4
blobe22afe7e15d6d7c8f563614f1a00c215a731ced1
1 # vasprintf-posix.m4
2 # serial 20
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_VASPRINTF_POSIX],
10   AC_REQUIRE([gl_FUNC_VASPRINTF_IS_POSIX])
11   if test $gl_cv_func_vasprintf_posix = no; then
12     gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS
13     gl_REPLACE_VASNPRINTF
14     gl_REPLACE_VASPRINTF
15   fi
18 dnl Test whether vasprintf exists and is POSIX compliant.
19 dnl Result is gl_cv_func_vasprintf_posix.
20 AC_DEFUN([gl_FUNC_VASPRINTF_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_vasprintf_posix=no
41   AC_CHECK_FUNCS([vasprintf])
42   case "$gl_cv_func_printf_sizes_c99" in
43     *yes)
44       case "$gl_cv_func_printf_sizes_c23" in
45         *yes)
46           case "$gl_cv_func_printf_long_double" in
47             *yes)
48               case "$gl_cv_func_printf_infinite" in
49                 *yes)
50                   case "$gl_cv_func_printf_infinite_long_double" in
51                     *yes)
52                       case "$gl_cv_func_printf_directive_a" in
53                         *yes)
54                           case "$gl_cv_func_printf_directive_b" in
55                             *yes)
56                               case "$gl_cv_func_printf_directive_f" in
57                                 *yes)
58                                   case m4_ifdef([gl_PRINTF_SUPPORT_N_DIRECTIVE],["$gl_cv_func_printf_directive_n"],["yes"]) in
59                                     *yes)
60                                       case "$gl_cv_func_printf_directive_ls" in
61                                         *yes)
62                                           case "$gl_cv_func_printf_directive_lc" in
63                                             *yes)
64                                               case "$gl_cv_func_printf_positions" in
65                                                 *yes)
66                                                   case "$gl_cv_func_printf_flag_grouping" in
67                                                     *yes)
68                                                       case "$gl_cv_func_printf_flag_leftadjust" in
69                                                         *yes)
70                                                           case "$gl_cv_func_printf_flag_zero" in
71                                                             *yes)
72                                                               case "$gl_cv_func_printf_flag_alt_precision_zero" in
73                                                                 *yes)
74                                                                   case "$gl_cv_func_printf_precision" in
75                                                                     *yes)
76                                                                       case "$gl_cv_func_printf_enomem" in
77                                                                         *yes)
78                                                                           if test $ac_cv_func_vasprintf = yes; then
79                                                                             # vasprintf exists and is
80                                                                             # already POSIX compliant.
81                                                                             gl_cv_func_vasprintf_posix=yes
82                                                                           fi
83                                                                           ;;
84                                                                       esac
85                                                                       ;;
86                                                                   esac
87                                                                   ;;
88                                                               esac
89                                                               ;;
90                                                           esac
91                                                           ;;
92                                                       esac
93                                                       ;;
94                                                   esac
95                                                   ;;
96                                               esac
97                                               ;;
98                                           esac
99                                           ;;
100                                       esac
101                                       ;;
102                                   esac
103                                   ;;
104                               esac
105                               ;;
106                           esac
107                           ;;
108                       esac
109                       ;;
110                   esac
111                   ;;
112               esac
113               ;;
114           esac
115           ;;
116       esac
117       ;;
118   esac