Skip to content

Commit f8edf31

Browse files
committed
Robustified discover script
1 parent cc4f493 commit f8edf31

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/config/discover.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ let pkg_export =
3535
Printf.sprintf "PKG_CONFIG_PATH=%s" path
3636
| _ -> ""
3737

38+
let split_ws str = List.filter (String.split ~on:' ' str) ~f:(String.(<>) "")
39+
3840
let () =
3941
let module C = Configurator in
4042
C.main ~name:"sqlite3" (fun c ->
@@ -46,7 +48,7 @@ let () =
4648
let cmd = pkg_export ^ " pkg-config --cflags sqlite3" in
4749
match read_lines_from_cmd ~max_lines:1 cmd with
4850
| [cflags] ->
49-
let cflags = String.split ~on:' ' cflags in
51+
let cflags = split_ws cflags in
5052
if
5153
is_macosx ||
5254
try
@@ -60,7 +62,7 @@ let () =
6062
let libs =
6163
let cmd = pkg_export ^ " pkg-config --libs sqlite3" in
6264
match read_lines_from_cmd ~max_lines:1 cmd with
63-
| [libs] -> String.split ~on:' ' libs
65+
| [libs] -> split_ws libs
6466
| _ -> failwith "pkg-config failed to return libs"
6567
in
6668
let conf = { C.Pkg_config.cflags; libs } in

0 commit comments

Comments
 (0)