diff --git a/myocamlbuild.ml b/myocamlbuild.ml index 5f27fb6..a5e0641 100644 --- a/myocamlbuild.ml +++ b/myocamlbuild.ml @@ -30,16 +30,25 @@ let () = (* Use -linkpkg for creating toplevels *) flag ["ocaml"; "link"; "toplevel"] & A"-linkpkg"; - (* Optcomp *) - flag ["ocaml"; "compile"; "pa_optcomp"] & S[A"-ppopt"; A "syntax/pa_optcomp.cmo"]; - flag ["ocaml"; "ocamldep"; "pa_optcomp"] & S[A"-ppopt"; A "syntax/pa_optcomp.cmo"]; - flag ["ocaml"; "doc"; "pa_optcomp"] & S[A"-ppopt"; A "syntax/pa_optcomp.cmo"]; - dep ["ocaml"; "ocamldep"; "pa_optcomp"] ["syntax/pa_optcomp.cmo"]; - let env = BaseEnvLight.load () in let path = BaseEnvLight.var_get "compiler_libs" env in let stdlib = BaseEnvLight.var_get "standard_library" env in + let findlib_version = BaseEnvLight.var_get "findlib_version" env in + let findlib_version = + Scanf.sscanf findlib_version "%d.%d" (Printf.sprintf "findlib_version=(%d, %d)") + in + + (* Optcomp *) + let args = + S[A"-ppopt"; A"syntax/pa_optcomp.cmo"; + A"-ppopt"; A"-let"; A"-ppopt"; A findlib_version] + in + flag ["ocaml"; "compile"; "pa_optcomp"] args; + flag ["ocaml"; "ocamldep"; "pa_optcomp"] args; + flag ["ocaml"; "doc"; "pa_optcomp"] args; + dep ["ocaml"; "ocamldep"; "pa_optcomp"] ["syntax/pa_optcomp.cmo"]; + (* Add directories for compiler-libraries: *) let paths = List.filter Sys.file_exists [path; path / "typing"; path / "parsing"; path / "utils"] in let paths = List.map (fun path -> S [A "-I"; A path]) paths in diff --git a/src/lib/uTop.ml b/src/lib/uTop.ml index a4afe55..bfa45c2 100644 --- a/src/lib/uTop.ml +++ b/src/lib/uTop.ml @@ -600,11 +600,13 @@ let () = let topfind_log, set_topfind_log = S.create ~eq:(fun _ _ -> false) [] +#if findlib_version >= (1, 4) let () = let real_log = !Topfind.log in Topfind.log := fun str -> set_topfind_log (str :: S.value topfind_log); if S.value topfind_verbose then real_log str +#endif let () = Hashtbl.add diff --git a/src/lib/uTop.mli b/src/lib/uTop.mli index 72fcab8..07f332c 100644 --- a/src/lib/uTop.mli +++ b/src/lib/uTop.mli @@ -48,7 +48,8 @@ val set_hide_reserved : bool -> unit (** Modifies {!hide_reserved}. *) val topfind_verbose : bool signal - (** If [false] (the default) messages from findlib are hidden. *) + (** If [false] (the default) messages from findlib are hidden. This is only effective + with findlib >= 1.4. *) val get_topfind_verbose : unit -> bool (** Returns the value of {!topfind_verbose}. *) @@ -57,7 +58,8 @@ val set_topfind_verbose : bool -> unit (** Modifies {!topfind_verbose}. *) val topfind_log : string list signal - (** List of messages logged by findlib since the beginning of the session. *) + (** List of messages logged by findlib since the beginning of the session. This + requires findlib >= 1.4. *) val show_box : bool signal (** If [true] (the default) the completion bar is displayed. *)