summaryrefslogtreecommitdiff
path: root/libjava/java/lang/natSystem.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/lang/natSystem.cc')
-rw-r--r--libjava/java/lang/natSystem.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/libjava/java/lang/natSystem.cc b/libjava/java/lang/natSystem.cc
index 8f06538d396..e4c328c443c 100644
--- a/libjava/java/lang/natSystem.cc
+++ b/libjava/java/lang/natSystem.cc
@@ -414,11 +414,12 @@ java::lang::System::init_properties (void)
#endif /* HAVE_GETCWD */
// Set user locale properties based on setlocale()
-#ifdef HAVE_SETLOCALE
+#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
// We let the user choose the locale. However, since Java differs
// from POSIX, we arbitrarily pick LC_MESSAGES as determining the
// Java locale. We can't use LC_ALL because it might return a full
- // list of all the settings.
+ // list of all the settings. If we don't have LC_MESSAGES then we
+ // just default to `en_US'.
setlocale (LC_ALL, "");
char *locale = setlocale (LC_MESSAGES, "");
if (locale && strlen (locale) >= 2)
@@ -438,7 +439,7 @@ java::lang::System::init_properties (void)
}
}
else
-#endif /* HAVE_SETLOCALE */
+#endif /* HAVE_SETLOCALE and HAVE_LC_MESSAGES */
{
SET ("user.language", "en");
SET ("user.region", "US");