* if we don't have uselocale, opt out all functions / structs related to it.
* if LDFLAGS have: -lgettextlib -lgettextpo -lgettextsrc -liconv -lintl this detection seems to work
[ --disable-nls do not use Native Language Support],
ok_nls=no, ok_nls=yes)
-if test "$ok_nls" != "no"; then
- AC_MSG_RESULT(Checking for per-thread NLS support...)
- AC_TRY_RUN([
- #define _GNU_SOURCE
- #include <libintl.h>
- #include <locale.h>
- #include <time.h>
- main() {
- char *foo = NULL;
- char baz[32];
- struct tm *tm;
- uselocale(LC_GLOBAL_LOCALE);
- foo = gettext("bar");
- if (0) {
- strftime_l(baz, sizeof baz, "%c", tm, LC_GLOBAL_LOCALE);
- }
- exit(0);
- }
- ],
- ok_uselocale=yes,
- ok_uselocale=no
- )
- ok_nls=$ok_uselocale
-fi
+dnl if test "$ok_nls" != "no"; then
+dnl AC_MSG_RESULT(Checking for per-thread NLS support...)
+dnl AC_TRY_RUN([
+dnl #define _GNU_SOURCE
+dnl #include <libintl.h>
+dnl #include <locale.h>
+dnl #include <time.h>
+dnl main() {
+dnl char *foo = NULL;
+dnl char baz[32];
+dnl struct tm *tm;
+dnl uselocale(LC_GLOBAL_LOCALE);
+dnl foo = gettext("bar");
+dnl if (0) {
+dnl strftime_l(baz, sizeof baz, "%c", tm, LC_GLOBAL_LOCALE);
+dnl }
+dnl exit(0);
+dnl }
+dnl ],
+dnl ok_uselocale=yes,
+dnl ok_uselocale=no
+dnl )
+dnl ok_nls=$ok_uselocale
+dnl fi
if test "$ok_nls" != "no"; then
AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
*/
size_t wc_strftime(char *s, size_t max, const char *format, const struct tm *tm)
{
-#ifdef ENABLE_NLS
+
+#ifdef HAVE_USELOCALE
if (wc_locales[WC->selected_language] == NULL) {
return strftime(s, max, format, tm);
}
"nl_NL"
};
+#ifdef HAVE_USELOCALE
locale_t wc_locales[NUM_LANGS]; /**< here we keep the parsed stuff */
+#endif
/** Keep information about one locale */
typedef struct _lang_pref{
*/
void initialize_locales(void) {
int i;
- locale_t Empty_Locale;
char buf[32];
+#ifdef HAVE_USELOCALE
+ locale_t Empty_Locale;
+
/* create default locale */
Empty_Locale = newlocale(LC_ALL_MASK, NULL, NULL);
+#endif
for (i = 0; i < NUM_LANGS; ++i) {
if (i == 0) {
else {
sprintf(buf, "%s.UTF8", AvailLang[i]);
}
+#ifdef HAVE_USELOCALE
wc_locales[i] = newlocale(
(LC_MESSAGES_MASK|LC_TIME_MASK),
buf,
else {
lprintf(3, "Configured available locale: %s\n", buf);
}
+#endif
}
}
#ifdef ENABLE_NLS
#include <libintl.h>
#include <locale.h>
+#ifdef HAVE_USELOCALE
extern locale_t wc_locales[];
+#endif
#define _(string) gettext(string)
#else
#define _(string) (string)