diff options
author | 2015-03-04 16:22:24 +0100 | |
---|---|---|
committer | 2015-03-04 16:22:24 +0100 | |
commit | a348471ec6303b9b080d77cf0ca7a58c21aa6369 (patch) | |
tree | 0746249e326b92fb21f98fe71e467f0ee0215058 /configure.ml | |
parent | d169ecbac96fe2a8a6a44395ad7fa83612e725c4 (diff) | |
parent | 00018101cf81f69d23587985a16fe3c8eefb8eaf (diff) |
Merge branch 'v8.5'
Diffstat (limited to 'configure.ml')
-rw-r--r-- | configure.ml | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/configure.ml b/configure.ml index e83ebc7af..e8ef3ace7 100644 --- a/configure.ml +++ b/configure.ml @@ -534,6 +534,16 @@ let camltag = match caml_version_list with (** * CamlpX configuration *) +(* Convention: we use camldir as a prioritary location for camlpX, if given *) + +let which_camlpX base = + match !Prefs.camldir with + | Some dir -> + let file = Filename.concat dir base in + if is_executable file then file else which base + | None -> + which base + (* TODO: camlp5dir should rather be the *binary* location, just as camldir *) (* TODO: remove the late attempts at finding gramlib.cma *) @@ -569,12 +579,12 @@ let check_camlp5 testcma = match !Prefs.camlp5dir with let check_camlp5_version () = try - let camlp5o = which "camlp5o" in + let camlp5o = which_camlpX "camlp5o" in let version_line, _ = run ~err:StdOut camlp5o ["-v"] in let version = List.nth (string_split ' ' version_line) 2 in match string_split '.' version with | major::minor::_ when s2i major > 5 || (s2i major, s2i minor) >= (5,1) -> - printf "You have Camlp5 %s. Good!\n" version; camlp5o + printf "You have Camlp5 %s. Good!\n" version; camlp5o, version | _ -> failwith "bad version" with | Not_found -> die "Error: cannot find Camlp5 binaries in path.\n" @@ -585,8 +595,8 @@ let config_camlpX () = if not !Prefs.usecamlp5 then raise NoCamlp5; let camlp5mod = "gramlib" in let camlp5libdir = check_camlp5 (camlp5mod^".cma") in - let camlp5o = check_camlp5_version () in - "camlp5", camlp5o, Filename.basename camlp5o, camlp5libdir, camlp5mod + let camlp5o, camlp5_version = check_camlp5_version () in + "camlp5", camlp5o, Filename.dirname camlp5o, camlp5libdir, camlp5mod, camlp5_version with NoCamlp5 -> (* We now try to use Camlp4, either by explicit choice or by lack of proper Camlp5 installation *) @@ -595,12 +605,13 @@ let config_camlpX () = if not (Sys.file_exists (camlp4libdir/camlp4mod^".cma")) then die "No Camlp4 installation found.\n"; try - let camlp4orf = which "camlp4orf" in - ignore (run camlp4orf []); - "camlp4", camlp4orf, Filename.basename camlp4orf, camlp4libdir, camlp4mod + let camlp4orf = which_camlpX "camlp4orf" in + let version_line, _ = run ~err:StdOut camlp4orf ["-v"] in + let camlp4_version = List.nth (string_split ' ' version_line) 2 in + "camlp4", camlp4orf, Filename.dirname camlp4orf, camlp4libdir, camlp4mod, camlp4_version with _ -> die "No Camlp4 installation found.\n" -let camlpX, camlpXo, camlpXbindir, fullcamlpXlibdir, camlpXmod = config_camlpX () +let camlpX, camlpXo, camlpXbindir, fullcamlpXlibdir, camlpXmod, camlpX_version = config_camlpX () let shorten_camllib s = if starts_with s (camllib^"/") then @@ -957,9 +968,11 @@ let print_summary () = pr " Coq VM bytecode link flags : %s\n" (String.concat " " vmbyteflags); pr " Other bytecode link flags : %s\n" custom_flag; pr " OS dependent libraries : %s\n" osdeplibs; - pr " OCaml/Camlp4 version : %s\n" caml_version; - pr " OCaml/Camlp4 binaries in : %s\n" camlbin; + pr " OCaml version : %s\n" caml_version; + pr " OCaml binaries in : %s\n" camlbin; pr " OCaml library in : %s\n" camllib; + pr " %s version : %s\n" (String.capitalize camlpX) camlpX_version; + pr " %s binaries in : %s\n" (String.capitalize camlpX) camlpXbindir; pr " %s library in : %s\n" (String.capitalize camlpX) camlpXlibdir; if best_compiler = "opt" then pr " Native dynamic link support : %B\n" hasnatdynlink; |