summaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2001-04-04 23:53:21 +0000
committerBruno Haible <bruno@clisp.org>2001-04-04 23:53:21 +0000
commit32cb998e0258a29dedca89f67276931992676924 (patch)
treef21d5973db7f07c0aadc8eebb097f0f00d4ce757 /m4
parentb2b841f8bda96fee7fa80a1f678fc12f37e3d605 (diff)
downloadexternal_gettext-32cb998e0258a29dedca89f67276931992676924.zip
external_gettext-32cb998e0258a29dedca89f67276931992676924.tar.gz
external_gettext-32cb998e0258a29dedca89f67276931992676924.tar.bz2
Add the mbswidth function to the lib.
Diffstat (limited to 'm4')
-rw-r--r--m4/ChangeLog7
-rw-r--r--m4/Makefile.am4
-rw-r--r--m4/mbrtowc.m418
-rw-r--r--m4/mbstate_t.m429
-rw-r--r--m4/mbswidth.m429
5 files changed, 85 insertions, 2 deletions
diff --git a/m4/ChangeLog b/m4/ChangeLog
index a51825e..ef98e45 100644
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -1,3 +1,10 @@
+2001-04-04 Bruno Haible <haible@clisp.cons.org>
+
+ * mbswidth.m4: New file, from textutils-2.0.13 with modifications.
+ * mbrtowc.m4: Likewise.
+ * mbstate_t.m4: Likewise.
+ * Makefile.am (EXTRA_DIST): Add them.
+
2001-03-29 Bruno Haible <haible@clisp.cons.org>
* gettext-0.10.36 released.
diff --git a/m4/Makefile.am b/m4/Makefile.am
index e930fd7..cad7a00 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -8,5 +8,5 @@ aclocal_DATA = codeset.m4 gettext.m4 iconv.m4 isc-posix.m4 lcmessage.m4 progtest
# |sed 's/@$/%/;s/@/ \\@/g' |tr @% '\012\012'
EXTRA_DIST = README \
c-bs-a.m4 codeset.m4 getline.m4 gettext.m4 iconv.m4 inttypes_h.m4 \
-isc-posix.m4 lcmessage.m4 libtool.m4 progtest.m4 setlocale.m4 signed.m4 \
-uintmax_t.m4 ulonglong.m4
+isc-posix.m4 lcmessage.m4 libtool.m4 mbrtowc.m4 mbstate_t.m4 mbswidth.m4 \
+progtest.m4 setlocale.m4 signed.m4 uintmax_t.m4 ulonglong.m4
diff --git a/m4/mbrtowc.m4 b/m4/mbrtowc.m4
new file mode 100644
index 0000000..371febf
--- /dev/null
+++ b/m4/mbrtowc.m4
@@ -0,0 +1,18 @@
+#serial 2
+
+dnl From Paul Eggert
+
+AC_DEFUN(jm_FUNC_MBRTOWC,
+[
+ AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
+ jm_cv_func_mbrtowc,
+ [AC_TRY_LINK(
+ [#include <wchar.h>],
+ [mbstate_t state; return ! (sizeof state && mbrtowc);],
+ jm_cv_func_mbrtowc=yes,
+ jm_cv_func_mbrtowc=no)])
+ if test $jm_cv_func_mbrtowc = yes; then
+ AC_DEFINE(HAVE_MBRTOWC, 1,
+ [Define to 1 if mbrtowc and mbstate_t are properly declared.])
+ fi
+])
diff --git a/m4/mbstate_t.m4 b/m4/mbstate_t.m4
new file mode 100644
index 0000000..a185a7d
--- /dev/null
+++ b/m4/mbstate_t.m4
@@ -0,0 +1,29 @@
+# serial 8
+
+# From Paul Eggert.
+
+# BeOS 5 has <wchar.h> but does not define mbstate_t,
+# so you can't declare an object of that type.
+# Check for this incompatibility with Standard C.
+
+# Include stdlib.h first, because otherwise this test would fail on Linux
+# (at least glibc-2.1.3) because the "_XOPEN_SOURCE 500" definition elicits
+# a syntax error in wchar.h due to the use of undefined __int32_t.
+
+AC_DEFUN(AC_MBSTATE_T,
+ [
+ AC_CHECK_HEADERS(stdlib.h)
+
+ AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t,
+ [AC_TRY_COMPILE([
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#include <wchar.h>],
+ [mbstate_t x; return sizeof x;],
+ ac_cv_type_mbstate_t=yes,
+ ac_cv_type_mbstate_t=no)])
+ if test $ac_cv_type_mbstate_t = no; then
+ AC_DEFINE(mbstate_t, int,
+ [Define to a type if <wchar.h> does not define.])
+ fi])
diff --git a/m4/mbswidth.m4 b/m4/mbswidth.m4
new file mode 100644
index 0000000..74fce1b
--- /dev/null
+++ b/m4/mbswidth.m4
@@ -0,0 +1,29 @@
+#serial 4
+
+dnl autoconf tests required for use of mbswidth.c
+dnl From Bruno Haible.
+
+AC_DEFUN(jm_PREREQ_MBSWIDTH,
+[
+ AC_REQUIRE([AC_HEADER_STDC])
+ AC_CHECK_HEADERS(limits.h stdlib.h string.h wchar.h wctype.h)
+ AC_CHECK_FUNCS(isascii iswcntrl iswprint wcwidth)
+ jm_FUNC_MBRTOWC
+
+ AC_CACHE_CHECK([whether wcwidth is declared], ac_cv_have_decl_wcwidth,
+ [AC_TRY_COMPILE([
+#if HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+], [
+#ifndef wcwidth
+ char *p = (char *) wcwidth;
+#endif
+], ac_cv_have_decl_wcwidth=yes, ac_cv_have_decl_wcwidth=no)])
+ if test $ac_cv_have_decl_wcwidth = yes; then
+ AC_DEFINE(HAVE_DECL_WCWIDTH, 1,
+ [Define to 1 if you have the declaration of wcwidth().])
+ fi
+
+ AC_MBSTATE_T
+])