1 | | --- numpy/distutils/fcompiler/g95.py.old 2007-07-30 09:27:56.000000000 -0700 |
2 | | +++ numpy/distutils/fcompiler/g95.py 2007-07-30 09:30:51.000000000 -0700 |
3 | | @@ -23,7 +23,7 @@ |
4 | | 'compiler_f77' : ["g95", "-ffixed-form"], |
5 | | 'compiler_fix' : ["g95", "-ffixed-form"], |
6 | | 'compiler_f90' : ["g95"], |
7 | | - 'linker_so' : ["g95","-shared"], |
8 | | + 'linker_so' : ["g95", "-g", "-Wall"], |
9 | | 'archiver' : ["ar", "-cr"], |
10 | | 'ranlib' : ["ranlib"] |
11 | | } |
12 | | @@ -37,6 +37,37 @@ |
13 | | return ['-O'] |
14 | | def get_flags_debug(self): |
15 | | return ['-g'] |
16 | | + def get_flags_linker_so(self): |
17 | | + opt = self.linker_so[1:] |
18 | | + if sys.platform=='darwin': |
19 | | + # MACOSX_DEPLOYMENT_TARGET must be at least 10.3. This is |
20 | | + # a reasonable default value even when building on 10.4 when using |
21 | | + # the official Python distribution and those derived from it (when |
22 | | + # not broken). |
23 | | + target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', None) |
24 | | + if target is None or target == '': |
25 | | + target = '10.3' |
26 | | + major, minor = target.split('.') |
27 | | + if int(minor) < 3: |
28 | | + minor = '3' |
29 | | + warnings.warn('Environment variable ' |
30 | | + 'MACOSX_DEPLOYMENT_TARGET reset to %s.%s' % (major, minor)) |
31 | | + os.environ['MACOSX_DEPLOYMENT_TARGET'] = '%s.%s' % (major, |
32 | | + minor) |
33 | | + |
34 | | + opt.extend(['-undefined', 'dynamic_lookup', '-bundle']) |
35 | | + else: |
36 | | + opt.append("-shared") |
37 | | + if sys.platform[:5]=='sunos': |
38 | | + # SunOS often has dynamically loaded symbols defined in the |
39 | | + # static library libg2c.a The linker doesn't like this. To |
40 | | + # ignore the problem, use the -mimpure-text flag. It isn't |
41 | | + # the safest thing, but seems to work. 'man gcc' says: |
42 | | + # ".. Instead of using -mimpure-text, you should compile all |
43 | | + # source code with -fpic or -fPIC." |
44 | | + opt.append('-mimpure-text') |
45 | | + return opt |
46 | | + |
47 | | |
48 | | if __name__ == '__main__': |
49 | | from distutils import log |