build: Test linker flags before using them
The linker flags we use are tied to Linux, not to GCC. This also means
that we need to test them for availability, in case we're building on
Linux with a compiler that does not support them.
@@ -91,10 +91,15 @@ if build_gobject
platform_deps += [ gobject ]
endif
-if cc.get_id() == 'gcc'
- graphene_link_args = [ '-Wl,-Bsymbolic-functions', '-Wl,-z,relro', '-Wl,-z,now', ]
-else
graphene_link_args = []
+
+# Add linker flags for Linux
+if host_machine.system().contains('linux')
+ foreach ldflag: [ '-Wl,-Bsymbolic-functions', '-Wl,-z,relro', '-Wl,-z,now', ]
+ if cc.has_argument(ldflag)
+ graphene_link_args += [ ldflag, ]
+ endif
+ endforeach
endif
libtype = get_option('default_library')
