* Missing check for mbsrtowc causes compilation failure on HP/UX 11.11
@ 2003-01-28 5:03 Joel Brobecker
2003-01-28 5:04 ` Joel Brobecker
0 siblings, 1 reply; 5+ messages in thread
From: Joel Brobecker @ 2003-01-28 5:03 UTC (permalink / raw)
To: bash-maintainers; +Cc: gdb-patches
Dear readline maintainers,
I noticed a compilation failure in the readline module of the current
sources of GDB (extracted from CVS). This is occuring on HP/UX 11.11,
using GCC 3.2.1. I think that the readline version number used in GDB
is 4.3.
The compilation fails inside _rl_vi_change_mbchar_case (vi_mode.c)
because the compiler could not find mbrtowc. I searched this function,
and found that it is not provided by this system, but I could find
mbrtowcs. I then saw that _rl_vi_change_mbchar_case is compiled only
if HANDLE_MULTIBYTE is set. In turn, HANDLE_MULTIBYTE is set only if
(see rlmbutil.h):
#if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H)
# include <wchar.h>
# include <wctype.h>
# if defined (HAVE_MBSRTOWCS) /* system is supposed to support XPG5 */
# define HANDLE_MULTIBYTE 1
# endif
#endif
It seems that configure is only checking for mbsrtowcs, but not mbsrtowc.
This works on HP/UX 11.00 where neither of these functions are provided,
but not on HP/UX 11.11 where mbsrtowcs is defined.
I therefore made the following change, where I added a check for mbsrtowc.
config.h.in has been updated accordingly. I also updated the condition in
rlmbutil.h to make sure both mbsrtowcs and mbsrtowc are available before
enabling multibyte.
The patch is attached.
Concerning copyright assignments, I am not sure what will be needed. The
company I work for has an assignment on file with the FSF for GDB work.
I hope this will be sufficient.
Changelog:
aclocal.m4
- add check for mbsrtowc.
config.h.in
- regenerate.
rlmbutil.h
- make sure mbsrtowc is available before enabling multibyte support.
--
Joel Brobecker,
Ada Core Technologies, Inc.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Missing check for mbsrtowc causes compilation failure on HP/UX 11.11
2003-01-28 5:03 Missing check for mbsrtowc causes compilation failure on HP/UX 11.11 Joel Brobecker
@ 2003-01-28 5:04 ` Joel Brobecker
2003-03-03 2:35 ` Elena Zannoni
2003-03-03 18:55 ` Joel Brobecker
0 siblings, 2 replies; 5+ messages in thread
From: Joel Brobecker @ 2003-01-28 5:04 UTC (permalink / raw)
To: bash-maintainers; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 280 bytes --]
> The patch is attached.
Sigh... With the patch, this time. Sorry.
> Changelog:
>
> aclocal.m4
> - add check for mbsrtowc.
>
> config.h.in
> - regenerate.
>
> rlmbutil.h
> - make sure mbsrtowc is available before enabling multibyte support.
--
Joel
[-- Attachment #2: readline.diff --]
[-- Type: text/plain, Size: 1657 bytes --]
diff -cp ../../gdb-public.orig/readline/aclocal.m4 ./aclocal.m4
*** ../../gdb-public.orig/readline/aclocal.m4 Fri Dec 13 08:55:58 2002
--- ./aclocal.m4 Mon Jan 27 12:42:10 2003
*************** AC_CHECK_HEADERS(wctype.h)
*** 1652,1657 ****
--- 1652,1658 ----
AC_CHECK_HEADERS(wchar.h)
AC_CHECK_HEADERS(langinfo.h)
+ AC_CHECK_FUNC(mbsrtowc, AC_DEFINE(HAVE_MBSRTOWC))
AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH))
diff -cp ../../gdb-public.orig/readline/config.h.in ./config.h.in
*** ../../gdb-public.orig/readline/config.h.in Fri Dec 13 08:55:59 2002
--- ./config.h.in Mon Jan 27 12:43:22 2003
***************
*** 31,36 ****
--- 31,39 ----
/* Define if you have the lstat function. */
#undef HAVE_LSTAT
+ /* Define if you have the mbsrtowc function. */
+ #undef HAVE_MBSRTOWC
+
/* Define if you have the mbsrtowcs function. */
#undef HAVE_MBSRTOWCS
diff -cp ../../gdb-public.orig/readline/rlmbutil.h ./rlmbutil.h
*** ../../gdb-public.orig/readline/rlmbutil.h Sun Dec 8 17:31:37 2002
--- ./rlmbutil.h Mon Jan 27 23:22:15 2003
***************
*** 35,41 ****
#if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H)
# include <wchar.h>
# include <wctype.h>
! # if defined (HAVE_MBSRTOWCS) /* system is supposed to support XPG5 */
# define HANDLE_MULTIBYTE 1
# endif
#endif
--- 35,42 ----
#if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H)
# include <wchar.h>
# include <wctype.h>
! # if defined (HAVE_MBSRTOWC) && defined (HAVE_MBSRTOWCS)
! /* system is supposed to support XPG5 */
# define HANDLE_MULTIBYTE 1
# endif
#endif
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Missing check for mbsrtowc causes compilation failure on HP/UX 11.11
2003-01-28 5:04 ` Joel Brobecker
@ 2003-03-03 2:35 ` Elena Zannoni
2003-03-03 19:05 ` Joel Brobecker
2003-03-03 18:55 ` Joel Brobecker
1 sibling, 1 reply; 5+ messages in thread
From: Elena Zannoni @ 2003-03-03 2:35 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
Joel, feel free to commit this to the gdb copy of readline. Just make sure you
add the changelog entry only to the ChangeLog.gdb file.
elena
Joel Brobecker writes:
> > The patch is attached.
>
> Sigh... With the patch, this time. Sorry.
>
> > Changelog:
> >
> > aclocal.m4
> > - add check for mbsrtowc.
> >
> > config.h.in
> > - regenerate.
> >
> > rlmbutil.h
> > - make sure mbsrtowc is available before enabling multibyte support.
>
> --
> Joel
> diff -cp ../../gdb-public.orig/readline/aclocal.m4 ./aclocal.m4
> *** ../../gdb-public.orig/readline/aclocal.m4 Fri Dec 13 08:55:58 2002
> --- ./aclocal.m4 Mon Jan 27 12:42:10 2003
> *************** AC_CHECK_HEADERS(wctype.h)
> *** 1652,1657 ****
> --- 1652,1658 ----
> AC_CHECK_HEADERS(wchar.h)
> AC_CHECK_HEADERS(langinfo.h)
>
> + AC_CHECK_FUNC(mbsrtowc, AC_DEFINE(HAVE_MBSRTOWC))
> AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
> AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH))
>
> diff -cp ../../gdb-public.orig/readline/config.h.in ./config.h.in
> *** ../../gdb-public.orig/readline/config.h.in Fri Dec 13 08:55:59 2002
> --- ./config.h.in Mon Jan 27 12:43:22 2003
> ***************
> *** 31,36 ****
> --- 31,39 ----
> /* Define if you have the lstat function. */
> #undef HAVE_LSTAT
>
> + /* Define if you have the mbsrtowc function. */
> + #undef HAVE_MBSRTOWC
> +
> /* Define if you have the mbsrtowcs function. */
> #undef HAVE_MBSRTOWCS
>
> diff -cp ../../gdb-public.orig/readline/rlmbutil.h ./rlmbutil.h
> *** ../../gdb-public.orig/readline/rlmbutil.h Sun Dec 8 17:31:37 2002
> --- ./rlmbutil.h Mon Jan 27 23:22:15 2003
> ***************
> *** 35,41 ****
> #if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H)
> # include <wchar.h>
> # include <wctype.h>
> ! # if defined (HAVE_MBSRTOWCS) /* system is supposed to support XPG5 */
> # define HANDLE_MULTIBYTE 1
> # endif
> #endif
> --- 35,42 ----
> #if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H)
> # include <wchar.h>
> # include <wctype.h>
> ! # if defined (HAVE_MBSRTOWC) && defined (HAVE_MBSRTOWCS)
> ! /* system is supposed to support XPG5 */
> # define HANDLE_MULTIBYTE 1
> # endif
> #endif
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Missing check for mbsrtowc causes compilation failure on HP/UX 11.11
2003-01-28 5:04 ` Joel Brobecker
2003-03-03 2:35 ` Elena Zannoni
@ 2003-03-03 18:55 ` Joel Brobecker
1 sibling, 0 replies; 5+ messages in thread
From: Joel Brobecker @ 2003-03-03 18:55 UTC (permalink / raw)
To: bash-maintainers; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 514 bytes --]
Dear bash maintainers,
I haven't received any feedback regarding this problem, but I noticed
that there was a typo in the patch I sent you (an unwanted 's' inside
'mbrtowc'). I have checked the following change in the gdb/readline
repository, it does not have the typo.
2003-03-03 Joel Brobecker <brobecker@gnat.com>
* aclocal.m4: Add check for mbrtowc.
* config.h.in: Regenerate.
* configure: Regenerate.
* rlmbutil.h: Disable multi-byte if mbrtowc is not defined.
--
Joel
[-- Attachment #2: readline.diff --]
[-- Type: text/plain, Size: 4764 bytes --]
Index: aclocal.m4
===================================================================
RCS file: /cvs/src/src/readline/aclocal.m4,v
retrieving revision 1.5
diff -c -3 -p -r1.5 aclocal.m4
*** aclocal.m4 3 Mar 2003 14:45:41 -0000 1.5
--- aclocal.m4 3 Mar 2003 18:46:41 -0000
*************** AC_CHECK_HEADERS(wctype.h)
*** 1652,1657 ****
--- 1652,1658 ----
AC_CHECK_HEADERS(wchar.h)
AC_CHECK_HEADERS(langinfo.h)
+ AC_CHECK_FUNC(mbrtowc, AC_DEFINE(HAVE_MBRTOWC))
AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
AC_CHECK_FUNC(wcwidth, have_wcwidth=yes)
if test "$have_wcwidth" = yes; then
Index: config.h.in
===================================================================
RCS file: /cvs/src/src/readline/config.h.in,v
retrieving revision 1.4
diff -c -3 -p -r1.4 config.h.in
*** config.h.in 8 Dec 2002 22:31:37 -0000 1.4
--- config.h.in 3 Mar 2003 18:46:41 -0000
***************
*** 31,36 ****
--- 31,39 ----
/* Define if you have the lstat function. */
#undef HAVE_LSTAT
+ /* Define if you have the mbrtowc function. */
+ #undef HAVE_MBRTOWC
+
/* Define if you have the mbsrtowcs function. */
#undef HAVE_MBSRTOWCS
Index: configure
===================================================================
RCS file: /cvs/src/src/readline/configure,v
retrieving revision 1.7
diff -c -3 -p -r1.7 configure
*** configure 3 Mar 2003 14:45:42 -0000 1.7
--- configure 3 Mar 2003 18:46:45 -0000
*************** fi
*** 6004,6009 ****
--- 6004,6088 ----
done
+ echo "$as_me:$LINENO: checking for mbrtowc" >&5
+ echo $ECHO_N "checking for mbrtowc... $ECHO_C" >&6
+ if test "${ac_cv_func_mbrtowc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+ cat >conftest.$ac_ext <<_ACEOF
+ #line $LINENO "configure"
+ /* confdefs.h. */
+ _ACEOF
+ cat confdefs.h >>conftest.$ac_ext
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h. */
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char mbrtowc (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+ #ifdef __STDC__
+ # include <limits.h>
+ #else
+ # include <assert.h>
+ #endif
+ /* Override any gcc2 internal prototype to avoid an error. */
+ #ifdef __cplusplus
+ extern "C"
+ {
+ #endif
+ /* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+ char mbrtowc ();
+ /* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+ #if defined (__stub_mbrtowc) || defined (__stub___mbrtowc)
+ choke me
+ #else
+ char (*f) () = mbrtowc;
+ #endif
+ #ifdef __cplusplus
+ }
+ #endif
+
+ int
+ main ()
+ {
+ return f != mbrtowc;
+ ;
+ return 0;
+ }
+ _ACEOF
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_mbrtowc=yes
+ else
+ echo "$as_me: failed program was:" >&5
+ sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_func_mbrtowc=no
+ fi
+ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+ fi
+ echo "$as_me:$LINENO: result: $ac_cv_func_mbrtowc" >&5
+ echo "${ECHO_T}$ac_cv_func_mbrtowc" >&6
+ if test $ac_cv_func_mbrtowc = yes; then
+ cat >>confdefs.h <<\_ACEOF
+ #define HAVE_MBRTOWC 1
+ _ACEOF
+
+ fi
+
echo "$as_me:$LINENO: checking for mbsrtowcs" >&5
echo $ECHO_N "checking for mbsrtowcs... $ECHO_C" >&6
if test "${ac_cv_func_mbsrtowcs+set}" = set; then
Index: rlmbutil.h
===================================================================
RCS file: /cvs/src/src/readline/rlmbutil.h,v
retrieving revision 1.3
diff -c -3 -p -r1.3 rlmbutil.h
*** rlmbutil.h 8 Dec 2002 22:31:37 -0000 1.3
--- rlmbutil.h 3 Mar 2003 18:46:45 -0000
***************
*** 35,41 ****
#if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H)
# include <wchar.h>
# include <wctype.h>
! # if defined (HAVE_MBSRTOWCS) /* system is supposed to support XPG5 */
# define HANDLE_MULTIBYTE 1
# endif
#endif
--- 35,42 ----
#if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H)
# include <wchar.h>
# include <wctype.h>
! # if defined (HAVE_MBRTOWC) && defined (HAVE_MBSRTOWCS)
! /* system is supposed to support XPG5 */
# define HANDLE_MULTIBYTE 1
# endif
#endif
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Missing check for mbsrtowc causes compilation failure on HP/UX 11.11
2003-03-03 2:35 ` Elena Zannoni
@ 2003-03-03 19:05 ` Joel Brobecker
0 siblings, 0 replies; 5+ messages in thread
From: Joel Brobecker @ 2003-03-03 19:05 UTC (permalink / raw)
To: Elena Zannoni; +Cc: gdb-patches
> Joel, feel free to commit this to the gdb copy of readline. Just make
> sure you add the changelog entry only to the ChangeLog.gdb file.
Thank you Elena. I've been lucky that I lost the sources where I worked
on this change, because I ended up re-applying the patch on my laptop
and test it again there. I thought I had tested it on Linux already, but
it turned out that I had made a typo in the name of the function to
check. This typo was sort of ok on the HP/UX machine, as the function
was not provided in any case, but it would have caused multi-byte
handling to be deactivated on other platforms... I sent the new patch
to the bash maintainers, and committed it in our tree.
2003-03-03 Joel Brobecker <brobecker@gnat.com>
* aclocal.m4: Add check for mbrtowc.
* config.h.in: Regenerate.
* configure: Regenerate.
* rlmbutil.h: Disable multi-byte if mbrtowc is not defined.
--
Joel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-03-03 19:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-28 5:03 Missing check for mbsrtowc causes compilation failure on HP/UX 11.11 Joel Brobecker
2003-01-28 5:04 ` Joel Brobecker
2003-03-03 2:35 ` Elena Zannoni
2003-03-03 19:05 ` Joel Brobecker
2003-03-03 18:55 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox