if not conf.env['FLEX']:
    conf.fatal("Embedded Heimdal build requires flex but it was not found.  Install flex or use --with-system-mitkrb5 or --with-system-heimdalkrb5")

if not conf.env['BISON']:
    conf.fatal("Embedded Heimdal build requires bison but it was not found.  Install bison or use --with-system-mitkrb5 or --with-system-heimdalkrb5")

conf.define('USING_EMBEDDED_HEIMDAL', 1)
conf.RECURSE('third_party/heimdal_build')

def check_system_heimdal_binary(name):
    if conf.LIB_MAY_BE_BUNDLED(name):
        return False
    if not conf.find_program(name, var=name.upper()):
        return False
    conf.define('USING_SYSTEM_%s' % name.upper(), 1)
    return True

check_system_heimdal_binary("compile_et")
check_system_heimdal_binary("asn1_compile")
