diff options
author | Stephane Glondu <steph@glondu.net> | 2010-07-21 09:46:51 +0200 |
---|---|---|
committer | Stephane Glondu <steph@glondu.net> | 2010-07-21 09:46:51 +0200 |
commit | 5b7eafd0f00a16d78f99a27f5c7d5a0de77dc7e6 (patch) | |
tree | 631ad791a7685edafeb1fb2e8faeedc8379318ae /lib/envars.ml | |
parent | da178a880e3ace820b41d38b191d3785b82991f5 (diff) |
Imported Upstream snapshot 8.3~beta0+13298
Diffstat (limited to 'lib/envars.ml')
-rw-r--r-- | lib/envars.ml | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/lib/envars.ml b/lib/envars.ml index d700ffe1..2e680ad0 100644 --- a/lib/envars.ml +++ b/lib/envars.ml @@ -9,77 +9,77 @@ (* This file gathers environment variables needed by Coq to run (such as coqlib) *) -let coqbin () = +let coqbin () = if !Flags.boot || Coq_config.local then Filename.concat Coq_config.coqsrc "bin" else System.canonical_path_name (Filename.dirname Sys.executable_name) -let guess_coqlib () = +let guess_coqlib () = let file = "states/initial.coq" in - if Sys.file_exists (Filename.concat Coq_config.coqlib file) + if Sys.file_exists (Filename.concat Coq_config.coqlib file) then Coq_config.coqlib - else + else let coqbin = System.canonical_path_name (Filename.dirname Sys.executable_name) in let prefix = Filename.dirname coqbin in - let rpath = if Coq_config.local then [] else + let rpath = if Coq_config.local then [] else (if Coq_config.arch = "win32" then ["lib"] else ["lib";"coq"]) in let coqlib = List.fold_left Filename.concat prefix rpath in if Sys.file_exists (Filename.concat coqlib file) then coqlib else Util.error "cannot guess a path for Coq libraries; please use -coqlib option" - -let coqlib () = + +let coqlib () = if !Flags.coqlib_spec then !Flags.coqlib else (if !Flags.boot then Coq_config.coqsrc else guess_coqlib ()) let path_to_list p = let sep = if Sys.os_type = "Win32" then ';' else ':' in - Util.split_string_at sep p + Util.split_string_at sep p let rec which l f = match l with | [] -> raise Not_found - | p :: tl -> - if Sys.file_exists (Filename.concat p f) - then p + | p :: tl -> + if Sys.file_exists (Filename.concat p f) + then p else which tl f - -let guess_camlbin () = - let path = try Sys.getenv "PATH" with _ -> raise Not_found in + +let guess_camlbin () = + let path = try Sys.getenv "PATH" with _ -> raise Not_found in let lpath = path_to_list path in which lpath "ocamlc" -let guess_camlp4bin () = - let path = try Sys.getenv "PATH" with _ -> raise Not_found in +let guess_camlp4bin () = + let path = try Sys.getenv "PATH" with _ -> raise Not_found in let lpath = path_to_list path in which lpath Coq_config.camlp4 -let camlbin () = +let camlbin () = if !Flags.camlbin_spec then !Flags.camlbin else if !Flags.boot then Coq_config.camlbin else try guess_camlbin () with _ -> Coq_config.camlbin -let camllib () = +let camllib () = if !Flags.boot then Coq_config.camllib - else - let camlbin = camlbin () in + else + let camlbin = camlbin () in let com = (Filename.concat camlbin "ocamlc") ^ " -where" in let _,res = System.run_command (fun x -> x) (fun _ -> ()) com in Util.strip res (* TODO : essayer aussi camlbin *) -let camlp4bin () = +let camlp4bin () = if !Flags.camlp4bin_spec then !Flags.camlp4bin else if !Flags.boot then Coq_config.camlp4bin else try guess_camlp4bin () with _ -> Coq_config.camlp4bin -let camlp4lib () = +let camlp4lib () = if !Flags.boot then Coq_config.camlp4lib - else - let camlp4bin = camlp4bin () in + else + let camlp4bin = camlp4bin () in let com = (Filename.concat camlp4bin Coq_config.camlp4) ^ " -where" in let _,res = System.run_command (fun x -> x) (fun _ -> ()) com in Util.strip res - + |