summaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
authorMarc-André Lemburg <mal@egenix.com>2003-09-22 11:14:40 (GMT)
committerMarc-André Lemburg <mal@egenix.com>2003-09-22 11:14:40 (GMT)
commitd7160f88455d9ff8d2c775ba7d52ca6f9907d90d (patch)
tree554601e3e8de19ab2ab5823eb5d973bcf157ad57 /configure.in
parent7e74384af5060e131675ef3c286ad98ed3db9128 (diff)
downloadcpython-d7160f88455d9ff8d2c775ba7d52ca6f9907d90d.zip
cpython-d7160f88455d9ff8d2c775ba7d52ca6f9907d90d.tar.gz
cpython-d7160f88455d9ff8d2c775ba7d52ca6f9907d90d.tar.bz2
Added test whether wchar_t is signed or not. A signed wchar_t is not usable as internal unicode type base for Py_UNICODE since the unicode implementation assumes an unsigned type.
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in26
1 files changed, 24 insertions, 2 deletions
diff --git a/configure.in b/configure.in
index b2deb65..d3760af 100644
--- a/configure.in
+++ b/configure.in
@@ -2689,6 +2689,25 @@ AC_TRY_COMPILE([
])
AC_MSG_RESULT($have_ucs4_tcl)
+# check whether wchar_t is signed or not
+if test "$wchar_h" = yes
+then
+ # check whether wchar_t is signed or not
+ AC_MSG_CHECKING(whether wchar_t is signed)
+ AC_CACHE_VAL(ac_cv_wchar_t_signed, [
+ AC_TRY_RUN([
+ #include <wchar.h>
+ int main()
+ {
+ exit((((wchar_t) -1) < ((wchar_t) 0)) ? 1 : 0);
+ }
+ ],
+ ac_cv_wchar_t_signed=yes,
+ ac_cv_wchar_t_signed=no,
+ ac_cv_wchar_t_signed=yes)])
+ AC_MSG_RESULT($ac_cv_wchar_t_signed)
+fi
+
AC_MSG_CHECKING(what type to use for unicode)
dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
AC_ARG_ENABLE(unicode,
@@ -2730,12 +2749,15 @@ else
UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
AC_DEFINE(Py_USING_UNICODE, 1,
[Define if you want to have a Unicode type.])
- if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
+
+ # 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"
then
PY_UNICODE_TYPE="wchar_t"
AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
[Define if you have a useable wchar_t type defined in wchar.h; useable
- means wchar_t must be 16-bit unsigned type. (see
+ means wchar_t must be an unsigned type with at least 16 bits. (see
Include/unicodeobject.h).])
AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
elif test "$ac_cv_sizeof_short" = "$unicode_size"