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

This commit is contained in:
Neil Rashbrook 2011-07-28 15:27:46 +01:00
Родитель 31a0c824b2
Коммит 5f82338b39
1 изменённых файлов: 32 добавлений и 40 удалений

Просмотреть файл

@ -7507,62 +7507,54 @@ 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
fi
dnl cpu check
case "${target_cpu}" in
i*86)
MOZ_CRT_CPU_ARCH=intel
;;
x86_64)
MOZ_CRT_CPU_ARCH=amd64
;;
*)
AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
;;
esac
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}])
if test -n "$WIN32_CRT_SRC_DIR" -a -d "$WIN32_CRT_SRC_DIR"; then
AC_MSG_RESULT([yes])
dnl cpu check
case "${target_cpu}" in
i*86)
MOZ_CRT_CPU_ARCH=intel
;;
x86_64)
MOZ_CRT_CPU_ARCH=amd64
;;
*)
AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
;;
esac
AC_SUBST(MOZ_CRT_CPU_ARCH)
WIN32_OLD_STYLE_JEMALLOC=1
AC_DEFINE(WIN32_OLD_STYLE_JEMALLOC)
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
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
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 -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
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 Also pass this to NSPR/NSS
DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
export DLLFLAGS