Subject: gettext 0.14+ and libintl_printf issues
To: None <tech-pkg@netbsd.org>
From: None <joerg@britannica.bec.de>
List: tech-pkg
Date: 02/07/2006 19:51:57
Hi all,
as found by jlam@, some packages have issues with the new gettext in the
link stage. I'll try to explain the background and how to fix this here.
The traditional i18n approach for printf has some serious short comings,
most promient when formating dates. For English locales, it is commonly
done as
	printf("%d/%d/%d", year, month, day);
while the German location would use something like
	printf("%d.%d.%d", day, month, year);

A solution adopted by the Open Group as extension in the Single Unix
Specification is to allow positional arguments in the format string, so
that
	printf(_("%d/%d/%d"), year, month, day);
would have a translated format string for German as
	"%3$d.%2d.%1d"

This extension is implemented for example in FreeBSD, DragonFly and
Linux. Most promonient case where it is missing is NetBSD.

devel/gettext-lib detects this omission in configure and provides
wrappers for printf et al + macros in libintl.h to use this wrappers
instead of the real functions.

This broke devel/gmake's loadavg which includes libintl.h, but didn't
link loadavg to -lintl.

When finding such a build problem, there are two solutions. If the
program does not use i18n itself, e.g. doesn't use the macro _, it
should simply not include libintl.h and work fine. The other option is
to add the missing link. For gmake, jlam added the link, since it is an
internal program and that's simpler.

Joerg