diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2020-04-09 17:47:17 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2020-06-24 17:55:38 +0800 |
commit | e78eb13bcb17ff9b289047a1b696033a1f0c454f (patch) | |
tree | 51c92ef1bda8ad767e1bef23272e1140e0c63024 | |
parent | d84ddda9106ca78c815a91aa9e9524533245373f (diff) | |
download | atk-e78eb13bcb17ff9b289047a1b696033a1f0c454f.tar.gz |
build: Improve bind_textdomain_codeset() checkimprove-bind_textdomain_codeset-check
The bind_textdomain_codeset() function may not be present in the CRT,
but in a separate libintl (gettext-runtime) library, or loaded via
proxy-intl (noted as "libintl" below).
Based on the way it is done in GLib: this looks for the ngettext()
function from the CRT, and if it is not found, we want to look into
libintl to check for the presence of this function.
Note that since GLib links to libintl if gettext-runtime functions are
not found in the CRT and does so in its pkg-config file, we do not
explicitly link to it here when building libatk.
-rw-r--r-- | meson.build | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/meson.build b/meson.build index 59d22e2..934a3ab 100644 --- a/meson.build +++ b/meson.build @@ -81,13 +81,21 @@ if host_machine.system() == 'darwin' common_ldflags += [ '-compatibility_version', darwin_versions[0], '-current_version', darwin_versions[1]] endif +# The gettext functions may not be necessarily +# included in the CRT, so look for libintl +# if that is the case +intl_dep = [] +if not cc.has_function('ngettext') + intl_dep = cc.find_library('intl', required: false) +endif + # Functions checked_funcs = [ 'bind_textdomain_codeset', ] foreach f: checked_funcs - if cc.has_function(f) + if cc.has_function(f, dependencies: intl_dep) atk_conf.set('HAVE_' + f.underscorify().to_upper(), 1) endif endforeach |