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 not llvm_lib_dir:
+ llvm_lib_dir = os.path.join(getattr(config, 'llvm_obj_root', None), 'lib')
+
+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 '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'] = caml_ld_library_path
+
+# Set up OCAMLRUNPARAM to enable backtraces in OCaml tests.
+config.environment['OCAMLRUNPARAM'] = 'b'
+
###
import os
# OCaml substitutions.
# Support tests for both native and bytecode builds.
-if config.ocamlopt_executable != "":
- config.substitutions.append( ('%ocamlcomp',
- "%s %s" % (config.ocamlopt_executable, config.ocaml_flags)) )
- config.substitutions.append( ('%cma', 'cmxa') )
+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 %s" % (config.ocamlfind_executable, config.ocaml_flags)) )
else:
- config.substitutions.append( ('%ocamlcomp',
- "%s %s" % (config.ocamlc_executable, config.ocaml_flags)) )
- config.substitutions.append( ('%cma', 'cma') )
+ 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