From bfd307855bd21108c98d72bf4d85a6c632396cde Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 21 Jul 2017 14:03:05 +0100 Subject: [PATCH] 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 6df7b11c6..acdb27c20 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 eacdfff79..93641021e 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 f70d54a43..1811e8bbc 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')