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 | use Config; |
5 | use Config; |
6 | use Socket; |
6 | |
|
|
7 | # when built as part of perl, these are not available |
|
|
8 | BEGIN { eval "use Socket ()" } |
|
|
9 | BEGIN { eval "use Fcntl ()" } |
7 | |
10 | |
8 | open my $fh, ">lib/AnyEvent/constants.pl" |
11 | open my $fh, ">lib/AnyEvent/constants.pl" |
9 | or die "lib/AnyEvent/constants.pl: $_[0]\n"; |
12 | or die "lib/AnyEvent/constants.pl: $_[0]\n"; |
10 | |
13 | |
11 | my $oldstdout = select $fh; |
14 | my $oldstdout = select $fh; |
… | |
… | |
29 | i WIN32 => $WIN32; |
32 | i WIN32 => $WIN32; |
30 | |
33 | |
31 | # add these purely to avoid loading Fcntl, which is slow and bloated. |
34 | # add these purely to avoid loading Fcntl, which is slow and bloated. |
32 | use Fcntl (); |
35 | use Fcntl (); |
33 | |
36 | |
34 | i F_SETFL => eval { Fcntl::F_SETFL() }; |
|
|
35 | i F_SETFD => eval { Fcntl::F_SETFD() }; |
37 | i F_SETFD => eval { Fcntl::F_SETFD() } || 2; |
|
|
38 | i F_SETFL => eval { Fcntl::F_SETFL() } || 4; |
36 | i O_NONBLOCK => eval { Fcntl::O_NONBLOCK() }; |
39 | i O_NONBLOCK => eval { Fcntl::O_NONBLOCK() } || 04000; |
37 | i FD_CLOEXEC => eval { Fcntl::FD_CLOEXEC() }; |
40 | i FD_CLOEXEC => eval { Fcntl::FD_CLOEXEC() } || 1; |
38 | |
41 | |
39 | print "package AnyEvent::Util;\n"; |
42 | print "package AnyEvent::Util;\n"; |
40 | |
43 | |
41 | # broken windows perls use undocumented error codes... |
44 | # broken windows perls use undocumented error codes... |
42 | if ($WIN32) { |
45 | if ($WIN32) { |