From 7a6397d2b35b6c1c6f0b833366d0659f4df85322 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 15 May 2018 20:18:24 +0900 Subject: [PATCH] meson: use has_link_argument() and friends This bumps the minimum required version of meson to 0.46, as `has_link_argument()` and friends are supported since 0.46. --- README | 2 +- meson.build | 23 +++-------------------- tools/meson-link-test.c | 1 - 3 files changed, 4 insertions(+), 22 deletions(-) delete mode 100644 tools/meson-link-test.c diff --git a/README b/README index 25e1631c0f..6801d0dc2d 100644 --- a/README +++ b/README @@ -162,7 +162,7 @@ REQUIREMENTS: docbook-xsl (optional, required for documentation) xsltproc (optional, required for documentation) python-lxml (optional, required to build the indices) - python >= 3.5, meson >= 0.45, ninja + python >= 3.5, meson >= 0.46, ninja gcc, awk, sed, grep, m4, and similar tools During runtime, you need the following additional diff --git a/meson.build b/meson.build index 26ef5b925d..437c71a3b2 100644 --- a/meson.build +++ b/meson.build @@ -9,7 +9,7 @@ project('systemd', 'c', 'sysconfdir=/etc', 'localstatedir=/var', ], - meson_version : '>= 0.45', + meson_version : '>= 0.46', ) libsystemd_version = '0.23.0' @@ -362,6 +362,7 @@ if get_option('buildtype') != 'debug' endif add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c') +add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c') # "negative" arguments: gcc on purpose does not return an error for "-Wno-" # arguments, just emits a warning. So test for the "positive" version instead. @@ -389,18 +390,6 @@ if cc.compiles(''' add_project_arguments('-Werror=shadow', language : 'c') endif -link_test_c = files('tools/meson-link-test.c') - -foreach arg : possible_link_flags - have = run_command(check_compilation_sh, - cc.cmd_array(), '-x', 'c', arg, - '-include', link_test_c).returncode() == 0 - message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no')) - if have - add_project_link_arguments(arg, language : 'c') - endif -endforeach - cpp = ' '.join(cc.cmd_array()) + ' -E' ##################################################################### @@ -2766,13 +2755,7 @@ foreach tuple : sanitizers sanitizer = tuple[0] build = tuple[1] - have = run_command(check_compilation_sh, - cc.cmd_array(), '-x', 'c', - '-fsanitize=@0@'.format(sanitizer), - '-include', link_test_c).returncode() == 0 - message('@0@ sanitizer supported: @1@'.format(sanitizer, have ? 'yes' : 'no')) - - if have + if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer)) prev = '' foreach p : fuzz_regression_tests b = p.split('/')[-2] diff --git a/tools/meson-link-test.c b/tools/meson-link-test.c deleted file mode 100644 index 825bbff05f..0000000000 --- a/tools/meson-link-test.c +++ /dev/null @@ -1 +0,0 @@ -int main(void) {return 0;}