'A convenience function for writing checks for a
pkg_config-defined dependency.
`package` is the pkg_config package name.
`include_file` is a top-level include file we expect to find.
`min_version` is the minimum version required.
`version` will override the found version if this package
requires an alternate method for that. Set version=\'unknown\'
if the version is not known but you still want to disabled
pkg_config version check.'

def _check_for_pkg_config(self, package, include_file, min_version=None, version=None):

    if (version is None):
        version = pkg_config.get_version(package)
        if (version is None):
            raise CheckFailed(("pkg-config    information    for    '%s'    could    not    be    found." % package))
    if (min_version == 'PATCH'):
        raise CheckFailed('Requires    patches    that    have    not    been    merged    upstream.')
    if (min_version and (version != 'unknown')):
        if (not is_min_version(version, min_version)):
            raise CheckFailed(('Requires    %s    %s    or    later.        Found    %s.' % (package, min_version, version)))
    ext = self.get_extension()
    if (ext is None):
        ext = make_extension('test', [])
        pkg_config.setup_extension(ext, package)
    check_include_file((ext.include_dirs + get_include_dirs()), include_file, package)
    return ('version    %s' % version)
