1 Author: Vincent Laporte <Vincent.Laporte@gmail.com>
2 Date: Sun Feb 1 11:19:50 2015 +0100
4 ocamlbuild: use ocamlfind to discover camlp4 path
6 and default to `+camlp4`
8 diff --git a/ocamlbuild/ocaml_specific.ml b/ocamlbuild/ocaml_specific.ml
9 index b902810..a73b7a5 100644
10 --- a/ocamlbuild/ocaml_specific.ml
11 +++ b/ocamlbuild/ocaml_specific.ml
12 @@ -698,15 +698,25 @@ ocaml_lib ~extern:true ~tag_name:"use_toplevel" "toplevellib";;
13 ocaml_lib ~extern:true ~dir:"+ocamldoc" "ocamldoc";;
14 ocaml_lib ~extern:true ~dir:"+ocamlbuild" ~tag_name:"use_ocamlbuild" "ocamlbuildlib";;
16 -ocaml_lib ~extern:true ~dir:"+camlp4" ~tag_name:"use_camlp4" "camlp4lib";;
17 -ocaml_lib ~extern:true ~dir:"+camlp4" ~tag_name:"use_old_camlp4" "camlp4";;
18 -ocaml_lib ~extern:true ~dir:"+camlp4" ~tag_name:"use_camlp4_full" "camlp4fulllib";;
22 + if sys_command "sh -c 'ocamlfind list >/dev/null' 2>/dev/null" != 0
23 + then raise (Findlib_error Cannot_run_ocamlfind);
24 + (query "camlp4").location
25 + with Findlib_error _ ->
29 +ocaml_lib ~extern:true ~dir:camlp4dir ~tag_name:"use_camlp4" "camlp4lib";;
30 +ocaml_lib ~extern:true ~dir:camlp4dir ~tag_name:"use_old_camlp4" "camlp4";;
31 +ocaml_lib ~extern:true ~dir:camlp4dir ~tag_name:"use_camlp4_full" "camlp4fulllib";;
32 flag ["ocaml"; "compile"; "use_camlp4_full"]
33 - (S[A"-I"; A"+camlp4/Camlp4Parsers";
34 - A"-I"; A"+camlp4/Camlp4Printers";
35 - A"-I"; A"+camlp4/Camlp4Filters"]);;
36 -flag ["ocaml"; "use_camlp4_bin"; "link"; "byte"] (A"+camlp4/Camlp4Bin.cmo");;
37 -flag ["ocaml"; "use_camlp4_bin"; "link"; "native"] (A"+camlp4/Camlp4Bin.cmx");;
38 + (S[A"-I"; A(camlp4dir^"/Camlp4Parsers");
39 + A"-I"; A(camlp4dir^"/Camlp4Printers");
40 + A"-I"; A(camlp4dir^"/Camlp4Filters")]);;
41 +flag ["ocaml"; "use_camlp4_bin"; "link"; "byte"] (A(camlp4dir^"/Camlp4Bin.cmo"));;
42 +flag ["ocaml"; "use_camlp4_bin"; "link"; "native"] (A(camlp4dir^"/Camlp4Bin.cmx"));;
44 flag ["ocaml"; "debug"; "compile"; "byte"] (A "-g");;
45 flag ["ocaml"; "debug"; "link"; "byte"; "program"] (A "-g");;