summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/TestSCons.py31
-rw-r--r--test/BuildDir.py18
-rw-r--r--test/CVS.py2
-rw-r--r--test/F77.py2
-rw-r--r--test/F77FLAGS.py2
-rw-r--r--test/F77PATH.py16
-rw-r--r--test/SHF77FLAGS.py2
-rw-r--r--test/scan-once.py3
8 files changed, 44 insertions, 32 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):
diff --git a/test/BuildDir.py b/test/BuildDir.py
index 9c37f2c..f38505e 100644
--- a/test/BuildDir.py
+++ b/test/BuildDir.py
@@ -30,10 +30,8 @@ import sys
import time
import TestSCons
-if sys.platform == 'win32':
- _exe = '.exe'
-else:
- _exe = ''
+_exe = TestSCons._exe
+fortran_runtime = TestSCons.fortran_lib
test = TestSCons.TestSCons()
@@ -92,14 +90,6 @@ SConscript('../build/var5/SConscript', "env")
SConscript('../build/var6/SConscript', "env")
""")
-if string.find(sys.platform, 'irix') != -1:
- fortran_runtime = 'ftn'
-
- # f77 does NOT work on cruncher
- test.no_result()
-else:
- fortran_runtime = 'g2c'
-
test.subdir(['work1', 'src'])
test.write(['work1', 'src', 'SConscript'], """
import os
@@ -133,8 +123,8 @@ except:
if f77 and env.Detect(env['F77']):
env.Command(target='b2.f', source='b2.in', action=buildIt)
- env.Copy(LIBS = [r'%s']).Program(target='bar2', source='b2.f')
- env.Copy(LIBS = [r'%s']).Program(target='bar1', source='b1.f')
+ env.Copy(LIBS = %s).Program(target='bar2', source='b2.f')
+ env.Copy(LIBS = %s).Program(target='bar1', source='b1.f')
""" % (fortran_runtime, fortran_runtime))
test.write(['work1', 'src', 'f1.c'], r"""
diff --git a/test/CVS.py b/test/CVS.py
index 33fbe0f..1ce28d6 100644
--- a/test/CVS.py
+++ b/test/CVS.py
@@ -235,7 +235,7 @@ test.subdir(['work3'])
test.write(['work3', 'SConstruct'], """\
import os
env = Environment(ENV = { 'PATH' : os.environ['PATH'] })
-env.SourceCode('.', env.CVS(':pserver:anonymous:@cvs.sourceforge.net:/cvsroot/scons'))
+env.SourceCode('.', env.CVS(':pserver:anonymous@cvs.sourceforge.net:/cvsroot/scons'))
env.Install('install', 'scons/SConstruct')
""")
diff --git a/test/F77.py b/test/F77.py
index b4ef9bf..94c7c77 100644
--- a/test/F77.py
+++ b/test/F77.py
@@ -158,7 +158,7 @@ os.system(string.join(sys.argv[1:], " "))
""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
test.write('SConstruct', """
-foo = Environment(LIBS = r'%s')
+foo = Environment(LIBS = %s)
f77 = foo.Dictionary('F77')
bar = foo.Copy(F77 = r'%s wrapper.py ' + f77)
foo.Program(target = 'foo', source = 'foo.f')
diff --git a/test/F77FLAGS.py b/test/F77FLAGS.py
index 6b9253b..027a02f 100644
--- a/test/F77FLAGS.py
+++ b/test/F77FLAGS.py
@@ -161,7 +161,7 @@ os.system(string.join(sys.argv[1:], " "))
""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
test.write('SConstruct', """
-foo = Environment(LIBS = r'%s')
+foo = Environment(LIBS = %s)
f77 = foo.Dictionary('F77')
bar = foo.Copy(F77 = r'%s wrapper.py ' + f77, F77FLAGS = '-Ix')
foo.Program(target = 'foo', source = 'foo.f')
diff --git a/test/F77PATH.py b/test/F77PATH.py
index f3dd483..af3a9c9 100644
--- a/test/F77PATH.py
+++ b/test/F77PATH.py
@@ -28,11 +28,7 @@ import os
import sys
import TestSCons
-if sys.platform == 'win32':
- _exe = '.exe'
-else:
- _exe = ''
-
+_exe = TestSCons._exe
FTN_LIB = TestSCons.fortran_lib
prog = 'prog' + _exe
@@ -49,14 +45,14 @@ if not test.detect('F77', 'g77'):
test.subdir('include', 'subdir', ['subdir', 'include'], 'inc2')
test.write('SConstruct', """
-env = Environment(F77PATH = ['$FOO'], LIBS = r'%s', FOO='include')
+env = Environment(F77PATH = ['$FOO'], LIBS = %s, FOO='include')
obj = env.Object(target='foobar/prog', source='subdir/prog.f')
env.Program(target='prog', source=obj)
SConscript('subdir/SConscript', "env")
BuildDir('variant', 'subdir', 0)
include = Dir('include')
-env = Environment(F77PATH=[include], LIBS = r'%s')
+env = Environment(F77PATH=[include], LIBS = %s)
SConscript('variant/SConscript', "env")
""" % (FTN_LIB, FTN_LIB))
@@ -161,14 +157,14 @@ test.up_to_date(arguments = args)
# Change F77PATH and make sure we don't rebuild because of it.
test.write('SConstruct', """
-env = Environment(F77PATH = Split('inc2 include'), LIBS = r'%s')
+env = Environment(F77PATH = Split('inc2 include'), LIBS = %s)
obj = env.Object(target='foobar/prog', source='subdir/prog.f')
env.Program(target='prog', source=obj)
SConscript('subdir/SConscript', "env")
BuildDir('variant', 'subdir', 0)
include = Dir('include')
-env = Environment(F77PATH=['inc2', include], LIBS = r'%s')
+env = Environment(F77PATH=['inc2', include], LIBS = %s)
SConscript('variant/SConscript', "env")
""" % (FTN_LIB, FTN_LIB))
@@ -196,7 +192,7 @@ test.up_to_date(arguments = args)
# Check that a null-string F77PATH doesn't blow up.
test.write('SConstruct', """
-env = Environment(F77PATH = '', LIBS = r'%s')
+env = Environment(F77PATH = '', LIBS = %s)
env.Library('foo', source = 'empty.f')
""" % FTN_LIB)
diff --git a/test/SHF77FLAGS.py b/test/SHF77FLAGS.py
index 27c6603..261f638 100644
--- a/test/SHF77FLAGS.py
+++ b/test/SHF77FLAGS.py
@@ -127,7 +127,7 @@ os.system(string.join(sys.argv[1:], " "))
""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
test.write('SConstruct', """
-foo = Environment(LIBS = r'%s')
+foo = Environment(LIBS = %s)
shf77 = foo.Dictionary('SHF77')
bar = foo.Copy(SHF77 = r'%s wrapper.py ' + shf77, SHF77FLAGS = '-Ix')
foo.SharedLibrary(target = 'foo/foo', source = 'foo.f')
diff --git a/test/scan-once.py b/test/scan-once.py
index f629db6..ea4dbee 100644
--- a/test/scan-once.py
+++ b/test/scan-once.py
@@ -303,6 +303,9 @@ import re
for k in fromdict.keys():
if k != "ENV" and k != "SCANNERS" and k != "CFLAGS" and k != "CXXFLAGS" \
and not SCons.Util.is_Dict(fromdict[k]):
+ # the next line fails in Cygwin because it tries to do env.subst on
+ # $RMIC $RMICFLAGS -d ${TARGET.attributes.java_lookupdir} ...
+ # when $TARGET is None, so $TARGET.attributes throws an exception
todict[k] = env.subst(str(fromdict[k]))
todict["CFLAGS"] = fromdict["CPPFLAGS"] + " " + \
string.join(map(lambda x: "-I" + x, env["CPPPATH"])) + " " + \