# 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
- 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 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'
# OCaml substitutions.
# Support tests for both native and bytecode builds.
-if config.have_ocamlopt == '1':
- config.substitutions.append( ('%ocamlcomp',
+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 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