mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
meson/Windows: Check whether system PCRE is a static build
Instead of hardcoding -DPCRE_STATIC into the CFLAGS of GLib, do the following on Windows only (since PCRE_STATIC only matters on Windows): -If there is no installed PCRE, use the included PCRE copy and enable -DPCRE_STATIC, as we did before. -If there is a installed PCRE, check whether the PCRE build is a static or DLL build by checking the linkage against pcre_free() with PCRE_STATIC defined works. If it does, enable -DPCRE_STATIC. -On non-Windows builds, do not enable -DPCRE_STATIC https://bugzilla.gnome.org/show_bug.cgi?id=783270
This commit is contained in:
parent
72528938b7
commit
ea6ac5f71e
@ -213,6 +213,12 @@ else
|
||||
glib_dtrace_hdr = []
|
||||
endif
|
||||
|
||||
pcre_static_args = []
|
||||
|
||||
if use_pcre_static_flag
|
||||
pcre_static_args = ['-DPCRE_STATIC']
|
||||
endif
|
||||
|
||||
libglib = shared_library('glib-2.0',
|
||||
glib_dtrace_obj, glib_dtrace_hdr,
|
||||
sources : [deprecated_sources, glib_sources, thread_src, plat_src],
|
||||
@ -224,7 +230,7 @@ libglib = shared_library('glib-2.0',
|
||||
include_directories : configinc,
|
||||
link_with : [charset_lib, gnulib_lib],
|
||||
dependencies : [pcre, thread_dep, libintl, librt] + libiconv + platform_deps,
|
||||
c_args : ['-DG_LOG_DOMAIN="GLib"', '-DGLIB_COMPILATION', '-DPCRE_STATIC'] + glib_hidden_visibility_args
|
||||
c_args : ['-DG_LOG_DOMAIN="GLib"', '-DGLIB_COMPILATION'] + pcre_static_args + glib_hidden_visibility_args
|
||||
)
|
||||
|
||||
libglib_dep = declare_dependency(link_with : libglib,
|
||||
|
21
meson.build
21
meson.build
@ -1391,6 +1391,27 @@ else
|
||||
endif
|
||||
glib_conf.set('USE_SYSTEM_PCRE', use_system_pcre)
|
||||
|
||||
use_pcre_static_flag = false
|
||||
|
||||
if host_system == 'windows'
|
||||
if not use_system_pcre
|
||||
use_pcre_static_flag = true
|
||||
else
|
||||
pcre_static = cc.links('''#define PCRE_STATIC
|
||||
#include <pcre.h>
|
||||
int main() {
|
||||
void *p = NULL;
|
||||
pcre_free(p);
|
||||
return 0;
|
||||
}''',
|
||||
dependencies: pcre,
|
||||
name : 'Windows system PCRE is a static build')
|
||||
if pcre_static
|
||||
use_pcre_static_flag = true
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
libm = cc.find_library('m', required : false)
|
||||
libffi_dep = dependency('libffi', version : '>= 3.0.0', fallback : ['libffi', 'ffi_dep'])
|
||||
zlib_libname = '-lz'
|
||||
|
Loading…
Reference in New Issue
Block a user