summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2003-03-03 18:52:27 +0000
committerJoel Brobecker <brobecker@gnat.com>2003-03-03 18:52:27 +0000
commit0db18c3fb56d5818a0ea9e5f5c89e47f41f02ced (patch)
tree4f841ad06e605df2e0331d98a85b77f78d1bda82
parent31b3bd81e31a32d073272c7b923e1abd85ebebd0 (diff)
downloadgdb-0db18c3fb56d5818a0ea9e5f5c89e47f41f02ced.tar.gz
* aclocal.m4: Add check for mbrtowc.
* config.h.in: Regenerate. * configure: Regenerate. * rlmbutil.h: Disable multi-byte if mbrtowc is not defined.
-rw-r--r--readline/ChangeLog.gdb7
-rw-r--r--readline/aclocal.m41
-rw-r--r--readline/config.h.in3
-rwxr-xr-xreadline/configure79
-rw-r--r--readline/rlmbutil.h3
5 files changed, 92 insertions, 1 deletions
diff --git a/readline/ChangeLog.gdb b/readline/ChangeLog.gdb
index ffb422bd53c..40eef930641 100644
--- a/readline/ChangeLog.gdb
+++ b/readline/ChangeLog.gdb
@@ -1,3 +1,10 @@
+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.
+
2003-03-03 Kris Warkentin <kewarken@qnx.com>
* aclocal.m4: Cause wcwidth check to substitute
diff --git a/readline/aclocal.m4 b/readline/aclocal.m4
index 68b287d4be8..bc43d8db013 100644
--- a/readline/aclocal.m4
+++ b/readline/aclocal.m4
@@ -1652,6 +1652,7 @@ AC_CHECK_HEADERS(wctype.h)
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
diff --git a/readline/config.h.in b/readline/config.h.in
index c53c2a109c6..62883d319b8 100644
--- a/readline/config.h.in
+++ b/readline/config.h.in
@@ -31,6 +31,9 @@
/* 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
diff --git a/readline/configure b/readline/configure
index 7dd9001c9c8..b5c2e8dcbf9 100755
--- a/readline/configure
+++ b/readline/configure
@@ -6004,6 +6004,85 @@ fi
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
diff --git a/readline/rlmbutil.h b/readline/rlmbutil.h
index 27ca32bfc7d..9b8464a07f5 100644
--- a/readline/rlmbutil.h
+++ b/readline/rlmbutil.h
@@ -35,7 +35,8 @@
#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 */
+# if defined (HAVE_MBRTOWC) && defined (HAVE_MBSRTOWCS)
+ /* system is supposed to support XPG5 */
# define HANDLE_MULTIBYTE 1
# endif
#endif