diff -Naur Python-2.7.9-orig/Lib/distutils/cygwinccompiler.py Python-2.7.9/Lib/distutils/cygwinccompiler.py
--- Python-2.7.9-orig/Lib/distutils/cygwinccompiler.py	2014-12-11 13:50:19.859000000 +0300
+++ Python-2.7.9/Lib/distutils/cygwinccompiler.py	2014-12-11 13:50:52.697000000 +0300
@@ -421,7 +421,8 @@
     from distutils.spawn import find_executable
     import re
 
-    gcc_exe = find_executable('gcc')
+    gcc_exe = os.environ.get('CC') or find_executable('gcc')
+    ld_exe = os.environ.get('LD') or find_executable('ld')
     if gcc_exe:
         out = os.popen(gcc_exe + ' -dumpversion','r')
         out_string = out.read()
@@ -431,9 +432,11 @@
             gcc_version = LooseVersion(result.group(1))
         else:
             gcc_version = None
+        out = os.popen(gcc_exe + ' --print-prog-name ld','r')
+        ld_exe = out.read().decode('ascii').split()[0]
+        out.close()
     else:
         gcc_version = None
-    ld_exe = find_executable('ld')
     if ld_exe:
         out = os.popen(ld_exe + ' -v','r')
         out_string = out.read()
@@ -445,7 +448,7 @@
             ld_version = None
     else:
         ld_version = None
-    dllwrap_exe = find_executable('dllwrap')
+    dllwrap_exe = os.environ.get('DLLWRAP') or find_executable('dllwrap')
     if dllwrap_exe:
         out = os.popen(dllwrap_exe + ' --version','r')
         out_string = out.read()
