We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6e07dd4 + ea5fbce commit 00bcbd1Copy full SHA for 00bcbd1
src/discover/discover.ml
@@ -14,7 +14,11 @@ let () =
14
main
15
~name:"discover"
16
~args:[ "-o", Set_string output, "FILENAME output file" ]
17
- (fun c ->
18
- let has_popcnt = c_test c ~c_flags:[ "-mpopcnt" ] program in
+ (fun _c ->
+ let f,oc = Filename.open_temp_file "baseconf" ".c" in
19
+ let has_popcnt =
20
+ Fun.protect ~finally:(fun () -> close_out oc; Sys.remove f)
21
+ (fun () -> Out_channel.(output_string oc program; flush oc);
22
+ Sys.command (Printf.sprintf "cc %s -mpopcnt -o /dev/null >/dev/null 2>&1" f) = 0) in
23
Flags.write_sexp !output (if has_popcnt then [ "-mpopcnt" ] else []))
24
;;
0 commit comments