def check_configured(bld):
	if not Configure.autoconfig:
		return bld

	conf_cls = getattr(Utils.g_module, 'configure_context', Utils.Context)
	bld_cls = getattr(Utils.g_module, 'build_context', Utils.Context)

	def reconf(proj):
		back = (Options.commands, Options.options.__dict__, Logs.zones, Logs.verbose)

		Options.commands = proj['commands']
		Options.options.__dict__ = proj['options']
		conf = conf_cls()
		conf.environ = proj['environ']
		configure(conf)

		(Options.commands, Options.options.__dict__, Logs.zones, Logs.verbose) = back

	try:
		proj = Environment.Environment(Options.lockfile)
	except IOError:
		conf = conf_cls()
		configure(conf)
	else:
		try:
			bld = bld_cls()
			bld.load_dirs(proj[SRCDIR], proj[BLDDIR])
			bld.load_envs()
		except Utils.WafError:
			reconf(proj)
			return bld_cls()

	try:
		proj = Environment.Environment(Options.lockfile)
	except __HOLE__:
		raise Utils.WafError('Auto-config: project does not configure (bug)')

	h = 0
	try:
		for file in proj['files']:
			if file.endswith('configure'):
				h = hash((h, Utils.readf(file)))
			else:
				mod = Utils.load_module(file)
				h = hash((h, mod.waf_hash_val))
	except (OSError, IOError):
		warn('Reconfiguring the project: a file is unavailable')
		reconf(proj)
	else:
		if (h != proj['hash']):
			warn('Reconfiguring the project: the configuration has changed')
			reconf(proj)

	return bld_cls()
dataset/ETHPy150Open appcelerator-archive/poc-nodejs-desktop/Resources/nodejs/builds/linux/node/lib/node/wafadmin/Scripting.py/check_configured