You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by jb...@apache.org on 2005/06/07 17:35:39 UTC
svn commit: r188798 - in /xerces/c/branches/jberry/3.0-unstable:
configure.ac m4/xerces_int_types.m4 m4/xerces_type_16bit_int.m4
m4/xerces_type_32bit_int.m4 src/xercesc/util/Xerces_autoconf_config.hpp.in
Author: jberry
Date: Tue Jun 7 08:35:37 2005
New Revision: 188798
URL: http://svn.apache.org/viewcvs?rev=188798&view=rev
Log:
Make some changes in order to better support multi-architecture binaries.
To accomplish this, we need to be able to configure once, and compile multiple
times (once for each architecture). So our checks in configure should, ideally,
be environment-specific, rather than architecture-specific.
In line with this, I modified tests for the integer type selection to look
first for standard types defined by the compiler/environment that give us the
information we need. We first look for (and use, if possible) uint16_t,
for instance, rather than checking whether the size of an integer is 2 bytes.
So as long as the compiler environment knows how to supply the appropriate type,
we don't care that an integer might be 2 bytes on one architecture, and 4 in
another. We can accomodate the build of a mixed architecture binary that might
include both. (Theoretically...)
Added:
xerces/c/branches/jberry/3.0-unstable/m4/xerces_int_types.m4 (with props)
Removed:
xerces/c/branches/jberry/3.0-unstable/m4/xerces_type_16bit_int.m4
xerces/c/branches/jberry/3.0-unstable/m4/xerces_type_32bit_int.m4
Modified:
xerces/c/branches/jberry/3.0-unstable/configure.ac
xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/Xerces_autoconf_config.hpp.in
Modified: xerces/c/branches/jberry/3.0-unstable/configure.ac
URL: http://svn.apache.org/viewcvs/xerces/c/branches/jberry/3.0-unstable/configure.ac?rev=188798&r1=188797&r2=188798&view=diff
==============================================================================
--- xerces/c/branches/jberry/3.0-unstable/configure.ac (original)
+++ xerces/c/branches/jberry/3.0-unstable/configure.ac Tue Jun 7 08:35:37 2005
@@ -54,7 +54,7 @@
AC_HEADER_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h inttypes.h langinfo.h limits.h locale.h \
- memory.h netdb.h netinet/in.h nl_types.h stddef.h stdlib.h \
+ memory.h netdb.h netinet/in.h nl_types.h stddef.h stdint.h stdlib.h \
string.h strings.h \
sys/param.h sys/socket.h sys/time.h sys/timeb.h \
unistd.h wchar.h wctype.h \
@@ -68,14 +68,15 @@
AC_C_VOLATILE
AC_C_BIGENDIAN
-AC_TYPE_OFF_T
-AC_TYPE_SIZE_T
-XERCES_TYPE_16BIT_INT
-XERCES_TYPE_32BIT_INT
AC_CHECK_SIZEOF(wchar_t)
AC_CHECK_TYPE(size_t)
AC_CHECK_TYPE(ssize_t)
+AC_TYPE_OFF_T
+AC_TYPE_SIZE_T
+
+XERCES_INT_TYPES
+
AC_CXX_HAVE_BOOL
AC_CXX_HAVE_NAMESPACES
AC_CXX_HAVE_STD_NAMESPACE
@@ -161,6 +162,8 @@
AS_IF([test x$ac_cv_header_sys_types_h = xyes],
AC_DEFINE([XERCES_HAVE_SYS_TYPES_H], 1, [Define to 1 if we have sys/types.h]))
+AS_IF([test x$ac_cv_header_stdint_h = xyes],
+ AC_DEFINE([XERCES_HAVE_STDINT_H], 1, [Define to 1 if we have stdint.h]))
case $host in
*-*-msdos* | *-*-mingw32* | *-*-cygwin* | *-*-windows* )
@@ -181,12 +184,7 @@
AS_IF([test $ac_cv_cxx_have_lstring],
AC_DEFINE([XERCES_LSTRSUPPORT], 1, [Define if there is support for L"widestring"]))
-AC_DEFINE_UNQUOTED([XERCES_16BIT_INT], $xerces_cv_type_16bit_int, [An appropriate 16 bit integer type])
-AC_DEFINE_UNQUOTED([XERCES_32BIT_INT], $xerces_cv_type_32bit_int, [An appropriate 32 bit integer type])
-
-AS_IF([test $ac_cv_sizeof_wchar_t -eq 2],
- AC_DEFINE([XERCES_XMLCH_T], [wchar_t], [Define to the 16 bit type used to represent Xerces UTF-16 characters]),
- AC_DEFINE_UNQUOTED([XERCES_XMLCH_T], [unsigned $xerces_cv_type_16bit_int], [Define to the 16 bit type used to represent Xerces UTF-16 characters]))
+AC_DEFINE_UNQUOTED([XERCES_XMLCH_T], [$xerces_cv_type_u16bit_int], [Define to the 16 bit type used to represent Xerces UTF-16 characters])
AS_IF([test x$ac_cv_type_size_t = xyes],
AC_DEFINE([XERCES_SIZE_T], [size_t], [Define as the appropriate size_t type]),
Added: xerces/c/branches/jberry/3.0-unstable/m4/xerces_int_types.m4
URL: http://svn.apache.org/viewcvs/xerces/c/branches/jberry/3.0-unstable/m4/xerces_int_types.m4?rev=188798&view=auto
==============================================================================
--- xerces/c/branches/jberry/3.0-unstable/m4/xerces_int_types.m4 (added)
+++ xerces/c/branches/jberry/3.0-unstable/m4/xerces_int_types.m4 Tue Jun 7 08:35:37 2005
@@ -0,0 +1,99 @@
+dnl @synopsis XERCES_INT_TYPES
+dnl
+dnl Determines what int types to use for various
+dnl Xerces standard integer types.
+dnl
+dnl @category C
+dnl @author James Berry
+dnl @version 2005-06-07
+dnl @license AllPermissive
+dnl
+dnl $Id$
+
+AC_DEFUN([XERCES_INT_TYPES],
+ [
+ AC_CHECK_HEADERS([stdint.h])
+ AC_CHECK_SIZEOF(short)
+ AC_CHECK_SIZEOF(int)
+ AC_CHECK_SIZEOF(long)
+ AC_CHECK_TYPE(int16_t)
+ AC_CHECK_TYPE(int32_t)
+ AC_CHECK_TYPE(uint16_t)
+ AC_CHECK_TYPE(uint32_t)
+
+ #
+ # Select a signed 16 bit integer type
+ #
+ AC_CACHE_CHECK([for an appropriate signed 16 bit integer type], [xerces_cv_type_s16bit_int], [
+ AS_IF([test x$ac_cv_header_stdint_h = xyes && test x$ac_cv_type_int16_t = xyes],
+ [xerces_cv_type_s16bit_int=int16_t],
+ [
+ if test $ac_cv_sizeof_int -eq 2; then
+ xerces_cv_type_s16bit_int=int
+ elif test $ac_cv_sizeof_short -eq 2; then
+ xerces_cv_type_s16bit_int=short
+ else
+ AC_MSG_ERROR([Couldn't find a signed 16 bit int type])
+ fi
+ ])
+ ])
+
+ #
+ # Select an unsigned 16 bit integer type
+ #
+ AC_CACHE_CHECK([for an appropriate unsigned 16 bit integer type], [xerces_cv_type_u16bit_int], [
+ AS_IF([test x$ac_cv_header_stdint_h = xyes && test x$ac_cv_type_uint16_t = xyes],
+ [xerces_cv_type_u16bit_int=uint16_t],
+ [
+ if test $ac_cv_sizeof_int -eq 2; then
+ xerces_cv_type_s16bit_int="unsigned int"
+ elif test $ac_cv_sizeof_short -eq 2; then
+ xerces_cv_type_s16bit_int="unsigned short"
+ else
+ AC_MSG_ERROR([Couldn't find an unsigned 16 bit int type])
+ fi
+ ])
+ ])
+
+
+ #
+ # Select a signed 32 bit integer type
+ #
+ AC_CACHE_CHECK([for an appropriate signed 32 bit integer type], [xerces_cv_type_s32bit_int], [
+ AS_IF([test x$ac_cv_header_stdint_h = xyes && test x$ac_cv_type_int32_t = xyes],
+ [xerces_cv_type_s32bit_int=int32_t],
+ [
+ if test $ac_cv_sizeof_int -eq 4; then
+ xerces_cv_type_s32bit_int=int
+ elif test $ac_cv_sizeof_long -eq 4; then
+ xerces_cv_type_s32bit_int=long
+ else
+ AC_MSG_ERROR([Couldn't find a signed 32 bit int type])
+ fi
+ ])
+ ])
+
+ #
+ # Select an unsigned 32 bit integer type
+ #
+ AC_CACHE_CHECK([for an appropriate unsigned 32 bit integer type], [xerces_cv_type_u32bit_int], [
+ AS_IF([test x$ac_cv_header_stdint_h = xyes && test x$ac_cv_type_uint32_t = xyes],
+ [xerces_cv_type_u32bit_int=uint32_t],
+ [
+ if test $ac_cv_sizeof_int -eq 4; then
+ xerces_cv_type_s32bit_int="unsigned int"
+ elif test $ac_cv_sizeof_long -eq 4; then
+ xerces_cv_type_s32bit_int="unsigned long"
+ else
+ AC_MSG_ERROR([Couldn't find an unsigned 32 bit int type])
+ fi
+ ])
+ ])
+
+ AC_DEFINE_UNQUOTED([XERCES_S16BIT_INT], $xerces_cv_type_s16bit_int, [An appropriate signed 16 bit integer type])
+ AC_DEFINE_UNQUOTED([XERCES_U16BIT_INT], $xerces_cv_type_u16bit_int, [An appropriate unsigned 16 bit integer type])
+ AC_DEFINE_UNQUOTED([XERCES_S32BIT_INT], $xerces_cv_type_s32bit_int, [An appropriate signed 32 bit integer type])
+ AC_DEFINE_UNQUOTED([XERCES_U32BIT_INT], $xerces_cv_type_u32bit_int, [An appropriate unsigned 32 bit integer type])
+ ]
+)
+
Propchange: xerces/c/branches/jberry/3.0-unstable/m4/xerces_int_types.m4
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/c/branches/jberry/3.0-unstable/m4/xerces_int_types.m4
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/Xerces_autoconf_config.hpp.in
URL: http://svn.apache.org/viewcvs/xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/Xerces_autoconf_config.hpp.in?rev=188798&r1=188797&r2=188798&view=diff
==============================================================================
--- xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/Xerces_autoconf_config.hpp.in (original)
+++ xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/Xerces_autoconf_config.hpp.in Tue Jun 7 08:35:37 2005
@@ -45,9 +45,12 @@
// ---------------------------------------------------------------------------
#undef XERCES_AUTOCONF
#undef XERCES_HAVE_SYS_TYPES_H
+#undef XERCES_HAVE_STDINT_H
-#undef XERCES_16BIT_INT
-#undef XERCES_32BIT_INT
+#undef XERCES_S16BIT_INT
+#undef XERCES_S32BIT_INT
+#undef XERCES_U16BIT_INT
+#undef XERCES_U32BIT_INT
#undef XERCES_XMLCH_T
#undef XERCES_SIZE_T
#undef XERCES_SSIZE_T
@@ -62,9 +65,11 @@
#undef XERCES_PLATFORM_IMPORT
// ---------------------------------------------------------------------------
-// Must include sys/types.h if we're going to typedef to size_t below,
-// so include sys/types.h if it's available.
+// Include standard headers, if available, that we may rely on below.
// ---------------------------------------------------------------------------
+#if XERCES_HAVE_STDINT_H
+# include <stdint.h>
+#endif
#if XERCES_HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
@@ -84,18 +89,18 @@
// ---------------------------------------------------------------------------
// Define unsigned 16 and 32 bit integers
// ---------------------------------------------------------------------------
-typedef unsigned XERCES_16BIT_INT XMLUInt16;
-typedef unsigned XERCES_32BIT_INT XMLUInt32;
+typedef XERCES_U16BIT_INT XMLUInt16;
+typedef XERCES_U32BIT_INT XMLUInt32;
// ---------------------------------------------------------------------------
// Define signed 32 bit integers
// ---------------------------------------------------------------------------
-typedef XERCES_32BIT_INT XMLInt32;
+typedef XERCES_S32BIT_INT XMLInt32;
// ---------------------------------------------------------------------------
// XMLFilePos is the type used to represent a file position.
// ---------------------------------------------------------------------------
-typedef unsigned XERCES_32BIT_INT XMLFilePos;
+typedef XERCES_U32BIT_INT XMLFilePos;
#define PROJ_XMLUTIL
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org