Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 60516fc

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 <[email protected]> Reviewed-by: Nazir Bilal Yavuz <[email protected]> Reviewed-by: Daniel Gustafsson <[email protected]> Discussion: https://postgr.es/m/CAN55FZ1Nk8wqY=mTrN78H026TuGV50h2H6uq1PwxhTauPYi3ug@mail.gmail.com Backpatch-through: 16
1 parent b26a3bc commit 60516fc

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
@@ -1339,14 +1339,37 @@ if sslopt in ['auto', 'openssl']
13391339

13401340
# via library + headers
13411341
if not ssl.found()
1342+
is_windows = host_system == 'windows'
1343+
1344+
ssl_lib_common_params = {
1345+
'dirs': test_lib_d,
1346+
'header_include_directories': postgres_inc,
1347+
'has_headers': ['openssl/ssl.h', 'openssl/err.h'],
1348+
}
13421349
ssl_lib = cc.find_library('ssl',
1343-
dirs: test_lib_d,
1344-
header_include_directories: postgres_inc,
1345-
has_headers: ['openssl/ssl.h', 'openssl/err.h'],
1346-
required: openssl_required)
1350+
kwargs: ssl_lib_common_params,
1351+
required: openssl_required and not is_windows
1352+
)
1353+
# Before OpenSSL 1.1.0, there was a different naming convention for
1354+
# libraries on Windows, so try the alternative name if ssl wasn't found
1355+
if not ssl_lib.found() and is_windows
1356+
ssl_lib = cc.find_library('ssleay32',
1357+
kwargs: ssl_lib_common_params,
1358+
required: openssl_required
1359+
)
1360+
endif
1361+
13471362
crypto_lib = cc.find_library('crypto',
13481363
dirs: test_lib_d,
1349-
required: openssl_required)
1364+
required: openssl_required and not is_windows)
1365+
# Before OpenSSL 1.1.0, there was a different naming convention for
1366+
# libraries on Windows, so try the alternatve name if crypto wasn't found
1367+
if not crypto_lib.found() and is_windows
1368+
crypto_lib = cc.find_library('libeay32',
1369+
dirs: test_lib_d,
1370+
required: openssl_required)
1371+
endif
1372+
13501373
if ssl_lib.found() and crypto_lib.found()
13511374
ssl_int = [ssl_lib, crypto_lib]
13521375
ssl = declare_dependency(dependencies: ssl_int, include_directories: postgres_inc)

0 commit comments

Comments
 (0)