summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-05-10 02:27:19 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-05-10 02:27:19 +0000
commitecc90c0efc8c36b4da62ae4a40adb6c1a5919fd7 (patch)
treead57665f20698d5d6fd0d38d075e4e320ad62e09 /lib
parenta9529cba730143751280608d9cb8a4d7f0b0a249 (diff)
downloadperl-ecc90c0efc8c36b4da62ae4a40adb6c1a5919fd7.tar.gz
[win32] fix ExtUtils::Liblist mishandling paths with spaces
p4raw-id: //depot/win32/perl@920
Diffstat (limited to 'lib')
-rw-r--r--lib/ExtUtils/Liblist.pm23
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/ExtUtils/Liblist.pm b/lib/ExtUtils/Liblist.pm
index 5c35dc7307..ccdffb8eea 100644
--- a/lib/ExtUtils/Liblist.pm
+++ b/lib/ExtUtils/Liblist.pm
@@ -182,6 +182,9 @@ sub _unix_os2_ext {
}
sub _win32_ext {
+
+ require Text::ParseWords;
+
my($self, $potential_libs, $verbose) = @_;
# If user did not supply a list, we punt.
@@ -206,14 +209,14 @@ sub _win32_ext {
# compute $extralibs from $potential_libs
my(@searchpath); # from "-L/path" entries in $potential_libs
- my(@libpath) = split " ", $libpth;
+ my(@libpath) = Text::ParseWords::quotewords('\s+', 0, $libpth);
my(@extralibs);
my($fullname, $thislib, $thispth);
my($pwd) = cwd(); # from Cwd.pm
my($lib) = '';
my($found) = 0;
- foreach $thislib (split ' ', $potential_libs){
+ foreach $thislib (Text::ParseWords::quotewords('\s+', 0, $potential_libs)){
# Handle possible linker path arguments.
if ($thislib =~ s/^-L// and not -d $thislib) {
@@ -223,7 +226,7 @@ sub _win32_ext {
}
elsif (-d $thislib) {
unless ($self->file_name_is_absolute($thislib)) {
- warn "Warning: -L$thislib changed to -L$pwd/$thislib\n";
+ warn "Warning: '-L$thislib' changed to '-L$pwd/$thislib'\n";
$thislib = $self->catdir($pwd,$thislib);
}
push(@searchpath, $thislib);
@@ -253,6 +256,9 @@ sub _win32_ext {
unless $found_lib>0;
}
return ('','','','') unless $found;
+
+ # make sure paths with spaces are properly quoted
+ @extralibs = map { (/\s/ && !/^".*"$/) ? qq["$_"] : $_ } @extralibs;
$lib = join(' ',@extralibs);
warn "Result: $lib\n" if $verbose;
wantarray ? ($lib, '', $lib, '') : $lib;
@@ -595,6 +601,17 @@ distinguish between them.
LDLOADLIBS and EXTRALIBS are always identical under Win32, and BSLOADLIBS
and LD_RUN_PATH are always empty (this may change in future).
+=item *
+
+You must make sure that any paths and path components are properly
+surrounded with double-quotes if they contain spaces. For example,
+C<$potential_libs> could be (literally):
+
+ "-Lc:\Program Files\vc\lib" msvcrt.lib "la test\foo bar.lib"
+
+Note how the first and last entries are protected by quotes in order
+to protect the spaces.
+
=back