diff options
| author | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-29 04:53:37 +0000 |
|---|---|---|
| committer | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-29 04:53:37 +0000 |
| commit | 09ccd8eee8de26eee83076bd4b58d4dc0d659aac (patch) | |
| tree | 3c6a848f28f77b64bcb40a956df2db902c406ab7 /libjava | |
| parent | 9acbe72b1f1bedbdab5be103febb7681d347b4bf (diff) | |
| download | ppe42-gcc-09ccd8eee8de26eee83076bd4b58d4dc0d659aac.tar.gz ppe42-gcc-09ccd8eee8de26eee83076bd4b58d4dc0d659aac.zip | |
2000-11-29 Bryce McKinlay <bryce@albatross.co.nz>
* java/lang/natSystem.cc (init_properties): Set user.language and
user.region.
* configure.in: Check for setlocale.
* configure: Rebuilt.
* include/config.h.in: Rebuilt.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37842 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
| -rw-r--r-- | libjava/ChangeLog | 10 | ||||
| -rwxr-xr-x | libjava/configure | 2 | ||||
| -rw-r--r-- | libjava/configure.in | 2 | ||||
| -rw-r--r-- | libjava/include/config.h.in | 6 | ||||
| -rw-r--r-- | libjava/java/lang/natSystem.cc | 27 |
5 files changed, 43 insertions, 4 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index d8d1d25cd90..5e6212f174d 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,11 @@ +2000-11-29 Bryce McKinlay <bryce@albatross.co.nz> + + * java/lang/natSystem.cc (init_properties): Set user.language and + user.region. + * configure.in: Check for setlocale. + * configure: Rebuilt. + * include/config.h.in: Rebuilt. + 2000-11-28 Warren Levy <warrenl@cygnus.com> * java/text/DateFormatSymbols.java (zoneStringsDefault): Added @@ -5,7 +13,7 @@ * java/text/SimpleDateFormat.java (format): Added case for TIMEZONE_FIELD. -2000-11-28 Bryce McKinlay <bryce@abatross.co.nz> +2000-11-28 Bryce McKinlay <bryce@albatross.co.nz> * java/io/DataInputStream.java: Merge classpath docs. Call in.read() directly rather than read() in all cases. Make primitive read diff --git a/libjava/configure b/libjava/configure index 55ac0dc178d..fdf7282ea2e 100755 --- a/libjava/configure +++ b/libjava/configure @@ -3398,7 +3398,7 @@ else fi done - for ac_func in iconv nl_langinfo + for ac_func in iconv nl_langinfo setlocale do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:3405: checking for $ac_func" >&5 diff --git a/libjava/configure.in b/libjava/configure.in index 7e0bbce3141..edf35b48585 100644 --- a/libjava/configure.in +++ b/libjava/configure.in @@ -405,7 +405,7 @@ else AC_CHECK_FUNCS(strerror ioctl select fstat open fsync sleep) AC_CHECK_FUNCS(gmtime_r localtime_r readdir_r getpwuid_r getcwd) AC_CHECK_FUNCS(access stat mkdir rename rmdir unlink realpath) - AC_CHECK_FUNCS(iconv nl_langinfo) + AC_CHECK_FUNCS(iconv nl_langinfo setlocale) AC_CHECK_FUNCS(inet_aton inet_addr, break) AC_CHECK_FUNCS(inet_pton uname inet_ntoa) AC_CHECK_FUNCS(backtrace fork execvp pipe) diff --git a/libjava/include/config.h.in b/libjava/include/config.h.in index ad904d3abf9..93edd56111d 100644 --- a/libjava/include/config.h.in +++ b/libjava/include/config.h.in @@ -25,6 +25,9 @@ /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS +/* Define if the X Window System is missing or not being used. */ +#undef X_DISPLAY_MISSING + /* Define this if you want runtime debugging enabled. */ #undef DEBUG @@ -263,6 +266,9 @@ /* Define if you have the select function. */ #undef HAVE_SELECT +/* Define if you have the setlocale function. */ +#undef HAVE_SETLOCALE + /* Define if you have the sleep function. */ #undef HAVE_SLEEP diff --git a/libjava/java/lang/natSystem.cc b/libjava/java/lang/natSystem.cc index 57133fbc9b2..a987e8d5ef0 100644 --- a/libjava/java/lang/natSystem.cc +++ b/libjava/java/lang/natSystem.cc @@ -339,6 +339,31 @@ java::lang::System::init_properties (void) #endif /* HAVE_UNISTD_H */ #endif /* HAVE_GETCWD */ + // Set user locale properties based on setlocale() +#ifdef HAVE_SETLOCALE + char *locale = setlocale (LC_ALL, ""); + if (locale && strlen (locale) >= 2) + { + char buf[3]; + buf[2] = '\0'; + // copy the first two chars to user.language + strncpy (buf, locale, 2); + SET ("user.language", buf); + // if the next char is a '_', copy the two after that to user.region + locale += 2; + if (locale[0] == '_') + { + locale++; + strncpy (buf, locale, 2); + SET ("user.region", buf); + } + } + else +#endif /* HAVE_SETLOCALE */ + { + SET ("user.language", "en"); + } + // Set some properties according to whatever was compiled in with // `-D'. for (int i = 0; _Jv_Compiler_Properties[i]; ++i) @@ -382,7 +407,7 @@ java::lang::System::init_properties (void) sb->append ((jchar) ';'); #else sb->append ((jchar) ':'); -#endif; +#endif } if (cp != NULL) sb->append (cp); |

