Skip to content

Commit

Permalink
Do not require prefix in configure when lib and mandir have been set (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Gbury authored Mar 31, 2022
1 parent 5efafdc commit 7606469
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions configure.ml
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,17 @@ let opam_var v =

(* Compute actual values for config options *)
let () =
let prefix_set = !prefix <> "" in
update "prefix" prefix (fun () -> opam_var "prefix");
update "libdir" libdir (fun () ->
if prefix_set then Filename.concat !prefix "lib" else opam_var "lib");
update "mandir" mandir (fun () ->
if prefix_set then Filename.concat !prefix "man" else opam_var "man");
if !prefix <> "" then begin
update "libdir" libdir (fun () -> Filename.concat !prefix "lib");
update "mandir" mandir (fun () -> Filename.concat !prefix "man");
()
end else begin
update "libdir" libdir (fun () -> opam_var "lib");
update "mandir" mandir (fun () -> opam_var "man");
()
end;
assert (!libdir <> "");
assert (!mandir <> "");
()

(* Output config options into lib/util/config.ml *)
Expand Down Expand Up @@ -185,7 +190,6 @@ let () =
let ch = open_out "Makefile.config" in
let fmt = Format.formatter_of_out_channel ch in
let () = Format.fprintf fmt "# Generated by configure@." in
let () = Format.fprintf fmt "prefix=%s@." !prefix in
let () = Format.fprintf fmt "libdir=%s@." !libdir in
let () = Format.fprintf fmt "mandir=%s@." !mandir in
let () = close_out ch in
Expand Down

0 comments on commit 7606469

Please sign in to comment.