Detect LG_SIZEOF_PTR depending on MSVC platform target

This commit is contained in:
rustyx 2016-01-30 13:37:26 +01:00 committed by Jason Evans
parent effaf7d40f
commit 46e0b2301c
2 changed files with 19 additions and 6 deletions

View File

@ -166,13 +166,18 @@ if test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then
CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat/C99" CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat/C99"
fi fi
AC_CHECK_SIZEOF([void *]) if test "x${je_cv_msvc}" = "xyes" ; then
if test "x${ac_cv_sizeof_void_p}" = "x8" ; then LG_SIZEOF_PTR=LG_SIZEOF_PTR_WIN
LG_SIZEOF_PTR=3 AC_MSG_RESULT([Using a predefined value for sizeof(void *): 4 for 32-bit, 8 for 64-bit])
elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then
LG_SIZEOF_PTR=2
else else
AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}]) AC_CHECK_SIZEOF([void *])
if test "x${ac_cv_sizeof_void_p}" = "x8" ; then
LG_SIZEOF_PTR=3
elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then
LG_SIZEOF_PTR=2
else
AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}])
fi
fi fi
AC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR]) AC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR])

View File

@ -33,5 +33,13 @@
*/ */
#undef JEMALLOC_USE_CXX_THROW #undef JEMALLOC_USE_CXX_THROW
#ifdef _MSC_VER
# ifdef _WIN64
# define LG_SIZEOF_PTR_WIN 3
# else
# define LG_SIZEOF_PTR_WIN 2
# endif
#endif
/* sizeof(void *) == 2^LG_SIZEOF_PTR. */ /* sizeof(void *) == 2^LG_SIZEOF_PTR. */
#undef LG_SIZEOF_PTR #undef LG_SIZEOF_PTR