build: Check for bind_textdomain_codeset() properly

Previously we weren’t checking for it in meson.build (but were checking
for it in configure.ac, courtesy of glib-gettext.m4). Roughly emulate
the checks from glib-gettext.m4, checking for bind_textdomain_codeset()
in whichever libintl implementation we found ngettext() in.

meson.build still doesn’t implement the full set and order of checks in
glib-gettext.m4; there’s still a FIXME about that in meson.build.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1313
This commit is contained in:
Philip Withnall 2018-08-29 11:59:47 +01:00
parent 7bc3edd1e5
commit 3032b5ed5b

View File

@ -903,7 +903,6 @@ glibconfig_conf.set('GLIB_USING_SYSTEM_PRINTF',
# Check for nl_langinfo and CODESET
# FIXME: Check for HAVE_BIND_TEXTDOMAIN_CODESET
if cc.links('''#include <langinfo.h>
int main (int argc, char ** argv) {
char *codeset = nl_langinfo (CODESET);
@ -1775,13 +1774,20 @@ endif
# implementations. This could be extended if issues are found in some platforms.
if cc.has_function('ngettext')
libintl = []
have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset')
else
libintl = cc.find_library('intl', required : false)
if not libintl.found()
libintl = subproject('proxy-libintl').get_variable('intl_dep')
have_bind_textdomain_codeset = true # proxy-libintl supports it
else
have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset',
dependencies : libintl)
endif
endif
glib_conf.set('HAVE_BIND_TEXTDOMAIN_CODESET', have_bind_textdomain_codeset)
# We require gettext to always be present
glib_conf.set('HAVE_DCGETTEXT', 1)
glib_conf.set('HAVE_GETTEXT', 1)