def CHECK_FUNCS_IN(conf,
                   list,
                   library,
                   mandatory=False,
                   checklibc=False,
                   headers=None,
                   link=True,
                   empty_decl=True,
                   set_target=True):
    """
    check that the functions in 'list' are available in 'library'
    if they are, then make that library available as a dependency

    if the library is not available and mandatory==True, then
    raise an error.

    If the library is not available and mandatory==False, then
    add the library to the list of dependencies to remove from
    build rules

    optionally check for the functions first in libc
    """
    remaining = TO_LIST(list)
    liblist = TO_LIST(library)

    # check if some already found
    for f in remaining[:]:
        if CONFIG_SET(conf, 'HAVE_%s' % f.upper()):
            remaining.remove(f)

    # see if the functions are in libc
    if checklibc:
        for f in remaining[:]:
            if CHECK_FUNC(conf, f, link=True, headers=headers):
                remaining.remove(f)

    if remaining == []:
        for lib in liblist:
            if GET_TARGET_TYPE(conf, lib) != 'SYSLIB' and empty_decl:
                SET_TARGET_TYPE(conf, lib, 'EMPTY')
        return True

    checklist = conf.CHECK_LIB(liblist,
                               empty_decl=empty_decl,
                               set_target=set_target)
    for lib in liblist[:]:
        if not lib in checklist and mandatory:
            Logs.error("Mandatory library '%s' not found for functions '%s'" %
                       (lib, list))
            sys.exit(1)

    ret = True
    for f in remaining:
        if not CHECK_FUNC(
                conf, f, lib=' '.join(checklist), headers=headers, link=link):
            ret = False

    return ret
Beispiel #2
0
def CHECK_FUNCS_IN(
    conf, list, library, mandatory=False, checklibc=False, headers=None, link=True, empty_decl=True, set_target=True
):
    """
    check that the functions in 'list' are available in 'library'
    if they are, then make that library available as a dependency

    if the library is not available and mandatory==True, then
    raise an error.

    If the library is not available and mandatory==False, then
    add the library to the list of dependencies to remove from
    build rules

    optionally check for the functions first in libc
    """
    remaining = TO_LIST(list)
    liblist = TO_LIST(library)

    # check if some already found
    for f in remaining[:]:
        if CONFIG_SET(conf, "HAVE_%s" % f.upper()):
            remaining.remove(f)

    # see if the functions are in libc
    if checklibc:
        for f in remaining[:]:
            if CHECK_FUNC(conf, f, link=True, headers=headers):
                remaining.remove(f)

    if remaining == []:
        for lib in liblist:
            if GET_TARGET_TYPE(conf, lib) != "SYSLIB" and empty_decl:
                SET_TARGET_TYPE(conf, lib, "EMPTY")
        return True

    checklist = conf.CHECK_LIB(liblist, empty_decl=empty_decl, set_target=set_target)
    for lib in liblist[:]:
        if not lib in checklist and mandatory:
            Logs.error("Mandatory library '%s' not found for functions '%s'" % (lib, list))
            sys.exit(1)

    ret = True
    for f in remaining:
        if not CHECK_FUNC(conf, f, lib=" ".join(checklist), headers=headers, link=link):
            ret = False

    return ret