aboutsummaryrefslogtreecommitdiff
path: root/tools/coqdoc
diff options
context:
space:
mode:
Diffstat (limited to 'tools/coqdoc')
-rw-r--r--tools/coqdoc/cdglobals.ml5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/coqdoc/cdglobals.ml b/tools/coqdoc/cdglobals.ml
index 0d3fb77551..5dd6cc6c83 100644
--- a/tools/coqdoc/cdglobals.ml
+++ b/tools/coqdoc/cdglobals.ml
@@ -79,14 +79,17 @@ let use_suffix prefix suffix =
(** A weaker analog of the function in Envars *)
+let getenv_else s dft = try Sys.getenv s with Not_found -> dft ()
+
let guess_coqlib () =
+ getenv_else "COQLIB" (fun () ->
let file = "theories/Init/Prelude.vo" in
let coqbin = normalize_path (Filename.dirname Sys.executable_name) in
let prefix = Filename.dirname coqbin in
let coqlib = use_suffix prefix Coq_config.coqlibsuffix in
if Sys.file_exists (coqlib / file) then coqlib else
if not Coq_config.local && Sys.file_exists (Coq_config.coqlib / file)
- then Coq_config.coqlib else prefix
+ then Coq_config.coqlib else prefix)
let header_trailer = ref true
let header_file = ref ""