From 90949386cd1a5f50a541edc048723f0f7f79e503 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 20 Apr 2021 19:25:10 +0300 Subject: [PATCH 43/43] Meson: Add BCryptGenRandom() support See osdn #42040 Signed-off-by: Marko Lindqvist --- gen_headers/meson_fc_config.h.in | 8 ++++++++ meson.build | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gen_headers/meson_fc_config.h.in b/gen_headers/meson_fc_config.h.in index c03e65331a..a24c782e9a 100644 --- a/gen_headers/meson_fc_config.h.in +++ b/gen_headers/meson_fc_config.h.in @@ -69,6 +69,9 @@ /* arpa/inet.h available */ #mesondefine HAVE_ARPA_INET_H +/* bcrypt.h available */ +#mesondefine HAVE_BCRYPT_H + /* bzlib.h available */ #mesondefine HAVE_BZLIB_H @@ -244,6 +247,11 @@ /* getentropy() available */ #mesondefine HAVE_GETENTROPY +#ifdef HAVE_BCRYPT_H +/* BCryptGenRandom() available */ +#mesondefine HAVE_BCRYPTGENRANDOM +#endif + /* gethostbyname() available */ #mesondefine HAVE_GETHOSTBYNAME diff --git a/meson.build b/meson.build index cc33deaf5e..bff32483cb 100644 --- a/meson.build +++ b/meson.build @@ -69,6 +69,7 @@ pub_headers = [ priv_headers = [ 'arpa/inet.h', + 'bcrypt.h', 'bzlib.h', 'direct.h', 'dlfcn.h', @@ -168,6 +169,13 @@ foreach func : priv_functions endif endforeach +if c_compiler.has_function('BCryptGenRandom', args: '-lbcrypt') + bcrypt_lib_dep = c_compiler.find_library('bcrypt') + priv_conf_data.set('HAVE_BCRYPTGENRANDOM', 1) +else + bcrypt_lib_dep = [] +endif + readline_dep = c_compiler.find_library('readline', required:false) if readline_dep.found() @@ -543,7 +551,8 @@ common_lib = library('freeciv', c_compiler.find_library('z', dirs: cross_lib_path), c_compiler.find_library('libcurl', dirs: cross_lib_path), c_compiler.find_library('libsqlite3', dirs: cross_lib_path), - ws2_dep, jansson_dep, lua_dep, lzma_dep, dependency('threads')], + ws2_dep, jansson_dep, lua_dep, lzma_dep, bcrypt_lib_dep, + dependency('threads')], install : true ) -- 2.30.2