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 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283
|
# 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
#
my $arch = $Config{'archname'} ;
print "OS= $^O\narchname = $arch\n" ;
print "Checking for Microsoft Windows... (not supported)\n";
if ( $^O =~ /MSWin32/ ) {
die qq{
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. \n\n};
}
print "Checking for multi-threaded Perl... (warning)\n";
use Config;
eval "use threads";
#belt and suspenders....
if ( ! $@ || $Config{usethreads} || $Config{useithreads} || $Config{use5005threads} ) {
print STDERR qq{
NOTE: 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.\n\n};
}
print "Checking support for signals... (required)... ";
if ( ! defined $Config{sig_name} ) {
die q{
Signals are not supported in this OS or perl version.
}
}
print "OK\n" ;
#is sigaction enabled?
print "Checking support for POSIX::sigaction... (required)... ";
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 "OK\n" ;
##print "Checking for armv5tejl... (not supported)\n";
###belt and suspenders....
##if ( $arch =~ m/arm/ ) {
## warn q((
##
## Sys::SigAction tests had problems with on armv5tejl
## systems. And recently a bug was opened on for an
## arm6 system.
##
## I believe (and the smoke tester agreed) that, given
## the fact this this module tests fine on virtually POSIX
## OSes, that arm systems have a base perl implementation
## of POSIX:sigaction that is likely the root cause.
##
## If you encounted problems on arm system please contact me
## to discuss c
##
## As a result of working with the filer of bug
## 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.
##
## If you find it works please notice me (the author). If you
## come up with changes that make it work... patch welcome and
## acknowledged.
##
## ));
##}
print "Checking for arm platforms... " ;
if ( $archname =~ m/^arm/ ) {
print STDERR q(
NOTE: inline nesting of signal handlers at different bracket
scopes is broken on arm platforms (segfaults). See t/inline_nested.t
for more information (this test will be skipped on this platform).
Nesting at the different call stack levels works fine, and this
is probably much more likely to be what would be used anyway.
);
}
else { print "OK\n" }
print "Checking for cygwin... (masking signals is broken on some versions at least)... ";
if ( $^O =~ /cygwin/ ) {
print STDERR q(
NOTE: Smoke testers have discovered that t/mask.t fails on at least
some versions cygwin. Specific versions of the os and perl
are now protected... but others may be found. On these platforms
masking signals probably does not work. See the hash reference
$broken_platforms for platforms known to be broken.
If you find others, please let me (the author) know.
);
}
else { print "OK\n" }
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 <= (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" ;
};
Time::HiRes::ualarm( 0 );
my $delta = $et - $st;
if ( $delta < 0.8 ) {
print qq(
Time::HiRes::ualarm() exists and works.
High resolution timeouts enabled."
);
$hr_works = 1;
}
else
{
warn qq(
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 qq(
Fractional seconds in timeout_call() may be used but will be
raised to the next higher integer value with POSIX::ceil().
);
}
my $arm_depth = 2;
if ( $arch =~ m/arm/ ) {
warn qq{
Nested signal handlers only works on this platform to a depth
of $arm_depth. See nested.t for more information.
};
}
##my $SAN = "$SAAD/Nested.pm" ;
##print "Writing $SAN\n" ;
##
##open( SAN, ">$SAN" );
##print SAN q(
##package Sys::SigAction::Nested;
##require 5.005;
##use strict;
###use warnings;
##use vars qw( @ISA @EXPORT_OK );
##require Exporter;
##@ISA = qw( Exporter );
##@EXPORT_OK = qw( max_depth );
##my $max_depth = undef;
##
##sub max_depth { return $max_depth; }; #test support
##
##);
##
##if ( $arch =~ m/arm/i )
##{
## print SAN '$max_depth = 2;' ."\n\n1;" ;
##}
##else
##{
## print SAN "1;\n" ;
##}
##close SAN;
##
#ok... enough defensiveness...
my $args = {
'NAME' => 'Sys::SigAction',
'VERSION_FROM' => 'lib/Sys/SigAction.pm', # finds $VERSION
'MIN_PERL_VERSION' => 5.6.0,
'PREREQ_PM' => {
'Test::More' => 0
,POSIX => 0
},
'ABSTRACT_FROM' => 'lib/Sys/SigAction.pm', # retrieve abstract from module
'AUTHOR' => 'Lincoln A. Baxter <lab-at-lincolnbaxter-dot-com>',
'clean' => { FILES => "lib/Sys/SigAction/" },
'META_MERGE' => {
"meta-spec" => { version => 2 },
resources => {
repository => {
type => 'git',
git => 'git://github.com/labaxter/sys-sigaction.git',
web => 'https://github.com/labaxter/sys-sigaction'
},
},
}
};
print "MakeMaker version = $ExtUtils::MakeMaker::VERSION\n";
if ($ExtUtils::MakeMaker::VERSION >= 6.3002 ) {
$args->{LICENSE} = 'perl';
}
WriteMakefile( %$args );
|