Ticket #12387: g95.patch

File g95.patch, 2.1 KB (added by mdroe@…, 17 years ago)
  • numpy/distutils/fcompiler/g95.py

    old new  
    2323        'compiler_f77' : ["g95", "-ffixed-form"],
    2424        'compiler_fix' : ["g95", "-ffixed-form"],
    2525        'compiler_f90' : ["g95"],
    26         'linker_so'    : ["g95","-shared"],
     26        'linker_so'    : ["g95", "-g", "-Wall"],
    2727        'archiver'     : ["ar", "-cr"],
    2828        'ranlib'       : ["ranlib"]
    2929        }
     
    3737        return ['-O']
    3838    def get_flags_debug(self):
    3939        return ['-g']
     40    def get_flags_linker_so(self):
     41        opt = self.linker_so[1:]
     42        if sys.platform=='darwin':
     43            # MACOSX_DEPLOYMENT_TARGET must be at least 10.3. This is
     44            # a reasonable default value even when building on 10.4 when using
     45            # the official Python distribution and those derived from it (when
     46            # not broken).
     47            target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', None)
     48            if target is None or target == '':
     49                target = '10.3'
     50            major, minor = target.split('.')
     51            if int(minor) < 3:
     52                minor = '3'
     53                warnings.warn('Environment variable '
     54                    'MACOSX_DEPLOYMENT_TARGET reset to %s.%s' % (major, minor))
     55            os.environ['MACOSX_DEPLOYMENT_TARGET'] = '%s.%s' % (major,
     56                minor)
     57
     58            opt.extend(['-undefined', 'dynamic_lookup', '-bundle'])
     59        else:
     60            opt.append("-shared")
     61        if sys.platform[:5]=='sunos':
     62            # SunOS often has dynamically loaded symbols defined in the
     63            # static library libg2c.a  The linker doesn't like this.  To
     64            # ignore the problem, use the -mimpure-text flag.  It isn't
     65            # the safest thing, but seems to work. 'man gcc' says:
     66            # ".. Instead of using -mimpure-text, you should compile all
     67            #  source code with -fpic or -fPIC."
     68            opt.append('-mimpure-text')
     69        return opt
     70
    4071
    4172if __name__ == '__main__':
    4273    from distutils import log