-conf = Configure(env, custom_tests = {
- 'CheckSDLConfig' : CheckSDLConfig
-})
-
-# TODO check -config apps in the Configure context
-
-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()
-
-if str(env['VARIANT']) == "optimize":
- env.Append(CXXFLAGS = "-O2 -g")
-elif str(env['VARIANT']) == "debug":
- env.Append(CXXFLAGS = "-O0 -g3")
+Help(opts.GenerateHelpText(env))
+
+# Package options
+env['PACKAGE_NAME'] = 'SuperTux'
+env['PACKAGE_VERSION'] = '0.2-cvs'
+env['PACKAGE_BUGREPORT'] = 'supertux-devel@lists.sourceforge.net'
+env['PACKAGE'] = env['PACKAGE_NAME'].lower()
+env['PACKAGE_STRING'] = env['PACKAGE_NAME'] + " " + env['PACKAGE_VERSION']
+
+# 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")