Commit 2bd02043 by Zack Weinberg Committed by Zack Weinberg

configure.in: Check for wchar.h, mbstowcs, and wcswidth.

        * configure.in: Check for wchar.h, mbstowcs, and wcswidth.
        * configure, config.in: Regenerate.
        * intl.c (gcc_gettext_width): New function.
        * intl.h: Prototype it.
cp:
        * call.c (print_z_candidates): Use gcc_gettext_width, not
        strlen, to determine how much padding to use.

From-SVN: r65517
parent 48ed72a3
2003-04-12 Zack Weinberg <zack@codesourcery.com>
* configure.in: Check for wchar.h, mbstowcs, and wcswidth.
* configure, config.in: Regenerate.
* intl.c (gcc_gettext_width): New function.
* intl.h: Prototype it.
2003-04-12 Stephane Carrez <stcarrez@nerim.fr> 2003-04-12 Stephane Carrez <stcarrez@nerim.fr>
* config/m68hc11/m68hc11.h (TARGET_SWITCHES): Fix -mnominmax option; * config/m68hc11/m68hc11.h (TARGET_SWITCHES): Fix -mnominmax option;
...@@ -52,7 +59,7 @@ ...@@ -52,7 +59,7 @@
* configure: Regenerate. * configure: Regenerate.
* config.in: Regenerate. * config.in: Regenerate.
* config/alpha/t-crtfm: Use -frandom-seed. * config/alpha/t-crtfm: Use -frandom-seed.
* doc/extend.texi (Empty Structures): New. * doc/extend.texi (Empty Structures): New.
* c-pch.c: Include flags.h. Add comments to routines. * c-pch.c: Include flags.h. Add comments to routines.
......
...@@ -162,6 +162,9 @@ ...@@ -162,6 +162,9 @@
/* Define if you have the lstat function. */ /* Define if you have the lstat function. */
#undef HAVE_LSTAT #undef HAVE_LSTAT
/* Define if you have the mbstowcs function. */
#undef HAVE_MBSTOWCS
/* Define if you have the mempcpy function. */ /* Define if you have the mempcpy function. */
#undef HAVE_MEMPCPY #undef HAVE_MEMPCPY
...@@ -216,6 +219,9 @@ ...@@ -216,6 +219,9 @@
/* Define if you have the tsearch function. */ /* Define if you have the tsearch function. */
#undef HAVE_TSEARCH #undef HAVE_TSEARCH
/* Define if you have the wcswidth function. */
#undef HAVE_WCSWIDTH
/* Define if you have the <argz.h> header file. */ /* Define if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H #undef HAVE_ARGZ_H
...@@ -279,6 +285,9 @@ ...@@ -279,6 +285,9 @@
/* Define if you have the <unistd.h> header file. */ /* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H #undef HAVE_UNISTD_H
/* Define if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
/* Define to enable the use of a default linker. */ /* Define to enable the use of a default linker. */
#undef DEFAULT_LINKER #undef DEFAULT_LINKER
......
...@@ -2434,7 +2434,7 @@ fi ...@@ -2434,7 +2434,7 @@ fi
# Find some useful tools # Find some useful tools
for ac_prog in gawk mawk nawk awk for ac_prog in mawk gawk nawk awk
do do
# Extract the first word of "$ac_prog", so it can be a program name with args. # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2 set dummy $ac_prog; ac_word=$2
...@@ -3102,7 +3102,7 @@ fi ...@@ -3102,7 +3102,7 @@ fi
for ac_hdr in limits.h stddef.h string.h strings.h stdlib.h time.h \ for ac_hdr in limits.h stddef.h string.h strings.h stdlib.h time.h \
fcntl.h unistd.h sys/file.h sys/time.h \ fcntl.h unistd.h sys/file.h sys/time.h \
sys/resource.h sys/param.h sys/times.h sys/stat.h \ sys/resource.h sys/param.h sys/times.h sys/stat.h \
direct.h malloc.h langinfo.h ldfcn.h direct.h malloc.h langinfo.h ldfcn.h wchar.h
do do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
...@@ -3714,7 +3714,7 @@ fi ...@@ -3714,7 +3714,7 @@ fi
for ac_func in times clock dup2 kill getrlimit setrlimit atoll atoq \ for ac_func in times clock dup2 kill getrlimit setrlimit atoll atoq \
sysconf strsignal putc_unlocked fputc_unlocked fputs_unlocked \ sysconf strsignal putc_unlocked fputc_unlocked fputs_unlocked \
fwrite_unlocked fprintf_unlocked getrusage nl_langinfo lstat \ fwrite_unlocked fprintf_unlocked getrusage nl_langinfo lstat \
scandir alphasort gettimeofday scandir alphasort gettimeofday mbstowcs wcswidth
do do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:3721: checking for $ac_func" >&5 echo "configure:3721: checking for $ac_func" >&5
......
...@@ -688,7 +688,7 @@ AC_HEADER_SYS_WAIT ...@@ -688,7 +688,7 @@ AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h \ AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h \
fcntl.h unistd.h sys/file.h sys/time.h \ fcntl.h unistd.h sys/file.h sys/time.h \
sys/resource.h sys/param.h sys/times.h sys/stat.h \ sys/resource.h sys/param.h sys/times.h sys/stat.h \
direct.h malloc.h langinfo.h ldfcn.h) direct.h malloc.h langinfo.h ldfcn.h wchar.h)
# Check for thread headers. # Check for thread headers.
AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=]) AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
...@@ -787,7 +787,7 @@ dnl gcc_AC_C_ENUM_BF_UNSIGNED ...@@ -787,7 +787,7 @@ dnl gcc_AC_C_ENUM_BF_UNSIGNED
AC_CHECK_FUNCS(times clock dup2 kill getrlimit setrlimit atoll atoq \ AC_CHECK_FUNCS(times clock dup2 kill getrlimit setrlimit atoll atoq \
sysconf strsignal putc_unlocked fputc_unlocked fputs_unlocked \ sysconf strsignal putc_unlocked fputc_unlocked fputs_unlocked \
fwrite_unlocked fprintf_unlocked getrusage nl_langinfo lstat \ fwrite_unlocked fprintf_unlocked getrusage nl_langinfo lstat \
scandir alphasort gettimeofday) scandir alphasort gettimeofday mbstowcs wcswidth)
AC_CHECK_TYPE(ssize_t, int) AC_CHECK_TYPE(ssize_t, int)
......
2003-04-12 Zack Weinberg <zack@codesourcery.com>
* call.c (print_z_candidates): Use gcc_gettext_width, not
strlen, to determine how much padding to use.
2003-04-10 Zack Weinberg <zack@codesourcery.com> 2003-04-10 Zack Weinberg <zack@codesourcery.com>
* decl.c: Update all calls to shadow_warning. * decl.c: Update all calls to shadow_warning.
......
...@@ -2508,9 +2508,9 @@ print_z_candidates (struct z_candidate *candidates) ...@@ -2508,9 +2508,9 @@ print_z_candidates (struct z_candidate *candidates)
print_z_candidate (str, candidates); print_z_candidate (str, candidates);
if (candidates->next) if (candidates->next)
{ {
/* Indent successive candidates by the length of the translation of /* Indent successive candidates by the width of the translation
the above string. */ of the above string. */
size_t len = strlen (str) + 1; size_t len = gcc_gettext_width (str) + 1;
char *spaces = alloca (len); char *spaces = alloca (len);
memset (spaces, ' ', len-1); memset (spaces, ' ', len-1);
spaces[len] = '\0'; spaces[len] = '\0';
......
...@@ -45,4 +45,35 @@ gcc_init_libintl () ...@@ -45,4 +45,35 @@ gcc_init_libintl ()
(void) textdomain ("gcc"); (void) textdomain ("gcc");
} }
#if defined HAVE_WCHAR_H && defined HAVE_MBSTOWCS && defined HAVE_WCSWIDTH
#include <wchar.h>
/* Returns the width in columns of MSGSTR, which came from gettext.
This is for indenting subsequent output. */
size_t
gcc_gettext_width (msgstr)
const char *msgstr;
{
size_t nwcs = mbstowcs (0, msgstr, 0);
wchar_t *wmsgstr = alloca ((nwcs + 1) * sizeof (wchar_t));
mbstowcs (wmsgstr, msgstr, nwcs + 1);
return wcswidth (wmsgstr, nwcs);
}
#else /* no wcswidth */
/* We don't have any way of knowing how wide the string is. Guess
the length of the string. */
size_t
gcc_gettext_width (msgstr)
const char *msgstr;
{
return strlen (msgstr);
}
#endif #endif
#endif /* ENABLE_NLS */
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
extern void gcc_init_libintl PARAMS ((void)); extern void gcc_init_libintl PARAMS ((void));
extern size_t gcc_gettext_width PARAMS ((const char *));
#else #else
/* Stubs. */ /* Stubs. */
# undef textdomain # undef textdomain
......
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