summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-10-16 11:09:25 +0000
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-10-16 11:09:25 +0000
commitd58bf5aa3d3631a46847733b1ff1985b30140228 (patch)
tree406c095d697ae0ae82bbf187e5c65151bd41232a /ext
parentc7848ba184fac8eca4125f4296d6e09fee2c1846 (diff)
parent50e27ac33704d6fb34d4be7cfb426b2097b27505 (diff)
downloadperl-d58bf5aa3d3631a46847733b1ff1985b30140228.tar.gz
Merge maint-5.004 branch (5.004_04) with mainline.
p4raw-id: //depot/perl@137
Diffstat (limited to 'ext')
-rw-r--r--ext/DynaLoader/DynaLoader.pm59
-rw-r--r--ext/IO/lib/IO/Socket.pm32
-rwxr-xr-xext/util/extliblist155
-rw-r--r--ext/util/make_ext25
4 files changed, 85 insertions, 186 deletions
diff --git a/ext/DynaLoader/DynaLoader.pm b/ext/DynaLoader/DynaLoader.pm
index 04404b7ee9..712d575e38 100644
--- a/ext/DynaLoader/DynaLoader.pm
+++ b/ext/DynaLoader/DynaLoader.pm
@@ -12,16 +12,21 @@ package DynaLoader;
#
# Tim.Bunce@ig.co.uk, August 1994
-use vars qw($VERSION);
+$VERSION = $VERSION = "1.03"; # avoid typo warning
-$VERSION = "1.02";
-
-require Carp;
require Config;
require AutoLoader;
*AUTOLOAD = \&AutoLoader::AUTOLOAD;
+# The following require can't be removed during maintenance
+# releases, sadly, because of the risk of buggy code that does
+# require Carp; Carp::croak "..."; without brackets dying
+# if Carp hasn't been loaded in earlier compile time. :-(
+# We'll let those bugs get found on the development track.
+require Carp if $] < 5.00450;
+
+
# enable debug/trace messages from DynaLoader perl code
$dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug;
@@ -82,6 +87,8 @@ if ($dl_debug) {
1; # End of main code
+sub croak { require Carp; Carp::croak(@_) }
+
# The bootstrap function cannot be autoloaded (without complications)
# so we define it here:
@@ -91,11 +98,14 @@ sub bootstrap {
local($module) = $args[0];
local(@dirs, $file);
- Carp::confess("Usage: DynaLoader::bootstrap(module)") unless $module;
+ unless ($module) {
+ require Carp;
+ Carp::confess("Usage: DynaLoader::bootstrap(module)");
+ }
# A common error on platforms which don't support dynamic loading.
# Since it's fatal and potentially confusing we give a detailed message.
- Carp::croak("Can't load module $module, dynamic loading not available in this perl.\n".
+ croak("Can't load module $module, dynamic loading not available in this perl.\n".
" (You may need to build a new perl executable which either supports\n".
" dynamic loading or has the $module module statically linked into it.)\n")
unless defined(&dl_load_file);
@@ -119,16 +129,17 @@ sub bootstrap {
next unless -d $dir; # skip over uninteresting directories
# check for common cases to avoid autoload of dl_findfile
- last if ($file=_check_file("$dir/$modfname.$dl_dlext"));
+ my $try = "$dir/$modfname.$dl_dlext";
+ last if $file = ($do_expand) ? dl_expandspec($try) : (-f $try && $try);
# no luck here, save dir for possible later dl_findfile search
- push(@dirs, "-L$dir");
+ push @dirs, $dir;
}
# last resort, let dl_findfile have a go in all known locations
- $file = dl_findfile(@dirs, map("-L$_",@INC), $modfname) unless $file;
+ $file = dl_findfile(map("-L$_",@dirs,@INC), $modfname) unless $file;
- Carp::croak("Can't find loadable object for module $module in \@INC (@INC)")
- unless $file;
+ croak("Can't locate loadable object for module $module in \@INC (\@INC contains: @INC)")
+ unless $file; # wording similar to error from 'require'
my $bootname = "boot_$module";
$bootname =~ s/\W/_/g;
@@ -153,16 +164,18 @@ sub bootstrap {
# it executed.
my $libref = dl_load_file($file, $module->dl_load_flags) or
- Carp::croak("Can't load '$file' for module $module: ".dl_error()."\n");
+ croak("Can't load '$file' for module $module: ".dl_error()."\n");
push(@dl_librefs,$libref); # record loaded object
my @unresolved = dl_undef_symbols();
- Carp::carp("Undefined symbols present after loading $file: @unresolved\n")
- if @unresolved;
+ if (@unresolved) {
+ require Carp;
+ Carp::carp("Undefined symbols present after loading $file: @unresolved\n");
+ }
my $boot_symbol_ref = dl_find_symbol($libref, $bootname) or
- Carp::croak("Can't find '$bootname' symbol in $file\n");
+ croak("Can't find '$bootname' symbol in $file\n");
my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file);
@@ -173,12 +186,12 @@ sub bootstrap {
}
-sub _check_file { # private utility to handle dl_expandspec vs -f tests
- my($file) = @_;
- return $file if (!$do_expand && -f $file); # the common case
- return $file if ( $do_expand && ($file=dl_expandspec($file)));
- return undef;
-}
+#sub _check_file { # private utility to handle dl_expandspec vs -f tests
+# my($file) = @_;
+# return $file if (!$do_expand && -f $file); # the common case
+# return $file if ( $do_expand && ($file=dl_expandspec($file)));
+# return undef;
+#}
# Let autosplit and the autoloader deal with these functions:
@@ -243,7 +256,8 @@ sub dl_findfile {
foreach $name (@names) {
my($file) = "$dir/$name";
print STDERR " checking in $dir for $name\n" if $dl_debug;
- $file = _check_file($file);
+ $file = ($do_expand) ? dl_expandspec($file) : (-f $file && $file);
+ #$file = _check_file($file);
if ($file) {
push(@found, $file);
next arg; # no need to look any further
@@ -279,6 +293,7 @@ sub dl_expandspec {
my $file = $spec; # default output to input
if ($Is_VMS) { # dl_expandspec should be defined in dl_vms.xs
+ require Carp;
Carp::croak("dl_expandspec: should be defined in XS file!\n");
} else {
return undef unless -f $file;
diff --git a/ext/IO/lib/IO/Socket.pm b/ext/IO/lib/IO/Socket.pm
index ab1917031d..aadb502f19 100644
--- a/ext/IO/lib/IO/Socket.pm
+++ b/ext/IO/lib/IO/Socket.pm
@@ -39,6 +39,11 @@ C<new> only looks for one key C<Domain> which tells new which domain
the socket will be in. All other arguments will be passed to the
configuration method of the package for that domain, See below.
+C<IO::Socket>s will be in autoflush mode after creation. Note that
+versions of IO::Socket prior to 1.1603 (as shipped with Perl 5.004_04)
+did not do this. So if you need backward compatibility, you should
+set autoflush explicitly.
+
=back
=head1 METHODS
@@ -118,7 +123,7 @@ use Exporter;
@ISA = qw(IO::Handle);
-$VERSION = "1.1602";
+$VERSION = "1.1603";
sub import {
my $pkg = shift;
@@ -129,6 +134,7 @@ sub import {
sub new {
my($class,%arg) = @_;
my $fh = $class->SUPER::new();
+ $fh->autoflush;
${*$fh}{'io_socket_timeout'} = delete $arg{Timeout};
@@ -392,7 +398,7 @@ and some related methods. The constructor can take the following options
PeerPort Remote port or service <service>[(<no>)] | <no>
LocalAddr Local host bind address hostname[:port]
LocalPort Local host bind port <service>[(<no>)] | <no>
- Proto Protocol name "tcp" | "udp" | ...
+ Proto Protocol name (or number) "tcp" | "udp" | ...
Type Socket type SOCK_STREAM | SOCK_DGRAM | ...
Listen Queue size for listen
Reuse Set SO_REUSEADDR before binding
@@ -410,10 +416,13 @@ parenthesis which is used if the service is not known by the system.
The C<PeerPort> specification can also be embedded in the C<PeerAddr>
by preceding it with a ":".
-Only one of C<Type> or C<Proto> needs to be specified, one will be
-assumed from the other. If you specify a symbolic C<PeerPort> port,
-then the constructor will try to derive C<Type> and C<Proto> from
-the service name.
+If C<Proto> is not given and you specify a symbolic C<PeerPort> port,
+then the constructor will try to derive C<Proto> from the service
+name. As a last resort C<Proto> "tcp" is assumed. The C<Type>
+parameter will be deduced from C<Proto> if not specified.
+
+If the constructor is only passed a single argument, it is assumed to
+be a C<PeerAddr> specification.
Examples:
@@ -428,6 +437,9 @@ Examples:
LocalPort => 9000,
Proto => 'tcp');
+ $sock = IO::Socket::INET->new('127.0.0.1:25');
+
+
=head2 METHODS
=over 4
@@ -463,6 +475,13 @@ peer host in a text form xx.xx.xx.xx
=cut
+sub new
+{
+ my $class = shift;
+ unshift(@_, "PeerAddr") if @_ == 1;
+ return $class->SUPER::new(@_);
+}
+
sub _sock_info {
my($addr,$port,$proto) = @_;
my @proto = ();
@@ -535,6 +554,7 @@ sub configure {
unless(defined $raddr);
}
+ $proto ||= (getprotobyname "tcp")[2];
return _error($fh,'Cannot determine protocol')
unless($proto);
diff --git a/ext/util/extliblist b/ext/util/extliblist
deleted file mode 100755
index 2351ddfd0e..0000000000
--- a/ext/util/extliblist
+++ /dev/null
@@ -1,155 +0,0 @@
-case $CONFIG in
-'')
- if test -f config.sh; then TOP=.;
- elif test -f ../config.sh; then TOP=..;
- elif test -f ../../config.sh; then TOP=../..;
- elif test -f ../../../config.sh; then TOP=../../..;
- elif test -f ../../../../config.sh; then TOP=../../../..;
- else
- echo "Can't find config.sh."; exit 1
- fi
- . $TOP/config.sh
- ;;
-esac
-: extliblist
-:
-: Author: Andy Dougherty doughera@lafcol.lafayette.edu
-:
-: This utility was only used by the old Makefile.SH extension
-: mechanism. It is now obsolete and may be removed in a future
-: release.
-:
-: This utility takes a list of libraries in the form
-: -llib1 -llib2 -llib3
-: and prints out lines suitable for inclusion in an extension
-: Makefile.
-: Extra library paths may be included with the form -L/another/path
-: this will affect the searches for all subsequent libraries.
-:
-: It is intended to be "dotted" from within an extension Makefile.SH.
-: see ext/POSIX/Makefile.SH for an example.
-: Prior to calling this, the variable potential_libs should be set
-: to the potential list of libraries
-:
-: It sets the following
-: extralibs = full list of libraries needed for static linking.
-: Only those libraries that actually exist are included.
-: dynaloadlibs = full path names of those libraries that are needed
-: but can be linked in dynamically on this platform. On
-: SunOS, for example, this would be .so* libraries,
-: but not archive libraries.
-: Eventually, this list can be used to write a bootstrap file.
-: statloadlibs = list of those libraries which must be statically
-: linked into the shared library. On SunOS 4.1.3,
-: for example, I have only an archive version of
-: -lm, and it must be linked in statically.
-:
-: This script uses config.sh variables libs, libpth, and so. It is mostly
-: taken from the metaconfig libs.U unit.
-extralibs=''
-dynaloadlibs=''
-statloadlibs=''
-Llibpth=''
-for thislib in `echo "XXX $potential_libs " | $sed 's/ -l/ /g'` ; do
- case "$thislib" in
- XXX)
- : Handle case where potential_libs is empty.
- ;;
- -L*)
- : Handle possible linker path arguments.
- newpath=`echo $thislib | $sed 's/^-L//'`
- if $test -d $newpath; then
- Llibpth="$Llibpth $newpath"
- extralibs="$extralibs $thislib"
- statloadlibs="$statloadlibs $thislib"
- fi
- ;;
- *)
- : Handle possible library arguments.
- for thispth in $Llibpth $libpth; do
- : Loop over possible wildcards and take the last one.
- for fullname in $thispth/lib$thislib.$so.[0-9]* ; do
- :
- done
- if $test -f $fullname; then
- break
- elif fullname=$thispth/lib$thislib.$so && $test -f $fullname; then
- break
- elif fullname=$thispth/lib${thislib}_s.a && $test -f $fullname; then
- thislib=${thislib}_s
- break
- elif fullname=$thispth/lib${thislib}.a && $test -f $fullname; then
- break
- elif fullname=$thispth/Slib${thislib}.a && $test -f $fullname; then
- break
- else
- fullname=''
- fi
- done
- : Now update library lists
- case "$fullname" in
- '')
- : Skip nonexistent files
- ;;
- *)
- : Do not add it into the extralibs if it is already linked in
- : with the main perl executable.
- case " $libs " in
- *" -l$thislib "*|*" -l${thislib}_s "*) ;;
- *) extralibs="$extralibs -l$thislib" ;;
- esac
- :
- : For NeXT and DLD, put files into DYNALOADLIBS to be
- : converted into a boostrap file. For other systems,
- : we will use ld with what I have misnamed STATLOADLIBS
- : to assemble the shared object.
- case "$dlsrc" in
- dl_dld*|dl_next*)
- dynaloadlibs="$dynaloadlibs $fullname" ;;
- *)
- case "$fullname" in
- *.a)
- statloadlibs="$statloadlibs -l$thislib"
- ;;
- *)
- : For SunOS4, do not add in this shared library
- : if it is already linked in the main
- : perl executable
- case "$osname" in
- sunos)
- case " $libs " in
- *" -l$thislib "*) ;;
- *) statloadlibs="$statloadlibs -l$thislib" ;;
- esac
- ;;
- *)
- statloadlibs="$statloadlibs -l$thislib"
- ;;
- esac
- ;;
- esac
- ;;
- esac
- ;;
- esac
- ;;
- esac
-done
-
-case "$dlsrc" in
-dl_next*)
- extralibs=`echo " $extralibs "| $sed -e 's/ -lm / /'` ;;
-esac
-
-set X $extralibs
-shift
-extralibs="$*"
-
-set X $dynaloadlibs
-shift
-dynaloadlibs="$*"
-
-set X $statloadlibs
-shift
-statloadlibs="$*"
-
diff --git a/ext/util/make_ext b/ext/util/make_ext
index bfbcc8340e..70a5d2eb23 100644
--- a/ext/util/make_ext
+++ b/ext/util/make_ext
@@ -4,16 +4,35 @@
# It primarily used by the perl Makefile:
#
# d_dummy $(dynamic_ext): miniperl preplibrary FORCE
-# ext/util/make_ext dynamic $@
+# @sh ext/util/make_ext dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
#
# It may be deleted in a later release of perl so try to
# avoid using it for other purposes.
target=$1; shift
extspec=$1; shift
+makecmd=$1; shift # Should be something like MAKE=make
passthru="$*" # allow extra macro=value to be passed through
echo ""
+# Previously, $make was taken from config.sh. However, the user might
+# instead be running a possibly incompatible make. This might happen if
+# the user types "gmake" instead of a plain "make", for example. The
+# correct current value of MAKE will come through from the main perl
+# makefile as MAKE=/whatever/make in $makecmd. We'll be cautious in
+# case third party users of this script (are there any?) don't have the
+# MAKE=$(MAKE) argument, which was added after 5.004_03.
+case "$makecmd" in
+MAKE=*)
+ eval $makecmd
+ ;;
+*) echo 'ext/util/make_ext: WARNING: Please include MAKE=$(MAKE)'
+ echo ' in your call to make_ext. See ext/util/make_ext for details.'
+ exit 1
+ ;;
+esac
+
+
case $CONFIG in
'')
if test -f config.sh; then TOP=.;
@@ -107,10 +126,10 @@ clean) ;;
realclean) ;;
*) # Give makefile an opportunity to rewrite itself.
# reassure users that life goes on...
- $make config $passthru || echo "$make config failed, continuing anyway..."
+ $MAKE config $passthru || echo "$MAKE config failed, continuing anyway..."
;;
esac
-$make $makeopts $target $makeargs $passthru || exit
+$MAKE $makeopts $target $makeargs $passthru || exit
exit $?