+# Check if we should compile a 64 bit binary on Mac OS X/Darwin
+try:
+ import platform
+ uname = platform.uname()
+ if uname[0] == 'Darwin' and compare_versions(uname[2], '9.0.0') >= 0:
+ if int(subprocess.Popen('sysctl -n hw.cpu64bit_capable', shell=True,
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+ close_fds=True).communicate()[0][0]):
+ env.Append(CCFLAGS='-arch x86_64')
+ env.Append(CFLAGS='-arch x86_64')
+ env.Append(LINKFLAGS='-arch x86_64')
+ env.Append(ASFLAGS='-arch x86_64')
+ env['OSX64bit'] = True
+except:
+ pass
+
+# Recent versions of scons substitute a "Null" object for Configure()
+# when configuration isn't necessary, e.g., if the "--help" option is
+# present. Unfortuantely this Null object always returns false,
+# breaking all our configuration checks. We replace it with our own
+# more optimistic null object that returns True instead.
+if not conf:
+ def NullCheck(*args, **kwargs):
+ return True
+
+ class NullConf:
+ def __init__(self, env):
+ self.env = env
+ def Finish(self):
+ return self.env
+ def __getattr__(self, mname):
+ return NullCheck
+
+ conf = NullConf(env)
+