[network-manager-applet/lr/meson-fixes: 3/4] meson: check for -Wl, --gc-sections linker flag properly



commit 8a4055644fdced736e870c8763e9c09f966d9071
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Fri Feb 15 17:37:35 2019 +0100

    meson: check for -Wl,--gc-sections linker flag properly
    
      WARNING: -Wl,--gc-sections looks like a linker argument, but
      has_argument and other similar methods only support checking compiler
      arguments. Using them to check linker arguments are never supported, and
      results are likely to be wrong regardless of the compiler you are using.
      has_link_argument or other similar method can be used instead.
    
    Requires newer meson. Sigh...

 meson.build | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/meson.build b/meson.build
index 8ba41792..7456a9a6 100644
--- a/meson.build
+++ b/meson.build
@@ -6,7 +6,7 @@ project(
     'buildtype=debugoptimized',
     'c_std=gnu99'
   ],
-  meson_version: '>= 0.43.0'
+  meson_version: '>= 0.46.0'
 )
 
 nma_name = 'nm-applet'
@@ -70,9 +70,8 @@ if enable_ld_gc
 
   test_ldflags = ['-Wl,--gc-sections']
 
-  foreach cflag: test_cflags + test_ldflags
-    assert(cc.has_argument(cflag), 'Unused symbol eviction requested but not supported. Use -Dld_gc=false to 
build without it.')
-  endforeach
+  assert(cc.has_multi_arguments(test_cflags), 'Unused symbol eviction requested but not supported. Use 
-Dld_gc=false to build without it.')
+  assert(cc.has_multi_link_arguments(test_ldflags), 'Unused symbol eviction requested but not supported. Use 
-Dld_gc=false to build without it.')
 
   common_flags += test_cflags
   common_ldflags += test_ldflags


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