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