summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTing-Wei Lan <lantw@src.gnome.org>2018-04-22 21:42:03 +0800
committerTing-Wei Lan <lantw@src.gnome.org>2018-04-22 21:57:10 +0800
commitff1dd5009c4c8367975662393988b5fc5d7f03e6 (patch)
tree43518a27fbdfc5e9239ef851c6e29b7f65372422
parentf922109a9c684d1fb852b041eccbeb4781b7039a (diff)
downloadgtk+-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.
-rw-r--r--meson.build8
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