Add CheckCXX check.
authorcournape <cournape@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Wed, 3 Sep 2008 08:30:17 +0000 (08:30 +0000)
committercournape <cournape@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Wed, 3 Sep 2008 08:30:17 +0000 (08:30 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@3331 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Conftest.py
src/engine/SCons/SConf.py
src/engine/SCons/SConfTests.py

index 34fd5e8b69605872ce9491e5cd795f024033919e..de918b1c9707ff542a6b40eea2ee03d64ad4b4f7 100644 (file)
@@ -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]:
index 05dd97e03c1dfb9ae24208786db019e3283c2d11..bee823b9c4278e6ae752d22660427c75a50008b7 100644 (file)
@@ -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 = '""'):
index 1399d3ab880015f4e43adecc58d452d63ef9624e..c9d59a155cc625a81a2694e59800abf8b8618655 100644 (file)
@@ -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()