… | |
… | |
7 | $|=1; |
7 | $|=1; |
8 | |
8 | |
9 | my $DEFINE; |
9 | my $DEFINE; |
10 | my @LIBS = []; |
10 | my @LIBS = []; |
11 | |
11 | |
12 | # check for completely broken platforms (such as netbsd) |
12 | my $threads = $Config{usethreads}; |
13 | if ($Config{usethreads} && $^O eq "netbsd") { |
|
|
14 | print <<EOF; |
|
|
15 | |
|
|
16 | *** |
|
|
17 | *** Your platform is BROKEN - netbsd pthreads are known to be completely broken. |
|
|
18 | *** There is *no* way to implement coroutines on this platform until the bugs |
|
|
19 | *** are fixed (this has been true for at least netbsd version 4.0). |
|
|
20 | *** |
|
|
21 | *** This affects many modules currently, so the recommended build option |
|
|
22 | *** for perl is to DISABLE THREAD support - it serves no practical purpose |
|
|
23 | *** on POSIX systems anyways, except that it slows down your programs a lot |
|
|
24 | *** and uses a lot more memory than fork (perl threads do not give you threads, |
|
|
25 | *** they are only windows-process emulation ported to unix). |
|
|
26 | *** |
|
|
27 | |
|
|
28 | EOF |
|
|
29 | } |
|
|
30 | |
13 | |
31 | print <<EOF; |
14 | print <<EOF; |
32 | |
15 | |
33 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
16 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
34 | |
17 | |
… | |
… | |
54 | |
37 | |
55 | if (exists $ENV{CORO_INTERFACE}) { |
38 | if (exists $ENV{CORO_INTERFACE}) { |
56 | $iface = $ENV{CORO_INTERFACE}; |
39 | $iface = $ENV{CORO_INTERFACE}; |
57 | |
40 | |
58 | } elsif ($^O =~ /win32/i or $^O =~ /cygwin/ or $^O =~ /mswin/) { |
41 | } elsif ($^O =~ /win32/i or $^O =~ /cygwin/ or $^O =~ /mswin/) { |
|
|
42 | # nothing works, really, without deep hacks |
59 | $iface = 'w'; |
43 | $iface = 'w'; |
60 | |
44 | |
61 | } elsif ($^O =~ /irix/) { |
45 | } elsif ($^O =~ /irix/) { |
|
|
46 | # sigaltstack works like sigstack, i.e. expects stack pointer, not stack base |
|
|
47 | # but wikipeida lists it as 100% posix compliant. geeeee. |
62 | $iface = "i"; |
48 | $iface = "i"; |
63 | |
49 | |
64 | } elsif ($^O =~ /linux/) { |
50 | } elsif ($^O =~ /linux/) { |
|
|
51 | # everything "just works", as expected |
65 | $iface = $iface_asm || "s"; |
52 | $iface = $iface_asm || "s"; |
66 | |
53 | |
67 | } elsif ($^O =~ /freebsd/) { |
54 | } elsif ($^O =~ /freebsd/) { |
68 | # FreeBSD 4.x has ucontext.h but no makecontext et al. (see BUGS section of |
55 | # FreeBSD 4.x has ucontext.h but no makecontext et al. (see BUGS section of |
69 | # man context). Assume the same problem for all other BSDs. |
56 | # man context). |
70 | # |
57 | # |
71 | # FreeBSD 6.2 has working ucontext, setjmp and asm, but |
58 | # FreeBSD 6.2 has marginally working ucontext, setjmp and asm, but |
72 | # some 5.8.8's barf when threaded due to broken threading. |
59 | # some 5.8.8's barf when threaded due to broken threading. |
73 | |
60 | |
74 | $iface = $iface_asm || "s"; |
61 | $iface = $iface_asm || "s"; |
75 | |
62 | |
76 | } elsif ($^O =~ /netbsd/) { |
63 | } elsif ($^O =~ /netbsd/) { |
77 | # netbsd is totally broken (pthreads are incomaptible with ucontext or other stack switching mechanisms) |
64 | # netbsd is totally broken (pthreads are incomaptible with ucontext or |
|
|
65 | # other stack switching mechanisms) therefore, default to pthread - |
78 | # therefore, default to pthread - hey, it might actually work, with some hacks |
66 | # hey, it might actually work, with some hacks |
79 | $iface = "p"; |
67 | $iface = "p"; |
80 | |
68 | |
81 | } elsif ($^O =~ /openbsd/) { |
69 | } elsif ($^O =~ /openbsd/) { |
82 | # asm seems to work, setjmp might, ucontext is missing |
70 | # asm seems to work, setjmp might, ucontext is missing, threads lets not talk about |
83 | $iface = $iface_asm || "s"; |
71 | $iface = $iface_asm || "s"; |
84 | |
72 | |
85 | } elsif ($^O =~ /solaris/) { |
73 | } elsif ($^O =~ /solaris/) { |
86 | # setjmp, ucontext seem to work, as well as asm |
74 | # setjmp, ucontext seem to work, as well as asm |
87 | $iface = $iface_asm || "s"; |
75 | $iface = $iface_asm || "s"; |
88 | |
76 | |
89 | } elsif ($^O =~ /darwin/) { |
77 | } elsif ($^O =~ /darwin/) { |
|
|
78 | # assembler doesn't support .type |
|
|
79 | # ucontext is of course totally broken (it just crashes) |
|
|
80 | # surprisingly, pthreads seem to work |
90 | $iface = "s"; |
81 | $iface = "s"; |
91 | |
82 | |
92 | } elsif ($^O =~ /dragonfly/) { |
83 | } elsif ($^O =~ /dragonfly/) { |
93 | # ucontext is totally broken on dragonfly bsd: |
84 | # ucontext is totally broken on dragonfly bsd: |
94 | # Fatal error 'siglongjmp()ing between thread contexts is undefined by POSIX 1003.1 |
85 | # Fatal error 'siglongjmp()ing between thread contexts is undefined by POSIX 1003.1 |