Eric Blake wrote: > However, the spurious output is still > misleading, so what do you think of this patch to clean it up? I have not > pushed it yet... > > A variable with _cv_ in the name is still cached, regardless of whether > you used AC_CACHE_VAL; all AC_CACHE_VAL does is wrap additional logic to > produce output, thus it should not be used in situations where you don't > want the side effect of output.
"AC_CACHE_VAL does is wrap additional logic to produce output" - that is something that may be valid in the current autoconf. But the documentation of AC_CACHE_VAL is clear about the fact that it is the AC_CACHE_VAL invocation that ensures the caching of the variable. The fact that - currently - a variable with _cv_ in its name is cached even without an AC_CACHE_VAL invocation is undocumented; you might even say that it's a bug. Therefore I find it unwise to rely on that. I'm applying this instead. It also relies on an undocumented detail (the as_echo_n variable), but it will be less hairy to fix if it breaks in future versions of autoconf. 2009-02-27 Bruno Haible <br...@clisp.org> Avoid spurious "(cached)" in configure output. * m4/gnulib-common.m4 (gl_CACHE_VAL_SILENT): New macro. * m4/ceil.m4 (gl_FUNC_CEIL_LIBS): Use it instead of AC_CACHE_VAL. * m4/ceilf.m4 (gl_FUNC_CEILF_LIBS): Likewise. * m4/ceill.m4 (gl_FUNC_CEILL_LIBS): Likewise. * m4/floor.m4 (gl_FUNC_FLOOR_LIBS): Likewise. * m4/floorf.m4 (gl_FUNC_FLOORF_LIBS): Likewise. * m4/floorl.m4 (gl_FUNC_FLOORL_LIBS): Likewise. * m4/stdarg.m4 (gl_STDARG_H): Likewise. Reported by Eric Blake. --- m4/gnulib-common.m4.orig 2009-02-27 18:24:00.000000000 +0100 +++ m4/gnulib-common.m4 2009-02-27 18:19:19.000000000 +0100 @@ -1,4 +1,4 @@ -# gnulib-common.m4 serial 10 +# gnulib-common.m4 serial 11 dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -109,3 +109,16 @@ [ AC_C_BIGENDIAN ]) + +# gl_CACHE_VAL_SILENT(cache-id, command-to-set-it) +# is like AC_CACHE_VAL(cache-id, command-to-set-it), except that it does not +# output a spurious "(cached)" mark in the midst of other configure output. +# This macro should be used instead of AC_CACHE_VAL when it is not surrounded +# by an AC_MSG_CHECKING/AC_MSG_RESULT pair. +AC_DEFUN([gl_CACHE_VAL_SILENT], +[ + saved_as_echo_n="$as_echo_n" + as_echo_n=':' + AC_CACHE_VAL([$1], [$2]) + as_echo_n="$saved_as_echo_n" +]) --- m4/ceil.m4.orig 2009-02-27 18:24:00.000000000 +0100 +++ m4/ceil.m4 2009-02-27 18:23:12.000000000 +0100 @@ -1,5 +1,5 @@ -# ceil.m4 serial 2 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# ceil.m4 serial 3 +dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -18,7 +18,7 @@ # Sets CEIL_LIBM. AC_DEFUN([gl_FUNC_CEIL_LIBS], [ - AC_CACHE_VAL([gl_cv_func_ceil_libm], [ + gl_CACHE_VAL_SILENT([gl_cv_func_ceil_libm], [ gl_cv_func_ceil_libm=? AC_TRY_LINK([ #ifndef __NO_MATH_INLINES --- m4/ceilf.m4.orig 2009-02-27 18:24:00.000000000 +0100 +++ m4/ceilf.m4 2009-02-27 18:21:10.000000000 +0100 @@ -1,5 +1,5 @@ -# ceilf.m4 serial 3 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# ceilf.m4 serial 4 +dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -34,7 +34,7 @@ # Sets CEILF_LIBM. AC_DEFUN([gl_FUNC_CEILF_LIBS], [ - AC_CACHE_VAL([gl_cv_func_ceilf_libm], [ + gl_CACHE_VAL_SILENT([gl_cv_func_ceilf_libm], [ gl_cv_func_ceilf_libm=? AC_TRY_LINK([ #ifndef __NO_MATH_INLINES --- m4/ceill.m4.orig 2009-02-27 18:24:00.000000000 +0100 +++ m4/ceill.m4 2009-02-27 18:21:49.000000000 +0100 @@ -1,5 +1,5 @@ -# ceill.m4 serial 3 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# ceill.m4 serial 4 +dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -34,7 +34,7 @@ # Sets CEILL_LIBM. AC_DEFUN([gl_FUNC_CEILL_LIBS], [ - AC_CACHE_VAL([gl_cv_func_ceill_libm], [ + gl_CACHE_VAL_SILENT([gl_cv_func_ceill_libm], [ gl_cv_func_ceill_libm=? AC_TRY_LINK([ #ifndef __NO_MATH_INLINES --- m4/floor.m4.orig 2009-02-27 18:24:00.000000000 +0100 +++ m4/floor.m4 2009-02-27 18:22:54.000000000 +0100 @@ -1,5 +1,5 @@ -# floor.m4 serial 2 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# floor.m4 serial 3 +dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -18,7 +18,7 @@ # Sets FLOOR_LIBM. AC_DEFUN([gl_FUNC_FLOOR_LIBS], [ - AC_CACHE_VAL([gl_cv_func_floor_libm], [ + gl_CACHE_VAL_SILENT([gl_cv_func_floor_libm], [ gl_cv_func_floor_libm=? AC_TRY_LINK([ #ifndef __NO_MATH_INLINES --- m4/floorf.m4.orig 2009-02-27 18:24:00.000000000 +0100 +++ m4/floorf.m4 2009-02-27 18:20:44.000000000 +0100 @@ -1,5 +1,5 @@ -# floorf.m4 serial 3 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# floorf.m4 serial 4 +dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -34,7 +34,7 @@ # Sets FLOORF_LIBM. AC_DEFUN([gl_FUNC_FLOORF_LIBS], [ - AC_CACHE_VAL([gl_cv_func_floorf_libm], [ + gl_CACHE_VAL_SILENT([gl_cv_func_floorf_libm], [ gl_cv_func_floorf_libm=? AC_TRY_LINK([ #ifndef __NO_MATH_INLINES --- m4/floorl.m4.orig 2009-02-27 18:24:00.000000000 +0100 +++ m4/floorl.m4 2009-02-27 18:21:31.000000000 +0100 @@ -1,5 +1,5 @@ -# floorl.m4 serial 3 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# floorl.m4 serial 4 +dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -34,7 +34,7 @@ # Sets FLOORL_LIBM. AC_DEFUN([gl_FUNC_FLOORL_LIBS], [ - AC_CACHE_VAL([gl_cv_func_floorl_libm], [ + gl_CACHE_VAL_SILENT([gl_cv_func_floorl_libm], [ gl_cv_func_floorl_libm=? AC_TRY_LINK([ #ifndef __NO_MATH_INLINES --- m4/stdarg.m4.orig 2009-02-27 18:24:00.000000000 +0100 +++ m4/stdarg.m4 2009-02-27 18:22:29.000000000 +0100 @@ -1,5 +1,5 @@ -# stdarg.m4 serial 2 -dnl Copyright (C) 2006, 2008 Free Software Foundation, Inc. +# stdarg.m4 serial 3 +dnl Copyright (C) 2006, 2008-2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -46,7 +46,7 @@ else dnl Provide a substitute in <config.h>, either __va_copy or as a simple dnl assignment. - AC_CACHE_VAL([gl_cv_func___va_copy], [ + gl_CACHE_VAL_SILENT([gl_cv_func___va_copy], [ AC_TRY_COMPILE([#include <stdarg.h>], [ #ifndef __va_copy error, bail out