Merge branch 'handle-stdout'
[SXSI/xpathcomp.git] / configure
1 #!/usr/bin/env ocaml
2
3 #directory "utils";;
4 #use "conf.ml";;
5
6 Conf.start ();;
7
8 Conf.check_prog "C compiler" "gcc --version";;
9 Conf.check_prog "C++ compiler" "g++ --version";;
10 let _,version, _ = Conf.prog "Ocaml bytecode compiler" "ocamlc -version";;
11 Conf.check "Ocaml version >= 3.11.0" Conf.version version (fun c -> c >= (3,11,0));;
12 Conf.check_prog ~required:false "Ocaml native compiler" "ocamlopt -version";;
13 Conf.check_prog "ocamlbuild" "ocamlbuild -version";;
14 Conf.check_prog "ocamlfind" "ocamlfind printconf";;
15
16 Conf.check_prog "camlp4" "ocamlfind query camlp4";;
17 Conf.check_prog "ulex" "ocamlfind query ulex";;
18 Conf.check_prog "expat" "ocamlfind query expat";;
19
20 Conf.check "libbp" (Conf.absolute) ("%s/../libbp/libbp.a") (Sys.file_exists);;
21 Conf.check "libcds" (Conf.absolute) ("%s/../libcds/lib/libcds.a") (Sys.file_exists);;
22 Conf.check "libxml-tree" (Conf.absolute) ("%s/../XMLTree/libxml-tree.a") (Sys.file_exists);;
23 Conf.check "TextCollection" (Conf.absolute) ("%s/../TextCollection/libTextCollection.a") (Sys.file_exists);;
24
25
26 let libs_files = [
27     (Conf.absolute) ("%s/../libbp/libbp.a");
28     (Conf.absolute) ("%s/../libcds/lib/libcds.a");
29     (Conf.absolute) ("%s/../XMLTree/libxml-tree.a");
30     (Conf.absolute) ("%s/../TextCollection/libTextCollection.a");
31 ]
32
33 let libs_I= [
34     Conf.absolute "-I%s/../libbp";
35     Conf.absolute "-I%s/../libcds/includes";
36     Conf.absolute "-I%s/../XMLTree";
37     Conf.absolute "-I%s/../TextCollection";
38     Conf.absolute "-I%s/..";
39      ]
40
41 let libs_L = [
42     Conf.absolute "-L%s/../libbp";
43     Conf.absolute "-L%s/../libcds/lib";
44     Conf.absolute "-L%s/../XMLTree";
45     Conf.absolute "-L%s/../TextCollection";
46     Conf.absolute "-L%s/..";
47    ]
48
49 (* Order is relevant *)
50 let libs_l = [
51      "-lxml-tree";
52      "-lTextCollection";
53      "-lbp";
54      "-lcds"
55 ]
56
57 let _,ocamlI,_ = Conf.exec "ocamlc -where";;
58 let ocamlI = [ "-I" ^ ocamlI ];;
59
60 Conf.def_str "cxx_cmd" "g++";;
61
62 Conf.def_list "cxx_includes" (libs_I @ ocamlI);;
63 Conf.def_list "cxx_lpaths" libs_L;;
64 Conf.def_list "cxx_libs" libs_l;;
65 Conf.def_list "cxx_libs_objects" libs_files;;
66
67
68 Conf.finish ();;