[atk/improve-bind_textdomain_codeset-check: 9/9] build: Improve bind_textdomain_codeset() check



commit e78eb13bcb17ff9b289047a1b696033a1f0c454f
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Thu Apr 9 17:47:17 2020 +0800

    build: Improve 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.

 meson.build | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
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


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