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
|
$NetBSD: patch-numpy_distutils_fcompiler_gnu.py,v 1.12 2017/06/15 07:02:53 adam Exp $
Linker needs -shared explictly (at least with GCC 4.7 on SunOS), plus
any ABI flags as appropriate.
On OS X, do not use '-bundle' and 'dynamic_lookup' (to avoid Python.framework).
Do not use -funroll-loops compiler flag.
Do not run a shell command when it is "None".
--- numpy/distutils/fcompiler/gnu.py.orig 2017-06-07 15:26:35.000000000 +0000
+++ numpy/distutils/fcompiler/gnu.py
@@ -57,8 +57,10 @@ class GnuFCompiler(FCompiler):
return ('gfortran', m.group(1))
else:
# Output probably from --version, try harder:
- m = re.search(r'GNU Fortran\s+95.*?([0-9-.]+)', version_string)
+ m = re.search(r'95.*?([0-9-.]+)', version_string)
if m:
+ if m.group(1).split(".") < ["4", "2"]:
+ self.g2c = "f95"
return ('gfortran', m.group(1))
m = re.search(r'GNU Fortran.*?\-?([0-9-.]+)', version_string)
if m:
@@ -87,7 +89,7 @@ class GnuFCompiler(FCompiler):
'compiler_f77' : [None, "-g", "-Wall", "-fno-second-underscore"],
'compiler_f90' : None, # Use --fcompiler=gnu95 for f90 codes
'compiler_fix' : None,
- 'linker_so' : [None, "-g", "-Wall"],
+ 'linker_so' : [None, "-g", "-Wall", "-shared", ""],
'archiver' : ["ar", "-cr"],
'ranlib' : ["ranlib"],
'linker_exe' : [None, "-g", "-Wall"]
@@ -139,7 +141,7 @@ class GnuFCompiler(FCompiler):
s = 'Env. variable MACOSX_DEPLOYMENT_TARGET set to 10.3'
warnings.warn(s, stacklevel=2)
- opt.extend(['-undefined', 'dynamic_lookup', '-bundle'])
+ opt.extend(['-undefined'])
else:
opt.append("-shared")
if sys.platform.startswith('sunos'):
@@ -215,7 +217,6 @@ class GnuFCompiler(FCompiler):
opt = ['-O2']
else:
opt = ['-O3']
- opt.append('-funroll-loops')
return opt
def _c_arch_flags(self):
@@ -270,7 +271,7 @@ class Gnu95FCompiler(GnuFCompiler):
"-fno-second-underscore"] + _EXTRAFLAGS,
'compiler_fix' : [None, "-Wall", "-g","-ffixed-form",
"-fno-second-underscore"] + _EXTRAFLAGS,
- 'linker_so' : ["<F90>", "-Wall", "-g"],
+ 'linker_so' : ["<F90>", "-Wall", "-g", "-shared", ""],
'archiver' : ["ar", "-cr"],
'ranlib' : ["ranlib"],
'linker_exe' : [None, "-Wall"]
@@ -283,7 +284,7 @@ class Gnu95FCompiler(GnuFCompiler):
def _universal_flags(self, cmd):
"""Return a list of -arch flags for every supported architecture."""
- if not sys.platform == 'darwin':
+ if not sys.platform == 'darwin' or cmd is None:
return []
arch_flags = []
# get arches the C compiler gets.
|