From 26b6d623d27fab56527990db910363ccc021909a Mon Sep 17 00:00:00 2001 From: Mykola Stryebkov Date: Mon, 11 Aug 2025 01:35:26 +0300 Subject: [PATCH] Never ask for -mpopcount on macosx --- src/discover/discover.ml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/discover/discover.ml b/src/discover/discover.ml index ce892e8..66c5565 100644 --- a/src/discover/discover.ml +++ b/src/discover/discover.ml @@ -14,11 +14,15 @@ let () = main ~name:"discover" ~args:[ "-o", Set_string output, "FILENAME output file" ] - (fun _c -> + (fun c -> let f,oc = Filename.open_temp_file "baseconf" ".c" in let has_popcnt = - Fun.protect ~finally:(fun () -> close_out oc; Sys.remove f) - (fun () -> Out_channel.(output_string oc program; flush oc); - Sys.command (Printf.sprintf "cc %s -mpopcnt -o /dev/null >/dev/null 2>&1" f) = 0) in + match ocaml_config_var_exn c "system" with + | "macosx" -> false + | _ -> + Fun.protect ~finally:(fun () -> close_out oc; Sys.remove f) + (fun () -> Out_channel.(output_string oc program; flush oc); + Sys.command (Printf.sprintf "cc %s -mpopcnt -o /dev/null >/dev/null 2>&1" f) = 0) + in Flags.write_sexp !output (if has_popcnt then [ "-mpopcnt" ] else [])) ;;