diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-12-28 12:13:40 +0100 |
|---|---|---|
| committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-12-28 12:13:40 +0100 |
| commit | b0afb8fe0ff1d87165af9df61501197a06240dda (patch) | |
| tree | 274ac6a96c53ef4c19ab4974ce24a06a233128c5 /gl/m4/vasnprintf.m4 | |
| parent | 68fc05381ee5fa0aee1413118fbb3d81ca888b09 (diff) | |
| download | monitoring-plugins-b0afb8fe0ff1d87165af9df61501197a06240dda.tar.gz | |
Sync with Gnulib stable-202507 code (a8ac9f9ce5)
Diffstat (limited to 'gl/m4/vasnprintf.m4')
| -rw-r--r-- | gl/m4/vasnprintf.m4 | 74 |
1 files changed, 64 insertions, 10 deletions
diff --git a/gl/m4/vasnprintf.m4 b/gl/m4/vasnprintf.m4 index 1ea2055e..1d040d6e 100644 --- a/gl/m4/vasnprintf.m4 +++ b/gl/m4/vasnprintf.m4 | |||
| @@ -1,14 +1,47 @@ | |||
| 1 | # vasnprintf.m4 | 1 | # vasnprintf.m4 |
| 2 | # serial 52 | 2 | # serial 56 |
| 3 | dnl Copyright (C) 2002-2004, 2006-2024 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2002-2004, 2006-2025 Free Software Foundation, Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 6 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 7 | 8 | ||
| 8 | AC_DEFUN([gl_FUNC_VASNPRINTF], | 9 | AC_DEFUN([gl_FUNC_VASNPRINTF], |
| 9 | [ | 10 | [ |
| 11 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
| 10 | AC_CHECK_FUNCS_ONCE([vasnprintf]) | 12 | AC_CHECK_FUNCS_ONCE([vasnprintf]) |
| 11 | if test $ac_cv_func_vasnprintf = no; then | 13 | if test $ac_cv_func_vasnprintf = yes; then |
| 14 | dnl On Cygwin, in directives with a huge width, the width is ignored, and | ||
| 15 | dnl the function returns a wrong result. | ||
| 16 | AC_CACHE_CHECK([whether vasnprintf works], | ||
| 17 | [gl_cv_func_vasnprintf_works], | ||
| 18 | [AC_RUN_IFELSE( | ||
| 19 | [AC_LANG_SOURCE( | ||
| 20 | [[#include <stdio.h> | ||
| 21 | ]], | ||
| 22 | [[size_t len; | ||
| 23 | char *res = vasnprintf (NULL, &len, "x%03000000000dy\n", -17); | ||
| 24 | /* On Cygwin 3.4.6, res is "x-17y\n" and len == 6: wrong. */ | ||
| 25 | return (res != NULL && len < 10); | ||
| 26 | ]]) | ||
| 27 | ], | ||
| 28 | [gl_cv_func_vasnprintf_works=yes], | ||
| 29 | [gl_cv_func_vasnprintf_works=no], | ||
| 30 | [case "$host_os" in | ||
| 31 | # Guess no on Cygwin. | ||
| 32 | cygwin*) gl_cv_func_vasnprintf_works="guessing no";; | ||
| 33 | # If we don't know, obey --enable-cross-guesses. | ||
| 34 | *) gl_cv_func_vasnprintf_works="$gl_cross_guess_normal";; | ||
| 35 | esac | ||
| 36 | ]) | ||
| 37 | ]) | ||
| 38 | fi | ||
| 39 | if test $ac_cv_func_vasnprintf != yes \ | ||
| 40 | || case "$gl_cv_func_vasnprintf_works" in | ||
| 41 | *yes) false;; | ||
| 42 | *) true;; | ||
| 43 | esac | ||
| 44 | then | ||
| 12 | gl_REPLACE_VASNPRINTF | 45 | gl_REPLACE_VASNPRINTF |
| 13 | fi | 46 | fi |
| 14 | ]) | 47 | ]) |
| @@ -42,7 +75,6 @@ AC_DEFUN([gl_FUNC_VASNWPRINTF], | |||
| 42 | # Prerequisites of lib/printf-args.h, lib/printf-args.c. | 75 | # Prerequisites of lib/printf-args.h, lib/printf-args.c. |
| 43 | AC_DEFUN([gl_PREREQ_PRINTF_ARGS], | 76 | AC_DEFUN([gl_PREREQ_PRINTF_ARGS], |
| 44 | [ | 77 | [ |
| 45 | AC_REQUIRE([gt_TYPE_WCHAR_T]) | ||
| 46 | AC_REQUIRE([gt_TYPE_WINT_T]) | 78 | AC_REQUIRE([gt_TYPE_WINT_T]) |
| 47 | ]) | 79 | ]) |
| 48 | 80 | ||
| @@ -51,7 +83,6 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS], | |||
| 51 | AC_DEFUN([gl_PREREQ_PRINTF_PARSE], | 83 | AC_DEFUN([gl_PREREQ_PRINTF_PARSE], |
| 52 | [ | 84 | [ |
| 53 | AC_REQUIRE([gl_FEATURES_H]) | 85 | AC_REQUIRE([gl_FEATURES_H]) |
| 54 | AC_REQUIRE([gt_TYPE_WCHAR_T]) | ||
| 55 | AC_REQUIRE([gt_TYPE_WINT_T]) | 86 | AC_REQUIRE([gt_TYPE_WINT_T]) |
| 56 | AC_REQUIRE([AC_TYPE_SIZE_T]) | 87 | AC_REQUIRE([AC_TYPE_SIZE_T]) |
| 57 | AC_CHECK_TYPE([ptrdiff_t], , | 88 | AC_CHECK_TYPE([ptrdiff_t], , |
| @@ -185,7 +216,6 @@ int main() | |||
| 185 | AC_DEFUN_ONCE([gl_PREREQ_VASNXPRINTF], | 216 | AC_DEFUN_ONCE([gl_PREREQ_VASNXPRINTF], |
| 186 | [ | 217 | [ |
| 187 | AC_REQUIRE([AC_FUNC_ALLOCA]) | 218 | AC_REQUIRE([AC_FUNC_ALLOCA]) |
| 188 | AC_REQUIRE([gt_TYPE_WCHAR_T]) | ||
| 189 | AC_REQUIRE([gt_TYPE_WINT_T]) | 219 | AC_REQUIRE([gt_TYPE_WINT_T]) |
| 190 | AC_CHECK_FUNCS([wcslen]) | 220 | AC_CHECK_FUNCS([wcslen]) |
| 191 | dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization | 221 | dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization |
| @@ -327,15 +357,39 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LC], | |||
| 327 | # Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. | 357 | # Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. |
| 328 | AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], | 358 | AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], |
| 329 | [ | 359 | [ |
| 360 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 330 | AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) | 361 | AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) |
| 331 | case "$gl_cv_func_printf_flag_grouping" in | 362 | AC_REQUIRE([gl_PRINTF_FLAG_GROUPING_INT_PRECISION]) |
| 332 | *yes) | 363 | AC_REQUIRE([gl_PRINTF_FLAG_GROUPING_MULTIBYTE]) |
| 333 | ;; | 364 | case "$host_os" in |
| 334 | *) | 365 | mingw* | windows*) |
| 366 | dnl MSVC does not support the ' flag at all. | ||
| 367 | dnl mingw does not support it, unless __USE_MINGW_ANSI_STDIO is defined. | ||
| 368 | dnl mingw also has other bugs regarding the ' flag. | ||
| 335 | AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1], | 369 | AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1], |
| 336 | [Define if the vasnprintf implementation needs special code for the | 370 | [Define if the vasnprintf implementation needs special code for the |
| 337 | ' flag.]) | 371 | ' flag.]) |
| 338 | ;; | 372 | ;; |
| 373 | *) | ||
| 374 | case "$gl_cv_func_printf_flag_grouping,$gl_cv_func_printf_flag_grouping_multibyte" in | ||
| 375 | *yes,*yes) | ||
| 376 | case "$gl_cv_func_printf_flag_grouping_int_precision" in | ||
| 377 | *yes) | ||
| 378 | ;; | ||
| 379 | *) | ||
| 380 | AC_DEFINE([NEED_PRINTF_FLAG_GROUPING_INT], [1], | ||
| 381 | [Define if the vasnprintf implementation needs special code for the | ||
| 382 | ' flag, for integer directives only.]) | ||
| 383 | ;; | ||
| 384 | esac | ||
| 385 | ;; | ||
| 386 | *) | ||
| 387 | AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1], | ||
| 388 | [Define if the vasnprintf implementation needs special code for the | ||
| 389 | ' flag.]) | ||
| 390 | ;; | ||
| 391 | esac | ||
| 392 | ;; | ||
| 339 | esac | 393 | esac |
| 340 | ]) | 394 | ]) |
| 341 | 395 | ||
