From: Ting-Wei Lan Date: Sun, 22 Apr 2018 13:42:03 +0000 (+0800) Subject: build: Use cc.links to check linker arguments X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1^2~18^2~22^2~418^2~3 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ff1dd5009c4c8367975662393988b5fc5d7f03e6;p=gtk4.git 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. --- 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