@conf
def find_dmd(conf):
    """
	Finds the program *dmd*, *dmd2*, or *ldc* and set the variable *D*
	"""
    conf.find_program(['dmd', 'dmd2', 'ldc'], var='D')
    out = conf.cmd_and_log(conf.env.D + ['--help'])
    if out.find('D Compiler v') == -1:
        out = conf.cmd_and_log(conf.env.D + ['-version'])
        if out.find('based on DMD v1.') == -1:
            conf.fatal('detected compiler is not dmd/ldc')
