From 0a983c44662188dc409373d03cea62dfa3c65cda Mon Sep 17 00:00:00 2001
From: Greg Ward <gward@python.net>
Date: Fri, 4 Aug 2000 01:29:27 +0000
Subject: [PATCH] Added 'debug' flag to 'find_library_file()', and changed code
 to handle it.

---
 Lib/distutils/msvccompiler.py | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/Lib/distutils/msvccompiler.py b/Lib/distutils/msvccompiler.py
index a1dedb0e53f..eecbb620ed3 100644
--- a/Lib/distutils/msvccompiler.py
+++ b/Lib/distutils/msvccompiler.py
@@ -474,13 +474,18 @@ class MSVCCompiler (CCompiler) :
         return self.library_filename (lib)
 
 
-    def find_library_file (self, dirs, lib):
-
+    def find_library_file (self, dirs, lib, debug=0):
+        # Prefer a debugging library if found (and requested), but deal
+        # with it if we don't have one.
+        if debug:
+            try_names = [lib + "_d", lib]
+        else:
+            try_names = [lib]
         for dir in dirs:
-            libfile = os.path.join (dir, self.library_filename (lib))
-            if os.path.exists (libfile):
-                return libfile
-
+            for name in try_names:
+                libfile = os.path.join(dir, self.library_filename (name))
+                if os.path.exists(libfile):
+                    return libfile
         else:
             # Oops, didn't find it in *any* of 'dirs'
             return None
-- 
2.30.9