[patch] HAVE_LC_MESSAGES for natSystem.cc

Andreas Tobler toa@pop.agri.ch
Thu Jan 10 10:33:00 GMT 2002


Hi,

this patch makes it possible to check whether a system has LC_MESSAGES
defined or not.
On darwin this isn't the case, so I check in natSystem.cc if not
HAVE_LC_MESSAGES and then define LC_MESSAGES with a ?number?.

I changed the configure.in and the aclocal.m4. Autoconf and autoheader
are necessary for configure and include/config.h.in
This offers other areas the HAVE_LC_MESSAGES as well.
If the aclocal.m4 change is necessary from my side I don't know. I
wasn't able to build it first since I missed a few m4.

Now I can build libjava on darwin again.

Comments? Ok?

Andreas

---

2002-01-10 Andreas Tobler <a.tobler@schweiz.ch>

                * libjava/configure.in (AM_LC_MESSAGES)
                add a LC_MESSAGES check
			* aclocal.m4 introduced the AM_LC_MESSAGES check.
                * libjava/java/lang/natSystem.cc
                handle LC_MESSAGES on systems not defined

--- configure.in.orig	Thu Jan 10 18:49:05 2002
+++ configure.in	Thu Jan 10 18:51:31 2002
@@ -451,6 +451,7 @@
 
    AM_ICONV
    AC_STRUCT_TIMEZONE
+   AM_LC_MESSAGES
 
    AC_CHECK_FUNCS(gethostbyname_r, [
      AC_DEFINE(HAVE_GETHOSTBYNAME_R)
--- aclocal.m4.orig	Thu Jan 10 18:48:35 2002
+++ aclocal.m4	Thu Jan 10 18:51:38 2002
@@ -351,4 +351,29 @@
   am_indx=`expr "<<$>>am_indx" + 1`
 done<<>>dnl>>)
 changequote([,]))])
+
+# 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])
 
--- java/lang/natSystem.cc.orig	Thu Jan 10 19:07:42 2002
+++ java/lang/natSystem.cc	Thu Jan 10 19:05:56 2002
@@ -415,6 +415,11 @@
 
   // Set user locale properties based on setlocale()
 #ifdef HAVE_SETLOCALE
+
+#if ! defined ( HAVE_LC_MESSAGES )
+#define LC_MESSAGES	1999	// what number shall we take?
+#endif 
+
   // 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



More information about the Java-patches mailing list