[gdk-pixbuf] meson: Use convenience functions for compiler checks



commit 56245497587534d903af48619d0e7e328b5aad2f
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Apr 25 16:57:38 2018 +0100

    meson: Use convenience functions for compiler checks
    
    Avoid a bunch of array iterations.
    
    The get_supported_link_arguments() call is gated on a Meson version
    check, to avoid requiring a bleeding edge stable version.

 meson.build |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)
---
diff --git a/meson.build b/meson.build
index fe5aba5..5558c99 100644
--- a/meson.build
+++ b/meson.build
@@ -160,20 +160,16 @@ if get_option('default_library') != 'static'
   endif
 endif
 
-foreach cflag: test_cflags
-  if cc.has_argument(cflag)
-    common_cflags += cflag
-  endif
-endforeach
+common_cflags += cc.get_supported_arguments(test_cflags)
 
 # Linker flags
 if host_machine.system() == 'linux'
-  ldflag_prog = 'int main (void) { return 0; }'
-  foreach ldflag: [ '-Wl,-Bsymbolic', '-Wl,-z,relro', '-Wl,-z,now', ]
-    if cc.links(ldflag_prog, args: ldflag, name: 'using @0@'.format(ldflag))
-      common_ldflags += ldflag
-    endif
-  endforeach
+  test_ldflags = ['-Wl,-Bsymbolic', '-Wl,-z,relro', '-Wl,-z,now']
+  if meson.version().version_compare('>= 0.46.0')
+    common_ldflags += cc.get_supported_link_arguments(test_ldflags)
+  else
+    common_ldflags += test_ldflags
+  endif
 endif
 
 # Maintain compatibility with autotools on macOS


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]