From 7c145b74a6ac0ec37352bc0d0e19a68622faf736 Mon Sep 17 00:00:00 2001 From: cournape Date: Wed, 3 Sep 2008 08:31:30 +0000 Subject: [PATCH] Add CheckSHCC and CheckSHCXX checkers (test fail). git-svn-id: http://scons.tigris.org/svn/scons/trunk@3333 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/engine/SCons/Conftest.py | 40 ++++++++++++++++++++++++++++++++++++ src/engine/SCons/SConf.py | 10 +++++++++ 2 files changed, 50 insertions(+) diff --git a/src/engine/SCons/Conftest.py b/src/engine/SCons/Conftest.py index de918b1c..d9db9577 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 CheckSHCC(context): + """ + Configure check for a working shared C compiler. + + This checks whether the C compiler, as defined in the $SHCC construction + variable, can compile a C source file. It uses the current $SHCCCOM value + too, so that it can test against non working flags. + + """ + context.Display("Checking whether the (shared) C compiler works") + text = """ +int foo() +{ + return 0; +} +""" + ret = _check_empty_program(context, 'SHCC', text, 'C') + _YesNoResult(context, ret, None, text) + return ret + def CheckCXX(context): """ Configure check for a working CXX compiler. @@ -182,6 +202,26 @@ int main() _YesNoResult(context, ret, None, text) return ret +def CheckSHCXX(context): + """ + Configure check for a working shared CXX compiler. + + This checks whether the CXX compiler, as defined in the $SHCXX construction + variable, can compile a CXX source file. It uses the current $SHCXXCOM value + too, so that it can test against non working flags. + + """ + context.Display("Checking whether the (shared) C++ compiler works") + text = """ +int main() +{ + return 0; +} +""" + ret = _check_empty_program(context, 'SHCXX', 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 bee823b9..75128166 100644 --- a/src/engine/SCons/SConf.py +++ b/src/engine/SCons/SConf.py @@ -403,6 +403,8 @@ class SConfBase: default_tests = { 'CheckCC' : CheckCC, 'CheckCXX' : CheckCXX, + 'CheckSHCC' : CheckSHCC, + 'CheckSHCXX' : CheckSHCXX, 'CheckFunc' : CheckFunc, 'CheckType' : CheckType, 'CheckTypeSize' : CheckTypeSize, @@ -932,6 +934,14 @@ def CheckCXX(context): res = SCons.Conftest.CheckCXX(context) return not res +def CheckSHCC(context): + res = SCons.Conftest.CheckSHCC(context) + return not res + +def CheckSHCXX(context): + res = SCons.Conftest.CheckSHCXX(context) + return not res + # Bram: Make this function obsolete? CheckHeader() is more generic. def CheckCHeader(context, header, include_quotes = '""'): -- 2.26.2