diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-03-21 22:06:22 +0530 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2017-07-13 19:03:39 -0400 |
commit | ee94ad776ef533f16c2561ea038106a8e23b1a75 (patch) | |
tree | e4c9952c452fb2aa8b2bfbb3b72010188ae4065a | |
parent | fb1f52e32fa21e0d7a3b5ac5e37afbd155ed8cee (diff) | |
download | glib-ee94ad776ef533f16c2561ea038106a8e23b1a75.tar.gz |
meson: Use proxy-libintl if gettext is not found
This is a stub-only library that can be used while building against
MSVC and contains no i18n machinery at all.
The dependencies added indirectly use the libintl.h header, and when
built as a subproject, the header won't be in a path known the
pre-processor.
-rw-r--r-- | gio/meson.build | 2 | ||||
-rw-r--r-- | gio/win32/meson.build | 1 | ||||
-rw-r--r-- | glib/meson.build | 8 | ||||
-rw-r--r-- | gobject/meson.build | 2 | ||||
-rw-r--r-- | meson.build | 25 |
5 files changed, 23 insertions, 15 deletions
diff --git a/gio/meson.build b/gio/meson.build index 1ac759782..f695f9e42 100644 --- a/gio/meson.build +++ b/gio/meson.build @@ -755,7 +755,7 @@ executable('gio', gio_tool_sources, c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args, # intl.lib is not compatible with SAFESEH link_args : noseh_link_args, - dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep]) + dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep]) executable('gresource', 'gresource-tool.c', install : true, diff --git a/gio/win32/meson.build b/gio/win32/meson.build index 8d3b165ee..3f6af82fb 100644 --- a/gio/win32/meson.build +++ b/gio/win32/meson.build @@ -10,5 +10,6 @@ giowin32_sources = [ giowin32_lib = static_library('giowin32', sources : [giowin32_sources, gioenumtypes_h], include_directories : [configinc, glibinc, gioinc, gmoduleinc], + dependencies : [libintl], pic : true, c_args : [ '-DHAVE_CONFIG_H', '-DG_DISABLE_DEPRECATED' ] + gio_c_args) diff --git a/glib/meson.build b/glib/meson.build index 3872262ab..9955e0c4c 100644 --- a/glib/meson.build +++ b/glib/meson.build @@ -233,24 +233,24 @@ if host_system == 'windows' gui_app : true, c_args : ['-DHAVE_CONFIG_H=1'], include_directories : configinc, - dependencies : [libglib_dep]) + dependencies : [libintl, libglib_dep]) executable('gspawn-win32-helper-console', 'gspawn-win32-helper.c', install : true, c_args : ['-DHAVE_CONFIG_H=1', '-DHELPER_CONSOLE'], include_directories : configinc, - dependencies : [libglib_dep]) + dependencies : [libintl, libglib_dep]) else executable('gspawn-win64-helper', 'gspawn-win32-helper.c', install : true, gui_app : true, c_args : ['-DHAVE_CONFIG_H=1'], include_directories : configinc, - dependencies : [libglib_dep]) + dependencies : [libintl, libglib_dep]) executable('gspawn-win64-helper-console', 'gspawn-win32-helper.c', install : true, c_args : ['-DHAVE_CONFIG_H=1', '-DHELPER_CONSOLE'], include_directories : configinc, - dependencies : [libglib_dep]) + dependencies : [libintl, libglib_dep]) endif else gtester = executable('gtester', 'gtester.c', diff --git a/gobject/meson.build b/gobject/meson.build index 49f707a8a..54387fe19 100644 --- a/gobject/meson.build +++ b/gobject/meson.build @@ -60,7 +60,7 @@ libgobject = shared_library('gobject-2.0', soversion : soversion, install : true, include_directories : [configinc], - dependencies : [libffi_dep, libglib_dep], + dependencies : [libintl, libffi_dep, libglib_dep], c_args : ['-DG_LOG_DOMAIN="GLib-GObject"', '-DGOBJECT_COMPILATION'] + glib_hidden_visibility_args) libgobject_dep = declare_dependency(link_with : libgobject, diff --git a/meson.build b/meson.build index c9f70f7a8..9de5715ab 100644 --- a/meson.build +++ b/meson.build @@ -115,12 +115,6 @@ if get_option('default_library') != 'static' endif endif -if run_command('xgettext', '--help').returncode() != 0 - error('GNU Gettext required currently.') -endif -glib_conf.set('HAVE_GETTEXT', 1) -glib_conf.set_quoted('GLIB_LOCALE_DIR', join_paths(glib_datadir, 'locale')) - # FIXME: what about Cygwin (G_WITH_CYGWIN) if host_system == 'windows' glib_os = '''#define G_OS_WIN32 @@ -603,8 +597,6 @@ endif # AC_FUNC_PRINTF_UNIX98 # Nothing uses HAVE_UNIX98_PRINTF -glib_conf.set('HAVE_DCGETTEXT', cc.has_header_symbol('libintl.h', 'dcgettext')) - # Check for nl_langinfo and CODESET # FIXME: Check for HAVE_BIND_TEXTDOMAIN_CODESET if cc.links('''#include <langinfo.h> @@ -1276,8 +1268,21 @@ glib_conf.set('USE_SYSTEM_PCRE', pcre.found()) libm = cc.find_library('m', required : false) libffi_dep = dependency('libffi', version : '>= 3.0.0', fallback : ['libffi', 'ffi_dep']) libz_dep = dependency('zlib', fallback : ['zlib', 'zlib_dep']) + # Only used on non-glibc targets libintl = cc.find_library('intl', required : false) +if host_system == 'windows' and not libintl.found() + # Used only when the gettext library is not available (MSVC, not MinGW) + libintl = subproject('proxy-libintl').get_variable('intl_dep') + glib_conf.set('HAVE_DCGETTEXT', 1) +else + glib_conf.set('HAVE_DCGETTEXT', cc.has_header_symbol('libintl.h', 'dcgettext')) +endif +# We require gettext to always be present +glib_conf.set('HAVE_GETTEXT', 1) +glib_conf.set_quoted('GLIB_LOCALE_DIR', join_paths(glib_datadir, 'locale')) +# xgettext is optional (on Windows for instance) +xgettext = find_program('xgettext', required : false) # libmount is only used by gio, but we need to fetch the libs to generate the # pkg-config file below @@ -1382,7 +1387,9 @@ subdir('gobject') subdir('gthread') subdir('gmodule') subdir('gio') -subdir('po') +if xgettext.found() + subdir('po') +endif # Configure and install pkg-config files pc_files = [ |