This commit was manufactured by cvs2svn to create tag
[heimdal.git] / cf / broken-snprintf.m4
blob68964c6a9370044aabbe6453825aef4238b6fc67
1 dnl $Id$
2 dnl
3 AC_DEFUN([AC_BROKEN_SNPRINTF], [
4 AC_CACHE_CHECK(for working snprintf,ac_cv_func_snprintf_working,
5 ac_cv_func_snprintf_working=yes
6 AC_TRY_RUN([
7 #include <stdio.h>
8 #include <string.h>
9 int main()
11         char foo[[3]];
12         snprintf(foo, 2, "12");
13         return strcmp(foo, "1");
14 }],:,ac_cv_func_snprintf_working=no,:))
16 if test "$ac_cv_func_snprintf_working" = yes; then
17         AC_DEFINE_UNQUOTED(HAVE_SNPRINTF, 1, [define if you have a working snprintf])
19 if test "$ac_cv_func_snprintf_working" = yes; then
20 AC_NEED_PROTO([#include <stdio.h>],snprintf)
24 AC_DEFUN([AC_BROKEN_VSNPRINTF],[
25 AC_CACHE_CHECK(for working vsnprintf,ac_cv_func_vsnprintf_working,
26 ac_cv_func_vsnprintf_working=yes
27 AC_TRY_RUN([
28 #include <stdio.h>
29 #include <string.h>
30 #include <stdarg.h>
32 int foo(int num, ...)
34         char bar[[3]];
35         va_list arg;
36         va_start(arg, num);
37         vsnprintf(bar, 2, "%s", arg);
38         va_end(arg);
39         return strcmp(bar, "1");
43 int main()
45         return foo(0, "12");
46 }],:,ac_cv_func_vsnprintf_working=no,:))
48 if test "$ac_cv_func_vsnprintf_working" = yes; then
49         AC_DEFINE_UNQUOTED(HAVE_VSNPRINTF, 1, [define if you have a working vsnprintf])
51 if test "$ac_cv_func_vsnprintf_working" = yes; then
52 AC_NEED_PROTO([#include <stdio.h>],vsnprintf)