+# directories
+env['APPDATADIR'] = "$DATADIR/$PACKAGE"
+env['LOCALEDIR'] = "$DATADIR/locale"
+
+
+# Create build_config.py and config.h
+if not os.path.exists("build_config.py") or not os.path.exists("config.h"):
+ print "build_config.py or config.h don't exist - Generating new build config..."
+
+ header = ConfigHeader()
+ header.Define("PACKAGE", env['PACKAGE'])
+ header.Define("PACKAGE_NAME", env['PACKAGE_NAME'])
+ header.Define("PACKAGE_VERSION", env['PACKAGE_VERSION'])
+ header.Define("PACKAGE_BUGREPORT", env['PACKAGE_BUGREPORT'])
+ header.Define("PACKAGE_STRING", env['PACKAGE_STRING'])
+
+ conf = Configure(env, custom_tests = {
+ 'CheckSDLConfig' : CheckSDLConfig
+ })
+ if not conf.CheckSDLConfig('1.2.4'):
+ print "Couldn't find libSDL >= 1.2.4"
+ Exit(1)
+ if not conf.CheckLib('SDL_mixer'):
+ print "Couldn't find SDL_mixer library!"
+ Exit(1)
+ if not conf.CheckLib('SDL_image'):
+ print "Couldn't find SDL_image library!"
+ Exit(1)
+ if not conf.CheckLib('GL'):
+ print "Couldn't find OpenGL library!"
+ Exit(1)
+
+ env = conf.Finish()
+
+ env.ParseConfig('sdl-config --cflags --libs')
+ env.Append(CPPDEFINES = \
+ {'DATA_PREFIX':"'\"" + env.subst('$APPDATADIR') + "\"'" ,
+ 'LOCALEDIR' :"'\"" + env.subst('$LOCALEDIR') + "\"'"})
+ opts.Save("build_config.py", env)
+ header.Save("config.h")
+else:
+ print "Using build_config.py"
+
+if env['VARIANT'] == "optimize":
+ env.Append(CXXFLAGS = "-O2 -g -Wall")
+elif env['VARIANT'] == "debug":
+ env.Append(CXXFLAGS = "-O0 -g3 -Wall -Werror")
+ env.Append(CPPDEFINES = { "DEBUG":"1" })
+elif env['VARIANT'] == "profile":
+ env.Append(CXXFLAGS = "-pg -O2")
+
+build_dir="build/" + env['PLATFORM'] + "/" + env['VARIANT']
+
+# create some install aliases (only add paths here that are really used)
+env.Alias('install-data', env.subst('$DESTDIR/$APPDATADIR'))
+env.Alias('install-exec', env.subst('$DESTDIR/$BINDIR'))
+env.Alias('install', ['install-data', 'install-exec'])
+
+# append some include dirs and link libsupertux with main app
+env.Append(CPPPATH = ["#", "#/src", "#/lib"])