summaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2001-06-26 22:22:37 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2001-06-26 22:22:37 (GMT)
commit0ba70cc3c893f70cc9deb09447277539d7625403 (patch)
treef26c28cc3ad9c594683c7c04e5b06786471d395c /configure.in
parentff1cc902fe80605fbc7d5fee8226e4c26832c5a9 (diff)
downloadcpython-0ba70cc3c893f70cc9deb09447277539d7625403.zip
cpython-0ba70cc3c893f70cc9deb09447277539d7625403.tar.gz
cpython-0ba70cc3c893f70cc9deb09447277539d7625403.tar.bz2
Support using UCS-4 as the Py_UNICODE type:
Add configure option --enable-unicode. Add config.h macros Py_USING_UNICODE, PY_UNICODE_TYPE, Py_UNICODE_SIZE, SIZEOF_WCHAR_T. Define Py_UCS2. Encode and decode large UTF-8 characters into single Py_UNICODE values for wide Unicode types; likewise for UTF-16. Remove test whether sizeof Py_UNICODE is two.
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in73
1 files changed, 54 insertions, 19 deletions
diff --git a/configure.in b/configure.in
index 2713336..80a8dfb 100644
--- a/configure.in
+++ b/configure.in
@@ -372,8 +372,8 @@ fi
OPT="$OPT -Dss_family=__ss_family -Dss_len=__ss_len"
AC_MSG_CHECKING([whether to enable ipv6])
AC_ARG_ENABLE(ipv6,
-[ --enable-ipv6 Enable ipv6 (with ipv4) support
- --disable-ipv6 Disable ipv6 support],
+[ --enable-ipv6 Enable ipv6 (with ipv4) support
+ --disable-ipv6 Disable ipv6 support],
[ case "$enableval" in
no)
AC_MSG_RESULT(no)
@@ -1578,23 +1578,58 @@ AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes",
wchar_h="no"
)
-# check for usable wchar_t
-usable_wchar_t="unkown"
-AC_MSG_CHECKING(for usable wchar_t)
-AC_TRY_RUN([
-#include "wchar.h"
-#include "wctype.h"
-main() {
- wchar_t s;
- if (sizeof(s) == 2)
- exit(0);
- else
- exit(1);
-}
-],
-AC_DEFINE(HAVE_USABLE_WCHAR_T) usable_wchar_t="yes",
-usable_wchar_t="no")
-AC_MSG_RESULT($usable_wchar_t)
+# determine wchar_t size
+if test "$wchar_h" = yes
+then
+ AC_CHECK_SIZEOF(wchar_t)
+fi
+
+AC_MSG_CHECKING(what type to use for unicode)
+AC_ARG_ENABLE(unicode,
+[ --enable-unicode[=ucs2,ucs4] Enable Unicode strings (default is yes)],,enable_unicode=yes)
+
+if test $enable_unicode = yes
+then
+ # Let Py_UNICODE size depend on wchar_t size
+ case "$ac_cv_sizeof_wchar_t" in
+ 2) enable_unicode="ucs2";;
+ 4) enable_unicode="ucs4";;
+ *) enable_unicode="ucs4";; # default to UCS-4
+ esac
+fi
+
+case "$enable_unicode" in
+ucs2) unicode_size="2"
+ AC_DEFINE(Py_UNICODE_SIZE,2)
+ ;;
+ucs4) unicode_size="4"
+ AC_DEFINE(Py_UNICODE_SIZE,4)
+ ;;
+esac
+
+if test "$enable_unicode" = "no"
+then
+ AC_MSG_RESULT(not used)
+else
+ AC_DEFINE(Py_USING_UNICODE)
+ if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
+ then
+ PY_UNICODE_TYPE="wchar_t"
+ AC_DEFINE(HAVE_USABLE_WCHAR_T)
+ AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
+ elif test "$ac_cv_sizeof_short" = "$unicode_size"
+ then
+ PY_UNICODE_TYPE="unsigned short"
+ AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
+ elif test "$ac_cv_sizeof_long" = "$unicode_size"
+ then
+ PY_UNICODE_TYPE="unsigned long"
+ AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
+ else
+ PY_UNICODE_TYPE="no type found"
+ fi
+ AC_MSG_RESULT($PY_UNICODE_TYPE)
+fi
# check for endianness
AC_C_BIGENDIAN