1 | #! perl |
1 | #! perl |
2 | |
2 | |
3 | # this file is unfortunately only executed at Makefile.PL time |
3 | # this file is unfortunately only executed at Makefile.PL time |
4 | |
4 | |
|
|
5 | my ($fh, $oldstdout); |
|
|
6 | |
|
|
7 | BEGIN { |
|
|
8 | open $fh, ">lib/AnyEvent/constants.pl" |
|
|
9 | or die "lib/AnyEvent/constants.pl: $!\n"; |
|
|
10 | |
|
|
11 | $oldstdout = select $fh; |
|
|
12 | |
|
|
13 | print "# automatically generated from constants.pl.PL\n"; |
|
|
14 | } |
|
|
15 | |
|
|
16 | { |
|
|
17 | # from common::sense 3.74 |
|
|
18 | use strict qw(vars subs); |
|
|
19 | no warnings; |
|
|
20 | use warnings qw(FATAL closed threads internal debugging pack malloc portable prototype |
|
|
21 | inplace io pipe unpack glob digit printf |
|
|
22 | layer reserved taint closure semicolon); |
|
|
23 | no warnings qw(exec newline unopened); |
|
|
24 | |
|
|
25 | BEGIN { |
|
|
26 | print "sub AnyEvent::common_sense {\n"; |
|
|
27 | printf " local \$^W;\n"; |
|
|
28 | printf " \${^WARNING_BITS} ^= \${^WARNING_BITS} ^ \"%s\";\n", |
|
|
29 | join "", map "\\x$_", unpack "(H2)*", ${^WARNING_BITS}; |
|
|
30 | # use strict, use utf8; |
|
|
31 | printf " \$^H |= 0x%x;\n", $^H; |
|
|
32 | print "}\n"; |
|
|
33 | } |
|
|
34 | } |
|
|
35 | |
5 | use Config; |
36 | use Config; |
|
|
37 | |
|
|
38 | print "# generated for perl $] built for $Config{archname}\n"; |
6 | |
39 | |
7 | # when built as part of perl, these are not available |
40 | # when built as part of perl, these are not available |
8 | BEGIN { eval "use Socket ()" } |
41 | BEGIN { eval "use Socket ()" } |
9 | BEGIN { eval "use Fcntl ()" } |
42 | BEGIN { eval "use Fcntl ()" } |
10 | BEGIN { eval "use POSIX ()" } |
43 | BEGIN { eval "use POSIX ()" } |
11 | |
44 | |
12 | open my $fh, ">lib/AnyEvent/constants.pl" |
|
|
13 | or die "lib/AnyEvent/constants.pl: $_[0]\n"; |
|
|
14 | |
|
|
15 | my $oldstdout = select $fh; |
|
|
16 | |
|
|
17 | print "# automatically generated from constants.pl.PL for perl $] built for $Config{archname}\n"; |
|
|
18 | |
|
|
19 | sub i($$) { |
45 | sub i($$) { |
20 | print "sub $_[0](){", $_[1]*1, "}\n"; |
46 | print "sub $_[0](){", $_[1]*1, "}\n"; |
21 | } |
47 | } |
22 | |
48 | |
23 | sub n($$) { |
49 | sub n($$) { |
… | |
… | |
42 | print "package AnyEvent::Base;\n"; |
68 | print "package AnyEvent::Base;\n"; |
43 | |
69 | |
44 | # add these purely to avoid loading POSIX, which is slow and bloated. |
70 | # add these purely to avoid loading POSIX, which is slow and bloated. |
45 | |
71 | |
46 | i WNOHANG => eval { POSIX::WNOHANG() } || 1; |
72 | i WNOHANG => eval { POSIX::WNOHANG() } || 1; |
|
|
73 | |
|
|
74 | print "package AnyEvent::IO;\n"; |
|
|
75 | |
|
|
76 | i O_RDONLY => eval { Fcntl::O_RDONLY() } || 0; |
|
|
77 | i O_WRONLY => eval { Fcntl::O_WRONLY() } || 1; |
|
|
78 | i O_RDWR => eval { Fcntl::O_RDWR () } || 2; |
|
|
79 | i O_CREAT => eval { Fcntl::O_CREAT () } || 64; |
|
|
80 | i O_EXCL => eval { Fcntl::O_EXCL () } || 128; |
|
|
81 | i O_TRUNC => eval { Fcntl::O_TRUNC () } || 512; |
|
|
82 | i O_APPEND => eval { Fcntl::O_APPEND() } || 1024; |
47 | |
83 | |
48 | print "package AnyEvent::Util;\n"; |
84 | print "package AnyEvent::Util;\n"; |
49 | |
85 | |
50 | # broken windows perls use undocumented error codes... |
86 | # broken windows perls use undocumented error codes... |
51 | if ($WIN32) { |
87 | if ($WIN32) { |
… | |
… | |
127 | linux TCP_WINDOW_CLAMP 10 |
163 | linux TCP_WINDOW_CLAMP 10 |
128 | linux TCP_INFO 11 |
164 | linux TCP_INFO 11 |
129 | linux TCP_QUICKACK 12 |
165 | linux TCP_QUICKACK 12 |
130 | linux TCP_CONGESTION 13 |
166 | linux TCP_CONGESTION 13 |
131 | linux TCP_MD5SIG 14 |
167 | linux TCP_MD5SIG 14 |
|
|
168 | linux TCP_FASTOPEN 23 |
|
|
169 | linux MSG_DONTWAIT 0x0040 |
|
|
170 | linux MSG_NOSIGNAL 0x4000 |
|
|
171 | linux MSG_MORE 0x8000 |
|
|
172 | linux MSG_FASTOPEN 0x20000000 |
132 | netbsd TCP_MAXSEG 2 |
173 | netbsd TCP_MAXSEG 2 |
133 | netbsd TCP_KEEPIDLE 3 |
174 | netbsd TCP_KEEPIDLE 3 |
134 | netbsd TCP_NOPUSH 4 |
175 | netbsd TCP_NOPUSH 4 |
135 | netbsd TCP_KEEPINTVL 5 |
176 | netbsd TCP_KEEPINTVL 5 |
136 | netbsd TCP_KEEPCNT 6 |
177 | netbsd TCP_KEEPCNT 6 |
137 | netbsd TCP_KEEPINIT 7 |
178 | netbsd TCP_KEEPINIT 7 |
138 | netbsd TCP_NOOPT 8 |
179 | netbsd TCP_NOOPT 8 |
139 | netbsd TCP_MD5SIG 0x10 |
180 | netbsd TCP_MD5SIG 0x10 |
140 | netbsd TCP_CONGESTION 0x20 |
181 | netbsd TCP_CONGESTION 0x20 |
|
|
182 | netbsd MSG_NOSIGNAL 0x0400 |
141 | cygwin TCP_MAXSEG 0x02 |
183 | cygwin TCP_MAXSEG 0x02 |
142 | cygwin TCP_NOPUSH 0x04 |
184 | cygwin TCP_NOPUSH 0x04 |
143 | cygwin TCP_NOOPT 0x08 |
185 | cygwin TCP_NOOPT 0x08 |
144 | freebsd TCP_MAXSEG 0x02 |
186 | freebsd TCP_MAXSEG 0x02 |
145 | freebsd TCP_NOPUSH 0x04 |
187 | freebsd TCP_NOPUSH 0x04 |
146 | freebsd TCP_NOOPT 0x08 |
188 | freebsd TCP_NOOPT 0x08 |
147 | freebsd TCP_MD5SIG 0x10 |
189 | freebsd TCP_MD5SIG 0x10 |
148 | freebsd TCP_INFO 0x20 |
190 | freebsd TCP_INFO 0x20 |
149 | freebsd TCP_CONGESTION 0x40 |
191 | freebsd TCP_CONGESTION 0x40 |
|
|
192 | freebsd MSG_NOSIGNAL 0x20000 |
150 | solaris TCP_CORK 0x18 |
193 | solaris TCP_CORK 0x18 |
151 | solaris TCP_LINGER2 0x1C |
194 | solaris TCP_LINGER2 0x1C |
152 | solaris TCP_INIT_CWND 0x15 |
195 | solaris TCP_INIT_CWND 0x15 |
153 | solaris TCP_KEEPALIVE 0x8 |
196 | solaris TCP_KEEPALIVE 0x8 |
154 | solaris TCP_MAXSEG 0x02 |
197 | solaris TCP_MAXSEG 0x02 |