Skip to content

Commit 0951d4e

Browse files
meson: Fix linking using old OpenSSL lib names
Before OpenSSL 1.1.0 the legacy names ssleay32 and libeay32 were still used on Windows, and while we have support for this auto- conf the meson buildsystem only used the new names on all plat- forms. This adds support for the old name scheme when building on Windows. This patch only applies to 17 and 16 as master no longer support OpenSSL 1.0.2. Author: Darek Ślusarczyk <dslusarczyk@splunk.com> Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com> Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Discussion: https://postgr.es/m/CAN55FZ1Nk8wqY=mTrN78H026TuGV50h2H6uq1PwxhTauPYi3ug@mail.gmail.com Backpatch-through: 16
1 parent 9af2b34 commit 0951d4e

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

meson.build

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,14 +1333,37 @@ if sslopt in ['auto', 'openssl']
13331333

13341334
# via library + headers
13351335
if not ssl.found()
1336+
is_windows = host_system == 'windows'
1337+
1338+
ssl_lib_common_params = {
1339+
'dirs': test_lib_d,
1340+
'header_include_directories': postgres_inc,
1341+
'has_headers': ['openssl/ssl.h', 'openssl/err.h'],
1342+
}
13361343
ssl_lib = cc.find_library('ssl',
1337-
dirs: test_lib_d,
1338-
header_include_directories: postgres_inc,
1339-
has_headers: ['openssl/ssl.h', 'openssl/err.h'],
1340-
required: openssl_required)
1344+
kwargs: ssl_lib_common_params,
1345+
required: openssl_required and not is_windows
1346+
)
1347+
# Before OpenSSL 1.1.0, there was a different naming convention for
1348+
# libraries on Windows, so try the alternative name if ssl wasn't found
1349+
if not ssl_lib.found() and is_windows
1350+
ssl_lib = cc.find_library('ssleay32',
1351+
kwargs: ssl_lib_common_params,
1352+
required: openssl_required
1353+
)
1354+
endif
1355+
13411356
crypto_lib = cc.find_library('crypto',
13421357
dirs: test_lib_d,
1343-
required: openssl_required)
1358+
required: openssl_required and not is_windows)
1359+
# Before OpenSSL 1.1.0, there was a different naming convention for
1360+
# libraries on Windows, so try the alternatve name if crypto wasn't found
1361+
if not crypto_lib.found() and is_windows
1362+
crypto_lib = cc.find_library('libeay32',
1363+
dirs: test_lib_d,
1364+
required: openssl_required)
1365+
endif
1366+
13441367
if ssl_lib.found() and crypto_lib.found()
13451368
ssl_int = [ssl_lib, crypto_lib]
13461369
ssl = declare_dependency(dependencies: ssl_int, include_directories: postgres_inc)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy