from waflib import Errors
from waftools.plugin import plugin

def plugin_configure(conf):
    if not conf.env.CXX:
        return
    
    try:
        conf.check_cfg(package="libgme", args="--cflags --libs",
                uselib_store="gme")
    except Errors.ConfigurationError:
        # pkg-config has been added to libgme after the 0.5.5 release
        # so check for older versions manually
        conf.check_cxx(header_name="gme/gme.h", lib="gme", uselib_store='gme')

configure, build = plugin('gme', configure=plugin_configure, tool='cxx',
        libs=['gme'])
