1 |
use ExtUtils::MakeMaker; |
2 |
use Coro::MakeMaker; |
3 |
|
4 |
use Canary::Stability Coro::Multicore => 1, 5.008009; |
5 |
|
6 |
if ($^O eq "MSWin32") { |
7 |
# configuration on windows is hardcoded - as always |
8 |
|
9 |
print STDERR <<EOF; |
10 |
|
11 |
*** |
12 |
*** Your platform is not standards compliant. To get this module working, you need to |
13 |
*** have the win32 pthread library (http://sourceware.org/pthreads-win32/) and |
14 |
*** the windows sdk or equivalent. |
15 |
*** |
16 |
|
17 |
EOF |
18 |
|
19 |
$INC = "$ENV{INC}"; |
20 |
$LIBS = ["$ENV{LIBS} -lpthread"]; |
21 |
|
22 |
} else { |
23 |
|
24 |
$INC = ""; |
25 |
$LIBS = ['-lpthread', '-lpthreads', '']; |
26 |
|
27 |
if ($^O =~ /bsd/i) { |
28 |
print <<EOF; |
29 |
|
30 |
If you have problems with deadlocks or crashes on your system, |
31 |
make sure your perl has been linked with -lpthread (you might try |
32 |
LD_PRELOAD=/path/to/libpthread.so as a workaround). Also, pthread support |
33 |
under many BSDs is not the best - before reporting a bug in this module, |
34 |
make sure it's not an OS bug. |
35 |
|
36 |
EOF |
37 |
} |
38 |
} |
39 |
|
40 |
if ($^O =~ /linux/ && $Config{usemymalloc} eq "y") { |
41 |
print <<EOF; |
42 |
|
43 |
*** |
44 |
*** WARNING: |
45 |
*** |
46 |
*** Your perl uses its own memory allocator (-Dusemymalloc=y), |
47 |
*** which is known not to be threadsafe on GNU/Linux and probably |
48 |
*** other platforms (even when not used concurrently, it trashes |
49 |
*** the data structures of the system malloc running concurrently), |
50 |
*** for perls up to 5.8.8 and possibly later versions. |
51 |
*** |
52 |
*** If you are unsure wether your perl has been fixed, your system |
53 |
*** is safe for other reasons, or you experience spurious segfaults, |
54 |
*** please compile your perl with -Dusemymalloc=n. |
55 |
*** |
56 |
|
57 |
EOF |
58 |
} |
59 |
|
60 |
print <<EOF; |
61 |
|
62 |
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
63 |
|
64 |
Coro::Multicore can do some simple checks to make sure perlinterp_release |
65 |
is called only with a valid perl context, and perlinterp_acquire without |
66 |
ensuring that they are always called in proper pairs. This is very useful |
67 |
while developing XS modules using perlmulticore.h. |
68 |
|
69 |
This costs a bit of performance though, so it is disabled by default. |
70 |
|
71 |
The environment variable CORO_MULTICORE_CHECK can be used to set a |
72 |
default for this answer. |
73 |
|
74 |
EOF |
75 |
|
76 |
my $extra = prompt ("Enable extra checks?", $ENV{CORO_MULTICORE_CHECK} ? "y" : "n") =~ /[Yy]/; |
77 |
|
78 |
my $define = sprintf "-DRECURSION_CHECK=%d", $extra; |
79 |
|
80 |
WriteMakefile(Coro::MakeMaker::coro_args( |
81 |
dist => { |
82 |
PREOP => 'pod2text Multicore.pm | tee README >$(DISTVNAME)/README; chmod -R u=rwX,go=rX . ;', |
83 |
COMPRESS => 'gzip -9v', |
84 |
SUFFIX => '.gz', |
85 |
}, |
86 |
NAME => "Coro::Multicore", |
87 |
VERSION_FROM => "Multicore.pm", |
88 |
CONFIGURE_REQUIRES => { "ExtUtils::MakeMaker" => 6.52, "Canary::Stability" => 0, "Coro" => 6.44 }, |
89 |
TEST_REQUIRES => { "Coro" => 6.44 }, |
90 |
DEFINE => $define, |
91 |
PREREQ_PM => { "Coro" => 6.44, "AnyEvent" => 7 }, |
92 |
INC => $INC, |
93 |
LIBS => $LIBS, |
94 |
)); |
95 |
|