1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
|
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
use 5.005;
use ExtUtils::MakeMaker;
# add a number of tests to stop the smoke testers from reporting Failed
# in unsupported environments
#
print "Checking for Microsoft Windows... (not supported)\n";
if ( $^O =~ /MSWin32/ ) {
die q{
OS unsupported
Sys::SigAction is not Supported on on $^O operating systems
if you can make all or most of the tests work on this OS, then
please send patches to me, and I will consider them for a new
release that supports $^O.
Note that smoke testers have had successful results in a Cygwin
environment however. So if you want to write scripts using
signals on a Win32 environment consider Cygwin Bash.
Lincoln
};
}
print "Checking for multi-threaded Perl... (warning)\n";
use Config;
eval "use threads";
#belt and suspenders....
if ( ! $@ || $Config{usethreads} || $Config{useithreads} || $Config{use5005threads} ) {
warn q{
This perl has multithread support enabled, this is not a problem for
single threaded perl applications.
Please see "MULTITHREAD PERL in the Sys::SigAction POD for more information
Lincoln
};
}
print "Checking support for signals... (required)\n";
if ( ! defined $Config{sig_name} ) {
die q{
Signals are not supported in this OS or perl version.
}
}
#is sigaction enabled?
print "Checking support for POSIX::sigaction... (required)\n";
if ( ( $] >= 5.008 ) &&
! ( $Config{useposix} && $Config{d_sigaction} ) ) {
die q{
This perl is not supported.
Perl must be built with 'useposix' and 'sigaction' defined.
};
}
print "Checking for armv5tejl... (not supported)\n";
#belt and suspenders....
if ( $Config{archname} =~ m/armv5tejl/ ) {
die q{
Sys::SigAction is not supported on armv5tejl systems.
I have communicated with the smoke tester on this OS,
and we believe that the base perl implementation of
POSIX:sigaction is probably the root cause.
if you want to use this module anyway, or work on getting
it supported by fixing the perl port, you can uncomment out
this section of Makefile.PL to build Sys::SigAction.
};
}
print "Checking for cygwin... (masking signals is broken on some versions at least)\n";
if ( $^O =~ /cygwin/ ) {
warn q(
Smoke testers have discovered that t/mask.t fails on at least
some verions cygwin. Specific versions of the os and perl
and now protected... but others may be found. On this platforms
masking signals probably does not work. See the hash reference
\$broken_platforms for platforms known to be broken.
);
}
my $SAAD = "lib/Sys/SigAction/" ;
my $SAA = "$SAAD/Alarm.pm" ;
print "Writing $SAA\n" ;
mkdir $SAAD if ( not -d $SAAD );
open( SAH, ">$SAA" );
print SAH q(
package Sys::SigAction::Alarm;
require 5.005;
use strict;
#use warnings;
use vars qw( @ISA @EXPORT_OK );
require Exporter;
@ISA = qw( Exporter );
@EXPORT_OK = qw( ssa_alarm );
my $have_hires = scalar eval 'use Time::HiRes; Time::HiRes::ualarm(0); 1;';
use POSIX qw( INT_MAX ceil ) ;
my $hrworks;
sub ssa_alarm($)
{
my $secs = shift;
#print print "secs=$secs\n";
if ( $hrworks and ($secs le (INT_MAX()/1_000_000.0) ) )
{
Time::HiRes::ualarm( $secs * 1_000_000 );
}
else
{
alarm( ceil( $secs ) );
}
}
sub hires_works { return $hrworks; }; #test support
);
print "Looking for Time::HiRes with a working ualarm()... \n" ;
use constant HR => eval 'use Time::HiRes; Time::HiRes::ualarm(0); 1;' ;
sub forever { pause(); }
sub handler { die "TIMEDOUT"; }
my $et, $st;
my $hr_works = 0;
if ( not HR )
{
print q(
Time::HiRes is not installed.
High resolution timeouts disabled.
);
}
else {
print "Testing Time::HiRes::ualarm()\n" ;
$SIG{'ALRM'} = \&handler;
eval {
$st = Time::HiRes::time();
eval {
Time::HiRes::ualarm( 0.1 * 1_000_000 );
forever();
};
Time::HiRes::ualarm( 0 );
$et = Time::HiRes::time();
#print "outside forever eval\n" ;
};
my $delta = $et - $st;
if ( $delta < 0.8 ) {
print q(
Time::HiRes::ualarm() exists and works.
High resolution timeouts enabled."
);
$hr_works = 1;
}
else
{
warn q(
Time::HiRes exists on this platform but Time::HiRes::ualarm
appears to be broken. High resolution timeouts disabled.
);
}
}
print SAH '$hrworks = '."$hr_works; 1;\n" ;
close( SAH );
print "\nWrote $SAA\n" ;
if ( not $hr_works ) {
warn q(
Fractional seconds in timeout_call() may be used but will be
raised to the next higher integer value with POSIX::ceil().
);
}
#ok... enough defensiveness...
my $args = {
'NAME' => 'Sys::SigAction',
'VERSION_FROM' => 'lib/Sys/SigAction.pm', # finds $VERSION
'PREREQ_PM' => {
'Test::More' => 0
,POSIX => 0
}, # e.g., Module::Name => 1.1
'ABSTRACT_FROM' => 'lib/Sys/SigAction.pm', # retrieve abstract from module
'AUTHOR' => 'Lincoln A. Baxter <lab-at-lincolnbaxter-dot-com>'
};
print "MakeMaker version = $ExtUtils::MakeMaker::VERSION\n";
if ($ExtUtils::MakeMaker::VERSION >= 6.3002 ) {
$args->{LICENSE} = 'perl';
}
WriteMakefile( %$args );
|