summaryrefslogtreecommitdiff
path: root/gnulib-m4/vasnprintf.m4
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2024-10-20 15:21:43 +0200
committerJörg Frings-Fürst <debian@jff.email>2024-10-20 15:21:43 +0200
commit4682deeb62247d34de87f8e777f99e2d337fd377 (patch)
tree5bd5b5605b5f3a4b3c8ea7468c34c23094afdef4 /gnulib-m4/vasnprintf.m4
parent00893e79fc62966067af1a106567db96bd170338 (diff)
New upstream version 1.3upstream/1.3upstream
Diffstat (limited to 'gnulib-m4/vasnprintf.m4')
-rw-r--r--gnulib-m4/vasnprintf.m440
1 files changed, 35 insertions, 5 deletions
diff --git a/gnulib-m4/vasnprintf.m4 b/gnulib-m4/vasnprintf.m4
index 21a85bb1..a02f4e1e 100644
--- a/gnulib-m4/vasnprintf.m4
+++ b/gnulib-m4/vasnprintf.m4
@@ -1,4 +1,5 @@
-# vasnprintf.m4 serial 52
+# vasnprintf.m4
+# serial 54
dnl Copyright (C) 2002-2004, 2006-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,8 +7,40 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_VASNPRINTF],
[
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_CHECK_FUNCS_ONCE([vasnprintf])
- if test $ac_cv_func_vasnprintf = no; then
+ if test $ac_cv_func_vasnprintf = yes; then
+ dnl On Cygwin, in directives with a huge width, the width is ignored, and
+ dnl the function returns a wrong result.
+ AC_CACHE_CHECK([whether vasnprintf works],
+ [gl_cv_func_vasnprintf_works],
+ [AC_RUN_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#include <stdio.h>
+ ]],
+ [[size_t len;
+ char *res = vasnprintf (NULL, &len, "x%03000000000dy\n", -17);
+ /* On Cygwin 3.4.6, res is "x-17y\n" and len == 6: wrong. */
+ return (res != NULL && len < 10);
+ ]])
+ ],
+ [gl_cv_func_vasnprintf_works=yes],
+ [gl_cv_func_vasnprintf_works=no],
+ [case "$host_os" in
+ # Guess no on Cygwin.
+ cygwin*) gl_cv_func_vasnprintf_works="guessing no";;
+ # If we don't know, obey --enable-cross-guesses.
+ *) gl_cv_func_vasnprintf_works="$gl_cross_guess_normal";;
+ esac
+ ])
+ ])
+ fi
+ if test $ac_cv_func_vasnprintf != yes \
+ || case "$gl_cv_func_vasnprintf_works" in
+ *yes) false;;
+ *) true;;
+ esac
+ then
gl_REPLACE_VASNPRINTF
fi
])
@@ -41,7 +74,6 @@ AC_DEFUN([gl_FUNC_VASNWPRINTF],
# Prerequisites of lib/printf-args.h, lib/printf-args.c.
AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
[
- AC_REQUIRE([gt_TYPE_WCHAR_T])
AC_REQUIRE([gt_TYPE_WINT_T])
])
@@ -50,7 +82,6 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
[
AC_REQUIRE([gl_FEATURES_H])
- AC_REQUIRE([gt_TYPE_WCHAR_T])
AC_REQUIRE([gt_TYPE_WINT_T])
AC_REQUIRE([AC_TYPE_SIZE_T])
AC_CHECK_TYPE([ptrdiff_t], ,
@@ -184,7 +215,6 @@ int main()
AC_DEFUN_ONCE([gl_PREREQ_VASNXPRINTF],
[
AC_REQUIRE([AC_FUNC_ALLOCA])
- AC_REQUIRE([gt_TYPE_WCHAR_T])
AC_REQUIRE([gt_TYPE_WINT_T])
AC_CHECK_FUNCS([wcslen])
dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization