[gvfs/wip/oholy/meson-version] build: Take advantage of has_function argument



commit 1c9e26a1004ec616968cf837c2f72e92abdab9f8
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Thu Apr 4 15:20:08 2019 +0200

    build: Take advantage of has_function argument
    
    Since meson 0.50.0, the `find_library` method can be used to verify
    if the library's headers or functions are present[0].
    
    The `has_function` argument has been used to check the `socketpair`
    function in the `socket` library.
    
    [0] http://mesonbuild.com/Release-notes-for-0-50-0.html#find-library-with-its-headers

 meson.build | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/meson.build b/meson.build
index a29b21db..dae1522c 100644
--- a/meson.build
+++ b/meson.build
@@ -65,14 +65,14 @@ have_socketpair = cc.has_function('socketpair')
 socket_deps = []
 
 if not have_socketpair
-  socket_dep = cc.find_library('socket', required: false)
-  have_socketpair = socket_dep.found() and cc.has_function('socketpair', dependencies: socket_dep)
-
-  if have_socketpair
-    socket_deps += socket_dep
-  endif
+  socket_dep = cc.find_library(
+    'socket',
+    has_function: 'socketpair',
+    required: false,
+  )
+  socket_deps += socket_dep
+  have_socketpair = socket_dep.found()
 endif
-
 config_h.set('HAVE_SOCKETPAIR', have_socketpair,
              description: 'Define if you have the socketpair function.')
 


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