2 from waflib import Logs
4 conf.RECURSE('source4/heimdal_build')
6 heimdal_includedirs = []
8 krb5_config = conf.find_program("krb5-config.heimdal", var="HEIMDAL_KRB5_CONFIG")
10 krb5_config = conf.find_program("krb5-config", var="HEIMDAL_KRB5_CONFIG")
12 # Not ideal, but seems like the best way to get at these paths:
13 f = open(krb5_config[0], 'r')
16 if l.startswith("libdir="):
17 heimdal_libdirs.append(l.strip()[len("libdir="):])
18 elif l.startswith("includedir="):
19 include_path = l.strip()[len("includedir="):]
20 heimdal_includedirs.append(include_path)
21 conf.define('HEIMDAL_KRB5_TYPES_PATH',
22 include_path + "/krb5-types.h")
26 def check_system_heimdal_lib(name, functions='', headers='', onlyif=None):
27 # Only use system library if the user requested the bundled one not be
29 if conf.LIB_MAY_BE_BUNDLED(name):
31 setattr(conf.env, "CPPPATH_%s" % name.upper(), heimdal_includedirs)
32 setattr(conf.env, "LIBPATH_%s" % name.upper(), heimdal_libdirs)
33 if not conf.CHECK_BUNDLED_SYSTEM(name, checkfunctions=functions, headers=headers,
36 conf.define('USING_SYSTEM_%s' % name.upper(), 1)
39 def check_system_heimdal_binary(name):
40 if conf.LIB_MAY_BE_BUNDLED(name):
42 if not conf.find_program(name, var=name.upper()):
44 conf.define('USING_SYSTEM_%s' % name.upper(), 1)
47 check_system_heimdal_lib("com_err", "com_right_r com_err", "com_err.h")
49 if check_system_heimdal_lib("roken", "rk_socket_set_reuseaddr", "roken.h"):
50 conf.env.CPPPATH_ROKEN_HOSTCC = conf.env.CPPPATH_ROKEN
51 conf.env.LIBPATH_ROKEN_HOSTCC = conf.env.LIBPATH_ROKEN
52 conf.env.LIB_ROKEN_HOSTCC = "roken"
53 conf.SET_TARGET_TYPE("ROKEN_HOSTCC", 'SYSLIB')
55 # Make sure HAVE_CONFIG_H is unset, as the system Heimdal headers use it
56 # and include config.h if it is set, resulting in failure (since config.h
59 DEFINES = list(conf.env.DEFINES)
60 conf.undefine("HAVE_CONFIG_H")
61 while "HAVE_CONFIG_H=1" in conf.env.DEFINES:
62 conf.env.DEFINES.remove("HAVE_CONFIG_H=1")
64 check_system_heimdal_lib("wind", "wind_stringprep", "wind.h", onlyif="roken")
65 check_system_heimdal_lib("hx509", "hx509_bitstring_print", "hx509.h", onlyif="roken wind")
66 check_system_heimdal_lib("asn1", "initialize_asn1_error_table", "asn1_err.h", onlyif="roken com_err")
67 check_system_heimdal_lib("heimbase", "heim_cmp", "heimbase.h", onlyif="roken")
68 check_system_heimdal_lib("hcrypto", "MD4_Init", "hcrypto/md4.h",
69 onlyif="asn1 roken com_err")
70 if check_system_heimdal_lib("krb5", "krb5_anyaddr", "krb5.h",
71 onlyif="roken wind asn1 hx509 hcrypto com_err heimbase"):
72 conf.CHECK_FUNCS_IN('krb5_free_unparsed_name', 'krb5', headers="krb5.h")
73 check_system_heimdal_lib("gssapi", "gss_oid_to_name", "gssapi.h",
74 onlyif="hcrypto asn1 roken krb5 com_err wind")
75 check_system_heimdal_lib("heimntlm", "heim_ntlm_ntlmv2_key", "heimntlm.h",
76 onlyif="roken hcrypto krb5")
77 if check_system_heimdal_lib("hdb", "hdb_db_dir", "krb5.h hdb.h",
78 onlyif="roken krb5 hcrypto com_err wind"):
81 int main(void) { hdb_enctype2key(NULL, NULL, NULL, 0, NULL); }
83 define='HDB_ENCTYPE2KEY_TAKES_KEYSET',
86 msg='Checking whether hdb_enctype2key takes a keyset argument',
89 check_system_heimdal_lib("kdc", "kdc_log", "kdc.h",
90 onlyif="roken krb5 hdb asn1 heimntlm hcrypto com_err wind heimbase")
92 conf.env.DEFINES = DEFINES
94 # With the proper checks in place we should be able to build against the system libtommath.
95 #if conf.CHECK_BUNDLED_SYSTEM('tommath', checkfunctions='mp_init', headers='tommath.h'):
96 # conf.define('USING_SYSTEM_TOMMATH', 1)
98 check_system_heimdal_binary("compile_et")
99 check_system_heimdal_binary("asn1_compile")