Debian Codegraph @

m4/vsnprintf.m4

raw
1 # vsnprintf.m4
2 # serial 7
3 dnl Copyright (C) 2002-2004, 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.
7 dnl This file is offered as-is, without any warranty.
8
9 dnl Libintl 0.17 will replace vsnprintf only if it does not support %1$s,
10 dnl but defers to any gnulib vsnprintf replacements. Therefore, gnulib
11 dnl must guarantee that the decision for replacing vsnprintf is a superset
12 dnl of the reasons checked by libintl.
13 AC_DEFUN([gl_FUNC_VSNPRINTF],
14 [
15 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
16 gl_cv_func_vsnprintf_usable=no
17 AC_CHECK_FUNCS([vsnprintf])
18 if test $ac_cv_func_vsnprintf = yes; then
19 gl_SNPRINTF_SIZE1
20 case "$gl_cv_func_snprintf_size1" in
21 *yes)
22 gl_SNPRINTF_RETVAL_C99
23 case "$gl_cv_func_snprintf_retval_c99" in
24 *yes)
25 gl_PRINTF_POSITIONS
26 case "$gl_cv_func_printf_positions" in
27 *yes)
28 gl_cv_func_vsnprintf_usable=yes
29 ;;
30 esac
31 ;;
32 esac
33 ;;
34 esac
35 fi
36 if test $gl_cv_func_vsnprintf_usable = no; then
37 gl_REPLACE_VSNPRINTF
38 fi
39 AC_CHECK_DECLS_ONCE([vsnprintf])
40 if test $ac_cv_have_decl_vsnprintf = no; then
41 HAVE_DECL_VSNPRINTF=0
42 fi
43 ])
44
45 AC_DEFUN([gl_REPLACE_VSNPRINTF],
46 [
47 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
48 AC_LIBOBJ([vsnprintf])
49 if test $ac_cv_func_vsnprintf = yes; then
50 REPLACE_VSNPRINTF=1
51 else
52 AC_CHECK_DECLS_ONCE([vsnprintf])
53 if test $ac_cv_have_decl_vsnprintf = yes; then
54 dnl If the function is declared but does not appear to exist, it may be
55 dnl defined as an inline function. In order to avoid a conflict, we have
56 dnl to define rpl_vsnprintf, not vsnprintf.
57 REPLACE_VSNPRINTF=1
58 fi
59 fi
60 gl_PREREQ_VSNPRINTF
61 ])
62
63 # Prerequisites of lib/vsnprintf.c.
64 AC_DEFUN([gl_PREREQ_VSNPRINTF], [:])