--- SConstruct
+++ SConstruct
@@ -1,8 +1,7 @@
 # -*- python -*-
 
-if True:
+if False:
     env = Environment(CPPFLAGS=['-g', '-O2', '-Wall', '-ansi', '-pedantic'])
-else:
     env = Environment(CXXFLAGS= [ "-O3", "-g3",
                                   "-ansi",
                                   "-pedantic",
@@ -18,6 +17,16 @@
                                   "-Winit-self", # only works with >= -O1
                                   "-Wno-unused-parameter",
                                   ])
+import os
+import SCons.Util
+
+env = Environment(CPPFLAGS=['-Wall', '-ansi', '-pedantic'])
+if os.environ.has_key('CXX'):
+    env['CXX'] = os.environ['CXX']
+if os.environ.has_key('CXXFLAGS'):
+    env['CXXFLAGS'] = SCons.Util.CLVar(os.environ['CXXFLAGS'])
+if os.environ.has_key('LDFLAGS'):
+    env['LINKFLAGS'] = SCons.Util.CLVar(os.environ['LDFLAGS'])
 
 f = open("VERSION")
 package_version = f.read()
