summaryrefslogtreecommitdiff
path: root/aclocal.m4
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2011-12-08 20:21:07 -0500
committerChet Ramey <chet.ramey@case.edu>2011-12-08 20:21:07 -0500
commitcd0ef72721f58f942ebedb1fb60246c6785a3677 (patch)
treeb190cf3e6937bfdc76ae6db54c08442bcd771d88 /aclocal.m4
parente6062848eb4961acb018a0d4663bf703245ae9ed (diff)
downloadbash-cd0ef72721f58f942ebedb1fb60246c6785a3677.tar.gz
commit bash-20091119 snapshot
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m484
1 files changed, 84 insertions, 0 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index be92a52a..10a4741e 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -4031,3 +4031,87 @@ AC_DEFUN([BASH_FUNC_FPURGE],
AC_CHECK_FUNCS_ONCE([__fpurge])
AC_CHECK_DECLS([fpurge], , , [#include <stdio.h>])
])
+
+AC_DEFUN([BASH_FUNC_SNPRINTF],
+[
+ AC_CHECK_FUNCS_ONCE([snprintf])
+ if test X$ac_cv_func_snprintf = Xyes; then
+ AC_CACHE_CHECK([for standard-conformant snprintf], [bash_cv_func_snprintf],
+ [AC_TRY_RUN([
+#include <stdio.h>
+
+main()
+{
+ int n;
+ n = snprintf (0, 0, "%s", "0123456");
+ exit(n != 7);
+}
+], bash_cv_func_snprintf=yes, bash_cv_func_snprintf=no,
+ [AC_MSG_WARN([cannot check standard snprintf if cross-compiling])
+ bash_cv_func_snprintf=yes]
+)])
+ if test $bash_cv_func_snprintf = no; then
+ ac_cv_func_snprintf=no
+ fi
+ fi
+ if test $ac_cv_func_snprintf = no; then
+ AC_DEFINE(HAVE_SNPRINTF, 0,
+ [Define if you have a standard-conformant snprintf function.])
+ fi
+])
+
+AC_DEFUN([BASH_FUNC_VSNPRINTF],
+[
+ AC_CHECK_FUNCS_ONCE([vsnprintf])
+ if test X$ac_cv_func_vsnprintf = Xyes; then
+ AC_CACHE_CHECK([for standard-conformant vsnprintf], [bash_cv_func_vsnprintf],
+ [AC_TRY_RUN([
+#if HAVE_STDARG_H
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+
+static int
+#if HAVE_STDARG_H
+foo(const char *fmt, ...)
+#else
+foo(format, va_alist)
+ const char *format;
+ va_dcl
+#endif
+{
+ va_list args;
+ int n;
+
+#if HAVE_STDARG_H
+ va_start(args, fmt);
+#else
+ va_start(args);
+#endif
+ n = vsnprintf(0, 0, fmt, args);
+ va_end (args);
+ return n;
+}
+
+main()
+{
+ int n;
+ n = foo("%s", "0123456");
+ exit(n != 7);
+}
+], bash_cv_func_vsnprintf=yes, bash_cv_func_vsnprintf=no,
+ [AC_MSG_WARN([cannot check standard vsnprintf if cross-compiling])
+ bash_cv_func_vsnprintf=yes]
+)])
+ if test $bash_cv_func_vsnprintf = no; then
+ ac_cv_func_vsnprintf=no
+ fi
+ fi
+ if test $ac_cv_func_vsnprintf = no; then
+ AC_DEFINE(HAVE_VSNPRINTF, 0,
+ [Define if you have a standard-conformant vsnprintf function.])
+ fi
+])