natSystem.cc (init_properties): Only look for default locale if LC_MESSAGES is defined.

* java/lang/natSystem.cc (init_properties): Only look for default
	locale if LC_MESSAGES is defined.
	* aclocal.m4, configure, include/config.h.in: Rebuilt.
	* configure.in: Call AM_LC_MESSAGES.
	* acinclude.m4 (AM_LC_MESSAGES): New macro.

From-SVN: r48781
This commit is contained in:
Tom Tromey 2002-01-11 23:00:58 +00:00 committed by Tom Tromey
parent 3e92902c7e
commit 999825b056
6 changed files with 282 additions and 188 deletions

View file

@ -1,3 +1,11 @@
2002-01-11 Tom Tromey <tromey@redhat.com>
* java/lang/natSystem.cc (init_properties): Only look for default
locale if LC_MESSAGES is defined.
* aclocal.m4, configure, include/config.h.in: Rebuilt.
* configure.in: Call AM_LC_MESSAGES.
* acinclude.m4 (AM_LC_MESSAGES): New macro.
2002-01-10 Tom Tromey <tromey@redhat.com>
For PR libgcj/5303:

View file

@ -191,3 +191,28 @@ size_t iconv();
fi
AC_SUBST(LIBICONV)
])
# Check whether LC_MESSAGES is available in <locale.h>.
# Ulrich Drepper <drepper@cygnus.com>, 1995.
#
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU General Public
# License or the GNU Library General Public License but which still want
# to provide support for the GNU gettext functionality.
# Please note that the actual code of the GNU gettext library is covered
# by the GNU Library General Public License, and the rest of the GNU
# gettext package package is covered by the GNU General Public License.
# They are *not* in the public domain.
# serial 2
AC_DEFUN([AM_LC_MESSAGES],
[if test $ac_cv_header_locale_h = yes; then
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
if test $am_cv_val_LC_MESSAGES = yes; then
AC_DEFINE(HAVE_LC_MESSAGES, 1,
[Define if your <locale.h> file defines LC_MESSAGES.])
fi
fi])

25
libjava/aclocal.m4 vendored
View file

@ -204,6 +204,31 @@ size_t iconv();
AC_SUBST(LIBICONV)
])
# Check whether LC_MESSAGES is available in <locale.h>.
# Ulrich Drepper <drepper@cygnus.com>, 1995.
#
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU General Public
# License or the GNU Library General Public License but which still want
# to provide support for the GNU gettext functionality.
# Please note that the actual code of the GNU gettext library is covered
# by the GNU Library General Public License, and the rest of the GNU
# gettext package package is covered by the GNU General Public License.
# They are *not* in the public domain.
# serial 2
AC_DEFUN([AM_LC_MESSAGES],
[if test $ac_cv_header_locale_h = yes; then
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
if test $am_cv_val_LC_MESSAGES = yes; then
AC_DEFINE(HAVE_LC_MESSAGES, 1,
[Define if your <locale.h> file defines LC_MESSAGES.])
fi
fi])
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.

404
libjava/configure vendored

File diff suppressed because it is too large Load diff

View file

@ -450,6 +450,7 @@ else
AC_DEFINE(HAVE_PROC_SELF_EXE)])
AM_ICONV
AM_LC_MESSAGES
AC_STRUCT_TIMEZONE
AC_CHECK_FUNCS(gethostbyname_r, [

View file

@ -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");