From b39b5151b937c4d36ff293b62cee988378245fac Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Tue, 20 Dec 2016 19:57:05 +0100 Subject: add stub implementation for libintl/gettext These adds the stubs from gettext-tiny 0.0.5 from here: https://github.com/sabotage-linux/gettext-tiny --- include/libintl.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 include/libintl.h (limited to 'include') diff --git a/include/libintl.h b/include/libintl.h new file mode 100644 index 000000000..b7123a963 --- /dev/null +++ b/include/libintl.h @@ -0,0 +1,61 @@ +#ifndef LIBINTL_H +#define LIBINTL_H + +char *gettext(const char *msgid); +char *dgettext(const char *domainname, const char *msgid); +char *dcgettext(const char *domainname, const char *msgid, int category); +char *ngettext(const char *msgid1, const char *msgid2, unsigned long n); +char *dngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long n); +char *dcngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long n, int category); + +char *textdomain(const char *domainname); +char *bind_textdomain_codeset(const char *domainname, const char *codeset); +char *bindtextdomain(const char *domainname, const char *dirname); + +#undef gettext_noop +#define gettext_noop(X) X + +#ifndef LIBINTL_NO_MACROS +/* if these macros are defined, configure checks will detect libintl as + * built into the libc because test programs will work without -lintl. + * for example: + * checking for ngettext in libc ... yes + * the consequence is that -lintl will not be added to the LDFLAGS. + * so if for some reason you want that libintl.a gets linked, + * add -DLIBINTL_NO_MACROS=1 to your CPPFLAGS. */ + +#define gettext(X) ((char*) (X)) +#define dgettext(dom, X) ((void)(dom), (char*) (X)) +#define dcgettext(dom, X, cat) ((void)(dom), (void)(cat), (char*) (X)) +#define ngettext(X, Y, N) \ + ((char*) (((N) == 1) ? ((void)(Y), (X)) : ((void)(X), (Y)))) +#define dngettext(dom, X, Y, N) \ + ((dom), (char*) (((N) == 1) ? ((void)(Y), (X)) : ((void)(X), (Y)))) +#define dcngettext(dom, X, Y, N, cat) \ + ((dom), (cat), (char*) (((N) == 1) ? ((void)(Y), (X)) : ((void)(X), (Y)))) +#define bindtextdomain(X, Y) ((void)(X), (void)(Y), (char*) "/") +#define bind_textdomain_codeset(dom, codeset) \ + ((void)(dom), (void)(codeset), (char*) 0) +#define textdomain(X) ((void)(X), (char*) "messages") + +#undef ENABLE_NLS +#undef DISABLE_NLS +#define DISABLE_NLS 1 + +#if __GNUC__ +0 > 3 +/* most ppl call bindtextdomain() without using its return value + thus we get tons of warnings about "statement with no effect" */ +#pragma GCC diagnostic ignored "-Wunused-value" +#endif + +#endif + +#include +#define gettext_printf(args...) printf(args) + +/* to supply LC_MESSAGES and other stuff GNU expects to be exported when + including libintl.h */ +#include + +#endif + -- cgit v1.2.3