It should save 6 seconds. Because it goes like this:
- Test whether 0.01 sec works.
- Test whether 0.1 sec works.
- If not, set the variable to 2, because that's the worst case and it
*must* work.
At which places will then a 'sleep 2' be done where (if not VFAT) a
'sleep 1' would be sufficient?
Sorry, I don't understand what you're saying.
When I look at the code, I see it checking .01, .1, and then 1.
If all those fail, then it falls back to 2 (but never tests it).
am_cv_filesystem_timestamp_resolution=2
am_try_resolutions=1
..
am_try_resolutions="0.01 0.1 $am_try_resolutions"
..
for am_try_res in $am_try_resolutions; do
... sleep $am_try_res twice for ls and four times for make ...
if <this resolution worked>; then
am_cv_filesystem_timestamp_resolution=$am_try_res
break
fi
done
At which places will then a 'sleep 2' be done
sleep 2 is currently never done, so far as I can see.
Anyway, I just committed the change to avoid the make-related sleeps if
the mtime_resolution is 1s. It's what I can see ... -k
-----------------------------------------------------------------------------
automake: omit make subsecond tests if at one-second resolution.
Partially ameliorates report from Bruno Haible, thread at
https://lists.gnu.org/archive/html/automake/2024-06/msg00015.html
* m4/sanity.m4 (_AM_FILESYSTEM_TIMESTAMP_RESOLUTION): if
resolution is only one second, assume make works, to
avoid several sleeps.
diff --git a/m4/sanity.m4 b/m4/sanity.m4
index 09489ffaa..68fbf36f7 100644
--- a/m4/sanity.m4
+++ b/m4/sanity.m4
@@ -90,40 +90,46 @@ for am_try_res in $am_try_resolutions; do
test "$[]3" = conftest.ts2 &&
test "$[]4" = conftest.ts1); then
#
- # Ok, ls -t worked. We have one more thing to check: make.
- # It can happen that everything else supports the subsecond mtimes,
- # but make doesn't, notably on macOS, which ships make 3.81 from
- # 2006 (the last one released under GPLv2). https://bugs.gnu.org/68808
- #
- # So, first let's create a Makefile:
- rm -f conftest.mk
- echo 'conftest.ts1: conftest.ts2' >conftest.mk
- echo ' touch conftest.ts2' >>conftest.mk
- #
- # Now, running
- # touch conftest.ts1; touch conftest.ts2; make
- # should touch ts1 because ts2 is newer. This could happen by luck,
- # but most often, it will fail if make's support is insufficient. So
- # test for several consecutive successes.
- #
- # (We reuse conftest.ts[12] because we still want to modify existing
- # files, not create new ones, per above.)
- n=0
+ # Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
+ # because we don't need to test make.
make_ok=true
- until test $n -eq 4; do
- echo one > conftest.ts1
- sleep $am_try_res
- echo two > conftest.ts2 # ts2 should now be newer than ts1
- if make -f conftest.mk | grep 'up to date' >/dev/null; then
- make_ok=false
- break # out of $n loop
- fi
- n=`expr $n + 1`
- done
+ if test $am_try_res != 1; then
+ # But if we've succeeded so far with a subsecond resolution, we
+ # have one more thing to check: make. It can happen that
+ # everything else supports the subsecond mtimes, but make doesn't;
+ # notably on macOS, which ships make 3.81 from 2006 (the last one
+ # released under GPLv2). https://bugs.gnu.org/68808
+ #
+ # So, first let's create a Makefile (real tab character):
+ rm -f conftest.mk
+ echo 'conftest.ts1: conftest.ts2' >conftest.mk
+ echo ' touch conftest.ts2' >>conftest.mk
+ #
+ # Now, running
+ # touch conftest.ts1; touch conftest.ts2; make
+ # should touch ts1 because ts2 is newer. This could happen by luck,
+ # but most often, it will fail if make's support is insufficient. So
+ # test for several consecutive successes.
+ #
+ # (We reuse conftest.ts[12] because we still want to modify existing
+ # files, not create new ones, per above.)
+ n=0
+ until test $n -eq 3; do
+ echo one > conftest.ts1
+ sleep $am_try_res
+ echo two > conftest.ts2 # ts2 should now be newer than ts1
+ if make -f conftest.mk | grep 'up to date' >/dev/null; then
+ make_ok=false
+ break # out of $n loop
+ fi
+ n=`expr $n + 1`
+ done
+ fi
+ #
if $make_ok; then
# Everything we know to check worked out, so call this resolution good.
am_cv_filesystem_timestamp_resolution=$am_try_res
- break # out of resolution loop
+ break # out of $am_try_res loop
fi
# Otherwise, we'll go on to check the next resolution.
fi
compile finished at Wed Jun 12 18:24:14 2024