[OCaml] Don't build stub libraries twice.
[oota-llvm.git] / test / lit.cfg
index af446b26ec37c8d8db4c5293eae9fd6da1571d2a..67c9bbae744e59a69d1c699d3932c07234f86dde 100644 (file)
@@ -101,13 +101,24 @@ for options in ['ASAN_OPTIONS', 'UBSAN_OPTIONS']:
         config.environment[options] = os.environ[options]
 
 # Set up OCAMLPATH to include newly built OCaml libraries.
-llvm_ocaml_lib = os.path.join(getattr(config, 'llvm_lib_dir', None), 'ocaml')
+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'
 
@@ -186,12 +197,13 @@ config.substitutions.append( ('%python', config.python_executable) )
 
 # 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