diff -r 6b5a42ae62ea SConstruct
--- a/SConstruct	Sun Dec 02 01:46:38 2007 -0800
+++ b/SConstruct	Mon Apr 07 12:53:58 2008 -0400
@@ -346,7 +346,6 @@ try:
             env.Append(CFLAGS='-arch x86_64')
             env.Append(LINKFLAGS='-arch x86_64')
             env.Append(ASFLAGS='-arch x86_64')
-            env['OSX64bit'] = True
 except:
     pass
 
@@ -613,11 +612,6 @@ Usage: scons [scons options] [build opti
 
 '''
 
-# libelf build is shared across all configs in the build root.
-env.SConscript('ext/libelf/SConscript',
-               build_dir = joinpath(build_root, 'libelf'),
-               exports = 'env')
-
 ###################################################
 #
 # This function is used to set up a directory with switching headers
@@ -752,6 +746,12 @@ for build_path in build_paths:
 
     if env['USE_SSE2']:
         env.Append(CCFLAGS='-msse2')
+    
+    # libelf build is shared across all configs in the build root.
+    env.SConscript('ext/libelf/SConscript',
+                   build_dir = joinpath(build_path, 'libelf'),
+                   exports = 'env')
+
 
     # The src/SConscript file sets up the build rules in 'env' according
     # to the configured options.  It returns a list of environments,
diff -r 6b5a42ae62ea ext/libelf/SConscript
--- a/ext/libelf/SConscript	Sun Dec 02 01:46:38 2007 -0800
+++ b/ext/libelf/SConscript	Mon Apr 07 12:53:58 2008 -0400
@@ -87,16 +87,9 @@ ElfFile('libelf_fsize.c')
 ElfFile('libelf_fsize.c')
 ElfFile('libelf_msize.c')
 
-m4env = Environment(ENV=os.environ)
-
-if env.get('CC'):
-    m4env['CC'] = env['CC']
-if env.get('CXX'):
-    m4env['CXX'] = env['CXX']
-
-if env.get('OSX64bit'):
-    m4env.Append(CFLAGS='-arch x86_64')
-    m4env.Append(LINKFLAGS='-arch x86_64')
+m4env = env.Copy()
+del m4env['CCFLAGS']
+del m4env['CPPPATH']
 
 # If we have gm4 use it
 if m4env.Detect('gm4'):
