On Tue, Jun 17, 2003 at 05:07:21PM -0400, Barry Warsaw wrote:
On Tue, 2003-06-17 at 16:53, Martin v. Löwis wrote:
What is missing is building a standard (i.e. UCS-2) Python against the Redhat (i.e. UCS-4) Tcl. There is now a note in README telling people to configure Python for UCS-4 on Redhat. It appears that all Redhat 9 users running into that so far find that acceptable.
It would be moderately nicer if configure could detect that UCS-4 was required and automatically provide the --enable-unicode=ucs4 option.
You'd be insane to stuff this in just before releasing 2.3 (since this is the first time I've ever written for autoconf), but here it is..
Running on a RedHat 9 machine: checking for wchar.h... yes checking for wchar_t... yes checking size of wchar_t... 4 checking for UCS-4 tcl... yes checking what type to use for unicode... wchar_t
Running on a RedHat 7.1 machine: checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking for wchar_t... yes checking size of wchar_t... 4 checking for UCS-4 tcl... no checking what type to use for unicode... unsigned short
Tested nowhere else in the universe... in particular, there's no attempt to find the location of the tcl.h header as setup.py does since it's in /usr/include/tcl.h on my system.
Detection of UCS-4 tcl does not override the --enable-unicode= setting. Someone who is building Python on a redhat9 system but does not want _tkinter may want the chance to override it, if only due to increased memory consumption of that build.
--- Python-2.3b1/configure.in 2003-04-11 10:35:52.000000000 -0500 +++ local-Python-2.3b1/configure.in 2003-06-17 20:17:13.000000000 -0500 @@ -2400,6 +2400,18 @@ AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>]) fi
+AC_MSG_CHECKING(for UCS-4 tcl) +have_ucs4_tcl=no +AC_TRY_COMPILE([ +#include <tcl.h> +#if TCL_UTF_MAX != 6 +# error "NOT UCS4_TCL" +#endif], , [ + AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6]) + have_ucs4_tcl=yes +]) +AC_MSG_RESULT($have_ucs4_tcl) + AC_MSG_CHECKING(what type to use for unicode) dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output AC_ARG_ENABLE(unicode, @@ -2410,7 +2422,12 @@ if test $enable_unicode = yes then - # Without any arguments, Py_UNICODE defaults to two-byte mode - enable_unicode="ucs2" + # Without any arguments, Py_UNICODE changes to match tcl (if present) + case "$have_ucs4_tcl" in + yes) enable_unicode="ucs4" + ;; + *) enable_unicode="ucs2" + ;; + esac fi