--- SConstruct.orig	2009-07-20 15:55:10.000000000 +0000
+++ SConstruct	2009-08-07 18:48:09.533670134 +0000
@@ -32,6 +32,7 @@
 opts = Options('scache.conf')
 opts.AddOptions(
     ('ARCH', 'Set architecture-specific compilation flags by hand (all flags as 1 argument)',''),
+    ('CFLAGS', 'Set custom CFLAGS',''),
     ('WINDOWS_KEY', 'Set X Modifier (Mod1,Mod2,Mod3,Mod4,Mod5) for "Windows" key', 'Mod4><Super'),
     BoolOption('AUDIOUNITS', 'Compile with Apple\'s AudioUnit library. (experimental)', 0),
     BoolOption('COREAUDIO', 'Compile with Apple\'s CoreAudio library', 0),
@@ -794,12 +795,15 @@
 # prepend boiler plate optimization flags
 #
 
-opt_flags[:0] = [
-    "-O3",
-    "-fomit-frame-pointer",
-    "-ffast-math",
-    "-fstrength-reduce",
-    "-pipe"
+if env['CFLAGS'] != '':
+    opt_flags[:0]=env['CFLAGS'].split()
+else:
+    opt_flags[:0] = [
+        "-O3",
+        "-fomit-frame-pointer",
+        "-ffast-math",
+        "-fstrength-reduce",
+        "-pipe"
     ]
 
 if env['DEBUG'] == 1: