000d18
From 67d9ad2238c6b58ea160df731208cc6f50b64e96 Mon Sep 17 00:00:00 2001
000d18
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
000d18
Date: Thu, 13 Jun 2019 13:14:26 +0200
000d18
Subject: [PATCH] pkgconfig
000d18
MIME-Version: 1.0
000d18
Content-Type: text/plain; charset=UTF-8
000d18
Content-Transfer-Encoding: 8bit
000d18
000d18
Link to OpenSSL library according to pkgconfig output if available.
000d18
000d18
Signed-off-by: Petr Písař <ppisar@redhat.com>
000d18
---
000d18
 Makefile.PL | 16 +++++++++++-----
000d18
 1 file changed, 11 insertions(+), 5 deletions(-)
000d18
000d18
diff --git a/Makefile.PL b/Makefile.PL
000d18
index 31d9c74..6d7ceba 100644
000d18
--- a/Makefile.PL
000d18
+++ b/Makefile.PL
000d18
@@ -200,11 +200,17 @@ EOM
000d18
         @{ $opts->{lib_links} } = map { $_ =~ s/32\b//g } @{ $opts->{lib_links} } if $Config{use64bitall};
000d18
     }
000d18
     else {
000d18
-        push @{ $opts->{lib_links} },
000d18
-             ($rsaref
000d18
-              ? qw( ssl crypto RSAglue rsaref z )
000d18
-              : qw( ssl crypto z )
000d18
-             );
000d18
+        my $libsflags = `pkg-config --libs-only-l openssl`;
000d18
+        if ( $libsflags ne '' ) {
000d18
+            push @{ $opts->{lib_links} }, map { s/^-l//; $_ } split(' ', $libsflags);
000d18
+        }
000d18
+        else {
000d18
+            push @{ $opts->{lib_links} },
000d18
+                 ($rsaref
000d18
+                  ? qw( ssl crypto RSAglue rsaref z )
000d18
+                  : qw( ssl crypto z )
000d18
+                 );
000d18
+        }
000d18
 
000d18
         if (($Config{cc} =~ /aCC/i) && $^O eq 'hpux') {
000d18
             print "*** Enabling HPUX aCC options (+e)\n";
000d18
-- 
000d18
2.20.1
000d18