heimdal_build: Look for asn1_compile (but by default, don't use it).
authorJelmer Vernooij <jelmer@samba.org>
Sat, 1 Jan 2011 00:25:10 +0000 (01:25 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 1 Jan 2011 03:00:03 +0000 (04:00 +0100)
source4/heimdal_build/wscript_build
source4/heimdal_build/wscript_configure

index dae6786cd7cf037c3474fbb1a2d87b5b05abdfc1..c71e22494bbfc0a3d36c5d9de111de4e7d7f8359 100644 (file)
@@ -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'):
index 5936b0441b0bd42f855907f23df47f610d840f86..63be7b701caf6f165979288784e95883b907f7d6 100644 (file)
@@ -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")