diff options
author | Steven Knight <knight@baldmt.com> | 2003-05-27 12:14:50 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2003-05-27 12:14:50 (GMT) |
commit | eb18e3716f7c5de0d9bc1399d4e4f4e4c587388a (patch) | |
tree | 5f9535a11da29058da2460e1aebd97efff9c6bda /etc | |
parent | dd46e3d77cb07573d2ff1cb0caed60e5f474cc3c (diff) | |
download | SCons-eb18e3716f7c5de0d9bc1399d4e4f4e4c587388a.zip SCons-eb18e3716f7c5de0d9bc1399d4e4f4e4c587388a.tar.gz SCons-eb18e3716f7c5de0d9bc1399d4e4f4e4c587388a.tar.bz2 |
Use -lfrtbegin when linking fortran in gcc3; Cygwin fixes. (Chad Austin)
Diffstat (limited to 'etc')
-rw-r--r-- | etc/TestSCons.py | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/etc/TestSCons.py b/etc/TestSCons.py index a87b55a..f23c5da 100644 --- a/etc/TestSCons.py +++ b/etc/TestSCons.py @@ -24,34 +24,57 @@ import TestCmd python = TestCmd.python_executable + +def gccFortranLibs(): + """Test whether -lfrtbegin is required. This can probably be done in + a more reliable way, but using popen3 is relatively efficient.""" + + libs = ['g2c'] + + try: + import popen2 + stderr = popen2.popen3('gcc -v')[2] + except OSError: + return libs + + for l in stderr.readlines(): + list = string.split(l) + if len(list) > 3 and list[:2] == ['gcc', 'version']: + if list[2][:2] == '3.': + libs = ['frtbegin'] + libs + break + return libs + + if sys.platform == 'win32': _exe = '.exe' _obj = '.obj' _shobj = '.obj' _dll = '.dll' lib_ = '' - fortran_lib = 'g2c' + fortran_lib = gccFortranLibs() elif sys.platform == 'cygwin': _exe = '.exe' _obj = '.o' _shobj = '.os' _dll = '.dll' lib_ = '' - fortran_lib = 'g2c' + fortran_lib = gccFortranLibs() elif string.find(sys.platform, 'irix') != -1: _exe = '' _obj = '.o' _shobj = '.o' _dll = '.so' lib_ = 'lib' - fortran_lib = 'ftn' + fortran_lib = ['ftn'] else: _exe = '' _obj = '.o' _shobj = '.os' _dll = '.so' lib_ = 'lib' - fortran_lib = 'g2c' + fortran_lib = gccFortranLibs() + class TestFailed(Exception): def __init__(self, args=None): |