from waftools.plugin import plugin

def plugin_configure(conf):
    if conf.check_pkg('mad', destvar='mad'):
        return True
    if not conf.check_header("mad.h"):
        return False
    return conf.check_library2("mad", uselib='mad', mandatory=0)

configure, build = plugin('mad', configure=plugin_configure,
                          source=['mad.c', 'xing.c', 'id3v1.c'],
                          needs_lib=True)
