]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport unixccompiler.py 1.36, ccompiler.py 1.40
authorAnthony Baxter <anthonybaxter@gmail.com>
Wed, 5 Dec 2001 06:57:31 +0000 (06:57 +0000)
committerAnthony Baxter <anthonybaxter@gmail.com>
Wed, 5 Dec 2001 06:57:31 +0000 (06:57 +0000)
support for dylib - allow zlib included in OS to be
used rather than have to compile and install in /usr/local

Lib/distutils/ccompiler.py
Lib/distutils/unixccompiler.py

index 4a282d4cff505d949638dc7c79fce55d8e2cb788..4efd93407bad3009ce4e92820735e84d17cc3088 100644 (file)
@@ -792,8 +792,8 @@ class CCompiler:
                           output_dir=''):
 
         if output_dir is None: output_dir = ''
-        if lib_type not in ("static","shared"):
-            raise ValueError, "'lib_type' must be \"static\" or \"shared\""
+        if lib_type not in ("static","shared","dylib"):
+            raise ValueError, "'lib_type' must be \"static\", \"shared\" or \"dylib\""
         fmt = getattr (self, lib_type + "_lib_format")
         ext = getattr (self, lib_type + "_lib_extension")
 
index 8a471ec06dc5042e5baaa9ce0b6e2717fbd4e202..5575bd7525e8bad15d2c4b17da27de69414c85aa 100644 (file)
@@ -71,7 +71,8 @@ class UnixCCompiler (CCompiler):
     obj_extension = ".o"
     static_lib_extension = ".a"
     shared_lib_extension = ".so"
-    static_lib_format = shared_lib_format = "lib%s%s"
+    dylib_lib_extension = ".dylib"
+    static_lib_format = shared_lib_format = dylib_lib_format = "lib%s%s"
 
 
 
@@ -259,6 +260,8 @@ class UnixCCompiler (CCompiler):
         for dir in dirs:
             shared = os.path.join(
                 dir, self.library_filename(lib, lib_type='shared'))
+            dylib = os.path.join(
+                dir, self.library_filename(lib, lib_type='dylib'))
             static = os.path.join(
                 dir, self.library_filename(lib, lib_type='static'))
 
@@ -266,7 +269,9 @@ class UnixCCompiler (CCompiler):
             # data to go on: GCC seems to prefer the shared library, so I'm
             # assuming that *all* Unix C compilers do.  And of course I'm
             # ignoring even GCC's "-static" option.  So sue me.
-            if os.path.exists(shared):
+            if os.path.exists(dylib):
+                return dylib
+            elif os.path.exists(shared):
                 return shared
             elif os.path.exists(static):
                 return static