diff --git a/SConstruct b/SConstruct index a97894315d..7179b14c0f 100644 --- a/SConstruct +++ b/SConstruct @@ -187,6 +187,8 @@ tests = {'CheckWXConfig' : wxconfig.CheckWXConfig, 'CheckPKGConfig' : utils.CheckPKGConfig, 'CheckPKG' : utils.CheckPKG, 'CheckSDL' : utils.CheckSDL, + 'CheckFink' : utils.CheckFink, + 'CheckMacports' : utils.CheckMacports, 'CheckPortaudio' : utils.CheckPortaudio, } @@ -199,6 +201,12 @@ conf = env.Configure(custom_tests = tests, if not conf.CheckPKGConfig('0.15.0'): print "Can't find pkg-config, some tests will fail" +# find ports/fink for library and include path +if sys.platform == 'darwin': + #ports usually has newer versions + conf.CheckMacports() + conf.CheckFink() + env['HAVE_SDL'] = conf.CheckSDL('1.0.0') # Bluetooth for wii support diff --git a/SconsTests/utils.py b/SconsTests/utils.py index e7b46e84f1..9b6a3de9fc 100644 --- a/SconsTests/utils.py +++ b/SconsTests/utils.py @@ -20,18 +20,50 @@ def CheckFramework(context, name): ret = 0 if (platform.system().lower() == 'darwin'): context.Message( '\nLooking for framework %s... ' % name ) - lastLINKFLAGS = context.env['LINKFLAGS'] - context.env.Append(LINKFLAGS = [ '-framework', name ]) + lastFRAMEWORKS = context.env['FRAMEWORKS'] + context.env.Append(FRAMEWORKS = [name]) ret = context.TryLink(""" int main(int argc, char **argv) { return 0; } """, '.c') if not ret: - context.env.Replace(LINKFLAGS = lastLINKFLAGS) + context.env.Replace(FRAMEWORKS = lastFRAMEWORKS +) return ret + +def CheckFink(context): + context.Message( 'Looking for fink... ') + prog = context.env.WhereIs('fink') + if prog: + ret = 1 + prefix = prog.rsplit(os.sep, 2)[0] + context.env.Append(LIBPATH = [prefix + os.sep +'lib'], + CPPPATH = [prefix + os.sep +'include']) + context.Message( 'Adding fink lib and include path') + else: + ret = 0 + + context.Result(ret) + return int(ret) + +def CheckMacports(context): + context.Message( 'Looking for macports... ') + prog = context.env.WhereIs('port') + if prog: + ret = 1 + prefix = prog.rsplit(os.sep, 2)[0] + context.env.Append(LIBPATH = [prefix + os.sep + 'lib'], + CPPPATH = [prefix + os.sep + 'include']) + context.Message( 'Adding port lib and include path') + else: + ret = 0 + + context.Result(ret) + return int(ret) + # TODO: We should use the scons one instead def CheckLib(context, name): context.Message( 'Looking for lib %s... ' % name )