| (result, output) = commands.getstatusoutput(petscconf.MAKE + ' checklink TESTFLAGS="'+str.join(' ',flags)+'"') |
| os.chdir(os.pardir) |
| if result: |
| return (0, output) |
| else: |
| return (1, output) |
| |
| def Link(functions,callbacks,flags): |
| (result, output) = LinkWithOutput(functions,callbacks,flags) |
| if result == 0: |
| log.Write(output) |
| return 0 |
| else: |
| return 1 |
| return result |
| |
| def FortranLink(functions,callbacks,flags): |
| log.Write('=== With linker flags: '+str.join(' ',flags)) |
| |
| f = [] |
| for i in functions: |
| f.append(i+'_') |
| c = [] |
| for i in callbacks: |
| c.append(i+'_') |
| if Link(f,c,flags): return 'UNDERSCORE' |
| c.append(i+'_') |
| (result, output1) = LinkWithOutput(f,c,flags) |
| if result: return ('UNDERSCORE','') |
| |
| f = [] |
| for i in functions: |
| f.append(i.upper()) |
| c = [] |
| for i in callbacks: |
| c.append(i.upper()) |
| if Link(f,c,flags): return 'CAPS' |
| if Link(functions,callbacks,flags): return 'STDCALL' |
| return '' |
| (result, output2) = LinkWithOutput(f,c,flags) |
| if result: return ('CAPS','') |
| |
| (result, output3) = LinkWithOutput(functions,callbacks,flags) |
| if result: return ('STDCALL','') |
| |
| output = '=== With linker flags: '+str.join(' ',flags) |
| output += '\n====== With underscore Fortran names\n' |
| output += output1 |
| output += '\n====== With capital Fortran names\n' |
| output += output2 |
| output += '\n====== With unmodified Fortran names\n' |
| output += output3+'\n' |
| return ('',output) |
| |
| def GenerateGuesses(name): |
| installdirs = ['/usr/local','/opt'] |
| if 'HOME' in os.environ: |