[glib: 1/3] Meson: Always fallback to proxy-libintl subproject



commit 5d0a99105d0f1972b05410d1388ec942bceaf483
Author: Xavier Claessens <xavier claessens collabora com>
Date:   Sun May 20 00:08:19 2018 -0400

    Meson: Always fallback to proxy-libintl subproject
    
    An implementation of gettext is required, but it's not always needed
    e.g. for CI builds.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=796264

 meson.build | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/meson.build b/meson.build
index d25dff3f2..ab2fcc8e5 100644
--- a/meson.build
+++ b/meson.build
@@ -1687,17 +1687,23 @@ else
   endif
 endif
 
-# 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)
+# First check in libc, fallback to libintl, and as last chance build
+# proxy-libintl subproject.
+# FIXME: glib-gettext.m4 has much more checks to detect broken/uncompatible
+# implementations. This could be extended if issues are found in some platforms.
+if cc.has_function('ngettext')
+  libintl = []
 else
-  glib_conf.set('HAVE_DCGETTEXT', cc.has_header_symbol('libintl.h', 'dcgettext'))
+  libintl = cc.find_library('intl', required : false)
+  if not libintl.found()
+    libintl = subproject('proxy-libintl').get_variable('intl_dep')
+  endif
 endif
+
 # We require gettext to always be present
+glib_conf.set('HAVE_DCGETTEXT', 1)
 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)


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