zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: make unicode support configurable
@ 2005-08-15 17:17 Wayne Davison
  2005-08-15 17:27 ` Peter Stephenson
  2005-08-15 17:46 ` Oliver Kiddle
  0 siblings, 2 replies; 5+ messages in thread
From: Wayne Davison @ 2005-08-15 17:17 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 820 bytes --]

Here's a first pass at turning the ZLE_UNICODE_SUPPORT define into a
configure item.  The attached patch allows the user to specify either
--with-unicode-support or --without-unicode-support (to force the
decision), otherwise it runs a test to see if it thinks unicode can
be supported (which consists of the current checks from system.h
transplanted into configure).  The code in system.h was also modified
to check the value of ZLE_UNICODE_SUPPORT instead of set it.

Some questions that should be answered:

  o Do we like the above name for the --with/--without option?
  o Is including locale.h (if it exists) the right include file for
    the new configure test for __STDC_ISO_10646__?  (It works on my
    Linux system.)
  o Do we need the old unicode "subset" logic that I removed from
    system.h?

..wayne..

[-- Attachment #2: unicode.patch --]
[-- Type: text/plain, Size: 2032 bytes --]

--- configure.ac	1 Aug 2005 09:54:56 -0000	1.37
+++ configure.ac	15 Aug 2005 16:56:54 -0000
@@ -2063,6 +2063,43 @@ int ptsname();], ,
    fi
 fi
 
+dnl ---------------
+dnl unicode support
+dnl ---------------
+AC_ARG_WITH(unicode-support,
+[  --with-unicode-support     support unicode characters in the line editor])
+
+echo $with_unicode_support >/tmp/uni
+case x"$with_unicode_support" in
+  xyes) zsh_cv_c_zle_unicode_support=yes ;;
+  xno) zsh_cv_c_zle_unicode_support=no ;;
+  *)
+    AC_CACHE_CHECK(if the compiler supports wide characters,
+     zsh_cv_c_zle_unicode_support,
+    [AC_TRY_COMPILE([
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
+     ], [
+int main() {
+#if defined(HAVE_WCHAR_H) && defined(HAVE_WCTOMB) \
+ && defined(HAVE_MBRTOWC) && defined(HAVE_WCRTOMB) \
+ && defined (__STDC_ISO_10646__)
+    return 0;
+#else
+#error Not supported.
+#endif
+}
+    ],
+      zsh_cv_c_zle_unicode_support=yes,
+      zsh_cv_c_zle_unicode_support=no)])
+    ;;
+esac
+AH_TEMPLATE([ZLE_UNICODE_SUPPORT],
+[Define to 1 if you want unicode support in the line editor.])
+if test $zsh_cv_c_zle_unicode_support = yes; then
+  AC_DEFINE(ZLE_UNICODE_SUPPORT)
+fi
 
 dnl ---------------
 dnl dynamic loading
--- Src/system.h	15 Aug 2005 10:01:48 -0000	1.33
+++ Src/system.h	15 Aug 2005 16:56:54 -0000
@@ -691,22 +691,9 @@ extern short ospeed;
 #define UNUSED(x) x
 #endif
 
-/*
- * This is a subset of ZLE_UNICODE_SUPPORT.  It is not all that likely
- * that only the subset is supported, however it's easy to make the
- * \u and \U escape sequences work with just the following.
- */
-#if defined(HAVE_WCHAR_H) && defined(HAVE_WCTOMB) && defined (__STDC_ISO_10646__)
+#ifdef ZLE_UNICODE_SUPPORT
 # include <wchar.h>
 # include <wctype.h>
-
-/*
- * More stringent requirements to enable complete Unicode conversion
- * between wide characters and multibyte strings.
- */
-#if defined(HAVE_MBRTOWC) && defined(HAVE_WCRTOMB)
-#define ZLE_UNICODE_SUPPORT	1
-#endif
 #else
 # ifdef HAVE_LANGINFO_H
 #   include <langinfo.h>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-08-15 18:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-15 17:17 PATCH: make unicode support configurable Wayne Davison
2005-08-15 17:27 ` Peter Stephenson
2005-08-15 18:27   ` Wayne Davison
2005-08-15 17:46 ` Oliver Kiddle
2005-08-15 17:54   ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).