aboutsummaryrefslogtreecommitdiffhomepage
path: root/configure.ml
diff options
context:
space:
mode:
authorGravatar Gaëtan Gilbert <gaetan.gilbert@skyskimmer.net>2017-11-19 13:59:46 +0100
committerGravatar Gaëtan Gilbert <gaetan.gilbert@skyskimmer.net>2017-11-20 11:27:18 +0100
commit5557c23a1cc33b825734403c29c5cca5685d22f0 (patch)
tree5e88d05a9531d2e03b7fa02bd1d4a8e160ea80af /configure.ml
parent8436fead3a8de28dc308729aa71e7da9f8113950 (diff)
Check findlib version in configure (fix #4270).
Diffstat (limited to 'configure.ml')
-rw-r--r--configure.ml30
1 files changed, 28 insertions, 2 deletions
diff --git a/configure.ml b/configure.ml
index 51f3fad7c..86f6b7fe3 100644
--- a/configure.ml
+++ b/configure.ml
@@ -266,6 +266,7 @@ module Prefs = struct
let nativecompiler = ref (not (os_type_win32 || os_type_cygwin))
let coqwebsite = ref "http://coq.inria.fr/"
let force_caml_version = ref false
+ let force_findlib_version = ref false
let warn_error = ref false
end
@@ -334,6 +335,8 @@ let args_options = Arg.align [
" URL of the coq website";
"-force-caml-version", Arg.Set Prefs.force_caml_version,
" Force OCaml version";
+ "-force-findlib-version", Arg.Set Prefs.force_findlib_version,
+ " Force findlib version";
"-warn-error", Arg.Set Prefs.warn_error,
" Make OCaml warnings into errors";
"-camldir", Arg.String (fun _ -> ()),
@@ -439,7 +442,7 @@ let browser =
(** * OCaml programs *)
-let camlbin, caml_version, camllib =
+let camlbin, caml_version, camllib, findlib_version =
let () = match !Prefs.ocamlfindcmd with
| Some cmd -> reset_caml_find camlexec cmd
| None ->
@@ -451,6 +454,7 @@ let camlbin, caml_version, camllib =
if not (is_executable camlexec.find)
then die ("Error: cannot find the executable '"^camlexec.find^"'.")
else
+ let findlib_version, _ = run camlexec.find ["query"; "findlib"; "-format"; "%v"] in
let caml_version, _ = run camlexec.find ["ocamlc";"-version"] in
let camllib, _ = run camlexec.find ["printconf";"stdlib"] in
let camlbin = (* TODO beurk beurk beurk *)
@@ -461,7 +465,7 @@ let camlbin, caml_version, camllib =
let () =
if is_executable (camlbin / "ocaml")
then reset_caml_top camlexec (camlbin / "ocaml") in
- camlbin, caml_version, camllib
+ camlbin, caml_version, camllib, findlib_version
let camlp4compat = "-loc loc"
@@ -491,6 +495,28 @@ let check_caml_version () =
let _ = check_caml_version ()
+let findlib_version_list = numeric_prefix_list findlib_version
+
+let findlib_version_nums =
+ try
+ if List.length findlib_version_list < 2 then failwith "bad version";
+ List.map s2i findlib_version_list
+ with _ ->
+ die ("I found ocamlfind but cannot read its version number!\n" ^
+ "Is it installed properly?")
+
+let check_findlib_version () =
+ if findlib_version_nums >= [1;4;1] then
+ printf "You have OCamlfind %s. Good!\n" findlib_version
+ else
+ let () = printf "Your version of OCamlfind is %s.\n" findlib_version in
+ if !Prefs.force_findlib_version then
+ printf "*Warning* Your version of OCamlfind is outdated.\n"
+ else
+ die "You need OCamlfind 1.4.1 or later."
+
+let _ = check_findlib_version ()
+
let camltag = match caml_version_list with
| x::y::_ -> "OCAML"^x^y
| _ -> assert false