From 69e170a84c2f0e722f85b88285b0d4bedcd20063 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 1 Nov 2024 12:25:22 +0100 Subject: [PATCH] Improve log output of an Autoconf test. * m4/malloc.m4 (gl_CHECK_MALLOC_POSIX): On native Windows, report "guessing yes/no". (gl_FUNC_MALLOC_POSIX): Update. * m4/strdup.m4 (gl_FUNC_STRDUP_POSIX): Likewise. --- ChangeLog | 8 ++++++++ m4/malloc.m4 | 23 +++++++++++++---------- m4/strdup.m4 | 9 +++++---- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index fcf057ebfe..36e34b048d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2024-11-01 Bruno Haible + + Improve log output of an Autoconf test. + * m4/malloc.m4 (gl_CHECK_MALLOC_POSIX): On native Windows, report + "guessing yes/no". + (gl_FUNC_MALLOC_POSIX): Update. + * m4/strdup.m4 (gl_FUNC_STRDUP_POSIX): Likewise. + 2024-10-31 Paul Eggert malloc, realloc: fix $3 bug diff --git a/m4/malloc.m4 b/m4/malloc.m4 index 0d4014de44..657eed779c 100644 --- a/m4/malloc.m4 +++ b/m4/malloc.m4 @@ -1,5 +1,5 @@ # malloc.m4 -# serial 39 +# serial 40 dnl Copyright (C) 2007, 2009-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, @@ -119,16 +119,19 @@ AC_DEFUN([gl_FUNC_MALLOC_POSIX], AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MALLOC_PTRDIFF]) AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) - if test "$gl_cv_func_malloc_posix" = yes; then - AC_DEFINE([HAVE_MALLOC_POSIX], [1], - [Define if malloc, realloc, and calloc set errno on allocation failure.]) - else - REPLACE_MALLOC_FOR_MALLOC_POSIX=1 - fi + case "$gl_cv_func_malloc_posix" in + *yes) + AC_DEFINE([HAVE_MALLOC_POSIX], [1], + [Define if malloc, realloc, and calloc set errno on allocation failure.]) + ;; + *) + REPLACE_MALLOC_FOR_MALLOC_POSIX=1 + ;; + esac ]) # Test whether malloc, realloc, calloc set errno to ENOMEM on failure. -# Set gl_cv_func_malloc_posix to yes or no accordingly. +# Set gl_cv_func_malloc_posix to *yes or *no accordingly. AC_DEFUN([gl_CHECK_MALLOC_POSIX], [ AC_REQUIRE([AC_CANONICAL_HOST]) @@ -154,8 +157,8 @@ AC_DEFUN([gl_CHECK_MALLOC_POSIX], ]], [[]]) ], - [gl_cv_func_malloc_posix=yes], - [gl_cv_func_malloc_posix=no]) + [gl_cv_func_malloc_posix="guessing yes"], + [gl_cv_func_malloc_posix="guessing no"]) ;; irix* | solaris*) dnl On IRIX 6.5, the three functions return NULL with errno unset diff --git a/m4/strdup.m4 b/m4/strdup.m4 index 33452dca47..d6989b52d4 100644 --- a/m4/strdup.m4 +++ b/m4/strdup.m4 @@ -1,5 +1,5 @@ # strdup.m4 -# serial 15 +# serial 16 dnl Copyright (C) 2002-2024 Free Software Foundation, Inc. @@ -21,9 +21,10 @@ AC_DEFUN([gl_FUNC_STRDUP_POSIX], [ AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) - if test $gl_cv_func_malloc_posix != yes; then - REPLACE_STRDUP=1 - fi + case "$gl_cv_func_malloc_posix" in + *yes) ;; + *) REPLACE_STRDUP=1 ;; + esac AC_CHECK_DECLS_ONCE([strdup]) if test $ac_cv_have_decl_strdup = no; then HAVE_DECL_STRDUP=0 -- 2.39.5