From 0dd793a14a0b0b593bff7d33c1f835fc5a38313e Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Mon, 4 Dec 2017 19:00:09 +0000 Subject: [configure] fix detection of `md5sum` --- configure.ml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'configure.ml') diff --git a/configure.ml b/configure.ml index 1ccb69106..1e729e97e 100644 --- a/configure.ml +++ b/configure.ml @@ -837,9 +837,16 @@ let strip = (** * md5sum command *) let md5sum = - if List.mem arch ["Darwin"; "FreeBSD"; "OpenBSD"] - then "md5 -q" else "md5sum" - + let rec loop = function + | [] -> die "Don’t know how to compute MD5 checksums…" + | (p, ma, a) :: tl -> + if fst (tryrun p (ma @ a)) <> "" + then List.fold_left (Printf.sprintf "%s %s") p ma + else loop tl + in loop [ + "md5sum", [], [ "--version" ]; + "md5", ["-q"], [ "-s" ; "''" ]; + ] (** * Documentation : do we have latex, hevea, ... *) -- cgit v1.2.3 From 52a37c791a349f8580653c8b2f53025c583ee024 Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Tue, 5 Dec 2017 09:35:31 +0000 Subject: [configure] adds a `select_command` function --- configure.ml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'configure.ml') diff --git a/configure.ml b/configure.ml index 1e729e97e..33387f4c6 100644 --- a/configure.ml +++ b/configure.ml @@ -178,6 +178,20 @@ let which prog = let program_in_path prog = try let _ = which prog in true with Not_found -> false +(** Choose a command among a list of candidates + (command name, mandatory arguments, arguments for this test). + Chooses the first one whose execution outputs a non-empty (first) line. + Dies with message [msg] if none is found. *) + +let select_command msg canditates = + let rec search = function + | [] -> die msg + | (p, x, y) :: tl -> + if fst (tryrun p (x @ y)) <> "" + then List.fold_left (Printf.sprintf "%s %s") p x + else search tl + in search canditates + (** As per bug #4828, ocamlfind on Windows/Cygwin barfs if you pass it a quoted path to camlpXo via -pp. So we only quote camlpXo on not Windows, and warn on Windows if the path contains spaces *) @@ -837,13 +851,7 @@ let strip = (** * md5sum command *) let md5sum = - let rec loop = function - | [] -> die "Don’t know how to compute MD5 checksums…" - | (p, ma, a) :: tl -> - if fst (tryrun p (ma @ a)) <> "" - then List.fold_left (Printf.sprintf "%s %s") p ma - else loop tl - in loop [ + select_command "Don’t know how to compute MD5 checksums…" [ "md5sum", [], [ "--version" ]; "md5", ["-q"], [ "-s" ; "''" ]; ] -- cgit v1.2.3 From 801147a25196d01f280a80fb3e64e644cfc92d83 Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Thu, 7 Dec 2017 09:32:32 +0000 Subject: [configure] fix spelling mistake --- configure.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'configure.ml') diff --git a/configure.ml b/configure.ml index 33387f4c6..37315aae7 100644 --- a/configure.ml +++ b/configure.ml @@ -183,14 +183,14 @@ let program_in_path prog = Chooses the first one whose execution outputs a non-empty (first) line. Dies with message [msg] if none is found. *) -let select_command msg canditates = +let select_command msg candidates = let rec search = function | [] -> die msg | (p, x, y) :: tl -> if fst (tryrun p (x @ y)) <> "" then List.fold_left (Printf.sprintf "%s %s") p x else search tl - in search canditates + in search candidates (** As per bug #4828, ocamlfind on Windows/Cygwin barfs if you pass it a quoted path to camlpXo via -pp. So we only quote camlpXo on not -- cgit v1.2.3