From 3febaed9ba9e02ba43259023c4e8255e53c0ad85 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 1 Jan 2011 01:25:10 +0100 Subject: [PATCH] heimdal_build: Look for asn1_compile (but by default, don't use it). --- source4/heimdal_build/wscript_build | 15 +++++++++++---- source4/heimdal_build/wscript_configure | 26 ++++++++++++++++++++------ 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/source4/heimdal_build/wscript_build b/source4/heimdal_build/wscript_build index dae6786cd7c..c71e22494bb 100644 --- a/source4/heimdal_build/wscript_build +++ b/source4/heimdal_build/wscript_build @@ -53,13 +53,17 @@ def HEIMDAL_ASN1(name, source, # source file. Note that in the case of a option_file, we have more than # one source file cd_rule = 'cd "${TGT[0].parent.abspath(env)}"' - asn1_rule = cd_rule + ' && "${BLDBIN}/asn1_compile" ${OPTION_FILE} ${ASN1OPTIONS} --one-code-file "${SRC[0].abspath(env)}" ${ASN1NAME}' + asn1_rule = cd_rule + ' && "${ASN1_COMPILE}" ${OPTION_FILE} ${ASN1OPTIONS} --one-code-file "${SRC[0].abspath(env)}" ${ASN1NAME}' source = to_list(source) if option_file is not None: source.append(option_file) + deps = '' + if not bld.CONFIG_SET('USING_SYSTEM_ASN1_COMPILE'): + deps = 'asn1_compile' + t = bld(rule=asn1_rule, ext_out = '.x', before = 'cc', @@ -67,7 +71,7 @@ def HEIMDAL_ASN1(name, source, shell = True, source = source, target = out_files, - depends_on = 'asn1_compile', + depends_on = deps, name=name + '_ASN1') t.env.ASN1NAME = asn1name @@ -861,8 +865,10 @@ HEIMDAL_SUBSYSTEM('HEIMDAL_VERS', group='build_compilers', deps='roken replace') -# here is the asn1 compiler build rule -HEIMDAL_BINARY('asn1_compile', + +if not bld.CONFIG_SET('USING_SYSTEM_ASN1_COMPILE'): + # here is the asn1 compiler build rule + HEIMDAL_BINARY('asn1_compile', 'lib/asn1/main.c lib/asn1/gen.c lib/asn1/gen_copy.c lib/asn1/gen_decode.c lib/asn1/gen_encode.c lib/asn1/gen_free.c lib/asn1/gen_glue.c lib/asn1/gen_length.c lib/asn1/gen_seq.c lib/asn1/gen_template.c lib/asn1/hash.c lib/asn1/symbol.c lib/asn1/asn1parse.c lib/asn1/lex.c', use_hostcc=True, use_global_deps=False, @@ -872,6 +878,7 @@ HEIMDAL_BINARY('asn1_compile', deps='ROKEN_HOSTCC LIBREPLACE_HOSTCC HEIMDAL_VERS_HOSTCC', install=False ) + bld.env['ASN1_COMPILE'] = os.path.join(bld.env['BUILD_DIRECTORY'], 'asn1_compile') if not bld.CONFIG_SET('USING_SYSTEM_COMPILE_ET'): diff --git a/source4/heimdal_build/wscript_configure b/source4/heimdal_build/wscript_configure index 5936b0441b0..63be7b701ca 100644 --- a/source4/heimdal_build/wscript_configure +++ b/source4/heimdal_build/wscript_configure @@ -1,4 +1,12 @@ #!/usr/bin/env python +# Waf build script for Samba 4's bundled Heimdal. + +# Unless explicitly requested by the user (e.g. +# "./configure --bundled-libraries=!asn1_compile") this will always use the +# bundled Heimdal, even if a system heimdal was found. The reason +# for this is that our checks for the system heimdal are not accurate +# enough yet to know if it is usable (some bug fix might be missing, +# compile_et might not generate the expected code, etc). import Logs, sys @@ -66,7 +74,8 @@ if conf.CHECK_BUNDLED_SYSTEM('com_err', checkfunctions='com_right_r com_err', he conf.define('USING_SYSTEM_COM_ERR', 1) def check_system_heimdal_lib(name, functions='', headers='', onlyif=None): - # Only use system library if the user requested the bundled one not be used. + # Only use system library if the user requested the bundled one not be + # used. if conf.LIB_MAY_BE_BUNDLED(name): return False setattr(conf.env, "CPPPATH_%s" % name.upper(), ["/usr/include/heimdal"]) @@ -76,6 +85,14 @@ def check_system_heimdal_lib(name, functions='', headers='', onlyif=None): conf.define('USING_SYSTEM_%s' % name.upper(), 1) return True +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 + if check_system_heimdal_lib("roken", "rk_socket_set_reuseaddr", "roken.h"): conf.env.CPPPATH_ROKEN_HOSTCC = conf.env.CPPPATH_ROKEN conf.env.LIBPATH_ROKEN_HOSTCC = conf.env.LIBPATH_ROKEN @@ -92,8 +109,5 @@ check_system_heimdal_lib("hcrypto", "MD4_Init", "hcrypto/md4.h", # conf.CHECK_BUNDLED_SYSTEM('tommath', checkfunctions='mp_init', headers='tommath.h') # conf.define('USING_SYSTEM_TOMMATH', 1) -# disable trying to use an external compile_et until we have a configure -# test that checks that the system one actually works. On some systems it -# results in missing symbols (eg. OpenSUSE 10.2 'opi' in the build farm) -#if conf.find_program('compile_et', var='COMPILE_ET'): -# conf.define('USING_SYSTEM_COMPILE_ET', 1) +check_system_heimdal_binary("compile_et") +check_system_heimdal_binary("asn1_compile") -- 2.11.4.GIT