This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
LC_MESSAGES patch
- To: libstdc++@sourceware.cygnus.com
- Subject: LC_MESSAGES patch
- From: "Mark E." <snowball3@usa.net>
- Date: Mon, 12 Apr 1999 23:24:44 -0400
Attached is a patch adds an Autoconf test to determine if
LC_MESSAGES is supported. locale.cc then uses the macro
generated by this test in place of the macro currently used.
The patch also fixes the DOS style absolute filename test in
AM_PROG_LD in aclocal.m4 to not check for a directory separator. The
test was incorrectly failing because it was looking for a backslash,
when gcc for DJGPP uses a slash.
Since the AM_ prefix is falling into official disfavor, I renamed
AM_LC_MESSAGES to AC_LC_MESSAGES and its variabled to use
the ac_ prefix.
ChangeLog:
* configure.in: Add locale.h to AC_CHECK_HEADERS argument. Call
AC_LC_MESSAGES macro.
* aclocal.m4 (AC_LC_MESSAGES): New. Determines if a target
supports LC_MESSAGES.
* config.h.in: Add entry for HAVE_LC_MESSAGES.
* src/locale.cc (locale::_S_normalize_category): Use the
HAVE_LC_MESSAGES macro to check for LC_MESSAGES support
instead of _G_NO_CLOCALE_HAS_MESSAGES.
And here's the entry for the AM_PROG_LD change:
* aclocal.m4 (AM_PROG_LD): For DOS style paths, simplify test to '?:'
from '?:\\' so any path beginning with a drive name matches.
Mark
---
Mark Elbrecht, snowball3@usa.net
http://snowball.digitalspace.net/
Index: libstdc++/configure.in
===================================================================
RCS file: /cvs/libstdc++/libstdc++/configure.in,v
retrieving revision 1.10
diff -c -3 -r1.10 configure.in
*** configure.in 1999/03/17 18:30:41 1.10
--- configure.in 1999/04/12 22:20:21
***************
*** 43,49 ****
dnl Check for available headers.
AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \
! machine/param.h sys/machine.h fp.h])
dnl Determine the endianess if we cannot do this from the headers.
if test "$ac_cv_header_endian_h" = no \
--- 43,49 ----
dnl Check for available headers.
AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \
! machine/param.h sys/machine.h fp.h locale.h])
dnl Determine the endianess if we cannot do this from the headers.
if test "$ac_cv_header_endian_h" = no \
***************
*** 69,73 ****
--- 69,75 ----
STDIO_WRAP_SRCS='$(STDIO_WRAP_SRCS)'
AC_SUBST(STDIO_WRAP_SRCS)
fi
+
+ AC_LC_MESSAGES
AC_OUTPUT([Makefile math/Makefile string/Makefile libio/Makefile src/Makefile])
Index: libstdc++/aclocal.m4
===================================================================
RCS file: /cvs/libstdc++/libstdc++/aclocal.m4,v
retrieving revision 1.2
diff -c -3 -r1.2 aclocal.m4
*** aclocal.m4 1998/07/14 23:09:06 1.2
--- aclocal.m4 1999/04/12 22:20:50
***************
*** 279,285 ****
case "$ac_prog" in
# Accept absolute paths.
changequote(,)dnl
! /* | [A-Za-z]:\\*)
changequote([,])dnl
test -z "$LD" && LD="$ac_prog"
;;
--- 279,285 ----
case "$ac_prog" in
# Accept absolute paths.
changequote(,)dnl
! /* | [A-Za-z]:*)
changequote([,])dnl
test -z "$LD" && LD="$ac_prog"
;;
***************
*** 490,493 ****
--- 490,513 ----
[AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
AC_SUBST(LIBSTRINGOBJS)dnl
])
+
+ # Check whether LC_MESSAGES is available in <locale.h>.
+ # Ulrich Drepper <drepper@cygnus.com>, 1995.
+ #
+ # This file file be copied and used freely without restrictions. It can
+ # be used in projects which are not available under the GNU Public License
+ # but which still want to provide support for the GNU gettext functionality.
+ # Please note that the actual code is *not* freely available.
+
+ # serial 1
+
+ AC_DEFUN(AC_LC_MESSAGES,
+ [if test $ac_cv_header_locale_h = yes; then
+ AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
+ [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
+ ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
+ if test $ac_cv_val_LC_MESSAGES = yes; then
+ AC_DEFINE(HAVE_LC_MESSAGES)
+ fi
+ fi])
Index: libstdc++/config.h.in
===================================================================
RCS file: /cvs/libstdc++/libstdc++/config.h.in,v
retrieving revision 1.6
diff -c -3 -r1.6 config.h.in
*** config.h.in 1999/03/17 18:33:24 1.6
--- config.h.in 1999/04/12 22:21:08
***************
*** 264,266 ****
--- 264,270 ----
/* Define if you have the <sys/machine.h> header file. */
#undef HAVE_SYS_MACHINE_H
+
+ /* Define if you have LC_MESSAGES in <locale.h>. */
+ #undef HAVE_LC_MESSAGES
+
Index: libstdc++/src/locale.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/src/locale.cc,v
retrieving revision 1.20
diff -c -3 -r1.20 locale.cc
*** locale.cc 1999/04/09 15:20:19 1.20
--- locale.cc 1999/04/12 22:23:52
***************
*** 397,403 ****
case LC_MONETARY: return monetary;
case LC_NUMERIC: return numeric;
case LC_TIME: return time;
! #ifndef _G_NO_CLOCALE_HAS_MESSAGES
case LC_MESSAGES: return messages;
#endif
case LC_ALL: return all;
--- 397,403 ----
case LC_MONETARY: return monetary;
case LC_NUMERIC: return numeric;
case LC_TIME: return time;
! #ifdef HAVE_LC_MESSAGES
case LC_MESSAGES: return messages;
#endif
case LC_ALL: return all;