Author: rleigh
Date: Tue Jan 30 20:03:04 2018
New Revision: 1822691
URL: http://svn.apache.org/viewvc?rev=1822691&view=rev
Log:
autoconf: Add --enable-xmlch options to configure XMLCh
Added:
xerces/c/trunk/m4/xerces_xmlch_selection.m4
Modified:
xerces/c/trunk/configure.ac
xerces/c/trunk/doc/build.xml
Modified: xerces/c/trunk/configure.ac
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/configure.ac?rev=1822691&r1=1822690&r2=1822691&view=diff
==============================================================================
--- xerces/c/trunk/configure.ac (original)
+++ xerces/c/trunk/configure.ac Tue Jan 30 20:03:04 2018
@@ -329,45 +329,7 @@ AC_DEFINE_UNQUOTED([XERCES_PLATFORM_IMPO
AS_IF([test ! $ac_cv_cxx_have_bool],
AC_DEFINE([XERCES_NO_NATIVE_BOOL], 1, [Define if there is no native
bool support in this environment]))
-AS_IF([test $ac_cv_cxx_have_lstring],
- AC_DEFINE([XERCES_LSTRSUPPORT], 1, [Define if there is support for
L"widestring"]))
-
-AC_MSG_CHECKING([whether C++11 char16_t is available])
-AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[]],
- [[const char16_t *unicode = u"Test
ünÃcodè â ©";]])],
- [
- xerces_cv_type_xmlch=char16_t
- AC_MSG_RESULT([yes])
- ],
- [
- xerces_cv_type_xmlch=$xerces_cv_type_u16bit_int
- AC_MSG_RESULT([no])
- ]
- )
-AM_CONDITIONAL([XERCES_USE_CHAR16], [test "x$xerces_cv_type_xmlch" =
"xchar16_t"])
-
-if test "$xerces_cv_type_xmlch" != "char16_t"; then
-# fallback to check if the Windows API is defined as using wchar_t or
-# unsigned short; if it's wchar_t, we need to map XMLCh to be wchar_t
-# (this is safe because on Windows wchar_t is used to store UTF-16
-# codepoints, while it is not true on Unix)
- AC_MSG_CHECKING([whether the Windows SDK is available and using
wchar_t as wide string])
- AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <windows.h>
- wchar_t file[] =
L"dummy.file";]],
- [[DeleteFileW(file);]])],
- [
- xerces_cv_type_xmlch=wchar_t
- AC_MSG_RESULT([yes])
- AC_DEFINE_UNQUOTED([XERCES_INCLUDE_WCHAR_H], 1,
[Define to have Xerces_autoconf_config.hpp include wchar.h])
- ],
- [
- xerces_cv_type_xmlch=$xerces_cv_type_u16bit_int
- AC_MSG_RESULT([no])
- ]
- )
-fi
-
-AC_DEFINE_UNQUOTED([XERCES_XMLCH_T], [$xerces_cv_type_xmlch], [Define to the
16 bit type used to represent Xerces UTF-16 characters])
+XERCES_XMLCH_SELECTION
AC_MSG_CHECKING([whether the compiler chokes on a placement operator delete])
AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <stdlib.h>
@@ -543,3 +505,4 @@ AC_MSG_NOTICE([ Mutex Manager: $mutexmg
AC_MSG_NOTICE([ Transcoder: $transcoder])
AC_MSG_NOTICE([ NetAccessor: $netaccessor])
AC_MSG_NOTICE([ Message Loader: $msgloader])
+AC_MSG_NOTICE([ XMLCh Type: $xmlch])
Modified: xerces/c/trunk/doc/build.xml
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/doc/build.xml?rev=1822691&r1=1822690&r2=1822691&view=diff
==============================================================================
--- xerces/c/trunk/doc/build.xml (original)
+++ xerces/c/trunk/doc/build.xml Tue Jan 30 20:03:04 2018
@@ -404,6 +404,31 @@
</tr>
</table>
+ <p>XMLCh type (UTF-16 character type):</p>
+
+ <table>
+ <tr>
+ <th>Option</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td><code>--enable-xmlch-char16_t</code></td>
+ <td>use <code>char16_t</code> (requires a C++11 compiler)</td>
+ </tr>
+ <tr>
+ <td><code>--enable-xmlch-uint16_t</code></td>
+ <td>use <code>uint16_t</code> from
+ <code><cstdint></code> or
+ <code><stdint.h></code>, or another unsigned
+ 16-bit type such as <code>unsigned short</code> if
+ the standard types are unavailable</td>
+ </tr>
+ <tr>
+ <td><code>--enable-xmlch-wchar_t</code></td>
+ <td>use <code>wchar_t</code> (Windows only)</td>
+ </tr>
+ </table>
+
<p>Thread support is enabled by default and can be disabled with the
<code>--disable-threads</code> option.</p>
Added: xerces/c/trunk/m4/xerces_xmlch_selection.m4
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/m4/xerces_xmlch_selection.m4?rev=1822691&view=auto
==============================================================================
--- xerces/c/trunk/m4/xerces_xmlch_selection.m4 (added)
+++ xerces/c/trunk/m4/xerces_xmlch_selection.m4 Tue Jan 30 20:03:04 2018
@@ -0,0 +1,148 @@
+dnl @synopsis XERCES_XMLCH_SELECTION
+dnl
+dnl Determines the which XMLCh type to use
+dnl
+dnl @category C
+dnl @author Roger Leigh
+dnl @version 2018-01-23
+dnl @license AllPermissive
+dnl
+dnl $Id$
+
+AC_DEFUN([XERCES_XMLCH_SELECTION],
+ [
+ xmlch_list=
+
+ AS_IF([test $ac_cv_cxx_have_lstring],
+ AC_DEFINE([XERCES_LSTRSUPPORT], 1, [Define if there is support for
L"widestring"]))
+
+ ######################################################
+ # Test for availability of each XML character type on this host.
+ # For each type that's available, and hasn't been disabled, add it to our
list.
+ # If the type has been explicitly "enable"d, then vote for it strongly,
+ # in upper case.
+ ######################################################
+
+ char16_t_available=false
+ AC_MSG_CHECKING([whether C++11 char16_t is available])
+ AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[]],
+ [[const char16_t *unicode = u"Test
ünÃcodè â ©";]])],
+ [char16_t_available=yes
+ AC_MSG_RESULT([yes])],
+ [char16_t_available=no
+ AC_MSG_RESULT([no])]
+ )
+ AC_MSG_CHECKING([whether we can support char16_t XMLCh])
+ list_add=
+ AS_IF([test x"$char16_t_available" != x"no"], [
+ AC_ARG_ENABLE([xmlch-char16_t],
+ AS_HELP_STRING([--enable-xmlch-char16_t],
+ [Enable char16_t XMLCh]),
+ [AS_IF([test x"$enableval" = xyes],
+ [list_add=CHAR16_T])],
+ [list_add=char16_t])
+ ])
+ AS_IF([test x"$list_add" != x],
+ [xmlch_list="$xmlch_list -$list_add-"; AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)]
+ )
+
+ # Check if the Windows API is defined as using wchar_t or
+ # unsigned short; if it's wchar_t, we need to map XMLCh to be wchar_t
+ # (this is safe because on Windows wchar_t is used to store UTF-16
+ # codepoints, while it is not true on Unix)
+ AC_MSG_CHECKING([whether the Windows SDK is available and using wchar_t as
wide string])
+ AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <windows.h>
+ wchar_t file[] = L"dummy.file";]],
+ [[DeleteFileW(file);]])],
+ [wchar_t_available=yes
+ AC_MSG_RESULT([yes])],
+ [wchar_t_available=no
+ AC_MSG_RESULT([no])]
+ )
+ AC_MSG_CHECKING([whether we can support wchar_t XMLCh])
+ list_add=
+ AS_IF([test x"$wchar_t_available" = xyes],
+ [AC_ARG_ENABLE([xmlch-wchar_t],
+ AS_HELP_STRING([--enable-xmlch-wchar_t],
+ [Enable wchar_t XMLCh]),
+ [AS_IF([test x"$enableval" = xyes],
+ [list_add=WCHAR_T])],
+ [list_add=wchar_t])
+ ])
+ AS_IF([test x"$list_add" != x],
+ [xmlch_list="$xmlch_list -$list_add-"; AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)]
+ )
+
+ AC_MSG_CHECKING([whether we can support uint16_t XMLCh])
+ list_add=
+ AC_ARG_ENABLE([xmlch-uint16_t],
+ AS_HELP_STRING([--enable-xmlch-uint16_t],
+ [Enable uint16_t XMLCh]),
+ [AS_IF([test x"$enableval" = xyes],
+ [list_add=UINT16_T])],
+ [list_add=uint16_t])
+ AS_IF([test x"$list_add" != x],
+ [xmlch_list="$xmlch_list -$list_add-"; AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)]
+ )
+
+ ######################################################
+ # Determine which XMLCh type to use.
+ #
+ # We do this in two passes. Types that have been enabled with "yes",
+ # and which start out in upper case, get the top priority on the first
pass.
+ # On the second pass, we consider those which are simply available, but
+ # which were not "disable"d (these won't even be in our list).
+ ######################################################
+ xmlch=
+ az_lower=abcdefghijklmnopqrstuvwxyz
+ az_upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
+ AC_MSG_CHECKING([for which XMLCh type to use (choices:$xmlch_list)])
+ for i in 1 2; do
+ # Swap upper/lower case in the xmlch_list. Cannot use tr ranges
+ # because of the portability issues.
+ #
+ xmlch_list=`echo $xmlch_list | tr "$az_lower$az_upper"
"$az_upper$az_lower"`
+
+ # Check for each xmlch, in implicit rank order
+ case $xmlch_list in
+ *-char16_t-*)
+ xmlch=char16_t
+ xmlch_type=char16_t
+ break
+ ;;
+
+ *-wchar_t-*)
+ xmlch=wchar_t
+ xmlch_type=wchar_t
+ break
+ ;;
+
+ *-uint16_t-*)
+ xmlch=uint16_t
+ xmlch_type=$xerces_cv_type_u16bit_int
+ break
+ ;;
+
+ *)
+ AS_IF([test $i -eq 2], [
+ xmlch=uint16_t
+ xmlch_type=$xerces_cv_type_u16bit_int
+ AC_MSG_RESULT([none available; falling back to uint16_t])
+ ]
+ )
+ ;;
+
+ esac
+ done
+
+ if test x"$xmlch" != x; then
+ AC_MSG_RESULT($xmlch)
+ fi
+
+ AM_CONDITIONAL([XERCES_USE_CHAR16], [test "x$xmlch" = "xchar16_t"])
+ AC_DEFINE_UNQUOTED([XERCES_XMLCH_T], [$xmlch_type], [Define to the 16 bit
type used to represent Xerces UTF-16 characters])
+ ]
+)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]