diff options
| author | David Cournapeau <cournape@gmail.com> | 2008-09-03 08:30:17 (GMT) |
|---|---|---|
| committer | David Cournapeau <cournape@gmail.com> | 2008-09-03 08:30:17 (GMT) |
| commit | 7df73d3a8dd2b3058c5d1bf2b4520706018ec010 (patch) | |
| tree | 851b4f428c803a3782c3024453b2316338368d43 /src/engine | |
| parent | 43f47128378072a3b78910bbc4274a1ff94ed9f7 (diff) | |
| download | SCons-7df73d3a8dd2b3058c5d1bf2b4520706018ec010.zip SCons-7df73d3a8dd2b3058c5d1bf2b4520706018ec010.tar.gz SCons-7df73d3a8dd2b3058c5d1bf2b4520706018ec010.tar.bz2 | |
Add CheckCXX check.
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/SCons/Conftest.py | 20 | ||||
| -rw-r--r-- | src/engine/SCons/SConf.py | 5 | ||||
| -rw-r--r-- | src/engine/SCons/SConfTests.py | 12 |
3 files changed, 37 insertions, 0 deletions
diff --git a/src/engine/SCons/Conftest.py b/src/engine/SCons/Conftest.py index 34fd5e8..de918b1 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 05dd97e..bee823b 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 1399d3a..c9d59a1 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() |
