Subject: | Add an environment variable to skip running configuration probes |
Hi, I'm looking at cross compiling Time-HiRes, and the configuration probes are something of a problem. They are currently implemented by compiling and running small test programs, but in cross compiling situations running the probes is hard or impossible.
On at least my GNU/Linux system, just compilation success or failure seems to be enough for getting the right configuration. Would you consider adding an opt-in facility to just compile but not run the probes? An environment variable would work fine for this purpose, see the attached patch (also available at https://github.com/ntyni/Time-HiRes/commit/8ad8c8af5fd04e272de370314940d5c28649c8e1 ).
Alternatively, I suppose the hints mechanism could be used, but there doesn't currently seem to be a hook for overriding $DEFINE when sourcing the hints. Perhaps one could be added? A downside of this approach is that it requires locally patching the source to be built, as I expect it's not realistic to arrive at a generic 'linux' configuration. Maybe a way to provide an external hint file could solve this?
Many thanks for your work,
--
Niko Tyni
ntyni@debian.org
Subject: | 0001-Add-an-environment-variable-to-skip-running-configur.patch |
From 8ad8c8af5fd04e272de370314940d5c28649c8e1 Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Thu, 21 Jan 2016 18:47:05 +0200
Subject: [PATCH] Add an environment variable to skip running configuration
probes
When cross-compiling, running the probes is hard or impossible,
but compiling them seems to get most things right at least on modern
systems. Having an opt-in method to skip the running part by setting
TIME_HIRES_DONT_RUN_PROBES=1 in the environment makes cross-compiling
possible on such systems.
The available method of skipping the probes completely based on %Config
information does not seem usable: $Config{d_nanosleep} was short lived
(perl-5.8.0-259-g2d73687 until perl-5.8.0-1750-g6bdd71e), and the
d_clock* entries don't seem to ever have existed. See also the thread
around http://www.nntp.perl.org/group/perl.perl5.porters/2003/07/msg77404.html
---
Makefile.PL | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.PL b/Makefile.PL
index bbdd7a7..22aa0c2 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -150,7 +150,7 @@ __EOD__
my $res = system($cccmd);
$ok = defined($res) && $res == 0 && -s $tmp_exe && -x _;
- if ( $ok && exists $args{run} && $args{run}) {
+ if ( $ok && exists $args{run} && $args{run} && !$ENV{TIME_HIRES_DONT_RUN_PROBES} ) {
my $tmp_exe =
File::Spec->catfile(File::Spec->curdir, $tmp_exe);
my @run = $tmp_exe;
--
2.7.0.rc3