diff options
author | Ting-Wei Lan <lantw@src.gnome.org> | 2018-04-22 21:42:03 +0800 |
---|---|---|
committer | Ting-Wei Lan <lantw@src.gnome.org> | 2018-04-22 21:57:10 +0800 |
commit | ff1dd5009c4c8367975662393988b5fc5d7f03e6 (patch) | |
tree | 43518a27fbdfc5e9239ef851c6e29b7f65372422 /meson.build | |
parent | f922109a9c684d1fb852b041eccbeb4781b7039a (diff) | |
download | gtk+-ff1dd5009c4c8367975662393988b5fc5d7f03e6.tar.gz |
build: Use cc.links to check linker arguments
Instead of hard-coding linker flags for a specific operating system and
a specific compiler, we can should cc.links to test them, so they can be
used on more operating systems and compilers.
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/meson.build b/meson.build index cdd83e7635..895cef9fc0 100644 --- a/meson.build +++ b/meson.build @@ -284,8 +284,12 @@ endif common_ldflags = [] -if host_machine.system() == 'linux' and cc.get_id() == 'gcc' - common_ldflags += [ '-Wl,-Bsymbolic', '-Wl,-z,relro', '-Wl,-z,now', ] +if os_unix and not os_darwin + foreach ldflag: [ '-Wl,-Bsymbolic', '-Wl,-z,relro', '-Wl,-z,now', ] + if cc.links('int main () { return 0; }', name: ldflag, args: ldflag) + common_ldflags += [ ldflag ] + endif + endforeach endif # Maintain compatibility with autotools |