MM_AIX needs neatvalue
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / Embed.pm
index ab85a13..2d6470e 100644 (file)
@@ -18,7 +18,7 @@ use vars qw(@ISA @EXPORT $VERSION
            );
 use strict;
 
-$VERSION = 1.2506_01;
+$VERSION = 1.26;
 
 @ISA = qw(Exporter);
 @EXPORT = qw(&xsinit &ldopts 
@@ -139,21 +139,26 @@ sub static_ext {
     @Extensions;
 }
 
+sub _escape {
+    my $arg = shift;
+    $$arg =~ s/([\(\)])/\\$1/g;
+}
+
 sub _ldflags {
     my $ldflags = $Config{ldflags};
-    $ldflags =~ s/([\(\)])/\\$1/g;
+    _escape(\$ldflags);
     return $ldflags;
 }
 
 sub _ccflags {
     my $ccflags = $Config{ccflags};
-    $ccflags =~ s/([\(\)])/\\$1/g;
+    _escape(\$ccflags);
     return $ccflags;
 }
 
 sub _ccdlflags {
     my $ccdlflags = $Config{ccdlflags};
-    $ccdlflags =~ s/([\(\)])/\\$1/g;
+    _escape(\$ccdlflags);
     return $ccdlflags;
 }
 
@@ -221,7 +226,10 @@ sub ldopts {
        $libperl = $Config{libperl};
     }
     else {
-       $libperl = (grep(/^-l\w*perl\w*$/, @link_args))[0] || "-lperl";
+       $libperl = (grep(/^-l\w*perl\w*$/, @link_args))[0]
+           || ($Config{libperl} =~ /^lib(\w+)(\Q$lib_ext\E|\.\Q$Config{dlext}\E)$/
+               ? "-l$1" : '')
+           || "-lperl";
     }
 
     my $lpath = File::Spec->catdir($Config{archlibexp}, 'CORE');