From 5616bbf3528a9a6264791fd7c9a6969f136f40f3 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 2 May 2017 23:11:06 +0100 Subject: [PATCH] build: Check for linker flags on Linux We can build Epoxy with different compilers on Linux, and they may not support all the linker flags we wish to use, so we should check whether or not they exist. --- src/meson.build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/meson.build b/src/meson.build index 6f44220..3d48a4d 100644 --- a/src/meson.build +++ b/src/meson.build @@ -50,7 +50,11 @@ epoxy_sources = sources + gen_sources common_ldflags = [] if host_system == 'linux' - common_ldflags = [ '-Wl,-Bsymbolic', '-Wl,-z,relro', '-Wl,-z,now', ] + foreach f: [ '-Wl,-Bsymbolic', '-Wl,-z,relro', '-Wl,-z,now', ] + if cc.has_argument(f) + common_ldflags += f + endif + endforeach endif # Maintain compatibility with autotools; see: https://github.com/anholt/libepoxy/issues/108