if symbolizer in os.environ:
config.environment[symbolizer] = os.environ[symbolizer]
-# Propagate options for sanitizers.
-for options in ['ASAN_OPTIONS', 'UBSAN_OPTIONS']:
- if options in os.environ:
- config.environment[options] = os.environ[options]
-
# Set up OCAMLPATH to include newly built OCaml libraries.
llvm_lib_dir = getattr(config, 'llvm_lib_dir', None)
-if llvm_lib_dir: # empty llvm_lib_dir is falsey, reads as None
+if llvm_lib_dir is None:
+ if llvm_obj_root is not None:
+ llvm_lib_dir = os.path.join(llvm_obj_root, 'lib')
+
+if llvm_lib_dir is not None:
llvm_ocaml_lib = os.path.join(llvm_lib_dir, 'ocaml')
- if 'OCAMLPATH' in os.environ:
- ocamlpath = os.path.pathsep.join((llvm_ocaml_lib, os.environ['OCAMLPATH']))
- config.environment['OCAMLPATH'] = ocamlpath
- else:
- config.environment['OCAMLPATH'] = llvm_ocaml_lib
+ if llvm_ocaml_lib is not None:
+ if 'OCAMLPATH' in os.environ:
+ ocamlpath = os.path.pathsep.join((llvm_ocaml_lib, os.environ['OCAMLPATH']))
+ config.environment['OCAMLPATH'] = ocamlpath
+ else:
+ config.environment['OCAMLPATH'] = llvm_ocaml_lib
+
+ if 'CAML_LD_LIBRARY_PATH' in os.environ:
+ caml_ld_library_path = os.path.pathsep.join((llvm_ocaml_lib,
+ os.environ['CAML_LD_LIBRARY_PATH']))
+ config.environment['CAML_LD_LIBRARY_PATH'] = caml_ld_library_path
+ else:
+ config.environment['CAML_LD_LIBRARY_PATH'] = llvm_ocaml_lib
# Set up OCAMLRUNPARAM to enable backtraces in OCaml tests.
config.environment['OCAMLRUNPARAM'] = 'b'
# OCaml substitutions.
# Support tests for both native and bytecode builds.
-if config.have_ocamlopt == '1':
- config.substitutions.append( ('%ocamlcomp',
- "%s ocamlopt %s" % (config.ocamlfind_executable, config.ocaml_flags)) )
+config.substitutions.append( ('%ocamlc',
+ "%s ocamlc %s" % (config.ocamlfind_executable, config.ocaml_flags)) )
+if config.have_ocamlopt in ('1', 'TRUE'):
+ config.substitutions.append( ('%ocamlopt',
+ "%s ocamlopt -cclib -L%s -cclib -Wl,-rpath,%s %s" %
+ (config.ocamlfind_executable, llvm_lib_dir, llvm_lib_dir, config.ocaml_flags)) )
else:
- config.substitutions.append( ('%ocamlcomp',
- "%s ocamlc %s" % (config.ocamlfind_executable, config.ocaml_flags)) )
+ config.substitutions.append( ('%ocamlopt', "true" ) )
# For each occurrence of an llvm tool name as its own word, replace it
# with the full path to the build directory holding that tool. This