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 [])) ;;