forked from ocaml-community/utop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.ml
38 lines (34 loc) · 977 Bytes
/
setup.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
(*
* setup.ml
* --------
* Copyright : (c) 2012, Jeremie Dimino <jeremie@dimino.org>
* Licence : BSD3
*
* This file is a part of utop.
*)
(* OASIS_START *)
#use "topfind";;
#require "oasis.dynrun";;
open OASISDynRun;;
(* OASIS_STOP *)
let search_compiler_libs () =
prerr_endline "I: Searching for OCaml compiler libraries";
let stdlib = BaseEnv.var_get "standard_library" in
let ( / ) = Filename.concat in
try
List.find (fun path -> Sys.file_exists (path / "types.cmi") || Sys.file_exists (path / "typing" / "types.cmi")) [
stdlib;
stdlib / "compiler-libs";
stdlib / "compiler-lib";
stdlib / ".." / "compiler-libs";
stdlib / ".." / "compiler-lib";
]
with Not_found ->
prerr_endline "E: Cannot find compiler libraries! See the README for details.";
exit 1
let compiler_libs =
BaseEnv.var_define
~short_desc:(fun () -> "compiler libraries")
"compiler_libs"
search_compiler_libs
let () = setup ()