… | |
… | |
15 | i CYGWIN => $^O =~ /cygwin/i; |
15 | i CYGWIN => $^O =~ /cygwin/i; |
16 | i WIN32 => $WIN32; |
16 | i WIN32 => $WIN32; |
17 | |
17 | |
18 | use Fcntl (); |
18 | use Fcntl (); |
19 | |
19 | |
20 | i F_SETFL => Fcntl::F_SETFL(); |
20 | i F_SETFL => eval { Fcntl::F_SETFL() }; |
21 | i F_SETFD => Fcntl::F_SETFD(); |
21 | i F_SETFD => eval { Fcntl::F_SETFD() }; |
22 | i O_NONBLOCK => Fcntl::O_NONBLOCK(); |
22 | i O_NONBLOCK => eval { Fcntl::O_NONBLOCK() }; |
23 | i FD_CLOEXEC => Fcntl::FD_CLOEXEC(); |
23 | i FD_CLOEXEC => eval { Fcntl::FD_CLOEXEC() }; |
24 | |
24 | |
25 | print "package AnyEvent::Util;\n"; |
25 | print "package AnyEvent::Util;\n"; |
26 | |
26 | |
27 | # broken windows perls use undocumented error codes... |
27 | # broken windows perls use undocumented error codes... |
28 | if ($WIN32) { |
28 | if ($WIN32) { |
… | |
… | |
36 | i WSAEINPROGRESS => -1e99; |
36 | i WSAEINPROGRESS => -1e99; |
37 | } |
37 | } |
38 | |
38 | |
39 | my $af_inet6; |
39 | my $af_inet6; |
40 | |
40 | |
41 | $af_inet6 ||= eval { use Socket ; Socket::AF_INET6 () }; |
41 | $af_inet6 ||= eval { require Socket ; Socket::AF_INET6 () }; |
42 | $af_ine6t ||= eval { use Socket6; Socket6::AF_INET6() }; |
42 | $af_ine6t ||= eval { require Socket6; Socket6::AF_INET6() }; |
43 | |
43 | |
44 | # uhoh |
44 | # uhoh |
45 | $af_inet6 ||= 10 if $^O =~ /linux/; |
45 | $af_inet6 ||= 10 if $^O =~ /linux/; |
46 | $af_inet6 ||= 23 if $^O =~ /cygwin/i; |
46 | $af_inet6 ||= 23 if $^O =~ /cygwin/i; |
47 | $af_inet6 ||= 23 if AnyEvent::WIN32; |
47 | $af_inet6 ||= 23 if AnyEvent::WIN32; |