Commit 039b16b2 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2004-04-23 20:53:55 by beppe] Added search for OCaml src in standard directories

Original author: beppe
Date: 2004-04-23 20:53:55+00:00
parent 08bce3b7
......@@ -59,6 +59,9 @@ let vars =
"sessiondir", ref "/tmp/cduce_sessions";
"mliface", ref ""
]
let src_dirs = ["/usr/src"; "/usr/local/src"; "/tmp"]
let fatal s = printf "*** Fatal error: %s\n" s; exit 1
let warning s = printf "* Warning: %s\n" s
......@@ -153,10 +156,27 @@ let exe = match Sys.os_type with
print "Cygwin detected... executable will have .exe extension"; "exe"
| _ -> ""
let rec search_sources source_list =
match source_list with
| [] -> (print "\
* Warning: no OCaml sources found in standard locations\n\
* Warning: please specify the source location with --mliface option\n\
* Warning: OCaml interface will not be compiled\n"; "")
| dir :: tail ->
print ("Looking for Ocaml sources in " ^ dir ^" ...\n"); flush stdout;
if Sys.command ("find " ^ dir ^ " -maxdepth 3 -name ocamlcomp.sh -fprintf .try %h 2> /dev/null") = 0
then try
let result = input_line (open_in ".try") in
ignore(Sys.command "rm .try") ;
print ("Found OCaml sources in" ^ result ^ "\n");
result
with End_of_file -> search_sources tail
else search_sources tail
let ml_interface =
let dir = !(List.assoc "mliface" vars) in
let dir1 = !(List.assoc "mliface" vars) in
let dir = (if dir1 = "" then search_sources src_dirs else dir1) in
if dir = "" then `no
else
let file = if native then "types.cmx" else "types.cmo" in
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment