diff options
author | Russ Allbery <rra@stanford.edu> | 2010-02-21 17:45:56 -0800 |
---|---|---|
committer | Russ Allbery <rra@stanford.edu> | 2010-02-21 17:45:56 -0800 |
commit | ae14bea1375dd5923d4a73e167b27bee13feb7b7 (patch) | |
tree | c1222395732cf8ce2cca32f013f080d19736f474 /m4/snprintf.m4 | |
parent | 57aba51dc26ebf0bdd034f6cb418a9ea5f1fc0be (diff) | |
parent | 60210334fa3dbd5dd168199063c6ee850d750d0c (diff) |
Merge commit 'upstream/0.10' into debian
Diffstat (limited to 'm4/snprintf.m4')
-rw-r--r-- | m4/snprintf.m4 | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/m4/snprintf.m4 b/m4/snprintf.m4 index 8ab3689..d933f55 100644 --- a/m4/snprintf.m4 +++ b/m4/snprintf.m4 @@ -1,5 +1,4 @@ -dnl snprintf.m4 -- Test for a working C99 snprintf. -dnl $Id$ +dnl Test for a working C99 snprintf. dnl dnl Check for a working snprintf. Some systems have an snprintf that doesn't dnl nul-terminate if the buffer isn't large enough. Others return -1 if the @@ -11,12 +10,14 @@ dnl Provides RRA_FUNC_SNPRINTF, which adds snprintf.o to LIBOBJS unless a dnl fully working snprintf is found. dnl dnl Written by Russ Allbery <rra@stanford.edu> -dnl Copyright 2006, 2008 Board of Trustees, Leland Stanford Jr. University +dnl Copyright 2006, 2008, 2009 +dnl Board of Trustees, Leland Stanford Jr. University +dnl dnl See LICENSE for licensing terms. dnl Source used by RRA_FUNC_SNPRINTF. -define([_RRA_FUNC_SNPRINTF_SOURCE], -[[#include <stdio.h> +AC_DEFUN([_RRA_FUNC_SNPRINTF_SOURCE], [[ +#include <stdio.h> #include <stdarg.h> char buf[2]; @@ -38,16 +39,17 @@ main() { return ((test("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0' && snprintf(NULL, 0, "%s", "abcd") == 4) ? 0 : 1); -}]]) +} +]]) dnl The user-callable test. AC_DEFUN([RRA_FUNC_SNPRINTF], [AC_CACHE_CHECK([for working snprintf], [rra_cv_func_snprintf_works], - [AC_TRY_RUN(_RRA_FUNC_SNPRINTF_SOURCE(), + [AC_RUN_IFELSE([AC_LANG_SOURCE([_RRA_FUNC_SNPRINTF_SOURCE])], [rra_cv_func_snprintf_works=yes], [rra_cv_func_snprintf_works=no], [rra_cv_func_snprintf_works=no])]) -AS_IF([test "$rra_cv_func_snprintf_works" = yes], + AS_IF([test x"$rra_cv_func_snprintf_works" = xyes], [AC_DEFINE([HAVE_SNPRINTF], 1, [Define if your system has a working snprintf function.])], [AC_LIBOBJ([snprintf])])]) |