meson: Fix the check for --version-script support

At the time we do this check, version_script has not yet been generated,
so we have to use something else.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2022-06-28 13:06:35 +01:00
parent 154cc9d5ca
commit 64e490afe7
3 changed files with 21 additions and 3 deletions

View file

@ -330,6 +330,7 @@ endif
noinst_PROGRAMS =
EXTRA_DIST += meson.build
EXTRA_DIST += test-version-script
# Add rules for code-coverage testing, as defined by AX_CODE_COVERAGE
include $(top_srcdir)/aminclude_static.am

View file

@ -172,9 +172,16 @@ version_script = configure_file(
configuration: data_config,
)
version_flags = '-Wl,--version-script,@0@'.format(version_script)
if not cc.has_link_argument(version_flags)
version_flags = []
# We can't use version_script to check for support, because it hasn't been
# generated yet, so use a static source file instead.
if cc.has_link_argument(
'-Wl,--version-script,@0@'.format(
meson.current_source_dir() / 'test-version-script'
)
)
version_flags = ['-Wl,--version-script,@0@'.format(version_script)]
else
version_flags = []
endif
libdbus = library('dbus-1',

10
dbus/test-version-script Normal file
View file

@ -0,0 +1,10 @@
NOT_REALLY_LIBDBUS_1_3 {
global:
dbus_*;
local:
*;
};
NOT_REALLY_LIBDBUS_PRIVATE_1.2.3 {
global:
_dbus_*;
};