From 7519ae9fe27737653894c7f60112091b14628cae Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 17 Nov 2006 11:38:15 +0000 Subject: [PATCH] proper MSVS_VERSION check git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4817 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/Math/SConscript | 2 +- SCons/Config/ms | 60 ++++++++++++++++++++--------------------- 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/Contrib/Math/SConscript b/Contrib/Math/SConscript index 8697aa58..5b6b306b 100644 --- a/Contrib/Math/SConscript +++ b/Contrib/Math/SConscript @@ -23,7 +23,7 @@ docs = Split(""" Import('BuildPlugin env') -if env['MSVS_VERSION'] >= 8.0: +if float(env['MSVS_VERSION']) >= 8.0: files += ['Source/mathcrtmt.lib'] else: files += ['Source/mathcrt.lib'] diff --git a/SCons/Config/ms b/SCons/Config/ms index e5590a07..e71b07fb 100644 --- a/SCons/Config/ms +++ b/SCons/Config/ms @@ -12,7 +12,7 @@ defenv['CPP_FLAG'] = '/TP' defenv['CPP_REQUIRES_STDLIB'] = 0 defenv['SUBSYS_CON'] = '/subsystem:console' -if defenv['MSVS_VERSION'] >= 8.0: +if float(defenv['MSVS_VERSION']) >= 8.0: defenv['EXCEPTION_FLAG'] = '/EHsc' defenv.Append(CCFLAGS = '/GS-') else: @@ -31,42 +31,40 @@ if defenv['DEBUG']: # if stl usage causes link failure, copy the good libcp.lib # from one of the other lib folders and use it instead. -if not defenv['MSVS_VERSION'] >= 8.0: +confenv = defenv.Clone() +conf = confenv.Configure() - confenv = defenv.Clone() - conf = confenv.Configure() +libcptest = """ +#include +int main() { + // %s + std::ofstream header("test", std::ofstream::out); + return 0; +} +""" - libcptest = """ - #include - int main() { - // %s - std::ofstream header("test", std::ofstream::out); - return 0; - } - """ +conf.env.PrependENVPath('LIB', Dir('#/.sconf_temp').abspath) +conf.env.Append(CCFLAGS = ['$EXCEPTION_FLAG']) - conf.env.PrependENVPath('LIB', Dir('#/.sconf_temp').abspath) - conf.env.Append(CCFLAGS = ['$EXCEPTION_FLAG']) +if not conf.TryLink(libcptest % 'no change', '.cpp'): + import os, shutil - if not conf.TryLink(libcptest % 'no change', '.cpp'): - import os, shutil + libdirs = defenv['ENV']['LIB'].split(os.pathsep) - libdirs = defenv['ENV']['LIB'].split(os.pathsep) + for libdir in libdirs: + try: + libcp = r'%s\libcp.lib' % libdir + shutil.copy(libcp, Dir('#/.sconf_temp').abspath) + if conf.TryLink(libcptest % (r'using %s' % libcp), '.cpp'): + defenv.PrependENVPath('LIB', Dir('#/.sconf_temp').abspath) + break + except IOError: + continue + else: + print "*** Couldn't find a good version of libcp.lib" + Exit(2) - for libdir in libdirs: - try: - libcp = r'%s\libcp.lib' % libdir - shutil.copy(libcp, Dir('#/.sconf_temp').abspath) - if conf.TryLink(libcptest % (r'using %s' % libcp), '.cpp'): - defenv.PrependENVPath('LIB', Dir('#/.sconf_temp').abspath) - break - except IOError: - continue - else: - print "*** Couldn't find a good version of libcp.lib" - Exit(2) - - conf.Finish() +conf.Finish() ### stub environment