Use xsize.h to protect against memory size overflows.
[gnulib.git] / m4 / vasnprintf.m4
1 # vasnprintf.m4 serial 3
2 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
3 dnl This file is free software, distributed under the terms of the GNU
4 dnl General Public License.  As a special exception to the GNU General
5 dnl Public License, this file may be distributed as part of a program
6 dnl that contains a configuration script generated by Autoconf, under
7 dnl the same distribution terms as the rest of that program.
8
9 AC_DEFUN([gl_FUNC_VASNPRINTF],
10 [
11   AC_REPLACE_FUNCS(vasnprintf)
12   if test $ac_cv_func_vasnprintf = no; then
13     AC_LIBOBJ(printf-args)
14     AC_LIBOBJ(printf-parse)
15     AC_LIBOBJ(asnprintf)
16     gl_PREREQ_PRINTF_ARGS
17     gl_PREREQ_PRINTF_PARSE
18     gl_PREREQ_VASNPRINTF
19     gl_PREREQ_ASNPRINTF
20   fi
21 ])
22
23 # Prequisites of lib/printf-args.h, lib/printf-args.c.
24 AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
25 [
26   AC_REQUIRE([bh_C_SIGNED])
27   AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
28   AC_REQUIRE([gt_TYPE_LONGDOUBLE])
29   AC_REQUIRE([gt_TYPE_WCHAR_T])
30   AC_REQUIRE([gt_TYPE_WINT_T])
31 ])
32
33 # Prequisites of lib/printf-parse.h, lib/printf-parse.c.
34 AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
35 [
36   AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
37   AC_REQUIRE([gt_TYPE_LONGDOUBLE])
38   AC_REQUIRE([gt_TYPE_WCHAR_T])
39   AC_REQUIRE([gt_TYPE_WINT_T])
40   AC_REQUIRE([AC_TYPE_SIZE_T])
41   AC_REQUIRE([gt_TYPE_SSIZE_T])
42   AC_CHECK_TYPES(ptrdiff_t)
43   AC_REQUIRE([gt_AC_TYPE_INTMAX_T])
44 ])
45
46 # Prerequisites of lib/vasnprintf.c.
47 AC_DEFUN([gl_PREREQ_VASNPRINTF],
48 [
49   AC_REQUIRE([AC_FUNC_ALLOCA])
50   AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
51   AC_REQUIRE([gt_TYPE_LONGDOUBLE])
52   AC_REQUIRE([gt_TYPE_WCHAR_T])
53   AC_REQUIRE([gt_TYPE_WINT_T])
54   AC_CHECK_FUNCS(snprintf wcslen)
55 ])
56
57 # Prerequisites of lib/asnprintf.c.
58 AC_DEFUN([gl_PREREQ_ASNPRINTF],
59 [
60 ])