1. SCons
  2. Core
  3. SCons

Source

SCons / test / LINK / SHLINKCOMSTR.py

Diff from to

File test/LINK/SHLINKCOMSTR.py

  • Ignore whitespace
 the displayed linker string for programs using shared libraries.
 """
 
+import sys
 import TestSCons
 
 _python_ = TestSCons._python_
 
 test.must_match('test3.dll', "test1.c\ntest2.c\n")
 
-
-# Now test an actual compile and link.  Since MS Windows
-# resets the link actions, this could fail even if the above
-# test passed.
-test.write('SConstruct', """
-env = Environment(CXXCOMSTR    = 'Compiling $TARGET ...',
-                  SHLINKCOMSTR   = 'Shared-Linking $TARGET ...')
-env.SharedLibrary('test', 'test.cpp')
-""")
-test.write('test.cpp', """
-int i;
-""")
-
-test.run()
-if ("Shared-Linking" not in test.stdout()):
-    test.fail_test()
-
-
+if sys.platform == "win32":
+    import SCons.Tool.MSCommon as msc
+    if msc.msvc_exists():
+        # Now test an actual compile and link.  Since MS Windows
+        # resets the link actions, this could fail even if the above
+        # test passed.
+        test.write('SConstruct', """
+        env = Environment(CXXCOMSTR    = 'Compiling $TARGET ...',
+                          SHLINKCOMSTR   = 'Shared-Linking $TARGET ...')
+        env.SharedLibrary('test', 'test.cpp')
+        """)
+        test.write('test.cpp', """
+        int i;
+        """)
+        
+        test.run()
+        if ("Shared-Linking" not in test.stdout()):
+            test.fail_test()
 
 test.pass_test()