GNOME Bugzilla – Bug 70627
AM_GLIB_GNU_GETTEXT / older libc problem
Last modified: 2011-02-18 15:55:24 UTC
On systems with an old libc or non gnu libc, libc does not provide all the library functions needed by gnome2 applications. The solution is to install a sufficiently new gettext, and link to its library (libintl?). However , AM_GLIB_GNU_GETTEXT does not support this. I use Red Hat Linux 6.2, which comes with an old gettext. I build the gnome2 version of gnumeric, which calls bind_textdomain_codeset. I've built a gettext 0.10.40 rpm from source, tweaking the spec file to build libintl.so, and installed it. gnumeric builds if I manually add '-lintl' to the link line. But when I autogen.sh using AM_GLIB_GNU_GETTEXT in configure.in, '-lintl' is omitted, and the build fails. Solaris users have experienced the same problem. The problem seems to be that when the AM_GLIB_GNU_GETTEXT macro finds bindtextdomain in libc, it falsely concludes that all is well. It should also test for bind_textdomain_codeset, and try linking with libintl if that fails with libc. Variations are possible, e.g. a parameter to tell whether bind_textdomain_codeset is needed, or two versions of the macro.
I would suggest that gnumeric should use UTF-8 .po files and not require bind_textdomain_codeset().(Though you need to call it if it is present.) This is what GTK+ does. I suspect that linking to a libintl when libc has gettext() as well will have some unpredictable side effects and wouldn't recommend it. (If you really disagree, reopen and I'll put adding an option to the macro on the future milestone as a feature request. We aren't going to get to it for 2.0.09 in any case.)
*** Bug 72034 has been marked as a duplicate of this bug. ***
*** Bug 70480 has been marked as a duplicate of this bug. ***
*** Bug 69965 has been marked as a duplicate of this bug. ***
*** Bug 73413 has been marked as a duplicate of this bug. ***
laszlo, which gettext are you doing builds with?
Reopening, marking gnome2, all OSs. Owen, this problem is real and spreading. Please don't just WONTFIX because your Linux box does not show it. Currently, gnome-vfs and gnome-print and everything using that will not link on Solaris without hacking in the form of Makefile-editing or LDFLAGS tricks. Can we have something like AC_CHECK_FUNC(bind_textdomain_codeset,,[AC_CHECK_LIB(intl,bind_textdomain_codeset)]) please?
It's not WONTFIX'ed because it doesn't happen on Linux, it's WONTFIX'ed because the GLib and GTK+ solution to UTF-8 translations doesn't require bind_textdomain_codeset().
Like I said, it's spreading. On Solaris you will not even get to try to compile gnumeric any more. Things will fail in gnome-vfs or gnome-print. See bug 78434 and bug 80577. Note, that when you go ahead and add -lintl to (say) gnome-vfs, then the final program will have bind_textdomain_codeset, but glib will not call it. If I read your 2002-02-05 15:25 comment right, then that is not desireable. So what is wrong with actually looking for bind_textdomain_codeset in -lintl? This is what I do and this is what sander and gman do. > I suspect that linking to a libintl when libc has gettext() as > well will have some unpredictable side effects and wouldn't > recommend it. I don't understand this fear. If it was well founded, -lintl could never be used on Solaris. Yet it seems to work just fine for lots of people. It's not quite the same scale as overriding malloc and other fancy things people do regularly.
it's not just gman and sander, it's the builds sun (and ximian) are using to test gnome 2 on solaris, and will probably be what sun will ship.
bind_textdomain_codeset (domain_name, "UTF-8") is needed even when .po and .mo file for the locale are encoded in UTF-8. From http://www.gnu.org/manual/glibc-2.2.3/html_node/libc_126.html, "The output character set (gettext returns) is, by default, the value of nl_langinfo (CODESET):.." "programs which store strings in a locale independent way (e.g. UTF-8) can request that gettext and related functions return the translations in that encoding, by use of the bind_textdomain_codeset function. " So, I think calling bind_textdomain_codeset(domainname, "UTF-8") is needed in all GNOME2 modules, including glib abd gtk+, in order to keep gettext from doing unexpected code conversion from UTF-8 to the locale text, but always returns "UTF-8".
Testing much appreciated: Wed Dec 11 14:28:50 2002 Owen Taylor <otaylor@redhat.com> * m4macros/glib-gettext.m4: Major rewrite; remove leftovers from building intl/, prefer libintl if both libc and libintl have dgettext and libintl also has bind_textdomain_codeset(). (#70627)