summaryrefslogtreecommitdiff
blob: e96611df13ffdaadafa01eec5bb61c955ed468d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
gfortran -v happily accepts any -arch X argument, but also happily dies
during compilation that it doesn't understand -arch argument.  Hence,
testing if -arch is supported like this is kind of not working well.

Since Apple does not officially ship fortran support (any), I wonder how
universal support could have crept into this piece of code all.  They
don't even have an Apple GCC compiler with fortran support (like we do
with Gentoo Prefix).

http://projects.scipy.org/numpy/ticket/1087


--- numpy/distutils/fcompiler/gnu.py
+++ numpy/distutils/fcompiler/gnu.py
@@ -12,13 +12,6 @@
 
 TARGET_R = re.compile("Target: ([a-zA-Z0-9_\-]*)")
 
-# XXX: do we really need to check for target ? If the arch is not supported,
-# the return code should be != 0
-_R_ARCHS = {"ppc": r"^Target: (powerpc-.*)$",
-    "i686": r"^Target: (i686-.*)$",
-    "x86_64": r"^Target: (i686-.*)$",
-    "ppc64": r"^Target: (powerpc-.*)$",}
-
 class GnuFCompiler(FCompiler):
     compiler_type = 'gnu'
     compiler_aliases = ('g77',)
@@ -215,6 +208,7 @@
     # OS X: GNU Fortran 95 (GCC) 4.1.0
     #       GNU Fortran 95 (GCC) 4.2.0 20060218 (experimental)
     #       GNU Fortran (GCC) 4.3.0 20070316 (experimental)
+    #       GNU Fortran (GCC) 4.2.1 (Apple Inc. build 5574)
 
     possible_executables = ['gfortran', 'f95']
     executables = {
@@ -241,46 +235,6 @@
 
     g2c = 'gfortran'
 
-    # Note that this is here instead of GnuFCompiler as gcc < 4 uses a
-    # different output format (which isn't as useful) than gcc >= 4,
-    # and we don't have to worry about g77 being universal (as it can't be).
-    def _can_target(self, cmd, arch):
-        """Return true is the compiler support the -arch flag for the given
-        architecture."""
-        newcmd = cmd[:]
-        newcmd.extend(["-arch", arch, "-v"])
-        st, out = exec_command(" ".join(newcmd))
-        if st == 0:
-            for line in out.splitlines():
-                m = re.search(_R_ARCHS[arch], line)
-                if m:
-                    return True
-        return False
-            
-    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"]:
-            if self._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':