Bug 567134: use the -DYNAMICBASE linker option for Visual C++ 8 (2005) SP1

or later.  Adapted from the code in NSPR's configure.in.  r=Christophe.


git-svn-id: svn://10.0.0.236/trunk@261058 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
wtc%google.com
2010-08-18 01:16:12 +00:00
parent f44486fcc8
commit 97cb4383a3

View File

@@ -63,9 +63,36 @@ else
RC = rc.exe
MT = mt.exe
# Determine compiler version
CC_VERSION := $(shell $(CC) 2>&1 | sed -ne \
's|.* \([0-9]\+\.[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?\).*|\1|p')
# Change the dots to spaces.
_CC_VERSION_WORDS := $(subst ., ,$(CC_VERSION))
_CC_VMAJOR := $(word 1,$(_CC_VERSION_WORDS))
_CC_VMINOR := $(word 2,$(_CC_VERSION_WORDS))
_CC_RELEASE := $(word 3,$(_CC_VERSION_WORDS))
_CC_BUILD := $(word 4,$(_CC_VERSION_WORDS))
_MSC_VER = $(_CC_VMAJOR)$(_CC_VMINOR)
_MSC_VER_6 = 1200
_MSC_VER := $(shell $(CC) 2>&1 | sed -ne \
's/.*[^0-9.]\([0-9]\{1,\}\)\.\([0-9]\{1,\}\).*/\1\2/p' )
ifeq ($(_CC_VMAJOR),14)
# -DYNAMICBASE is only supported on VC8SP1 or newer,
# so be very specific here!
# VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
ifeq ($(_CC_RELEASE).$(_CC_BUILD),50727.42)
USE_DYNAMICBASE =
else
ifeq ($(_CC_RELEASE).$(_CC_BUILD),50727.762)
USE_DYNAMICBASE = 1
else
_LOSER := $(error Unknown compiler version $(CC_VERSION))
endif
endif
endif
# if $(_CC_VMAJOR) >= 15
# NOTE: 'sort' sorts the words in lexical order, so this test works
# only if $(_CC_VMAJOR) is two digits.
ifeq ($(firstword $(sort $(_CC_VMAJOR) 15)),15)
USE_DYNAMICBASE = 1
endif
endif
ifdef BUILD_TREE
@@ -123,6 +150,9 @@ else # !NS_USE_GCC
OS_DLLFLAGS += -PDB:NONE
endif
endif
ifdef USE_DYNAMICBASE
OS_DLLFLAGS += -DYNAMICBASE
endif
ifdef BUILD_OPT
OS_CFLAGS += -MD
ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))