diff -r 1081e3dd3f3e -r f7edb3b90816 SConstruct --- a/SConstruct Sun Apr 27 22:55:17 2008 +0200 +++ b/SConstruct Mon Apr 28 11:44:11 2008 +0200 @@ -48,6 +48,9 @@ opt.Save('.optioncache', env) Help(opt.GenerateHelpText(env)) + +### configure + platform = 'unknown' def CheckPlatform(context): global platform @@ -104,11 +107,9 @@ conf.CheckGCC() conf.CheckIntelC() conf.CheckCPUFlags() -env = conf.Finish() - -if intelc and env['intelc']: - Tool("intelc").generate(env) +if intelc and conf.env['intelc']: + Tool("intelc").generate(conf.env) cc = 'intelc' elif gcc: cc = 'gcc' @@ -119,17 +120,17 @@ if cc == 'intelc': add_flags += cpuflags_intelc + ' ' -if env['precision'] == 'double': +if conf.env['precision'] == 'double': add_flags += '-DPYRIT_DOUBLE ' elif cc == 'gcc': add_flags += '-fsingle-precision-constant ' -add_flags += env['flags'] +add_flags += conf.env['flags'] if cc == 'intelc': - env.Append(CCFLAGS="-O3 -w1 " + add_flags) + conf.env.Append(CCFLAGS="-O3 -w1 " + add_flags) elif cc == 'gcc': - env.Append(CCFLAGS="-O3 -Wall -pipe " + add_flags) + conf.env.Append(CCFLAGS="-O3 -Wall -pipe " + add_flags) # CCFLAGS= -fno-strict-aliasing else: print "No supported compiler found." @@ -138,11 +139,19 @@ print "Using compiler: " + cc print "Additional flags: " + add_flags -# pthread -if env['PLATFORM'] == 'win32': - env.Append(LIBS=["pthreadGC2"]) +if conf.CheckLibWithHeader('png', 'png.h', 'C'): + conf.env.Append(CCFLAGS='-DHAVE_PNG') + conf.env.Append(LIBS=['png']) + +if conf.env['PLATFORM'] == 'win32': + conf.env.Append(LIBS=["pthreadGC2"]) else: - env.Append(CCFLAGS="-pthread ") + conf.env.Append(CCFLAGS="-pthread ") + +env = conf.Finish() + + +### build targets (lib, pymodule) = SConscript('src/SConscript', build_dir='build/lib', duplicate=0, exports='env')