Remove traces of Py_USING_UNICODE and Unicode-specific conditionals in configure.

Rename --enable-unicode to --with-wide-unicode; the default is still not wide.
This commit is contained in:
Georg Brandl 2008-01-07 18:10:24 +00:00
parent 22ec03c286
commit 52d168a995
9 changed files with 93 additions and 132 deletions

View File

@ -751,7 +751,7 @@ Encodings and Unicode
Unicode strings are stored internally as sequences of codepoints (to be precise Unicode strings are stored internally as sequences of codepoints (to be precise
as :ctype:`Py_UNICODE` arrays). Depending on the way Python is compiled (either as :ctype:`Py_UNICODE` arrays). Depending on the way Python is compiled (either
via :option:`--enable-unicode=ucs2` or :option:`--enable-unicode=ucs4`, with the via :option:`--without-wide-unicode` or :option:`--with-wide-unicode`, with the
former being the default) :ctype:`Py_UNICODE` is either a 16-bit or 32-bit data former being the default) :ctype:`Py_UNICODE` is either a 16-bit or 32-bit data
type. Once a Unicode object is used outside of CPU and memory, CPU endianness type. Once a Unicode object is used outside of CPU and memory, CPU endianness
and how these arrays are stored as bytes become an issue. Transforming a and how these arrays are stored as bytes become an issue. Transforming a

View File

@ -171,7 +171,6 @@ DYNLOADFILE= @DYNLOADFILE@
MACHDEP_OBJS= @MACHDEP_OBJS@ MACHDEP_OBJS= @MACHDEP_OBJS@
LIBOBJDIR= Python/ LIBOBJDIR= Python/
LIBOBJS= @LIBOBJS@ LIBOBJS= @LIBOBJS@
UNICODE_OBJS= @UNICODE_OBJS@
PYTHON= python$(EXE) PYTHON= python$(EXE)
BUILDPYTHON= python$(BUILDEXE) BUILDPYTHON= python$(BUILDEXE)
@ -320,8 +319,9 @@ OBJECT_OBJS= \
Objects/structseq.o \ Objects/structseq.o \
Objects/tupleobject.o \ Objects/tupleobject.o \
Objects/typeobject.o \ Objects/typeobject.o \
Objects/weakrefobject.o \ Objects/unicodeobject.o \
$(UNICODE_OBJS) Objects/unicodectype.o \
Objects/weakrefobject.o
########################################################################## ##########################################################################

View File

@ -7,7 +7,7 @@ Python News
What's New in Python 3.0a3? What's New in Python 3.0a3?
=========================== ===========================
*Release data: XX-XXX-2008* *Release date: XX-XXX-2008*
Core and Builtins Core and Builtins
----------------- -----------------
@ -46,6 +46,7 @@ Extension Modules
- Issue #1762972: Readded the reload() function as imp.reload() - Issue #1762972: Readded the reload() function as imp.reload()
Library Library
------- -------
@ -56,6 +57,13 @@ Library
- Issue #1578: Problems in win_getpass. - Issue #1578: Problems in win_getpass.
Build
-----
- Renamed --enable-unicode configure flag to --with-wide-unicode, since
Unicode strings can't be disabled anymore.
C API C API
----- -----
@ -143,12 +151,12 @@ Library
- Removed all types from the 'types' module that are easily accessable through - Removed all types from the 'types' module that are easily accessable through
builtins. builtins.
What's New in Python 3.0a1? What's New in Python 3.0a1?
========================== ==========================
*Release date: 31-Aug-2007* *Release date: 31-Aug-2007*
Core and Builtins Core and Builtins
----------------- -----------------

View File

@ -58,7 +58,6 @@
#define WITH_DOC_STRINGS 1 #define WITH_DOC_STRINGS 1
/* Unicode related */ /* Unicode related */
#define Py_USING_UNICODE 1
#define PY_UNICODE_TYPE wchar_t #define PY_UNICODE_TYPE wchar_t
#define Py_UNICODE_SIZE SIZEOF_SHORT #define Py_UNICODE_SIZE SIZEOF_SHORT

View File

@ -80,7 +80,6 @@
/* #define SIZEOF_LONG_LONG 8 */ /* Count of Bytes in a (long long) */ /* #define SIZEOF_LONG_LONG 8 */ /* Count of Bytes in a (long long) */
/* unicode definines */ /* unicode definines */
#define Py_USING_UNICODE
#define PY_UNICODE_TYPE wchar_t #define PY_UNICODE_TYPE wchar_t
#define Py_UNICODE_SIZE SIZEOF_SHORT #define Py_UNICODE_SIZE SIZEOF_SHORT

View File

@ -218,10 +218,7 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
assert(tok->cur - tok->buf < INT_MAX); assert(tok->cur - tok->buf < INT_MAX);
err_ret->offset = (int)(tok->cur - tok->buf); err_ret->offset = (int)(tok->cur - tok->buf);
len = tok->inp - tok->buf; len = tok->inp - tok->buf;
#ifdef Py_USING_UNICODE
text = PyTokenizer_RestoreEncoding(tok, len, &err_ret->offset); text = PyTokenizer_RestoreEncoding(tok, len, &err_ret->offset);
#endif
if (text == NULL) { if (text == NULL) {
text = (char *) PyObject_MALLOC(len + 1); text = (char *) PyObject_MALLOC(len + 1);
if (text != NULL) { if (text != NULL) {

106
configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh #! /bin/sh
# From configure.in Revision: 59625 . # From configure.in Revision: 59826 .
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for python 3.0. # Generated by GNU Autoconf 2.61 for python 3.0.
# #
@ -728,7 +728,6 @@ HAVE_GETHOSTBYNAME_R
HAVE_GETHOSTBYNAME HAVE_GETHOSTBYNAME
LIBM LIBM
LIBC LIBC
UNICODE_OBJS
THREADHEADERS THREADHEADERS
SRCDIRS SRCDIRS
LTLIBOBJS' LTLIBOBJS'
@ -1321,8 +1320,6 @@ Optional Features:
--enable-toolbox-glue disable/enable MacOSX glue code for extensions --enable-toolbox-glue disable/enable MacOSX glue code for extensions
--enable-ipv6 Enable ipv6 (with ipv4) support --enable-ipv6 Enable ipv6 (with ipv4) support
--disable-ipv6 Disable ipv6 support --disable-ipv6 Disable ipv6 support
--enable-unicode[=ucs[24]]
Enable Unicode strings (default is yes)
Optional Packages: Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@ -1349,6 +1346,7 @@ Optional Packages:
--with-fpectl enable SIGFPE catching --with-fpectl enable SIGFPE catching
--with-libm=STRING math library --with-libm=STRING math library
--with-libc=STRING C library --with-libc=STRING C library
--with-wide-unicode Use 4-byte Unicode characters (default is 2 bytes)
Some influential environment variables: Some influential environment variables:
CC C compiler command CC C compiler command
@ -21481,95 +21479,76 @@ fi
echo "${ECHO_T}$ac_cv_wchar_t_signed" >&6; } echo "${ECHO_T}$ac_cv_wchar_t_signed" >&6; }
fi fi
{ echo "$as_me:$LINENO: checking what type to use for unicode" >&5 { echo "$as_me:$LINENO: checking what type to use for str" >&5
echo $ECHO_N "checking what type to use for unicode... $ECHO_C" >&6; } echo $ECHO_N "checking what type to use for str... $ECHO_C" >&6; }
# Check whether --enable-unicode was given.
if test "${enable_unicode+set}" = set; then # Check whether --with-wide-unicode was given.
enableval=$enable_unicode; if test "${with_wide_unicode+set}" = set; then
withval=$with_wide_unicode;
if test "$withval" != no
then unicode_size="4"
else unicode_size="2"
fi
else else
enable_unicode=yes
fi
case "$have_ucs4_tcl" in
yes) unicode_size="4" ;;
*) unicode_size="2" ;;
esac
if test $enable_unicode = yes
then
# Without any arguments, Py_UNICODE defaults to two-byte mode
case "$have_ucs4_tcl" in
yes) enable_unicode="ucs4"
;;
*) enable_unicode="ucs2"
;;
esac
fi fi
case "$enable_unicode" in
ucs2) unicode_size="2"
cat >>confdefs.h <<\_ACEOF
#define Py_UNICODE_SIZE 2
_ACEOF
;; case "$unicode_size" in
ucs4) unicode_size="4" 4) cat >>confdefs.h <<\_ACEOF
cat >>confdefs.h <<\_ACEOF
#define Py_UNICODE_SIZE 4 #define Py_UNICODE_SIZE 4
_ACEOF _ACEOF
;;
;; *) cat >>confdefs.h <<\_ACEOF
#define Py_UNICODE_SIZE 2
_ACEOF
;;
esac esac
# wchar_t is only usable if it maps to an unsigned type
if test "$enable_unicode" = "no" if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
then
UNICODE_OBJS=""
{ echo "$as_me:$LINENO: result: not used" >&5
echo "${ECHO_T}not used" >&6; }
else
UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
cat >>confdefs.h <<\_ACEOF
#define Py_USING_UNICODE 1
_ACEOF
# wchar_t is only usable if it maps to an unsigned type
if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
-a "$ac_cv_wchar_t_signed" = "no" -a "$ac_cv_wchar_t_signed" = "no"
then then
PY_UNICODE_TYPE="wchar_t" PY_UNICODE_TYPE="wchar_t"
cat >>confdefs.h <<\_ACEOF cat >>confdefs.h <<\_ACEOF
#define HAVE_USABLE_WCHAR_T 1 #define HAVE_USABLE_WCHAR_T 1
_ACEOF _ACEOF
cat >>confdefs.h <<\_ACEOF cat >>confdefs.h <<\_ACEOF
#define PY_UNICODE_TYPE wchar_t #define PY_UNICODE_TYPE wchar_t
_ACEOF _ACEOF
elif test "$ac_cv_sizeof_short" = "$unicode_size" elif test "$ac_cv_sizeof_short" = "$unicode_size"
then then
PY_UNICODE_TYPE="unsigned short" PY_UNICODE_TYPE="unsigned short"
cat >>confdefs.h <<\_ACEOF cat >>confdefs.h <<\_ACEOF
#define PY_UNICODE_TYPE unsigned short #define PY_UNICODE_TYPE unsigned short
_ACEOF _ACEOF
elif test "$ac_cv_sizeof_long" = "$unicode_size" elif test "$ac_cv_sizeof_long" = "$unicode_size"
then then
PY_UNICODE_TYPE="unsigned long" PY_UNICODE_TYPE="unsigned long"
cat >>confdefs.h <<\_ACEOF cat >>confdefs.h <<\_ACEOF
#define PY_UNICODE_TYPE unsigned long #define PY_UNICODE_TYPE unsigned long
_ACEOF _ACEOF
else else
PY_UNICODE_TYPE="no type found" PY_UNICODE_TYPE="no type found"
fi
{ echo "$as_me:$LINENO: result: $PY_UNICODE_TYPE" >&5
echo "${ECHO_T}$PY_UNICODE_TYPE" >&6; }
fi fi
{ echo "$as_me:$LINENO: result: $PY_UNICODE_TYPE" >&5
echo "${ECHO_T}$PY_UNICODE_TYPE" >&6; }
# check for endianness # check for endianness
{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 { echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
@ -24432,13 +24411,12 @@ HAVE_GETHOSTBYNAME_R!$HAVE_GETHOSTBYNAME_R$ac_delim
HAVE_GETHOSTBYNAME!$HAVE_GETHOSTBYNAME$ac_delim HAVE_GETHOSTBYNAME!$HAVE_GETHOSTBYNAME$ac_delim
LIBM!$LIBM$ac_delim LIBM!$LIBM$ac_delim
LIBC!$LIBC$ac_delim LIBC!$LIBC$ac_delim
UNICODE_OBJS!$UNICODE_OBJS$ac_delim
THREADHEADERS!$THREADHEADERS$ac_delim THREADHEADERS!$THREADHEADERS$ac_delim
SRCDIRS!$SRCDIRS$ac_delim SRCDIRS!$SRCDIRS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF _ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 19; then if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 18; then
break break
elif $ac_last_try; then elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

View File

@ -3003,72 +3003,55 @@ then
ac_cv_wchar_t_signed=yes)]) ac_cv_wchar_t_signed=yes)])
AC_MSG_RESULT($ac_cv_wchar_t_signed) AC_MSG_RESULT($ac_cv_wchar_t_signed)
fi fi
AC_MSG_CHECKING(what type to use for unicode)
dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
AC_ARG_ENABLE(unicode,
AC_HELP_STRING(--enable-unicode@<:@=ucs@<:@24@:>@@:>@, Enable Unicode strings (default is yes)),
[],
[enable_unicode=yes])
if test $enable_unicode = yes AC_MSG_CHECKING(what type to use for str)
then AC_ARG_WITH(wide-unicode,
# Without any arguments, Py_UNICODE defaults to two-byte mode AC_HELP_STRING(--with-wide-unicode, Use 4-byte Unicode characters (default is 2 bytes)),
case "$have_ucs4_tcl" in [
yes) enable_unicode="ucs4" if test "$withval" != no
;; then unicode_size="4"
*) enable_unicode="ucs2" else unicode_size="2"
;;
esac
fi fi
],
[
case "$have_ucs4_tcl" in
yes) unicode_size="4" ;;
*) unicode_size="2" ;;
esac
])
AH_TEMPLATE(Py_UNICODE_SIZE, AH_TEMPLATE(Py_UNICODE_SIZE,
[Define as the size of the unicode type.]) [Define as the size of the unicode type.])
case "$enable_unicode" in case "$unicode_size" in
ucs2) unicode_size="2" 4) AC_DEFINE(Py_UNICODE_SIZE, 4) ;;
AC_DEFINE(Py_UNICODE_SIZE,2) *) AC_DEFINE(Py_UNICODE_SIZE, 2) ;;
;;
ucs4) unicode_size="4"
AC_DEFINE(Py_UNICODE_SIZE,4)
;;
esac esac
AH_TEMPLATE(PY_UNICODE_TYPE, AH_TEMPLATE(PY_UNICODE_TYPE,
[Define as the integral type used for Unicode representation.]) [Define as the integral type used for Unicode representation.])
AC_SUBST(UNICODE_OBJS) # wchar_t is only usable if it maps to an unsigned type
if test "$enable_unicode" = "no" if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
then
UNICODE_OBJS=""
AC_MSG_RESULT(not used)
else
UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
AC_DEFINE(Py_USING_UNICODE, 1,
[Define if you want to have a Unicode type.])
# wchar_t is only usable if it maps to an unsigned type
if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
-a "$ac_cv_wchar_t_signed" = "no" -a "$ac_cv_wchar_t_signed" = "no"
then then
PY_UNICODE_TYPE="wchar_t" PY_UNICODE_TYPE="wchar_t"
AC_DEFINE(HAVE_USABLE_WCHAR_T, 1, AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
[Define if you have a useable wchar_t type defined in wchar.h; useable [Define if you have a useable wchar_t type defined in wchar.h; useable
means wchar_t must be an unsigned type with at least 16 bits. (see means wchar_t must be an unsigned type with at least 16 bits. (see
Include/unicodeobject.h).]) Include/unicodeobject.h).])
AC_DEFINE(PY_UNICODE_TYPE,wchar_t) AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
elif test "$ac_cv_sizeof_short" = "$unicode_size" elif test "$ac_cv_sizeof_short" = "$unicode_size"
then then
PY_UNICODE_TYPE="unsigned short" PY_UNICODE_TYPE="unsigned short"
AC_DEFINE(PY_UNICODE_TYPE,unsigned short) AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
elif test "$ac_cv_sizeof_long" = "$unicode_size" elif test "$ac_cv_sizeof_long" = "$unicode_size"
then then
PY_UNICODE_TYPE="unsigned long" PY_UNICODE_TYPE="unsigned long"
AC_DEFINE(PY_UNICODE_TYPE,unsigned long) AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
else else
PY_UNICODE_TYPE="no type found" PY_UNICODE_TYPE="no type found"
fi
AC_MSG_RESULT($PY_UNICODE_TYPE)
fi fi
AC_MSG_RESULT($PY_UNICODE_TYPE)
# check for endianness # check for endianness
AC_C_BIGENDIAN AC_C_BIGENDIAN

View File

@ -821,9 +821,6 @@
/* Define as the size of the unicode type. */ /* Define as the size of the unicode type. */
#undef Py_UNICODE_SIZE #undef Py_UNICODE_SIZE
/* Define if you want to have a Unicode type. */
#undef Py_USING_UNICODE
/* Define as the return type of signal handlers (`int' or `void'). */ /* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE #undef RETSIGTYPE