aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/coqdoc/cdglobals.ml
diff options
context:
space:
mode:
authorGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2011-04-20 15:03:47 +0000
committerGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2011-04-20 15:03:47 +0000
commit72e30fdb992bf6adfae9b4a0345123ca6279eb2b (patch)
tree9d70562af216370d5419dd2e2b4bd0872ea4c074 /tools/coqdoc/cdglobals.ml
parentd7c619b29f80eff6cc0551d1a64eb92d789b601e (diff)
Coqdoc: also try coqlib relative to the coqdoc binary location
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@14035 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'tools/coqdoc/cdglobals.ml')
-rw-r--r--tools/coqdoc/cdglobals.ml18
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/coqdoc/cdglobals.ml b/tools/coqdoc/cdglobals.ml
index 1b1a321e6..a412e6865 100644
--- a/tools/coqdoc/cdglobals.ml
+++ b/tools/coqdoc/cdglobals.ml
@@ -49,6 +49,22 @@ type glob_source_t =
let glob_source = ref DotGlob
+(** A weaker analog of the function in Envars *)
+
+let guess_coqlib () =
+ let file = "states/initial.coq" in
+ if Sys.file_exists (Filename.concat Coq_config.coqlib file)
+ then Coq_config.coqlib
+ else
+ let coqbin = Filename.dirname Sys.executable_name in
+ let prefix = Filename.dirname coqbin in
+ 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
+ Coq_config.coqlib
+
let header_trailer = ref true
let header_file = ref ""
let header_file_spec = ref false
@@ -66,7 +82,7 @@ let page_title = ref ""
let title = ref ""
let externals = ref true
let coqlib = ref Coq_config.wwwstdlib
-let coqlib_path = ref Coq_config.coqlib
+let coqlib_path = ref (guess_coqlib ())
let raw_comments = ref false
let parse_comments = ref false
let plain_comments = ref false