[Python-Dev] Can't compile _tkinter.c with Redhat 9 (post-SF#719880)

Jeff Epler jepler@unpythonic.net
Tue, 17 Jun 2003 20:28:47 -0500


On Tue, Jun 17, 2003 at 05:07:21PM -0400, Barry Warsaw wrote:
> On Tue, 2003-06-17 at 16:53, Martin v. L=F6wis wrote:
>=20
> > What is missing is building a standard (i.e. UCS-2) Python against th=
e
> > 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.
>=20
> It would be moderately nicer if configure could detect that UCS-4 was
> required and automatically provide the --enable-unicode=3Ducs4 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=3D 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.

Jeff

--- 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
=20
+AC_MSG_CHECKING(for UCS-4 tcl)
+have_ucs4_tcl=3Dno
+AC_TRY_COMPILE([
+#include <tcl.h>
+#if TCL_UTF_MAX !=3D 6
+# error "NOT UCS4_TCL"
+#endif], [], [
+  AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_M=
AX=3D=3D6])
+  have_ucs4_tcl=3Dyes
+])
+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,=20
@@ -2410,7 +2422,12 @@
 if test $enable_unicode =3D yes
 then
-  # Without any arguments, Py_UNICODE defaults to two-byte mode
-  enable_unicode=3D"ucs2"
+  # Without any arguments, Py_UNICODE changes to match tcl (if present)
+  case "$have_ucs4_tcl" in
+  yes) enable_unicode=3D"ucs4"
+       ;;
+  *)   enable_unicode=3D"ucs2"
+       ;;
+  esac
 fi
=20
 AH_TEMPLATE(Py_UNICODE_SIZE,