Bug 673197 Enable jemalloc on VC8/9 express r=khuey

This commit is contained in:
Neil Rashbrook 2011-07-27 20:23:43 +01:00
parent 9f41868df7
commit 57fcf13979

View File

@ -7507,22 +7507,38 @@ else
;;
*-mingw*)
AC_DEFINE(MOZ_MEMORY_WINDOWS)
dnl This is sort of awful. Will revisit if we add support for more versions
AC_MSG_CHECKING([for VC2005/2008++ CRT source])
if test "$CC_VERSION" == "14.00.50727.762" -o "$CC_VERSION" == "15.00.30729.01"; then
WIN32_OLD_STYLE_JEMALLOC=1
AC_DEFINE(WIN32_OLD_STYLE_JEMALLOC)
elif test "$CC_VERSION" == "16.00.30319.01" -o "$CC_VERSION" == "16.00.40219.01"; then
WIN32_NEW_STYLE_JEMALLOC=1
AC_DEFINE(WIN32_NEW_STYLE_JEMALLOC)
else
AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 or 2010 currently.])
fi
if test -z "$WIN32_CRT_SRC_DIR" -a -n "$WIN32_OLD_STYLE_JEMALLOC"; then
if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
AC_MSG_ERROR([When building jemalloc, set WIN32_CRT_SRC_DIR to the path to the Visual C++ CRT source (usually VCINSTALLDIR\crt\src, but VCINSTALLDIR is not set, so I can't autodetect it for you).])
else
if test -z "$WIN32_CRT_SRC_DIR" -a -n "$VCINSTALLDIR"; then
WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
fi
if test -n "$WIN32_CRT_SRC_DIR" -a -d "$WIN32_CRT_SRC_DIR"; then
AC_MSG_RESULT([yes])
WIN32_OLD_STYLE_JEMALLOC=1
WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
_objdir_win=`pwd -W`
WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$MOZ_CRT_CPU_ARCH"
MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
fi
fi
if test -z "$WIN32_OLD_STYLE_JEMALLOC"; then
AC_MSG_RESULT([no])
WIN32_NEW_STYLE_JEMALLOC=1
AC_DEFINE(WIN32_NEW_STYLE_JEMALLOC)
if test -z "$MOZ_DEBUG"; then
WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
else
WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
fi
dnl Look for a broken crtdll.obj
WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
if grep -q __imp__\{0,1\}free crtdll.obj; then
MOZ_MEMORY_LDFLAGS='-MANIFEST:NO -LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
else
MOZ_MEMORY_LDFLAGS='$(DIST)/../memory/jemalloc/jemalloc.lib'
fi
rm crtdll.obj
fi
dnl cpu check
case "${target_cpu}" in
@ -7539,30 +7555,6 @@ else
AC_SUBST(MOZ_CRT_CPU_ARCH)
if test -n "$WIN32_OLD_STYLE_JEMALLOC"; then
if test ! -d "$WIN32_CRT_SRC_DIR"; then
AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
fi
WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
_objdir_win=`pwd -W`
WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$MOZ_CRT_CPU_ARCH"
MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
else
if test -z "$MOZ_DEBUG"; then
WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
else
WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
fi
dnl Look for a broken crtdll.obj
WIN32_CRTDLL_FULLPATH=`lib -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
lib -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
if grep -q '__imp__\{0,1\}free' crtdll.obj; then
MOZ_MEMORY_LDFLAGS='-MANIFEST:NO -LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
else
MOZ_MEMORY_LDFLAGS='$(DIST)/../memory/jemalloc/jemalloc.lib'
fi
rm crtdll.obj
fi
dnl Also pass this to NSPR/NSS
DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
export DLLFLAGS