Subject: [bug#61240] [PATCH 2/2] Gracefully degrade if Time::HiRes is not available

From: Paul Eggert <[email-masked]>
Date: Tue, 28 Mar 2023 10:03:02 -0700

On 2023-03-28 08:21, Warren Young wrote:
> Surely Solaris 10 (shipped in 2005) is relegated to the role of porting target, getting nothing but a “dist” tarball?

Good point. I'll cc this to Dagobert Michelsen, who maintains the 
Autoconf port for Solaris 10. Dagobert, are people still running 
Autoconf on Solaris 10? If not, worrying about porting to older Perl 
should be even lower priority than it already is.

For context, this email is about GNU bug 61240:

https://bugs.gnu.org/61240

and the fallout that the latest Autoconf release candidate does not run 
on the old version of Perl installed by default on Solaris 10. See:

https://lists.gnu.org/r/autoconf/2023-03/msg00030.html

If OpenCSW already installs a new-enough Perl version then this Autoconf 
business shouldn't be a real issue. On the other hand if it's really 
trivial to keep Autoconf portable to older Perl, and if Jacob Bachmeyer 
or some other Perl expert can vouch for the change, we might as well put 
it in.

PS. I see that msg00030 was not archived at https://bugs.gnu.org/61240, 
so here is a quoted copy of the contents of msg00030 so that this stuff 
gets archived there too:

> On 2023-02-07 21:29, Jacob Bachmeyer wrote:
>> use Exporter;
>> -use Time::HiRes qw(stat);
>> use IO::File;
>>
>> +# use sub-second resolution timestamps if available,
>> +# carry on with one-second resolution timestamps if that is all we have
>> +BEGIN { eval { require Time::HiRes; import Time::HiRes qw(stat) } }
> 
> Thanks for looking into this. Sorry about the long delay.
> 
> My memory was jogged by the recent Autoconf release candidate, which requires Perl 5.10 for what I think is the same reason <https://lists.gnu.org/r/autoconf/2023-03/msg00020.html>. This release candidate didn't build on my Solaris 10 server because Solaris 10 has only Perl 5.8.4. Of course I can work around this by also installing a recent Perl but that is a bit of a pain. I'll cc this email to [email-masked] to give them a heads-up about <https://bugs.gnu.org/61240>.
> 
> It'd be nice (though not crucial) if we could get to the bottom of this for Automake and to sync the result to Autoconf before the new Autoconf release comes out, so that Solaris 10 users of the new Autoconf need to install only recent GNU M4, and not also a recent Perl.
> 
> To get back to the proposed patch quoted above:
> 
> Why change from "use Time::HiRes qw(stat);" to "require Time::HiRes; import Time::HiRes qw(stat)"? (Again, please bear in mind that my Perl is quite rusty.)
> 
> The code formerly had "use File::stat;" before it changed to "use Time::HiRes qw(stat);". Why doesn't the proposed patch need to fall back to "use File::stat;" on older Perls lacking Time::HiRes?
> 
> Thanks again for any advice you can provide.