From 14633b1da0d8c60a0a2796cac87e68db67146f8c Mon Sep 17 00:00:00 2001 From: cournape Date: Wed, 3 Sep 2008 08:30:17 +0000 Subject: [PATCH] Add CheckCXX check. git-svn-id: http://scons.tigris.org/svn/scons/trunk@3331 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/engine/SCons/Conftest.py | 20 ++++++++++++++++++++ src/engine/SCons/SConf.py | 5 +++++ src/engine/SCons/SConfTests.py | 12 ++++++++++++ 3 files changed, 37 insertions(+) diff --git a/src/engine/SCons/Conftest.py b/src/engine/SCons/Conftest.py index 34fd5e8b..de918b1c 100644 --- a/src/engine/SCons/Conftest.py +++ b/src/engine/SCons/Conftest.py @@ -162,6 +162,26 @@ int main() _YesNoResult(context, ret, None, text) return ret +def CheckCXX(context): + """ + Configure check for a working CXX compiler. + + This checks whether the CXX compiler, as defined in the $CXX construction + variable, can compile a CXX source file. It uses the current $CXXCOM value + too, so that it can test against non working flags. + + """ + context.Display("Checking whether the C++ compiler works") + text = """ +int main() +{ + return 0; +} +""" + ret = _check_empty_program(context, 'CXX', text, 'C++') + _YesNoResult(context, ret, None, text) + return ret + def _check_empty_program(context, comp, text, language): """Return 0 on success, 1 otherwise.""" if not context.env.has_key(comp) or not context.env[comp]: diff --git a/src/engine/SCons/SConf.py b/src/engine/SCons/SConf.py index 05dd97e0..bee823b9 100644 --- a/src/engine/SCons/SConf.py +++ b/src/engine/SCons/SConf.py @@ -402,6 +402,7 @@ class SConfBase: # add default tests default_tests = { 'CheckCC' : CheckCC, + 'CheckCXX' : CheckCXX, 'CheckFunc' : CheckFunc, 'CheckType' : CheckType, 'CheckTypeSize' : CheckTypeSize, @@ -927,6 +928,10 @@ def CheckCC(context): res = SCons.Conftest.CheckCC(context) return not res +def CheckCXX(context): + res = SCons.Conftest.CheckCXX(context) + return not res + # Bram: Make this function obsolete? CheckHeader() is more generic. def CheckCHeader(context, header, include_quotes = '""'): diff --git a/src/engine/SCons/SConfTests.py b/src/engine/SCons/SConfTests.py index 1399d3ab..c9d59a15 100644 --- a/src/engine/SCons/SConfTests.py +++ b/src/engine/SCons/SConfTests.py @@ -349,6 +349,18 @@ int main() { finally: sconf.Finish() + def test_CheckCXX(self): + """Test SConf.CheckCXX() + """ + self._resetSConfState() + sconf = self.SConf.SConf(self.scons_env, + conf_dir=self.test.workpath('config.tests'), + log_file=self.test.workpath('config.log')) + try: + self._test_check_compilers('CXX', sconf.CheckCXX, 'CheckCXX') + finally: + sconf.Finish() + def test_CheckHeader(self): """Test SConf.CheckHeader() -- 2.26.2