Skip to content

Commit

Permalink
Robustified discover script
Browse files Browse the repository at this point in the history
  • Loading branch information
mmottl committed Aug 4, 2017
1 parent cc4f493 commit f8edf31
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/config/discover.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit f8edf31

Please sign in to comment.