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)