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