[gssdp] build: Simplify if_nametoindex test a bit
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [gssdp] build: Simplify if_nametoindex test a bit
- Date: Thu, 29 Nov 2018 11:11:12 +0000 (UTC)
commit 2cafc98a713ab73fd6a9bf251155b43be006b6e1
Author: Jens Georg <mail jensge org>
Date:   Thu Nov 29 12:01:58 2018 +0100
    build: Simplify if_nametoindex test a bit
    
    Using Meson's compiler.has_function test
 meson.build | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
---
diff --git a/meson.build b/meson.build
index 8d6a90d..f24540a 100644
--- a/meson.build
+++ b/meson.build
@@ -22,17 +22,10 @@ pktinfo_available = cc.compiles(pktinfo_test,
 conf.set('HAVE_PKTINFO', pktinfo_available)
 
 # Check for if_nametoindex
-if_nametoindex_test = '''#include <net/if.h>
-int main(int argc, char *argv[]) {
-  (void) argc;
-  (void) argv;
-  if_nametoindex("lo");
-  return 0;
-}
-'''
-
-ifnametoindex_available = cc.compiles(if_nametoindex_test,
-                                      name : 'if_nametoindex is available')
+ifnametoindex_available = cc.has_function(
+    'if_nametoindex',
+    prefix : '#include <net/if.h>'
+)
 conf.set('HAVE_IFNAMETOINDEX', ifnametoindex_available)
 
 # Check for SIOCGIFINDEX
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]