diff options
author | Pearu Peterson <pearu@pearu-laptop.(none)> | 2010-10-16 21:38:04 +0300 |
---|---|---|
committer | Pearu Peterson <pearu@pearu-laptop.(none)> | 2010-10-16 21:38:04 +0300 |
commit | 43b05fdd1c0ba1c6686297d16d257985dd986d3b (patch) | |
tree | fa1da8d128f0b91665eddf3edccaa7b68370ab12 /numpy/distutils/fcompiler/gnu.py | |
parent | 1ef8aac121008e558040d8937788daed46ce8ca4 (diff) | |
parent | 93f7521dd0ac9edc0034eec5501a126cc4683b70 (diff) | |
download | numpy-43b05fdd1c0ba1c6686297d16d257985dd986d3b.tar.gz |
Merge branch 'master' of git@github.com:numpy/numpy
Diffstat (limited to 'numpy/distutils/fcompiler/gnu.py')
-rw-r--r-- | numpy/distutils/fcompiler/gnu.py | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/numpy/distutils/fcompiler/gnu.py b/numpy/distutils/fcompiler/gnu.py index becdefad5..632c6d97a 100644 --- a/numpy/distutils/fcompiler/gnu.py +++ b/numpy/distutils/fcompiler/gnu.py @@ -202,8 +202,18 @@ class GnuFCompiler(FCompiler): opt.append('-funroll-loops') return opt + def _c_arch_flags(self): + """ Return detected arch flags from CFLAGS """ + from distutils import sysconfig + cflags = sysconfig.get_config_vars()['CFLAGS'] + arch_re = re.compile(r"-arch\s+(\w+)") + arch_flags = [] + for arch in arch_re.findall(cflags): + arch_flags += ['-arch', arch] + return arch_flags + def get_flags_arch(self): - return [] + return self._c_arch_flags() class Gnu95FCompiler(GnuFCompiler): compiler_type = 'gnu95' @@ -249,30 +259,6 @@ class Gnu95FCompiler(GnuFCompiler): g2c = 'gfortran' - def _universal_flags(self, cmd): - """Return a list of -arch flags for every supported architecture.""" - if not sys.platform == 'darwin': - return [] - arch_flags = [] - for arch in ["ppc", "i686", "x86_64", "ppc64"]: - if _can_target(cmd, arch): - arch_flags.extend(["-arch", arch]) - return arch_flags - - def get_flags(self): - flags = GnuFCompiler.get_flags(self) - arch_flags = self._universal_flags(self.compiler_f90) - if arch_flags: - flags[:0] = arch_flags - return flags - - def get_flags_linker_so(self): - flags = GnuFCompiler.get_flags_linker_so(self) - arch_flags = self._universal_flags(self.linker_so) - if arch_flags: - flags[:0] = arch_flags - return flags - def get_library_dirs(self): opt = GnuFCompiler.get_library_dirs(self) if sys.platform == 'win32': |