forked from geneweb/geneweb
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfigure.ml
More file actions
64 lines (56 loc) · 1.95 KB
/
configure.ml
File metadata and controls
64 lines (56 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
(* ocaml ./configure.ml *)
#use "topfind"
#require "unix"
let installed pkg = 0 = Sys.command ("ocamlfind query -qo -qe " ^ pkg)
let errmsg = "usage: " ^ Sys.argv.(0) ^ " [options]"
let warning_sosa_legacy () =
Format.eprintf
"The option --sosa-legacy has no longer effect. To use the legacy \
implementation, DO NOT install zarith in your opam switch and recompile \
GeneWeb.@."
let warning_sosa_zarith () =
Format.eprintf
"The option --sosa-zarith has no longer effect. To use the Zarith \
implementation, install zarith in your opam switch and recompile \
GeneWeb.@."
let warning_syslog () =
Format.eprintf
"The option --syslog has no longer effect. The syslog option is always \
enabled.@."
let warning_gwd_caching () =
Format.eprintf
"The option --gwd-caching has no longer effect. To enable cache in memory \
feature, install ancient in your opam switch and recompile GeneWeb.@."
let speclist =
[
( "--sosa-legacy",
Arg.Unit warning_sosa_legacy,
" Use legacy Sosa module implementation" );
( "--sosa-zarith",
Arg.Unit warning_sosa_zarith,
" Use Sosa module implementation based on `zarith` library" );
("--syslog", Arg.Unit warning_syslog, " Log gwd errors using syslog");
( "--gwd-caching",
Arg.Unit warning_gwd_caching,
" Enable database preloading (Unix-only)" );
]
|> List.sort compare |> Arg.align
let () =
Arg.parse speclist failwith errmsg;
let os_type, ext =
match
let p = Unix.open_process_in "uname -s" in
let line = input_line p in
close_in p;
line
with
| ("Linux" | "Darwin" | "FreeBSD") as os_type -> (os_type, "")
| _ -> ("Win", ".exe")
in
let ch = open_out "Makefile.config" in
let writeln s = output_string ch @@ s ^ "\n" in
let var name value = writeln @@ name ^ "=" ^ value in
writeln @@ "# This file is generated by " ^ Sys.argv.(0) ^ ".";
var "OS_TYPE" os_type;
var "EXT" ext;
close_out ch