summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrustyx <me@rustyx.org>2016-01-30 12:37:26 (GMT)
committerJason Evans <jasone@canonware.com>2016-02-20 18:50:24 (GMT)
commit46e0b2301c0e0ee71f5714d0cdf320ba2d027271 (patch)
tree7551ee8dbaa61fc7cd132fee6989a91d03b4bb35
parenteffaf7d40fba191386162e907195b0198c75866a (diff)
downloadjemalloc-46e0b2301c0e0ee71f5714d0cdf320ba2d027271.zip
jemalloc-46e0b2301c0e0ee71f5714d0cdf320ba2d027271.tar.gz
jemalloc-46e0b2301c0e0ee71f5714d0cdf320ba2d027271.tar.bz2
Detect LG_SIZEOF_PTR depending on MSVC platform target
-rw-r--r--configure.ac17
-rw-r--r--include/jemalloc/jemalloc_defs.h.in8
2 files changed, 19 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index 5232c8f..9a489d9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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"
fi
-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
+if test "x${je_cv_msvc}" = "xyes" ; then
+ LG_SIZEOF_PTR=LG_SIZEOF_PTR_WIN
+ AC_MSG_RESULT([Using a predefined value for sizeof(void *): 4 for 32-bit, 8 for 64-bit])
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
AC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR])
diff --git a/include/jemalloc/jemalloc_defs.h.in b/include/jemalloc/jemalloc_defs.h.in
index ab13c37..6d89435 100644
--- a/include/jemalloc/jemalloc_defs.h.in
+++ b/include/jemalloc/jemalloc_defs.h.in
@@ -33,5 +33,13 @@
*/
#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. */
#undef LG_SIZEOF_PTR