diff --git a/Changes b/Changes index dd74253..dbc2926 100644 --- a/Changes +++ b/Changes @@ -18,8 +18,8 @@ OCamlbuild NEXT_RELEASE - Changed OCamlbuild's license to LGPLv2 with static linking exception. - OGPR#219: speedup target-already-built builds (ygrek) -- MPR#6605, OGPR#117: use ocamlfind, if available, to discover camlp4 path - (Vincent Laporte) +- MPR#6605, OGPR#117: un-hardcode camlp4 library path + (Vincent Laporte and Gabriel Scherer) - #20: add -dot and -man-related ocamldoc options (Gabriel Scherer) - #10, PR#21: Fix manpages generation: properly pass the "manpage" tag. diff --git a/src/ocaml_specific.ml b/src/ocaml_specific.ml index f69dc1e..f6e9fc2 100644 --- a/src/ocaml_specific.ml +++ b/src/ocaml_specific.ml @@ -748,14 +748,13 @@ ocaml_lib ~extern:true ~dir:"+ocamldoc" "ocamldoc";; ocaml_lib ~extern:true ~dir:"+ocamlbuild" ~tag_name:"use_ocamlbuild" "ocamlbuildlib";; let camlp4dir = - Findlib.( - try - if sys_command "sh -c 'ocamlfind list >/dev/null' 2>/dev/null" != 0 - then raise (Findlib_error Cannot_run_ocamlfind); - (query "camlp4").location - with Findlib_error _ -> - "+camlp4" - );; + let where cmd = + (* may raise a Failure exception *) + String.chomp + (My_unix.run_and_read + (cmd ^ " -where 2>/dev/null")) in + try where "camlp4" with _ -> "+camlp4" +;; ocaml_lib ~extern:true ~dir:camlp4dir ~tag_name:"use_camlp4" "camlp4lib";; ocaml_lib ~extern:true ~dir:camlp4dir ~tag_name:"use_old_camlp4" "camlp4";;