[libsoup] Fix xml2 and sqlite fallbacks



commit 9ab923ac20e9695050a58b3f22607da0375824a5
Author: Xavier Claessens <xavier claessens collabora com>
Date:   Mon Jun 3 15:44:18 2019 -0400

    Fix xml2 and sqlite fallbacks
    
    We should try find_library() before fallback to subproject, for
    platforms that does not ship the .pc file.
    
    Also the return value of cc.has_header() is currently not used, those
    statements have no effect. Fix this by using has_headers kwarg of
    find_library(), a new syntax from Meson 0.50.0. We want to find the
    library AND its headers, or fallback to subproject.

 meson.build | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/meson.build b/meson.build
index 8024d405..aae5c0bd 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
 project('libsoup', 'c',
         version: '2.67.1',
-        meson_version : '>=0.48',
+        meson_version : '>=0.50',
         license : 'LGPL2',
         default_options : 'c_std=c89')
 
@@ -77,26 +77,33 @@ gio_dep = dependency('gio-2.0', version : glib_required_version,
 
 glib_deps = [glib_dep, gobject_dep, gio_dep]
 
-sqlite_dep = dependency('sqlite3', required: false,
-                        fallback: ['sqlite', 'sqlite_dep'])
+sqlite_dep = dependency('sqlite3', required: false)
 
 # Fallback check for sqlite, not all platforms ship pkg-config file
 if not sqlite_dep.found()
-  cc.has_header('sqlite3.h')
-  cc.has_header('sqlite3ext.h')
-  sqlite_dep = cc.find_library('sqlite3')
+  sqlite_dep = cc.find_library('sqlite3',
+    has_headers : ['sqlite3.h', 'sqlite3ext.h'],
+    required: false)
 endif
 
-libxml_dep = dependency('libxml-2.0', required: false,
-                        fallback: ['libxml2', 'xml2lib_dep'])
+if not sqlite_dep.found()
+  sqlite_dep = subproject('sqlite').get_variable('sqlite_dep')
+endif
+
+libxml_dep = dependency('libxml-2.0', required: false)
 
 # Fallback check for libxml2, not all platforms ship pkg-config file
 if not libxml_dep.found()
   # Note: The XML include dir needs to be within the INCLUDE envvar,
   # such as <INCLUDEDIR>\libxml2
-  cc.has_header('libxml/tree.h')
   libxml2_libname = cc.get_id() == 'msvc' ? 'libxml2' : 'xml2'
-  libxml_dep = cc.find_library(libxml2_libname)
+  libxml_dep = cc.find_library(libxml2_libname,
+    has_headers : 'libxml/tree.h',
+    required: false)
+endif
+
+if not libxml_dep.found()
+  libxml_dep = subproject('libxml2').get_variable('xml2lib_dep')
 endif
 
 cdata = configuration_data()


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