[glib] meson: Allow toggling internal/system PCRE dependency



commit bfd307855bd21108c98d72bf4d85a6c632396cde
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Fri Jul 21 14:03:05 2017 +0100

    meson: Allow toggling internal/system PCRE dependency
    
    We don't always want to build GLib with a dependency on the system's
    PCRE. The Autotools build allows this, and so should the Meson build.

 glib/meson.build  |    2 +-
 meson.build       |   12 +++++++++---
 meson_options.txt |    1 +
 3 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/glib/meson.build b/glib/meson.build
index 6df7b11..acdb27c 100644
--- a/glib/meson.build
+++ b/glib/meson.build
@@ -4,7 +4,7 @@ configure_file(input : 'glibconfig.h.in', output : 'glibconfig.h',
   configuration : glibconfig_conf)
 
 subdir('libcharset')
-if not pcre.found()
+if not use_system_pcre
   subdir('pcre')
 endif
 
diff --git a/meson.build b/meson.build
index eacdfff..9364102 100644
--- a/meson.build
+++ b/meson.build
@@ -1339,8 +1339,14 @@ else
   error('No iconv() implementation found in C library or libiconv')
 endif
 
-pcre = dependency('libpcre', required : false) # Should check for Unicode support, too. FIXME
-glib_conf.set('USE_SYSTEM_PCRE', pcre.found())
+if get_option('with-pcre') == 'internal'
+  pcre = []
+  use_system_pcre = false
+else
+  pcre = dependency('libpcre', required : false) # Should check for Unicode support, too. FIXME
+  use_system_pcre = pcre.found()
+endif
+glib_conf.set('USE_SYSTEM_PCRE', use_system_pcre)
 
 libm = cc.find_library('m', required : false)
 libffi_dep = dependency('libffi', version : '>= 3.0.0', fallback : ['libffi', 'ffi_dep'])
@@ -1401,7 +1407,7 @@ endif
 if libiconv.length() != 0
   glib_conf.set('ICONV_LIBS', '-liconv')
 endif
-if pcre.found()
+if use_system_pcre
   glib_conf.set('PCRE_LIBS', '-lpcre')
 endif
 if libmount_dep.length() == 1 and libmount_dep[0].found()
diff --git a/meson_options.txt b/meson_options.txt
index f70d54a..1811e8b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,5 +1,6 @@
 option('with-docs', type : 'combo', choices : ['auto', 'yes', 'no'], value : 'auto')
 option('with-man', type : 'combo', choices : ['auto', 'yes', 'no'], value : 'auto')
+option('with-pcre', type : 'combo', choices : ['system', 'internal'], value : 'system')
 option('enable-libmount', type : 'combo', choices : ['auto', 'yes', 'no'], value : 'yes')
 option('enable-dtrace', type : 'boolean', value : false,
   description : 'include tracing support for dtrace')


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