13
13
* link shared library handled by 'cc -shared'
16
__revision__ = "$Id: unixccompiler.py 77378 2010-01-08 23:48:37Z tarek.ziade $"
16
__revision__ = "$Id: unixccompiler.py 81674 2010-06-03 14:59:56Z ronald.oussoren $"
19
19
from types import StringType, NoneType
21
21
from distutils import sysconfig
305
305
dylib_f = self.library_filename(lib, lib_type='dylib')
306
306
static_f = self.library_filename(lib, lib_type='static')
308
if sys.platform == 'darwin':
309
# On OSX users can specify an alternate SDK using
310
# '-isysroot', calculate the SDK root if it is specified
311
# (and use it further on)
312
cflags = sysconfig.get_config_var('CFLAGS')
313
m = re.search(r'-isysroot\s+(\S+)', cflags)
309
322
shared = os.path.join(dir, shared_f)
310
323
dylib = os.path.join(dir, dylib_f)
311
324
static = os.path.join(dir, static_f)
326
if sys.platform == 'darwin' and (
327
dir.startswith('/System/') or dir.startswith('/usr/')):
328
shared = os.path.join(sysroot, dir[1:], shared_f)
329
dylib = os.path.join(sysroot, dir[1:], dylib_f)
330
static = os.path.join(sysroot, dir[1:], static_f)
312
332
# We're second-guessing the linker here, with not much hard
313
333
# data to go on: GCC seems to prefer the shared library, so I'm
314
334
# assuming that *all* Unix C compilers do. And of course I'm