Blob Blame History Raw
--- inc/Module/Install/PRIVATE/Net/SSLeay.pm
+++ inc/Module/Install/PRIVATE/Net/SSLeay.pm
@@ -121,11 +121,16 @@ EOM
         @{ $opts->{lib_links} } = map { $_ =~ s/32\b//g } @{ $opts->{lib_links} } if $Config{use64bitall};
     }
     else {
-        push @{ $opts->{lib_links} },
-             ($rsaref
-              ? qw( ssl crypto RSAglue rsaref z )
-              : qw( ssl crypto z )
-             );
+        if ( eval { require ExtUtils::PkgConfig } && ExtUtils::PkgConfig->exists('openssl') ) {
+            push @{ $opts->{lib_links} }, map { s/^-l//; $_ } split(' ', ExtUtils::PkgConfig->libs_only_l('openssl'));
+        }
+        else {
+            push @{ $opts->{lib_links} },
+                 ($rsaref
+                  ? qw( ssl crypto RSAglue rsaref z )
+                  : qw( ssl crypto z )
+                 );
+        }
 
         if (($Config{cc} =~ /aCC/i) && $^O eq 'hpux') {
             print "*** Enabling HPUX aCC options (+e)\n";