def METHOD_NAME(env, *args, **kwargs):
    kwargs.setdefault(
        "conf_dir", os.path.join(env["GEM5BUILD"], "scons_config")
    )
    kwargs.setdefault(
        "log_file", os.path.join(env["GEM5BUILD"], "scons_config.log")
    )
    kwargs.setdefault("custom_tests", {})
    kwargs["custom_tests"].update(
        {
            "CheckCxxFlag": CheckCxxFlag,
            "CheckLinkFlag": CheckLinkFlag,
            "CheckMember": CheckMember,
            "CheckPkgConfig": CheckPkgConfig,
            "CheckPythonLib": CheckPythonLib,
        }
    )
    conf = SCons.Script.METHOD_NAME(env, *args, **kwargs)
    # 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(main)
    try:
        yield conf
    finally:
        env.Replace(**conf.Finish().Dictionary())