Commit 191bf464 by Zack Weinberg Committed by Zack Weinberg

aclocal.m4 (AM_WITH_NLS): AC_DEFINE HAVE_LIBINTL_H and USE_INCLUDED_LIBINTL when appropriate.

	* aclocal.m4 (AM_WITH_NLS): AC_DEFINE HAVE_LIBINTL_H and
	USE_INCLUDED_LIBINTL when appropriate.
	* configure, config.in: Regenerate.
	* Makefile.in (datadir): Set to @datadir@.
	(intl.o): Also depend on $(CONFIG_H) and system.h.

	* intl.c: Factor out common gettext initialization sequence.
	(gcc_init_libintl):  New function.
	* intl.h: Include intl/libgnuintl.h if USE_INCLUDED_LIBINTL;
	otherwise include libintl.h if HAVE_LIBINTL_H; otherwise turn
	off NLS.  Add multiple include guard.  No need to #ifdef-guard
	an #undef.  Prototype gcc_init_libintl here.

	* collect2.c (main), cppmain.c (general_init), gcc.c (main),
	gcov.c (main), protoize.c (main), toplev.c (toplev_main):
	Use gcc_init_libintl.

intl:
	* Makefile.in: Don't copy libgnuintl.h anywhere.

From-SVN: r46348
parent 7c87e9f9
2001-10-19 Zack Weinberg <zack@codesourcery.com>
* aclocal.m4 (AM_WITH_NLS): AC_DEFINE HAVE_LIBINTL_H and
USE_INCLUDED_LIBINTL when appropriate.
* configure, config.in: Regenerate.
* Makefile.in (datadir): Set to @datadir@.
(intl.o): Also depend on $(CONFIG_H) and system.h.
* intl.c: Factor out common gettext initialization sequence.
(gcc_init_libintl): New function.
* intl.h: Include intl/libgnuintl.h if USE_INCLUDED_LIBINTL;
otherwise include libintl.h if HAVE_LIBINTL_H; otherwise turn
off NLS. Add multiple include guard. No need to #ifdef-guard
an #undef. Prototype gcc_init_libintl here.
* collect2.c (main), cppmain.c (general_init), gcc.c (main),
gcov.c (main), protoize.c (main), toplev.c (toplev_main):
Use gcc_init_libintl.
2001-10-19 Catherine Moore <clm@redhat.com>
* config/stormy16/stormy16.h (ASM_COMMENT_START): Define.
......
......@@ -313,7 +313,7 @@ infodir = @infodir@
# Where cpp should go besides $prefix/bin if necessary
cpp_install_dir = @cpp_install_dir@
# where the locale files go
datadir = $(prefix)/@DATADIRNAME@
datadir = @datadir@
localedir = $(datadir)/locale
# Extension (if any) to put in installed man-page filename.
manext = .1
......@@ -1962,8 +1962,7 @@ $(HOST_PREFIX_1)ggc-none.o: ggc-none.c $(HCONFIG_H) $(SYSTEM_H)
#
# Remake internationalization support.
intl.o: intl.c intl.h Makefile
intl.o: intl.c $(CONFIG_H) system.h intl.h Makefile
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-DLOCALEDIR=\"$(localedir)\" \
-c $(srcdir)/intl.c
......
......@@ -1406,8 +1406,11 @@ AC_DEFUN([AM_WITH_NLS],
define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
dnl GCC LOCAL: Expose presence of libintl.h to C code.
AC_CHECK_HEADER(libintl.h,
[AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
[AC_DEFINE([HAVE_LIBINTL_H], 1,
[Define if you have the <libintl.h> header file.])
AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
[AC_TRY_LINK([#include <libintl.h>
extern int _nl_msg_cat_cntr;],
[bindtextdomain ("", "");
......@@ -1605,6 +1608,12 @@ changequote([,])dnl
AC_SUBST(INTLOBJS)
AC_SUBST(POFILES)
AC_SUBST(POSUB)
dnl GCC LOCAL: Make USE_INCLUDED_LIBINTL visible to C code.
if test $USE_INCLUDED_LIBINTL = yes; then
AC_DEFINE([USE_INCLUDED_LIBINTL], 1,
[Define to use the libintl included with this package instead of any
version in the system libraries.])
fi
dnl For backward compatibility. Some configure.ins may be using this.
nls_cv_header_intl=
......
......@@ -873,18 +873,7 @@ main (argc, argv)
signal (SIGCHLD, SIG_DFL);
#endif
/* LC_CTYPE determines the character set used by the terminal so it has be set
to output messages correctly. */
#ifdef HAVE_LC_MESSAGES
setlocale (LC_CTYPE, "");
setlocale (LC_MESSAGES, "");
#else
setlocale (LC_ALL, "");
#endif
(void) bindtextdomain (PACKAGE, localedir);
(void) textdomain (PACKAGE);
gcc_init_libintl ();
/* Do not invoke xcalloc before this point, since locale needs to be
set first, in case a diagnostic is issued. */
......
/* config.in. Generated automatically from configure.in by autoheader. */
/* config.in. Generated automatically from configure.in by autoheader 2.13. */
/* Define if using alloca.c. */
#undef C_ALLOCA
......@@ -511,9 +511,16 @@
is requested. */
#undef ENABLE_NLS
/* Define if you have the <libintl.h> header file. */
#undef HAVE_LIBINTL_H
/* Define if the GNU gettext() function is already present or preinstalled. */
#undef HAVE_GETTEXT
/* Define to use the libintl included with this package instead of any
version in the system libraries. */
#undef USE_INCLUDED_LIBINTL
/* Define to 1 if installation paths should be looked up in Windows32
Registry. Ignored on non windows32 hosts. */
#undef ENABLE_WIN32_REGISTRY
......
......@@ -100,18 +100,7 @@ general_init (argv0)
xmalloc_set_program_name (progname);
/* LC_CTYPE determines the character set used by the terminal so it
has to be set to output messages correctly. */
#ifdef HAVE_LC_MESSAGES
setlocale (LC_CTYPE, "");
setlocale (LC_MESSAGES, "");
#else
setlocale (LC_ALL, "");
#endif
(void) bindtextdomain (PACKAGE, localedir);
(void) textdomain (PACKAGE);
gcc_init_libintl ();
}
/* Handle switches, preprocess and output. */
......
......@@ -5559,18 +5559,7 @@ main (argc, argv)
GCC_DRIVER_HOST_INITIALIZATION;
#endif
/* LC_CTYPE determines the character set used by the terminal so it has be set
to output messages correctly. */
#ifdef HAVE_LC_MESSAGES
setlocale (LC_CTYPE, "");
setlocale (LC_MESSAGES, "");
#else
setlocale (LC_ALL, "");
#endif
(void) bindtextdomain (PACKAGE, localedir);
(void) textdomain (PACKAGE);
gcc_init_libintl ();
if (signal (SIGINT, SIG_IGN) != SIG_IGN)
signal (SIGINT, fatal_error);
......
......@@ -243,18 +243,7 @@ main (argc, argv)
int argc;
char **argv;
{
/* LC_CTYPE determines the character set used by the terminal so it has be set
to output messages correctly. */
#ifdef HAVE_LC_MESSAGES
setlocale (LC_CTYPE, "");
setlocale (LC_MESSAGES, "");
#else
setlocale (LC_ALL, "");
#endif
(void) bindtextdomain (PACKAGE, localedir);
(void) textdomain (PACKAGE);
gcc_init_libintl ();
process_args (argc, argv);
......
/* intl.c - internationalization */
/* Message translation utilities.
Copyright (C) 2001 Free Software Foundation, Inc.
#include "ansidecl.h"
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#include "config.h"
#include "system.h"
#include "intl.h"
const char localedir[] = LOCALEDIR;
#ifdef ENABLE_NLS
/* Initialize the translation library for GCC. This performs the
appropriate sequence of calls - setlocale, bindtextdomain,
textdomain. LC_CTYPE determines the character set used by the
terminal, so it has be set to output messages correctly. */
void
gcc_init_libintl ()
{
#ifdef HAVE_LC_MESSAGES
setlocale (LC_CTYPE, "");
setlocale (LC_MESSAGES, "");
#else
setlocale (LC_ALL, "");
#endif
(void) bindtextdomain (PACKAGE, LOCALEDIR);
(void) textdomain (PACKAGE);
}
#endif
/* intl.h - internationalization
Copyright 1998 Free Software Foundation, Inc.
Copyright 1998, 2001 Free Software Foundation, Inc.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -16,6 +16,9 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#ifndef GCC_INTL_H
#define GCC_INTL_H
#ifdef HAVE_LOCALE_H
# include <locale.h>
#endif
......@@ -24,23 +27,27 @@
# define setlocale(category, locale) (locale)
#endif
#ifdef ENABLE_NLS
# include <libintl.h>
extern const char localedir[];
#ifdef USE_INCLUDED_LIBINTL
# include <intl/libgnuintl.h>
#else
/* Stubs that do something close enough. */
# ifdef textdomain
# undef textdomain
# ifdef HAVE_LIBINTL_H
# include <libintl.h>
# else
# undef ENABLE_NLS
# endif
#endif
#ifdef ENABLE_NLS
extern void gcc_init_libintl PARAMS ((void));
#else
/* Stubs. */
# undef textdomain
# define textdomain(domain) (domain)
# ifdef bindtextdomain
# undef bindtextdomain
# endif
# undef bindtextdomain
# define bindtextdomain(domain, directory) (domain)
# ifdef gettext
# undef gettext
# endif
# undef gettext
# define gettext(msgid) (msgid)
# define gcc_init_libintl() /* nothing */
#endif
#ifndef _
......@@ -50,3 +57,5 @@
#ifndef N_
# define N_(msgid) (msgid)
#endif
#endif /* intl.h */
2001-10-19 Zack Weinberg <zack@codesourcery.com>
* Makefile.in: Don't copy libgnuintl.h anywhere.
2001-10-12 Zack Weinberg <zack@codesourcery.com>
* Update entire directory from gettext 0.10.40.
......
......@@ -105,8 +105,9 @@ LTV_AGE=0
INCLUDES = -I.. -I. -I$(top_srcdir)/intl -I$(top_srcdir) \
-I$(top_srcdir)/config -I$(top_srcdir)/../include
# GCC LOCAL: Removed libintl.h from all-yes.
all: all-@USE_INCLUDED_LIBINTL@
all-yes: libintl.$la libintl.h charset.alias ref-add.sed ref-del.sed
all-yes: libintl.$la charset.alias ref-add.sed ref-del.sed
all-no: all-no-@BUILD_INCLUDED_LIBINTL@
all-no-yes: libgnuintl.$la
all-no-no:
......@@ -124,8 +125,9 @@ libintl.la libgnuintl.la: $(OBJECTS)
-rpath $(libdir) \
-no-undefined
libintl.h: libgnuintl.h
cp $(srcdir)/libgnuintl.h libintl.h
#GCC LOCAL: Do not install this file.
#libintl.h: libgnuintl.h
# cp $(srcdir)/libgnuintl.h libintl.h
charset.alias: config.charset
$(SHELL) $(srcdir)/config.charset '@host@' > t-$@
......
......@@ -4584,18 +4584,7 @@ main (argc, argv)
signal (SIGCHLD, SIG_DFL);
#endif
/* LC_CTYPE determines the character set used by the terminal so it has be set
to output messages correctly. */
#ifdef HAVE_LC_MESSAGES
setlocale (LC_CTYPE, "");
setlocale (LC_MESSAGES, "");
#else
setlocale (LC_ALL, "");
#endif
(void) bindtextdomain (PACKAGE, localedir);
(void) textdomain (PACKAGE);
gcc_init_libintl ();
cwd_buffer = getpwd ();
if (!cwd_buffer)
......
......@@ -4622,18 +4622,7 @@ toplev_main (argc, argv)
xmalloc_set_program_name (progname);
/* LC_CTYPE determines the character set used by the terminal so it has be set
to output messages correctly. */
#ifdef HAVE_LC_MESSAGES
setlocale (LC_CTYPE, "");
setlocale (LC_MESSAGES, "");
#else
setlocale (LC_ALL, "");
#endif
(void) bindtextdomain (PACKAGE, localedir);
(void) textdomain (PACKAGE);
gcc_init_libintl ();
/* Install handler for SIGFPE, which may be received while we do
compile-time floating point arithmetic. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment