diff --git a/moo/configure b/moo/configure index 0ad318f..b4ccea9 100755 --- a/moo/configure +++ b/moo/configure @@ -1504,8 +1504,8 @@ Optional Features: --enable-ltdl-install install libltdl --enable-debug build the library in the debug mode (default. no) --enable-unicode Use the unicode character type as the default - character type. one of yes, no, ucs2, ucs4 (default. - yes) + character type. one of yes, no, yes:2, yes:4, no:2, + no:4 (default. yes) --enable-cxx build the library for C++ if a C++ compiler is available (default. yes) --enable-dynamic-module enable dynamic module capability(default. yes) @@ -22530,20 +22530,43 @@ else fi -if test "${enable_unicode}" = "yes" +if test "${enable_unicode}" = "yes:4" then +$as_echo "#define MOO_UNICODE_SIZE 4" >>confdefs.h + + $as_echo "#define MOO_ENABLE_UNICODE 1" >>confdefs.h -elif test "${enable_unicode}" = "ucs2" +elif test "${enable_unicode}" = "yes:2" then -$as_echo "#define MOO_ENABLE_UNICODE 2" >>confdefs.h +$as_echo "#define MOO_UNICODE_SIZE 2" >>confdefs.h -elif test "${enable_unicode}" = "ucs4" + +$as_echo "#define MOO_ENABLE_UNICODE 1" >>confdefs.h + +elif test "${enable_unicode}" = "yes" then -$as_echo "#define MOO_ENABLE_UNICODE 4" >>confdefs.h +$as_echo "#define MOO_UNICODE_SIZE 1" >>confdefs.h + + +$as_echo "#define MOO_ENABLE_UNICODE 1" >>confdefs.h + +elif test "${enable_unicode}" = "no:4" +then + +$as_echo "#define MOO_UNICODE_SIZE 4" >>confdefs.h + +elif test "${enable_unicode}" = "no:2" +then + +$as_echo "#define MOO_UNICODE_SIZE 2" >>confdefs.h + +else + +$as_echo "#define MOO_UNICODE_SIZE 1" >>confdefs.h fi diff --git a/moo/configure.ac b/moo/configure.ac index e101640..47304b2 100644 --- a/moo/configure.ac +++ b/moo/configure.ac @@ -645,20 +645,31 @@ else AC_SUBST(BUILD_MODE, "release") fi -AC_ARG_ENABLE([unicode], - [AS_HELP_STRING([--enable-unicode],[Use the unicode character type as the default character type. one of yes, no, ucs2, ucs4 (default. yes)])], +AC_ARG_ENABLE([unicode], + [AS_HELP_STRING([--enable-unicode],[Use the unicode character type as the default character type. one of yes, no, yes:2, yes:4, no:2, no:4 (default. yes)])], enable_unicode=$enableval, enable_unicode=yes ) -if test "${enable_unicode}" = "yes" +if test "${enable_unicode}" = "yes:4" then + AC_DEFINE([MOO_UNICODE_SIZE],[4],[Unicode character type size]) AC_DEFINE([MOO_ENABLE_UNICODE],[1],[Use the unicode character type as the default character type]) -elif test "${enable_unicode}" = "ucs2" +elif test "${enable_unicode}" = "yes:2" then - AC_DEFINE([MOO_ENABLE_UNICODE],[2],[Use the unicode character type as the default character type]) -elif test "${enable_unicode}" = "ucs4" + AC_DEFINE([MOO_UNICODE_SIZE],[2],[Unicode character type size]) + AC_DEFINE([MOO_ENABLE_UNICODE],[1],[Use the unicode character type as the default character type]) +elif test "${enable_unicode}" = "yes" then - AC_DEFINE([MOO_ENABLE_UNICODE],[4],[Use the unicode character type as the default character type]) + AC_DEFINE([MOO_UNICODE_SIZE],[1],[Unicode character type size]) + AC_DEFINE([MOO_ENABLE_UNICODE],[1],[Use the unicode character type as the default character type]) +elif test "${enable_unicode}" = "no:4" +then + AC_DEFINE([MOO_UNICODE_SIZE],[4],[Unicode character type size]) +elif test "${enable_unicode}" = "no:2" +then + AC_DEFINE([MOO_UNICODE_SIZE],[2],[Unicode character type size]) +else + AC_DEFINE([MOO_UNICODE_SIZE],[1],[Unicode character type size]) fi AC_ARG_ENABLE([cxx], diff --git a/moo/lib/moo-cfg.h.in b/moo/lib/moo-cfg.h.in index ab74a1e..a8923b3 100644 --- a/moo/lib/moo-cfg.h.in +++ b/moo/lib/moo-cfg.h.in @@ -542,6 +542,9 @@ /* Define if socklen_t is signed */ #undef MOO_SOCKLEN_T_IS_SIGNED +/* Unicode character type size */ +#undef MOO_UNICODE_SIZE + /* Define if dlsym() requires a leading underscore in symbol names. */ #undef NEED_USCORE diff --git a/moo/lib/moo-cmn.h b/moo/lib/moo-cmn.h index 092e5c8..6c7fde7 100644 --- a/moo/lib/moo-cmn.h +++ b/moo/lib/moo-cmn.h @@ -280,7 +280,7 @@ typedef unsigned char moo_bchu_t; /* unsigned version of moo_bch_t for #define MOO_SIZEOF_BCH_T MOO_SIZEOF_CHAR #define MOO_SIZEOF_BCI_T MOO_SIZEOF_INT -#if defined(MOO_ENABLE_UNICODE) && (MOO_ENABLE_UNICODE == 4) +#if defined(MOO_UNICODE_SIZE) && (MOO_UNICODE_SIZE >= 4) # if defined(__GNUC__) && defined(__CHAR32_TYPE__) typedef __CHAR32_TYPE__ moo_uch_t; # else