diff options
author | Robert Kern <robert.kern@gmail.com> | 2005-03-11 00:53:24 +0000 |
---|---|---|
committer | Robert Kern <robert.kern@gmail.com> | 2005-03-11 00:53:24 +0000 |
commit | b5ec49d17c699cc58510a9159a3e9832b06888d6 (patch) | |
tree | 2757ceeb5e8af393da22bf39adb6dd0f23912d96 /scipy_distutils/gnufcompiler.py | |
parent | 3ac42a6d78dda727f25dc44d08b9c1539b502203 (diff) | |
download | numpy-b5ec49d17c699cc58510a9159a3e9832b06888d6.tar.gz |
OSX fix for g77
Diffstat (limited to 'scipy_distutils/gnufcompiler.py')
-rw-r--r-- | scipy_distutils/gnufcompiler.py | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/scipy_distutils/gnufcompiler.py b/scipy_distutils/gnufcompiler.py index f826bf9af..61c71175c 100644 --- a/scipy_distutils/gnufcompiler.py +++ b/scipy_distutils/gnufcompiler.py @@ -2,6 +2,7 @@ import re import os import sys +import warnings from cpuinfo import cpu from fcompiler import FCompiler @@ -49,11 +50,27 @@ class GnuFCompiler(FCompiler): def get_flags_linker_so(self): opt = [] if sys.platform=='darwin': - if os.path.realpath(sys.executable).startswith('/System'): + try: + import MacOS + except ImportError: + is_framework = False + else: + is_framework = (MacOS.linkmodel == 'framework') + if is_framework: # This is when Python is from Apple framework - opt.extend(["-Wl,-framework","-Wl,Python"]) - #else we are running in Fink python. - opt.extend(["-lcc_dynamic","-bundle"]) + target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', None) + if target is None: + target = '10.3' + major, minor = target.split('.') + if int(minor) < 3: + minor = '3' + warnings.warn('Environment variable ' + 'MACOSX_DEPLOYMENT_TARGET reset to 10.3') + os.environ['MACOSX_DEPLOYMENT_TARGET'] = '%s.%s' % (major, + minor) + + opt.extend(['-undefined', 'dynamic_lookup']) + opt.append('-bundle') else: opt.append("-shared") if sys.platform[:5]=='sunos': @@ -96,6 +113,8 @@ class GnuFCompiler(FCompiler): opt.append('gcc') if g2c is not None: opt.append(g2c) + if sys.platform == 'darwin': + opt.append('cc_dynamic') return opt def get_flags_debug(self): |