From f8edf31f6a37479a509a27e44157509bb702db90 Mon Sep 17 00:00:00 2001 From: Markus Mottl Date: Thu, 3 Aug 2017 20:00:42 -0400 Subject: [PATCH] Robustified discover script --- src/config/discover.ml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/config/discover.ml b/src/config/discover.ml index 41b6cc2..7892437 100644 --- a/src/config/discover.ml +++ b/src/config/discover.ml @@ -35,6 +35,8 @@ let pkg_export = Printf.sprintf "PKG_CONFIG_PATH=%s" path | _ -> "" +let split_ws str = List.filter (String.split ~on:' ' str) ~f:(String.(<>) "") + let () = let module C = Configurator in C.main ~name:"sqlite3" (fun c -> @@ -46,7 +48,7 @@ let () = let cmd = pkg_export ^ " pkg-config --cflags sqlite3" in match read_lines_from_cmd ~max_lines:1 cmd with | [cflags] -> - let cflags = String.split ~on:' ' cflags in + let cflags = split_ws cflags in if is_macosx || try @@ -60,7 +62,7 @@ let () = let libs = let cmd = pkg_export ^ " pkg-config --libs sqlite3" in match read_lines_from_cmd ~max_lines:1 cmd with - | [libs] -> String.split ~on:' ' libs + | [libs] -> split_ws libs | _ -> failwith "pkg-config failed to return libs" in let conf = { C.Pkg_config.cflags; libs } in