From 5035f6076a4d883da9b871b8286e298c2e7c7ebd Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 24 Sep 2023 20:46:59 +0300 Subject: [PATCH 46/46] Meson: Add bz2 compression support See osdn #48724 Signed-off-by: Marko Lindqvist --- gen_headers/meson_fc_config.h.in | 3 +++ gen_headers/meson_freeciv_config.h.in | 3 +++ meson.build | 15 ++++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/gen_headers/meson_fc_config.h.in b/gen_headers/meson_fc_config.h.in index 98b5544162..1200aa4973 100644 --- a/gen_headers/meson_fc_config.h.in +++ b/gen_headers/meson_fc_config.h.in @@ -258,6 +258,9 @@ /* bind() available */ #mesondefine HAVE_BIND +/* header available */ +#mesondefine HAVE_BZLIB_H + /* clock_gettime() available */ #mesondefine HAVE_CLOCK_GETTIME diff --git a/gen_headers/meson_freeciv_config.h.in b/gen_headers/meson_freeciv_config.h.in index 87e612ea5f..2a88782f50 100644 --- a/gen_headers/meson_freeciv_config.h.in +++ b/gen_headers/meson_freeciv_config.h.in @@ -142,6 +142,9 @@ /* zlib is available */ #mesondefine FREECIV_HAVE_LIBZ +/* libbzip2 is available */ +#mesondefine FREECIV_HAVE_LIBBZ2 + /* liblzma is available */ #mesondefine FREECIV_HAVE_LIBLZMA diff --git a/meson.build b/meson.build index ee8907515f..775ed62ee8 100644 --- a/meson.build +++ b/meson.build @@ -531,6 +531,19 @@ else readline_dep = [] endif +if c_compiler.has_header('bzlib.h', args: header_arg) + priv_conf_data.set('HAVE_BZLIB_H', 1) + + bz2_dep = c_compiler.find_library('bz2', dirs: cross_lib_path, + required:false) + + if bz2_dep.found() + pub_conf_data.set('FREECIV_HAVE_LIBBZ2', 1) + endif +else + bz2_dep = [] +endif + if c_compiler.has_header('lzma.h', args: header_arg) priv_conf_data.set('HAVE_LZMA_H', 1) @@ -1268,7 +1281,7 @@ common_lib = library('freeciv', link_whole: fc_deps, dependencies: [zlib_dep, curl_dep, m_dep, sqlite3_dep, icu_dep, - net_dep, jansson_dep, lua_dep, lzma_dep, zstd_dep, + net_dep, jansson_dep, lua_dep, bz2_dep, lzma_dep, zstd_dep, bcrypt_lib_dep, iconv_lib_dep, gettext_dep, charset_dep, mw_dep, dependency('threads')], -- 2.40.1