Commit 5abbc48d authored by Kim Nguyễn's avatar Kim Nguyễn Committed by Pietro Abate

Detect OCaml version used for the ocaml bridge in the configure script.

Conflicts:
	configure.ml
parent 3366b696
......@@ -138,7 +138,7 @@ let check_feature f p =
else (print "disabled\n"; false)
let native =
check_feature "ocamlopt" (fun () -> command "ocamlfind ocamlopt") && !native
check_feature "ocamlopt" (fun () -> command "ocamlfind ocamlopt")
let check_pkg p () =
try
......@@ -179,7 +179,17 @@ let add_icon = match Sys.os_type with
let check_mliface dir =
(* Sys.file_exists (Filename.concat dir "typing/types.ml") *)
Sys.file_exists (Filename.concat dir "typing/types.ml")
List.for_all (fun f ->
Sys.file_exists (Filename.concat dir f))
[ "typing/types.ml"; "VERSION" ]
let mliface_version dir =
let ic = open_in (Filename.concat dir "VERSION") in
let s = input_line ic in
close_in ic;
if s < "4" then "3.x"
else if s < "4.02" then "4.01"
else "4.02"
let ocaml_stdlib () =
if (Sys.command "ocamlc -where > ocaml_stdlib" <> 0) then
......@@ -195,17 +205,19 @@ let make_absolute dir =
then Filename.concat (Sys.getcwd ()) dir
else dir
let ml_interface =
let ml_interface, mliface_version =
let dir1 = !(List.assoc "mliface" vars) in
let dirs = if dir1 = "" then [] else [ make_absolute dir1 ] in
print "ocaml sources... ";
let rec loop = function
| [] ->
print "not found (the interface will not be built)\n";
None
None, ""
| d::dirs ->
if check_mliface d then
(print ("found: " ^ d ^ "\n"); Some d)
let version = mliface_version d in
(print ("found: " ^ d ^ ", version " ^ version ^ "\n");
Some d, version)
else loop dirs
in
loop dirs
......@@ -285,7 +297,7 @@ let () =
fprintf out "# This file has been generated by the configure script\n";
fprintf out "NATIVE=%b\n" native;
(match ml_interface with
| Some d -> fprintf out "ML_INTERFACE=true\nOCAML_SRC=%s\n" d
| Some d -> fprintf out "ML_INTERFACE=true\nOCAML_SRC=%s\nML_INTERFACE_VERSION=%s\n" d mliface_version
| None -> fprintf out "ML_INTERFACE=false\n");
fprintf out "PXP=%b\n" pxp;
fprintf out "EXPAT=%b\n" expat;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment