diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1998-05-18 09:40:58 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-05-18 09:40:58 +0000 |
commit | 3666098248b43282bda1153dae2f4c1e4af38d09 (patch) | |
tree | 9c69a323f89cdd81b231dc630b0eaf134225da7a /ext/DynaLoader | |
parent | 9e6b2b00f0190751b970ece3db7033405cb08ca5 (diff) | |
parent | d2719217c9b7910115cef7ea0c16d68e6b286cf7 (diff) | |
download | perl-3666098248b43282bda1153dae2f4c1e4af38d09.tar.gz |
[asperl] integrate mainline changes (untested)
p4raw-id: //depot/asperl@1010
Diffstat (limited to 'ext/DynaLoader')
-rw-r--r-- | ext/DynaLoader/DynaLoader.pm.PL (renamed from ext/DynaLoader/DynaLoader.pm) | 54 | ||||
-rw-r--r-- | ext/DynaLoader/Makefile.PL | 7 | ||||
-rw-r--r-- | ext/DynaLoader/dl_aix.xs | 14 | ||||
-rw-r--r-- | ext/DynaLoader/dl_hpux.xs | 7 |
4 files changed, 68 insertions, 14 deletions
diff --git a/ext/DynaLoader/DynaLoader.pm b/ext/DynaLoader/DynaLoader.pm.PL index 712d575e38..4c4155985d 100644 --- a/ext/DynaLoader/DynaLoader.pm +++ b/ext/DynaLoader/DynaLoader.pm.PL @@ -1,3 +1,19 @@ + +use Config; + +sub to_string { + my ($value) = @_; + $value =~ s/\\/\\\\'/g; + $value =~ s/'/\\'/g; + return "'$value'"; +} + +unlink "DynaLoader.pm" if -f "DynaLoader.pm"; +open OUT, ">DynaLoader.pm" or die $!; +print OUT <<'EOT'; + +# Generated from DynaLoader.pm.PL (resolved %Config::Config values) + package DynaLoader; # And Gandalf said: 'Many folk like to know beforehand what is to @@ -14,8 +30,6 @@ package DynaLoader; $VERSION = $VERSION = "1.03"; # avoid typo warning -require Config; - require AutoLoader; *AUTOLOAD = \&AutoLoader::AUTOLOAD; @@ -43,10 +57,15 @@ $dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug; sub dl_load_flags { 0x00 } -# +# ($dl_dlext, $dlsrc) +# = @Config::Config{'dlext', 'dlsrc'}; +EOT + +print OUT " (\$dl_dlext, \$dlsrc) = (", + to_string($Config::Config{'dlext'}), ",", + to_string($Config::Config{'dlsrc'}), ")\n;" ; -($dl_dlext, $dlsrc) - = @Config::Config{'dlext', 'dlsrc'}; +print OUT <<'EOT'; # Some systems need special handling to expand file specifications # (VMS support by Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU>) @@ -65,7 +84,14 @@ $do_expand = $Is_VMS = $^O eq 'VMS'; # Initialise @dl_library_path with the 'standard' library path # for this platform as determined by Configure -push(@dl_library_path, split(' ',$Config::Config{'libpth'})); + +# push(@dl_library_path, split(' ', $Config::Config{'libpth'}); +EOT + +print OUT "push(\@dl_library_path, split(' ', ", + to_string($Config::Config{'libpth'}), "));\n"; + +print OUT <<'EOT'; # Add to @dl_library_path any extra directories we can gather from # environment variables. So far LD_LIBRARY_PATH is the only known @@ -205,8 +231,14 @@ sub dl_findfile { my (@args) = @_; my (@dirs, $dir); # which directories to search my (@found); # full paths to real files we have found - my $dl_ext= $Config::Config{'dlext'}; # suffix for perl extensions - my $dl_so = $Config::Config{'so'}; # suffix for shared libraries +EOT + +print OUT ' my $dl_ext= ' . to_string($Config::Config{'dlext'}) . + "; # \$Config::Config{'dlext'} suffix for perl extensions\n"; +print OUT ' my $dl_so = ' . to_string($Config::Config{'so'}) . + "; # \$Config::Config{'so'} suffix for shared libraries\n"; + +print OUT <<'EOT'; print STDERR "dl_findfile(@args)\n" if $dl_debug; @@ -350,7 +382,7 @@ etc and also allow pseudo-dynamic linking (using C<ld -A> at runtime). It must be stressed that the DynaLoader, by itself, is practically useless for accessing non-Perl libraries because it provides almost no Perl-to-C 'glue'. There is, for example, no mechanism for calling a C -library function or supplying arguments. A ExtUtils::DynaLib module +library function or supplying arguments. A C::DynaLib module is available from CPAN sites which performs that function for some common system types. @@ -691,3 +723,7 @@ Solaris global loading added by Nick Ing-Simmons with design/coding assistance from Tim Bunce, January 1996. =cut +EOT + +close OUT or die $!; + diff --git a/ext/DynaLoader/Makefile.PL b/ext/DynaLoader/Makefile.PL index 9323935880..2c86abfc41 100644 --- a/ext/DynaLoader/Makefile.PL +++ b/ext/DynaLoader/Makefile.PL @@ -7,11 +7,12 @@ WriteMakefile( MAN3PODS => ' ', # Pods will be built by installman. SKIP => [qw(dynamic dynamic_lib dynamic_bs)], XSPROTOARG => '-noprototypes', # XXX remove later? - VERSION_FROM => 'DynaLoader.pm', - clean => {FILES => 'DynaLoader.c DynaLoader.xs'}, + VERSION_FROM => 'DynaLoader.pm.PL', + PL_FILES => {'DynaLoader.pm.PL'=>'DynaLoader.pm'}, + PM => {'DynaLoader.pm' => '$(INST_LIBDIR)/DynaLoader.pm'}, + clean => {FILES => 'DynaLoader.c DynaLoader.xs DynaLoader.pm'}, ); - sub MY::postamble { ' DynaLoader.xs: $(DLSRC) diff --git a/ext/DynaLoader/dl_aix.xs b/ext/DynaLoader/dl_aix.xs index 4e865edd3b..ea5040857d 100644 --- a/ext/DynaLoader/dl_aix.xs +++ b/ext/DynaLoader/dl_aix.xs @@ -29,6 +29,20 @@ #include <a.out.h> #include <ldfcn.h> +/* + * AIX 4.3 does remove some useful definitions from ldfcn.h. Define + * these here to compensate for that lossage. + */ +#ifndef BEGINNING +# define BEGINNING SEEK_SET +#endif +#ifndef FSEEK +# define FSEEK(ldptr,o,p) fseek(IOPTR(ldptr),(p==BEGINNING)?(OFFSET(ldptr) +o):o,p) +#endif +#ifndef FREAD +# define FREAD(p,s,n,ldptr) fread(p,s,n,IOPTR(ldptr)) +#endif + /* If using PerlIO, redefine these macros from <ldfcn.h> */ #ifdef USE_PERLIO #define FSEEK(ldptr,o,p) PerlIO_seek(IOPTR(ldptr),(p==BEGINNING)?(OFFSET(ldptr)+o):o,p) diff --git a/ext/DynaLoader/dl_hpux.xs b/ext/DynaLoader/dl_hpux.xs index 51d464e6de..a82e0eac11 100644 --- a/ext/DynaLoader/dl_hpux.xs +++ b/ext/DynaLoader/dl_hpux.xs @@ -65,6 +65,9 @@ dl_load_file(filename, flags=0) * unresolved references in situations like this. */ /* bind_type = BIND_IMMEDIATE|BIND_NONFATAL; */ } + /* BIND_NOSTART removed from bind_type because it causes the shared library's */ + /* initialisers not to be run. This causes problems with all of the static objects */ + /* in the library. */ #ifdef DEBUGGING if (dl_debug) bind_type |= BIND_VERBOSE; @@ -74,14 +77,14 @@ dl_load_file(filename, flags=0) for (i = 0; i <= max; i++) { char *sym = SvPVX(*av_fetch(dl_resolve_using, i, 0)); DLDEBUG(1,PerlIO_printf(PerlIO_stderr(), "dl_load_file(%s) (dependent)\n", sym)); - obj = shl_load(sym, bind_type | BIND_NOSTART, 0L); + obj = shl_load(sym, bind_type, 0L); if (obj == NULL) { goto end; } } DLDEBUG(1,PerlIO_printf(PerlIO_stderr(), "dl_load_file(%s): ", filename)); - obj = shl_load(filename, bind_type | BIND_NOSTART, 0L); + obj = shl_load(filename, bind_type, 0L); DLDEBUG(2,PerlIO_printf(PerlIO_stderr(), " libref=%x\n", obj)); end: |