summaryrefslogtreecommitdiff
path: root/cpan/Socket
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2011-12-16 22:37:41 +0000
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2011-12-16 23:31:59 +0000
commit37b1de1b0a6e30de345a177eb3f65c0a4bb3081c (patch)
treec3a524e308eb4b6884bdf898447b292e9aa4399f /cpan/Socket
parent974d5816ae8d0d7427376628a6d3d85973dbecc3 (diff)
downloadperl-37b1de1b0a6e30de345a177eb3f65c0a4bb3081c.tar.gz
Update Socket to CPAN version 1.97
[DELTA] 1.97 CHANGES: * Rewritten Makefile.PL configure-time logic to use only core's ExtUtils::CBuilder rather than CPAN's ExtUtils::CChecker * Fix implementation of synthesized newSVpvn_flags() to also work on threaded 5.10.0 * Set INSTALLDIRS=perl on perl before 5.11; required as it's replacing a core module
Diffstat (limited to 'cpan/Socket')
-rw-r--r--cpan/Socket/Makefile.PL140
-rw-r--r--cpan/Socket/Socket.pm2
-rw-r--r--cpan/Socket/Socket.xs4
3 files changed, 88 insertions, 58 deletions
diff --git a/cpan/Socket/Makefile.PL b/cpan/Socket/Makefile.PL
index bedca394c3..43cc833014 100644
--- a/cpan/Socket/Makefile.PL
+++ b/cpan/Socket/Makefile.PL
@@ -1,90 +1,118 @@
+#!perl
+use strict;
+use warnings;
+
use ExtUtils::MakeMaker;
use ExtUtils::Constant 0.23 'WriteConstants';
use Config;
my @DEFINES;
-unless( $ENV{PERL_CORE} ) {
- # Building standalone, not as core.
- require ExtUtils::CChecker;
- my $cc = ExtUtils::CChecker->new;
-
- my %defines = (
- # -Dfoo func() $Config{key}
- HAS_GETADDRINFO => [ "getaddrinfo", "d_getaddrinfo" ],
- HAS_GETNAMEINFO => [ "getnameinfo", "d_getnameinfo" ],
- HAS_INET_ATON => [ "inet_aton", "d_inetaton" ],
- HAS_INETNTOP => [ "inet_ntop", "d_inetntop" ],
- HAS_INETPTON => [ "inet_pton", "d_inetpton" ],
- );
- foreach my $define ( sort keys %defines ) {
- my ( $func, $key ) = @{$defines{$define}};
- next if exists $Config{$key};
+my $cb;
+my $seq = 0;
+sub check_for
+{
+ my %args = @_;
+ return if exists $Config{$args{confkey}};
+
+ require ExtUtils::CBuilder;
+ $cb ||= ExtUtils::CBuilder->new( quiet => 1 );
+
+ my $main = $args{main};
+
+ print "Checking $args{define}...\n";
- $cc->try_compile_run(
- define => $define,
- source => <<"EOF" )
+ my $file_base = "test-$seq"; $seq++;
+
+ my $file_source = "$file_base.c";
+
+ {
+ open( my $file_source_fh, ">", $file_source ) or die "Cannot write $file_source - $!";
+ print $file_source_fh <<"EOF";
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-int main(int argc, char *argv[]) {
- void *p = &$func;
+int main(int argc, char *argv[])
+ {
+ $main
return 0;
-}
+ }
EOF
- and print "$func() found\n"
- or print "$func() not found\n";
}
- unless( exists $Config{d_sockaddr_sa_len} ) {
- $cc->try_compile_run(
- define => "HAS_SOCKADDR_SA_LEN",
- source => <<'EOF' )
-#include <sys/types.h>
-#include <sys/socket.h>
-int main(int argc, char *argv[]) {
- struct sockaddr sa;
- sa.sa_len = 0;
- return 0;
+ my $file_obj = eval { $cb->compile( source => $file_source ) };
+ unlink $file_source;
+
+ return 0 unless defined $file_obj;
+
+ my $file_exe = eval { $cb->link_executable( objects => $file_obj ) };
+ unlink $file_obj;
+
+ return 0 unless defined $file_exe;
+
+ # Don't need to try running it
+ unlink $file_exe;
+
+ push @DEFINES, $args{define};
}
-EOF
- and print "sockaddr has sa_len\n"
- or print "sockaddr does not have sa_len\n";
- }
- unless( exists $Config{d_sin6_scope_id} ) {
- $cc->try_compile_run(
- define => "HAS_SIN6_SCOPE_ID",
- source => <<'EOF' )
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-int main(int argc, char *argv[]) {
- struct sockaddr_in6 sin6;
- sin6.sin6_scope_id = 0;
- return 0;
+sub check_for_func
+{
+ my %args = @_;
+ my $func = delete $args{func};
+ check_for( %args, main => "void *p = &$func;" );
}
-EOF
- and print "sockaddr_in6 has sin6_scope_id\n"
- or print "sockaddr_in6 does not have sin6_scope_id\n";
- }
- @DEFINES = @{ $cc->extra_compiler_flags };
+my %defines = (
+ # -Dfoo func() $Config{key}
+ HAS_GETADDRINFO => [ "getaddrinfo", "d_getaddrinfo" ],
+ HAS_GETNAMEINFO => [ "getnameinfo", "d_getnameinfo" ],
+ HAS_INET_ATON => [ "inet_aton", "d_inetaton" ],
+ HAS_INETNTOP => [ "inet_ntop", "d_inetntop" ],
+ HAS_INETPTON => [ "inet_pton", "d_inetpton" ],
+);
+
+foreach my $define ( sort keys %defines ) {
+ my ( $func, $key ) = @{$defines{$define}};
+ check_for_func(
+ confkey => $key,
+ define => $define,
+ func => $func
+ );
}
+check_for(
+ confkey => "d_sockaddr_sa_len",
+ define => "HAS_SOCKADDR_SA_LEN",
+ main => "struct sockaddr sa; sa.sa_len = 0;"
+);
+
+check_for(
+ confkey => "d_sin6_scope_id",
+ define => "HAS_SIN6_SCOPE_ID",
+ main => "struct sockaddr_in6 sin6; sin6.sin6_scope_id = 0;"
+);
+
+my %makefile_args;
+
+# Since we're providing a later version of a core module, before 5.12 the
+# @INC order is wrong so we'll have to go in perl rather than site dirs
+$makefile_args{INSTALLDIRS} = "perl" if $] < 5.012;
+
WriteMakefile(
NAME => 'Socket',
VERSION_FROM => 'Socket.pm',
($Config{libs} =~ /(-lsocks\S*)/ ? (LIBS => [ "$1" ] ) : ()),
XSPROTOARG => '-noprototypes', # XXX remove later?
realclean => {FILES=> 'const-c.inc const-xs.inc'},
- DEFINE => join( " ", @DEFINES ),
+ DEFINE => join( " ", map { "-D$_" } @DEFINES ),
CONFIGURE_REQUIRES => {
- 'ExtUtils::CChecker' => 0,
+ 'ExtUtils::CBuilder' => 0,
'ExtUtils::Constant' => '0.23',
},
+ %makefile_args,
);
my @names = (
qw(
diff --git a/cpan/Socket/Socket.pm b/cpan/Socket/Socket.pm
index 25eb5f3e6f..17fda97cfe 100644
--- a/cpan/Socket/Socket.pm
+++ b/cpan/Socket/Socket.pm
@@ -2,7 +2,7 @@ package Socket;
use strict;
-our $VERSION = '1.96';
+our $VERSION = '1.97';
=head1 NAME
diff --git a/cpan/Socket/Socket.xs b/cpan/Socket/Socket.xs
index 1e3eeb0e61..febe0b473f 100644
--- a/cpan/Socket/Socket.xs
+++ b/cpan/Socket/Socket.xs
@@ -85,12 +85,14 @@ NETINET_DEFINE_CONTEXT
#endif
#ifdef NEED_newSVpvn_flags
-static SV *newSVpvn_flags(pTHX_ const char *s, STRLEN len, U32 flags)
+static SV *my_newSVpvn_flags(pTHX_ const char *s, STRLEN len, U32 flags)
{
SV *sv = newSVpvn(s, len);
SvFLAGS(sv) |= (flags & SVf_UTF8);
return (flags & SVs_TEMP) ? sv_2mortal(sv) : sv;
}
+
+#define newSVpvn_flags(s,len,flags) my_newSVpvn_flags(aTHX_ s,len,flags)
#endif
#ifndef HAS_INET_ATON