← Index
NYTProf Performance Profile   « line view »
For Makefile.PL
  Run on Sun Mar 1 16:04:44 2015
Reported on Sun Mar 1 16:09:02 2015

FilenameC:/tmp64ng/perl/lib/ExtUtils/Liblist/Kid.pm
StatementsExecuted 4039 statements in 46.8ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1831115.6ms15.6msExtUtils::Liblist::Kid::::CORE:ftfileExtUtils::Liblist::Kid::CORE:ftfile (opcode)
31115.6ms46.8msExtUtils::Liblist::Kid::::_win32_extExtUtils::Liblist::Kid::_win32_ext
1110s0sExtUtils::Liblist::Kid::::BEGIN@12ExtUtils::Liblist::Kid::BEGIN@12
1110s0sExtUtils::Liblist::Kid::::BEGIN@13ExtUtils::Liblist::Kid::BEGIN@13
1110s0sExtUtils::Liblist::Kid::::BEGIN@16ExtUtils::Liblist::Kid::BEGIN@16
1110s0sExtUtils::Liblist::Kid::::BEGIN@17ExtUtils::Liblist::Kid::BEGIN@17
1110s0sExtUtils::Liblist::Kid::::BEGIN@18ExtUtils::Liblist::Kid::BEGIN@18
1110s0sExtUtils::Liblist::Kid::::BEGIN@19ExtUtils::Liblist::Kid::BEGIN@19
1110s0sExtUtils::Liblist::Kid::::BEGIN@8ExtUtils::Liblist::Kid::BEGIN@8
63110s0sExtUtils::Liblist::Kid::::CORE:ftdirExtUtils::Liblist::Kid::CORE:ftdir (opcode)
522810s0sExtUtils::Liblist::Kid::::CORE:matchExtUtils::Liblist::Kid::CORE:match (opcode)
378110s0sExtUtils::Liblist::Kid::::CORE:regcompExtUtils::Liblist::Kid::CORE:regcomp (opcode)
198610s0sExtUtils::Liblist::Kid::::CORE:substExtUtils::Liblist::Kid::CORE:subst (opcode)
189410s0sExtUtils::Liblist::Kid::::_debugExtUtils::Liblist::Kid::_debug
0000s0sExtUtils::Liblist::Kid::::_unix_os2_extExtUtils::Liblist::Kid::_unix_os2_ext
0000s0sExtUtils::Liblist::Kid::::_vms_extExtUtils::Liblist::Kid::_vms_ext
126110s0sExtUtils::Liblist::Kid::::_win32_attach_extensionsExtUtils::Liblist::Kid::_win32_attach_extensions
63110s0sExtUtils::Liblist::Kid::::_win32_build_file_listExtUtils::Liblist::Kid::_win32_build_file_list
63110s0sExtUtils::Liblist::Kid::::_win32_build_prefixed_listExtUtils::Liblist::Kid::_win32_build_prefixed_list
3110s15.6msExtUtils::Liblist::Kid::::_win32_default_search_pathsExtUtils::Liblist::Kid::_win32_default_search_paths
3110s0sExtUtils::Liblist::Kid::::_win32_lib_extensionsExtUtils::Liblist::Kid::_win32_lib_extensions
3110s0sExtUtils::Liblist::Kid::::_win32_make_lib_search_listExtUtils::Liblist::Kid::_win32_make_lib_search_list
63110s15.6msExtUtils::Liblist::Kid::::_win32_search_fileExtUtils::Liblist::Kid::_win32_search_file
378110s0sExtUtils::Liblist::Kid::::_win32_try_attach_extensionExtUtils::Liblist::Kid::_win32_try_attach_extension
3110s46.8msExtUtils::Liblist::Kid::::extExtUtils::Liblist::Kid::ext
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package ExtUtils::Liblist::Kid;
2
3# XXX Splitting this out into its own .pm is a temporary solution.
4
5# This kid package is to be used by MakeMaker. It will not work if
6# $self is not a Makemaker.
7
820s10s
# spent 0s within ExtUtils::Liblist::Kid::BEGIN@8 which was called: # once (0s+0s) by main::BEGIN@1 at line 8
use 5.006;
# spent 0s making 1 call to ExtUtils::Liblist::Kid::BEGIN@8
9
10# Broken out of MakeMaker from version 4.11
11
1220s20s
# spent 0s within ExtUtils::Liblist::Kid::BEGIN@12 which was called: # once (0s+0s) by main::BEGIN@1 at line 12
use strict;
# spent 0s making 1 call to ExtUtils::Liblist::Kid::BEGIN@12 # spent 0s making 1 call to strict::import
1320s20s
# spent 0s within ExtUtils::Liblist::Kid::BEGIN@13 which was called: # once (0s+0s) by main::BEGIN@1 at line 13
use warnings;
# spent 0s making 1 call to ExtUtils::Liblist::Kid::BEGIN@13 # spent 0s making 1 call to warnings::import
1410sour $VERSION = '7.04';
15
1620s20s
# spent 0s within ExtUtils::Liblist::Kid::BEGIN@16 which was called: # once (0s+0s) by main::BEGIN@1 at line 16
use ExtUtils::MakeMaker::Config;
# spent 0s making 1 call to ExtUtils::Liblist::Kid::BEGIN@16 # spent 0s making 1 call to ExtUtils::MakeMaker::Config::import
1720s20s
# spent 0s within ExtUtils::Liblist::Kid::BEGIN@17 which was called: # once (0s+0s) by main::BEGIN@1 at line 17
use Cwd 'cwd';
# spent 0s making 1 call to Exporter::import # spent 0s making 1 call to ExtUtils::Liblist::Kid::BEGIN@17
1820s20s
# spent 0s within ExtUtils::Liblist::Kid::BEGIN@18 which was called: # once (0s+0s) by main::BEGIN@1 at line 18
use File::Basename;
# spent 0s making 1 call to Exporter::import # spent 0s making 1 call to ExtUtils::Liblist::Kid::BEGIN@18
19215.6ms10s
# spent 0s within ExtUtils::Liblist::Kid::BEGIN@19 which was called: # once (0s+0s) by main::BEGIN@1 at line 19
use File::Spec;
# spent 0s making 1 call to ExtUtils::Liblist::Kid::BEGIN@19
20
21
# spent 46.8ms (0s+46.8) within ExtUtils::Liblist::Kid::ext which was called 3 times, avg 15.6ms/call: # 3 times (0s+46.8ms) by ExtUtils::MM_Unix::extliblist at line 13 of ExtUtils/Liblist.pm, avg 15.6ms/call
sub ext {
2230s346.8ms if ( $^O eq 'VMS' ) { return &_vms_ext; }
# spent 46.8ms making 3 calls to ExtUtils::Liblist::Kid::_win32_ext, avg 15.6ms/call
23 elsif ( $^O eq 'MSWin32' ) { return &_win32_ext; }
24 else { return &_unix_os2_ext; }
25}
26
27sub _unix_os2_ext {
28 my ( $self, $potential_libs, $verbose, $give_libs ) = @_;
29 $verbose ||= 0;
30
31 if ( $^O =~ /os2|android/ and $Config{perllibs} ) {
32
33 # Dynamic libraries are not transitive, so we may need including
34 # the libraries linked against perl.dll/libperl.so again.
35
36 $potential_libs .= " " if $potential_libs;
37 $potential_libs .= $Config{perllibs};
38 }
39 return ( "", "", "", "", ( $give_libs ? [] : () ) ) unless $potential_libs;
40 warn "Potential libraries are '$potential_libs':\n" if $verbose;
41
42 my ( $so ) = $Config{so};
43 my ( $libs ) = defined $Config{perllibs} ? $Config{perllibs} : $Config{libs};
44 my $Config_libext = $Config{lib_ext} || ".a";
45 my $Config_dlext = $Config{dlext};
46
47 # compute $extralibs, $bsloadlibs and $ldloadlibs from
48 # $potential_libs
49 # this is a rewrite of Andy Dougherty's extliblist in perl
50
51 my ( @searchpath ); # from "-L/path" entries in $potential_libs
52 my ( @libpath ) = split " ", $Config{'libpth'} || '';
53 my ( @ldloadlibs, @bsloadlibs, @extralibs, @ld_run_path, %ld_run_path_seen );
54 my ( @libs, %libs_seen );
55 my ( $fullname, @fullname );
56 my ( $pwd ) = cwd(); # from Cwd.pm
57 my ( $found ) = 0;
58
59 foreach my $thislib ( split ' ', $potential_libs ) {
60 my ( $custom_name ) = '';
61
62 # Handle possible linker path arguments.
63 if ( $thislib =~ s/^(-[LR]|-Wl,-R|-Wl,-rpath,)// ) { # save path flag type
64 my ( $ptype ) = $1;
65 unless ( -d $thislib ) {
66 warn "$ptype$thislib ignored, directory does not exist\n"
67 if $verbose;
68 next;
69 }
70 my ( $rtype ) = $ptype;
71 if ( ( $ptype eq '-R' ) or ( $ptype =~ m!^-Wl,-[Rr]! ) ) {
72 if ( $Config{'lddlflags'} =~ /-Wl,-[Rr]/ ) {
73 $rtype = '-Wl,-R';
74 }
75 elsif ( $Config{'lddlflags'} =~ /-R/ ) {
76 $rtype = '-R';
77 }
78 }
79 unless ( File::Spec->file_name_is_absolute( $thislib ) ) {
80 warn "Warning: $ptype$thislib changed to $ptype$pwd/$thislib\n";
81 $thislib = $self->catdir( $pwd, $thislib );
82 }
83 push( @searchpath, $thislib );
84 push( @extralibs, "$ptype$thislib" );
85 push( @ldloadlibs, "$rtype$thislib" );
86 next;
87 }
88
89 if ( $thislib =~ m!^-Wl,! ) {
90 push( @extralibs, $thislib );
91 push( @ldloadlibs, $thislib );
92 next;
93 }
94
95 # Handle possible library arguments.
96 if ( $thislib =~ s/^-l(:)?// ) {
97 # Handle -l:foo.so, which means that the library will
98 # actually be called foo.so, not libfoo.so. This
99 # is used in Android by ExtUtils::Depends to allow one XS
100 # module to link to another.
101 $custom_name = $1 || '';
102 }
103 else {
104 warn "Unrecognized argument in LIBS ignored: '$thislib'\n";
105 next;
106 }
107
108 my ( $found_lib ) = 0;
109 foreach my $thispth ( @searchpath, @libpath ) {
110
111 # Try to find the full name of the library. We need this to
112 # determine whether it's a dynamically-loadable library or not.
113 # This tends to be subject to various os-specific quirks.
114 # For gcc-2.6.2 on linux (March 1995), DLD can not load
115 # .sa libraries, with the exception of libm.sa, so we
116 # deliberately skip them.
117 if ((@fullname =
118 $self->lsdir($thispth, "^\Qlib$thislib.$so.\E[0-9]+")) ||
119 (@fullname =
120 $self->lsdir($thispth, "^\Qlib$thislib.\E[0-9]+\Q\.$so"))) {
121 # Take care that libfoo.so.10 wins against libfoo.so.9.
122 # Compare two libraries to find the most recent version
123 # number. E.g. if you have libfoo.so.9.0.7 and
124 # libfoo.so.10.1, first convert all digits into two
125 # decimal places. Then we'll add ".00" to the shorter
126 # strings so that we're comparing strings of equal length
127 # Thus we'll compare libfoo.so.09.07.00 with
128 # libfoo.so.10.01.00. Some libraries might have letters
129 # in the version. We don't know what they mean, but will
130 # try to skip them gracefully -- we'll set any letter to
131 # '0'. Finally, sort in reverse so we can take the
132 # first element.
133
134 #TODO: iterate through the directory instead of sorting
135
136 $fullname = "$thispth/" . (
137 sort {
138 my ( $ma ) = $a;
139 my ( $mb ) = $b;
140 $ma =~ tr/A-Za-z/0/s;
141 $ma =~ s/\b(\d)\b/0$1/g;
142 $mb =~ tr/A-Za-z/0/s;
143 $mb =~ s/\b(\d)\b/0$1/g;
144 while ( length( $ma ) < length( $mb ) ) { $ma .= ".00"; }
145 while ( length( $mb ) < length( $ma ) ) { $mb .= ".00"; }
146
147 # Comparison deliberately backwards
148 $mb cmp $ma;
149 } @fullname
150 )[0];
151 }
152 elsif ( -f ( $fullname = "$thispth/lib$thislib.$so" )
153 && ( ( $Config{'dlsrc'} ne "dl_dld.xs" ) || ( $thislib eq "m" ) ) )
154 {
155 }
156 elsif (-f ( $fullname = "$thispth/lib${thislib}_s$Config_libext" )
157 && ( $Config{'archname'} !~ /RM\d\d\d-svr4/ )
158 && ( $thislib .= "_s" ) )
159 { # we must explicitly use _s version
160 }
161 elsif ( -f ( $fullname = "$thispth/lib$thislib$Config_libext" ) ) {
162 }
163 elsif ( defined( $Config_dlext )
164 && -f ( $fullname = "$thispth/lib$thislib.$Config_dlext" ) )
165 {
166 }
167 elsif ( -f ( $fullname = "$thispth/$thislib$Config_libext" ) ) {
168 }
169 elsif ( -f ( $fullname = "$thispth/lib$thislib.dll$Config_libext" ) ) {
170 }
171 elsif ( $^O eq 'cygwin' && -f ( $fullname = "$thispth/$thislib.dll" ) ) {
172 }
173 elsif ( -f ( $fullname = "$thispth/Slib$thislib$Config_libext" ) ) {
174 }
175 elsif ($^O eq 'dgux'
176 && -l ( $fullname = "$thispth/lib$thislib$Config_libext" )
177 && readlink( $fullname ) =~ /^elink:/s )
178 {
179
180 # Some of DG's libraries look like misconnected symbolic
181 # links, but development tools can follow them. (They
182 # look like this:
183 #
184 # libm.a -> elink:${SDE_PATH:-/usr}/sde/\
185 # ${TARGET_BINARY_INTERFACE:-m88kdgux}/usr/lib/libm.a
186 #
187 # , the compilation tools expand the environment variables.)
188 }
189 elsif ( $custom_name && -f ( $fullname = "$thispth/$thislib" ) ) {
190 }
191 else {
192 warn "$thislib not found in $thispth\n" if $verbose;
193 next;
194 }
195 warn "'-l$thislib' found at $fullname\n" if $verbose;
196 push @libs, $fullname unless $libs_seen{$fullname}++;
197 $found++;
198 $found_lib++;
199
200 # Now update library lists
201
202 # what do we know about this library...
203 my $is_dyna = ( $fullname !~ /\Q$Config_libext\E\z/ );
204 my $in_perl = ( $libs =~ /\B-l:?\Q${thislib}\E\b/s );
205
206 # include the path to the lib once in the dynamic linker path
207 # but only if it is a dynamic lib and not in Perl itself
208 my ( $fullnamedir ) = dirname( $fullname );
209 push @ld_run_path, $fullnamedir
210 if $is_dyna
211 && !$in_perl
212 && !$ld_run_path_seen{$fullnamedir}++;
213
214 # Do not add it into the list if it is already linked in
215 # with the main perl executable.
216 # We have to special-case the NeXT, because math and ndbm
217 # are both in libsys_s
218 unless (
219 $in_perl
220 || ( $Config{'osname'} eq 'next'
221 && ( $thislib eq 'm' || $thislib eq 'ndbm' ) )
222 )
223 {
224 push( @extralibs, "-l$custom_name$thislib" );
225 }
226
227 # We might be able to load this archive file dynamically
228 if ( ( $Config{'dlsrc'} =~ /dl_next/ && $Config{'osvers'} lt '4_0' )
229 || ( $Config{'dlsrc'} =~ /dl_dld/ ) )
230 {
231
232 # We push -l$thislib instead of $fullname because
233 # it avoids hardwiring a fixed path into the .bs file.
234 # Mkbootstrap will automatically add dl_findfile() to
235 # the .bs file if it sees a name in the -l format.
236 # USE THIS, when dl_findfile() is fixed:
237 # push(@bsloadlibs, "-l$thislib");
238 # OLD USE WAS while checking results against old_extliblist
239 push( @bsloadlibs, "$fullname" );
240 }
241 else {
242 if ( $is_dyna ) {
243
244 # For SunOS4, do not add in this shared library if
245 # it is already linked in the main perl executable
246 push( @ldloadlibs, "-l$custom_name$thislib" )
247 unless ( $in_perl and $^O eq 'sunos' );
248 }
249 else {
250 push( @ldloadlibs, "-l$custom_name$thislib" );
251 }
252 }
253 last; # found one here so don't bother looking further
254 }
255 warn "Warning (mostly harmless): " . "No library found for -l$thislib\n"
256 unless $found_lib > 0;
257 }
258
259 unless ( $found ) {
260 return ( '', '', '', '', ( $give_libs ? \@libs : () ) );
261 }
262 else {
263 return ( "@extralibs", "@bsloadlibs", "@ldloadlibs", join( ":", @ld_run_path ), ( $give_libs ? \@libs : () ) );
264 }
265}
266
267
# spent 46.8ms (15.6+31.2) within ExtUtils::Liblist::Kid::_win32_ext which was called 3 times, avg 15.6ms/call: # 3 times (15.6ms+31.2ms) by ExtUtils::Liblist::Kid::ext at line 22, avg 15.6ms/call
sub _win32_ext {
268
26930s require Text::ParseWords;
270
27130s my ( $self, $potential_libs, $verbose, $give_libs ) = @_;
27230s $verbose ||= 0;
273
274 # If user did not supply a list, we punt.
275 # (caller should probably use the list in $Config{libs})
27630s return ( "", "", "", "", ( $give_libs ? [] : () ) ) unless $potential_libs;
277
278 # TODO: make this use MM_Win32.pm's compiler detection
27930s my %libs_seen;
280 my @extralibs;
28130s my $cc = $Config{cc} || '';
28230s30s my $VC = $cc =~ /\bcl\b/i;
# spent 0s making 3 calls to ExtUtils::Liblist::Kid::CORE:match, avg 0s/call
28330s30s my $GC = $cc =~ /\bgcc\b/i;
# spent 0s making 3 calls to ExtUtils::Liblist::Kid::CORE:match, avg 0s/call
284
28530s30s my $libext = _win32_lib_extensions();
# spent 0s making 3 calls to ExtUtils::Liblist::Kid::_win32_lib_extensions, avg 0s/call
28630s my @searchpath = ( '' ); # from "-L/path" entries in $potential_libs
28730s315.6ms my @libpath = _win32_default_search_paths( $VC, $GC );
# spent 15.6ms making 3 calls to ExtUtils::Liblist::Kid::_win32_default_search_paths, avg 5.20ms/call
28830s30s my $pwd = cwd(); # from Cwd.pm
# spent 0s making 3 calls to Cwd::_win32_cwd, avg 0s/call
28930s my $search = 1;
290
291 # compute @extralibs from $potential_libs
29230s30s my @lib_search_list = _win32_make_lib_search_list( $potential_libs, $verbose );
# spent 0s making 3 calls to ExtUtils::Liblist::Kid::_win32_make_lib_search_list, avg 0s/call
29330s for ( @lib_search_list ) {
294
295630s my $thislib = $_;
296
297 # see if entry is a flag
298630s630s if ( /^:\w+$/ ) {
# spent 0s making 63 calls to ExtUtils::Liblist::Kid::CORE:match, avg 0s/call
299 $search = 0 if lc eq ':nosearch';
300 $search = 1 if lc eq ':search';
301 _debug( "Ignoring unknown flag '$thislib'\n", $verbose ) if !/^:(no)?(search|default)$/i;
302 next;
303 }
304
305 # if searching is disabled, do compiler-specific translations
306630s unless ( $search ) {
307 s/^-l(.+)$/$1.lib/ unless $GC;
308 s/^-L/-libpath:/ if $VC;
309 push( @extralibs, $_ );
310 next;
311 }
312
313 # handle possible linker path arguments
3146315.6ms1260s if ( s/^-L// and not -d ) {
# spent 0s making 63 calls to ExtUtils::Liblist::Kid::CORE:ftdir, avg 0s/call # spent 0s making 63 calls to ExtUtils::Liblist::Kid::CORE:subst, avg 0s/call
315 _debug( "$thislib ignored, directory does not exist\n", $verbose );
316 next;
317 }
318 elsif ( -d ) {
319 unless ( File::Spec->file_name_is_absolute( $_ ) ) {
320 warn "Warning: '$thislib' changed to '-L$pwd/$_'\n";
321 $_ = $self->catdir( $pwd, $_ );
322 }
323 push( @searchpath, $_ );
324 next;
325 }
326
327630s my @paths = ( @searchpath, @libpath );
328630s6315.6ms my ( $fullname, $path ) = _win32_search_file( $thislib, $libext, \@paths, $verbose, $GC );
# spent 15.6ms making 63 calls to ExtUtils::Liblist::Kid::_win32_search_file, avg 248µs/call
329
330630s if ( !$fullname ) {
331 warn "Warning (mostly harmless): No library found for $thislib\n";
332 next;
333 }
334
335630s630s _debug( "'$thislib' found as '$fullname'\n", $verbose );
# spent 0s making 63 calls to ExtUtils::Liblist::Kid::_debug, avg 0s/call
336630s push( @extralibs, $fullname );
337630s $libs_seen{$fullname} = 1 if $path; # why is this a special case?
338 }
339
34030s my @libs = keys %libs_seen;
341
34230s return ( '', '', '', '', ( $give_libs ? \@libs : () ) ) unless @extralibs;
343
344 # make sure paths with spaces are properly quoted
34530s @extralibs = map { qq["$_"] } @extralibs;
34630s @libs = map { qq["$_"] } @libs;
347
34830s my $lib = join( ' ', @extralibs );
349
350 # normalize back to backward slashes (to help braindead tools)
351 # XXX this may break equally braindead GNU tools that don't understand
352 # backslashes, either. Seems like one can't win here. Cursed be CP/M.
35330s30s $lib =~ s,/,\\,g;
# spent 0s making 3 calls to ExtUtils::Liblist::Kid::CORE:subst, avg 0s/call
354
35530s30s _debug( "Result: $lib\n", $verbose );
# spent 0s making 3 calls to ExtUtils::Liblist::Kid::_debug, avg 0s/call
35630s wantarray ? ( $lib, '', $lib, '', ( $give_libs ? \@libs : () ) ) : $lib;
357}
358
359
# spent 0s within ExtUtils::Liblist::Kid::_win32_make_lib_search_list which was called 3 times, avg 0s/call: # 3 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_ext at line 292, avg 0s/call
sub _win32_make_lib_search_list {
36030s my ( $potential_libs, $verbose ) = @_;
361
362 # If Config.pm defines a set of default libs, we always
363 # tack them on to the user-supplied list, unless the user
364 # specified :nodefault
36530s my $libs = $Config{'perllibs'};
36630s30s $potential_libs = join( ' ', $potential_libs, $libs ) if $libs and $potential_libs !~ /:nodefault/i;
# spent 0s making 3 calls to ExtUtils::Liblist::Kid::CORE:match, avg 0s/call
36730s30s _debug( "Potential libraries are '$potential_libs':\n", $verbose );
# spent 0s making 3 calls to ExtUtils::Liblist::Kid::_debug, avg 0s/call
368
36930s30s $potential_libs =~ s,\\,/,g; # normalize to forward slashes
# spent 0s making 3 calls to ExtUtils::Liblist::Kid::CORE:subst, avg 0s/call
370
37130s30s my @list = Text::ParseWords::quotewords( '\s+', 0, $potential_libs );
# spent 0s making 3 calls to Text::ParseWords::quotewords, avg 0s/call
372
37330s return @list;
374}
375
376
# spent 15.6ms (0s+15.6) within ExtUtils::Liblist::Kid::_win32_default_search_paths which was called 3 times, avg 5.20ms/call: # 3 times (0s+15.6ms) by ExtUtils::Liblist::Kid::_win32_ext at line 287, avg 5.20ms/call
sub _win32_default_search_paths {
37730s my ( $VC, $GC ) = @_;
378
37930s my $libpth = $Config{'libpth'} || '';
38030s30s $libpth =~ s,\\,/,g; # normalize to forward slashes
# spent 0s making 3 calls to ExtUtils::Liblist::Kid::CORE:subst, avg 0s/call
381
38230s315.6ms my @libpath = Text::ParseWords::quotewords( '\s+', 0, $libpth );
# spent 15.6ms making 3 calls to Text::ParseWords::quotewords, avg 5.20ms/call
38330s push @libpath, "$Config{installarchlib}/CORE"; # add "$Config{installarchlib}/CORE" to default search path
384
38530s push @libpath, split /;/, $ENV{LIB} if $VC and $ENV{LIB};
38630s push @libpath, split /;/, $ENV{LIBRARY_PATH} if $GC and $ENV{LIBRARY_PATH};
387
38830s return @libpath;
389}
390
391
# spent 15.6ms (0s+15.6) within ExtUtils::Liblist::Kid::_win32_search_file which was called 63 times, avg 248µs/call: # 63 times (0s+15.6ms) by ExtUtils::Liblist::Kid::_win32_ext at line 328, avg 248µs/call
sub _win32_search_file {
392630s my ( $thislib, $libext, $paths, $verbose, $GC ) = @_;
393
394630s630s my @file_list = _win32_build_file_list( $thislib, $GC, $libext );
# spent 0s making 63 calls to ExtUtils::Liblist::Kid::_win32_build_file_list, avg 0s/call
395
396630s for my $lib_file ( @file_list ) {
397630s for my $path ( @{$paths} ) {
3981830s my $fullname = $lib_file;
3991830s $fullname = "$path\\$fullname" if $path;
400
40118315.6ms18315.6ms return ( $fullname, $path ) if -f $fullname;
# spent 15.6ms making 183 calls to ExtUtils::Liblist::Kid::CORE:ftfile, avg 85µs/call
402
4031200s1200s _debug( "'$thislib' not found as '$fullname'\n", $verbose );
# spent 0s making 120 calls to ExtUtils::Liblist::Kid::_debug, avg 0s/call
404 }
405 }
406
407 return;
408}
409
410
# spent 0s within ExtUtils::Liblist::Kid::_win32_build_file_list which was called 63 times, avg 0s/call: # 63 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_search_file at line 394, avg 0s/call
sub _win32_build_file_list {
411630s my ( $lib, $GC, $extensions ) = @_;
412
413630s630s my @pre_fixed = _win32_build_prefixed_list( $lib, $GC );
# spent 0s making 63 calls to ExtUtils::Liblist::Kid::_win32_build_prefixed_list, avg 0s/call
414630s1260s return map _win32_attach_extensions( $_, $extensions ), @pre_fixed;
# spent 0s making 126 calls to ExtUtils::Liblist::Kid::_win32_attach_extensions, avg 0s/call
415}
416
417
# spent 0s within ExtUtils::Liblist::Kid::_win32_build_prefixed_list which was called 63 times, avg 0s/call: # 63 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_build_file_list at line 413, avg 0s/call
sub _win32_build_prefixed_list {
418630s my ( $lib, $GC ) = @_;
419
420630s630s return $lib if $lib !~ s/^-l//;
# spent 0s making 63 calls to ExtUtils::Liblist::Kid::CORE:subst, avg 0s/call
421630s630s return $lib if $lib =~ /^lib/ and !$GC;
# spent 0s making 63 calls to ExtUtils::Liblist::Kid::CORE:match, avg 0s/call
422
423630s630s ( my $no_prefix = $lib ) =~ s/^lib//i;
# spent 0s making 63 calls to ExtUtils::Liblist::Kid::CORE:subst, avg 0s/call
424630s $lib = "lib$lib" if $no_prefix eq $lib;
425
426630s return ( $lib, $no_prefix ) if $GC;
427 return ( $no_prefix, $lib );
428}
429
430
# spent 0s within ExtUtils::Liblist::Kid::_win32_attach_extensions which was called 126 times, avg 0s/call: # 126 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_build_file_list at line 414, avg 0s/call
sub _win32_attach_extensions {
4311260s my ( $lib, $extensions ) = @_;
4321260s3780s return map _win32_try_attach_extension( $lib, $_ ), @{$extensions};
# spent 0s making 378 calls to ExtUtils::Liblist::Kid::_win32_try_attach_extension, avg 0s/call
433}
434
435
# spent 0s within ExtUtils::Liblist::Kid::_win32_try_attach_extension which was called 378 times, avg 0s/call: # 378 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_attach_extensions at line 432, avg 0s/call
sub _win32_try_attach_extension {
4363780s my ( $lib, $extension ) = @_;
437
4383780s7560s return $lib if $lib =~ /\Q$extension\E$/i;
# spent 0s making 378 calls to ExtUtils::Liblist::Kid::CORE:match, avg 0s/call # spent 0s making 378 calls to ExtUtils::Liblist::Kid::CORE:regcomp, avg 0s/call
4393780s return "$lib$extension";
440}
441
442
# spent 0s within ExtUtils::Liblist::Kid::_win32_lib_extensions which was called 3 times, avg 0s/call: # 3 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_ext at line 285, avg 0s/call
sub _win32_lib_extensions {
44330s my @extensions;
44430s push @extensions, $Config{'lib_ext'} if $Config{'lib_ext'};
44560s30s push @extensions, '.dll.a' if grep { m!^\.a$! } @extensions;
# spent 0s making 3 calls to ExtUtils::Liblist::Kid::CORE:match, avg 0s/call
44690s60s push @extensions, '.lib' unless grep { m!^\.lib$! } @extensions;
# spent 0s making 6 calls to ExtUtils::Liblist::Kid::CORE:match, avg 0s/call
44730s return \@extensions;
448}
449
450
# spent 0s within ExtUtils::Liblist::Kid::_debug which was called 189 times, avg 0s/call: # 120 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_search_file at line 403, avg 0s/call # 63 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_ext at line 335, avg 0s/call # 3 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_ext at line 355, avg 0s/call # 3 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_make_lib_search_list at line 367, avg 0s/call
sub _debug {
4511890s my ( $message, $verbose ) = @_;
4521890s return if !$verbose;
453 warn $message;
454 return;
455}
456
457sub _vms_ext {
458 my ( $self, $potential_libs, $verbose, $give_libs ) = @_;
459 $verbose ||= 0;
460
461 my ( @crtls, $crtlstr );
462 @crtls = ( ( $Config{'ldflags'} =~ m-/Debug-i ? $Config{'dbgprefix'} : '' ) . 'PerlShr/Share' );
463 push( @crtls, grep { not /\(/ } split /\s+/, $Config{'perllibs'} );
464 push( @crtls, grep { not /\(/ } split /\s+/, $Config{'libc'} );
465
466 # In general, we pass through the basic libraries from %Config unchanged.
467 # The one exception is that if we're building in the Perl source tree, and
468 # a library spec could be resolved via a logical name, we go to some trouble
469 # to insure that the copy in the local tree is used, rather than one to
470 # which a system-wide logical may point.
471 if ( $self->{PERL_SRC} ) {
472 my ( $locspec, $type );
473 foreach my $lib ( @crtls ) {
474 if ( ( $locspec, $type ) = $lib =~ m{^([\w\$-]+)(/\w+)?} and $locspec =~ /perl/i ) {
475 if ( lc $type eq '/share' ) { $locspec .= $Config{'exe_ext'}; }
476 elsif ( lc $type eq '/library' ) { $locspec .= $Config{'lib_ext'}; }
477 else { $locspec .= $Config{'obj_ext'}; }
478 $locspec = $self->catfile( $self->{PERL_SRC}, $locspec );
479 $lib = "$locspec$type" if -e $locspec;
480 }
481 }
482 }
483 $crtlstr = @crtls ? join( ' ', @crtls ) : '';
484
485 unless ( $potential_libs ) {
486 warn "Result:\n\tEXTRALIBS: \n\tLDLOADLIBS: $crtlstr\n" if $verbose;
487 return ( '', '', $crtlstr, '', ( $give_libs ? [] : () ) );
488 }
489
490 my ( %found, @fndlibs, $ldlib );
491 my $cwd = cwd();
492 my ( $so, $lib_ext, $obj_ext ) = @Config{ 'so', 'lib_ext', 'obj_ext' };
493
494 # List of common Unix library names and their VMS equivalents
495 # (VMS equivalent of '' indicates that the library is automatically
496 # searched by the linker, and should be skipped here.)
497 my ( @flibs, %libs_seen );
498 my %libmap = (
499 'm' => '',
500 'f77' => '',
501 'F77' => '',
502 'V77' => '',
503 'c' => '',
504 'malloc' => '',
505 'crypt' => '',
506 'resolv' => '',
507 'c_s' => '',
508 'socket' => '',
509 'X11' => 'DECW$XLIBSHR',
510 'Xt' => 'DECW$XTSHR',
511 'Xm' => 'DECW$XMLIBSHR',
512 'Xmu' => 'DECW$XMULIBSHR'
513 );
514
515 warn "Potential libraries are '$potential_libs'\n" if $verbose;
516
517 # First, sort out directories and library names in the input
518 my ( @dirs, @libs );
519 foreach my $lib ( split ' ', $potential_libs ) {
520 push( @dirs, $1 ), next if $lib =~ /^-L(.*)/;
521 push( @dirs, $lib ), next if $lib =~ /[:>\]]$/;
522 push( @dirs, $lib ), next if -d $lib;
523 push( @libs, $1 ), next if $lib =~ /^-l(.*)/;
524 push( @libs, $lib );
525 }
526 push( @dirs, split( ' ', $Config{'libpth'} ) );
527
528 # Now make sure we've got VMS-syntax absolute directory specs
529 # (We don't, however, check whether someone's hidden a relative
530 # path in a logical name.)
531 foreach my $dir ( @dirs ) {
532 unless ( -d $dir ) {
533 warn "Skipping nonexistent Directory $dir\n" if $verbose > 1;
534 $dir = '';
535 next;
536 }
537 warn "Resolving directory $dir\n" if $verbose;
538 if ( File::Spec->file_name_is_absolute( $dir ) ) {
539 $dir = VMS::Filespec::vmspath( $dir );
540 }
541 else {
542 $dir = $self->catdir( $cwd, $dir );
543 }
544 }
545 @dirs = grep { length( $_ ) } @dirs;
546 unshift( @dirs, '' ); # Check each $lib without additions first
547
548 LIB: foreach my $lib ( @libs ) {
549 if ( exists $libmap{$lib} ) {
550 next unless length $libmap{$lib};
551 $lib = $libmap{$lib};
552 }
553
554 my ( @variants, $cand );
555 my ( $ctype ) = '';
556
557 # If we don't have a file type, consider it a possibly abbreviated name and
558 # check for common variants. We try these first to grab libraries before
559 # a like-named executable image (e.g. -lperl resolves to perlshr.exe
560 # before perl.exe).
561 if ( $lib !~ /\.[^:>\]]*$/ ) {
562 push( @variants, "${lib}shr", "${lib}rtl", "${lib}lib" );
563 push( @variants, "lib$lib" ) if $lib !~ /[:>\]]/;
564 }
565 push( @variants, $lib );
566 warn "Looking for $lib\n" if $verbose;
567 foreach my $variant ( @variants ) {
568 my ( $fullname, $name );
569
570 foreach my $dir ( @dirs ) {
571 my ( $type );
572
573 $name = "$dir$variant";
574 warn "\tChecking $name\n" if $verbose > 2;
575 $fullname = VMS::Filespec::rmsexpand( $name );
576 if ( defined $fullname and -f $fullname ) {
577
578 # It's got its own suffix, so we'll have to figure out the type
579 if ( $fullname =~ /(?:$so|exe)$/i ) { $type = 'SHR'; }
580 elsif ( $fullname =~ /(?:$lib_ext|olb)$/i ) { $type = 'OLB'; }
581 elsif ( $fullname =~ /(?:$obj_ext|obj)$/i ) {
582 warn "Warning (mostly harmless): " . "Plain object file $fullname found in library list\n";
583 $type = 'OBJ';
584 }
585 else {
586 warn "Warning (mostly harmless): " . "Unknown library type for $fullname; assuming shared\n";
587 $type = 'SHR';
588 }
589 }
590 elsif (-f ( $fullname = VMS::Filespec::rmsexpand( $name, $so ) )
591 or -f ( $fullname = VMS::Filespec::rmsexpand( $name, '.exe' ) ) )
592 {
593 $type = 'SHR';
594 $name = $fullname unless $fullname =~ /exe;?\d*$/i;
595 }
596 elsif (
597 not length( $ctype ) and # If we've got a lib already,
598 ( -f ( $fullname = VMS::Filespec::rmsexpand( $name, $lib_ext ) ) or -f ( $fullname = VMS::Filespec::rmsexpand( $name, '.olb' ) ) )
599
600 )
601 {
602 $type = 'OLB';
603 $name = $fullname unless $fullname =~ /olb;?\d*$/i;
604 }
605 elsif (
606 not length( $ctype ) and # If we've got a lib already,
607 ( -f ( $fullname = VMS::Filespec::rmsexpand( $name, $obj_ext ) ) or -f ( $fullname = VMS::Filespec::rmsexpand( $name, '.obj' ) ) )
608
609 )
610 {
611 warn "Warning (mostly harmless): " . "Plain object file $fullname found in library list\n";
612 $type = 'OBJ';
613 $name = $fullname unless $fullname =~ /obj;?\d*$/i;
614 }
615 if ( defined $type ) {
616 $ctype = $type;
617 $cand = $name;
618 last if $ctype eq 'SHR';
619 }
620 }
621 if ( $ctype ) {
622
623 push @{ $found{$ctype} }, $cand;
624 warn "\tFound as $cand (really $fullname), type $ctype\n"
625 if $verbose > 1;
626 push @flibs, $name unless $libs_seen{$fullname}++;
627 next LIB;
628 }
629 }
630 warn "Warning (mostly harmless): " . "No library found for $lib\n";
631 }
632
633 push @fndlibs, @{ $found{OBJ} } if exists $found{OBJ};
634 push @fndlibs, map { "$_/Library" } @{ $found{OLB} } if exists $found{OLB};
635 push @fndlibs, map { "$_/Share" } @{ $found{SHR} } if exists $found{SHR};
636 my $lib = join( ' ', @fndlibs );
637
638 $ldlib = $crtlstr ? "$lib $crtlstr" : $lib;
639 $ldlib =~ s/^\s+|\s+$//g;
640 warn "Result:\n\tEXTRALIBS: $lib\n\tLDLOADLIBS: $ldlib\n" if $verbose;
641 wantarray ? ( $lib, '', $ldlib, '', ( $give_libs ? \@flibs : () ) ) : $lib;
642}
643
64410s1;
 
# spent 0s within ExtUtils::Liblist::Kid::CORE:ftdir which was called 63 times, avg 0s/call: # 63 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_ext at line 314, avg 0s/call
sub ExtUtils::Liblist::Kid::CORE:ftdir; # opcode
# spent 15.6ms within ExtUtils::Liblist::Kid::CORE:ftfile which was called 183 times, avg 85µs/call: # 183 times (15.6ms+0s) by ExtUtils::Liblist::Kid::_win32_search_file at line 401, avg 85µs/call
sub ExtUtils::Liblist::Kid::CORE:ftfile; # opcode
# spent 0s within ExtUtils::Liblist::Kid::CORE:match which was called 522 times, avg 0s/call: # 378 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_try_attach_extension at line 438, avg 0s/call # 63 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_build_prefixed_list at line 421, avg 0s/call # 63 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_ext at line 298, avg 0s/call # 6 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_lib_extensions at line 446, avg 0s/call # 3 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_ext at line 282, avg 0s/call # 3 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_lib_extensions at line 445, avg 0s/call # 3 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_ext at line 283, avg 0s/call # 3 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_make_lib_search_list at line 366, avg 0s/call
sub ExtUtils::Liblist::Kid::CORE:match; # opcode
# spent 0s within ExtUtils::Liblist::Kid::CORE:regcomp which was called 378 times, avg 0s/call: # 378 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_try_attach_extension at line 438, avg 0s/call
sub ExtUtils::Liblist::Kid::CORE:regcomp; # opcode
# spent 0s within ExtUtils::Liblist::Kid::CORE:subst which was called 198 times, avg 0s/call: # 63 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_ext at line 314, avg 0s/call # 63 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_build_prefixed_list at line 420, avg 0s/call # 63 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_build_prefixed_list at line 423, avg 0s/call # 3 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_ext at line 353, avg 0s/call # 3 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_default_search_paths at line 380, avg 0s/call # 3 times (0s+0s) by ExtUtils::Liblist::Kid::_win32_make_lib_search_list at line 369, avg 0s/call
sub ExtUtils::Liblist::Kid::CORE:subst; # opcode