Hi,

This configure output

  checking for a BSD-compatible install... /usr/bin/install -c
  checking whether sleep supports fractional seconds... true
  checking filesystem timestamp resolution... 2
  checking whether build environment is sane... yes
  ...

bugs me, like it would bug every physicist. A physical entity should always
be displayed with its unit.

It's like you asking me "How long did your breakfast take today?" and me
answering "Two."

Here's a patch that changes this display to

  checking for a BSD-compatible install... /usr/bin/install -c
  checking whether sleep supports fractional seconds... true
  checking filesystem timestamp resolution... 2 sec
  checking whether build environment is sane... yes
  ...

so that everyone understands the value.

The patch passes "make check".

It uses the ${var%...} syntax, which is present in all shells that
'configure' accepts without re-execing (see [1] column 4). I have also
verified that a tarball, made with this changes, configures fine on
Solaris 10.

Bruno

[1] 
https://git.savannah.gnu.org/gitweb/?p=gnulib/maint-tools.git;a=blob;f=test-programs/sh-features;h=ff7d4b6fa29c58da4fbec47a5e78a63f9673670c;hb=HEAD#l152
>From 9f15a04dd9865db339595b0710a4ebefed6cd853 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Mon, 1 Jul 2024 21:04:17 +0200
Subject: [PATCH] automake: Improve display of filesystem timestamp resolution.

* m4/sanity.m4 (_AM_FILESYSTEM_TIMESTAMP_RESOLUTION): Add a ' sec'
suffix to am_cv_filesystem_timestamp_resolution.
(AM_SANITY_CHECK): Update sleep command.
* configure.ac (MTIME_RESOLUTION): Update assignment.
* t/ax/test-defs.in (MTIME_RESOLUTION): Likewise.
---
 configure.ac      | 2 +-
 m4/sanity.m4      | 8 ++++----
 t/ax/test-defs.in | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 13c9f59ae..e947cfd78 100644
--- a/configure.ac
+++ b/configure.ac
@@ -190,7 +190,7 @@ AC_PROG_FGREP
 # The test suite needs to know the resolution of timestamps
 # supported by the filesystem hosting the build.  The value
 # will be acceptable to 'sleep' on this system.
-MTIME_RESOLUTION=$am_cv_filesystem_timestamp_resolution
+MTIME_RESOLUTION=${am_cv_filesystem_timestamp_resolution% sec}
 if test -z "$MTIME_RESOLUTION"; then
   AC_MSG_NOTICE(am_cv_filesystem_timestamp_resolution strangely not set; using 1)
   MTIME_RESOLUTION=1
diff --git a/m4/sanity.m4 b/m4/sanity.m4
index 9e556b33a..3c69f686c 100644
--- a/m4/sanity.m4
+++ b/m4/sanity.m4
@@ -30,7 +30,7 @@ AC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
 AC_CACHE_CHECK([filesystem timestamp resolution],
                am_cv_filesystem_timestamp_resolution, [dnl
 # Default to the worst case.
-am_cv_filesystem_timestamp_resolution=2
+am_cv_filesystem_timestamp_resolution='2 sec'
 
 # Only try to go finer than 1 sec if sleep can do it.
 # Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
@@ -146,7 +146,7 @@ for am_try_res in $am_try_resolutions; do
     #
     if $make_ok; then
       # Everything we know to check worked out, so call this resolution good.
-      am_cv_filesystem_timestamp_resolution=$am_try_res
+      am_cv_filesystem_timestamp_resolution="$am_try_res sec"
       break # out of $am_try_res loop
     fi
     # Otherwise, we'll go on to check the next resolution.
@@ -198,7 +198,7 @@ for am_try in 1 2; do
     break
   fi
   # Just in case.
-  sleep $am_cv_filesystem_timestamp_resolution
+  sleep ${am_cv_filesystem_timestamp_resolution% sec}
   am_has_slept=yes
 done
 
@@ -212,7 +212,7 @@ fi
 # generated files are strictly newer.
 am_sleep_pid=
 AS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
-  ( sleep $am_cv_filesystem_timestamp_resolution ) &
+  ( sleep ${am_cv_filesystem_timestamp_resolution% sec} ) &
   am_sleep_pid=$!
 ])
 AC_CONFIG_COMMANDS_PRE(
diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in
index aac5d60e3..388271cd5 100644
--- a/t/ax/test-defs.in
+++ b/t/ax/test-defs.in
@@ -195,7 +195,7 @@ case $MTIME_RESOLUTION in
       # that's a bug somewhere.
       if test -n "$am_cv_filesystem_timestamp_resolution"; then
         #echo "$me: got $am_cv_filesystem_timestamp_resolution" >&2
-        MTIME_RESOLUTION=$am_cv_filesystem_timestamp_resolution
+        MTIME_RESOLUTION=${am_cv_filesystem_timestamp_resolution% sec}
       else
         # ends up in test-suite.log.
         echo "$me: subsecond-mtime supported per automake and auto4mte" \
-- 
2.34.1

Reply via email to