Skip to content

Commit 1fefe9d

Browse files
committed
Merge pull request #350 from ltratt/master
Use clang to build, unless the user explicitly specifies a different compiler
2 parents a8e09a4 + 044579a commit 1fefe9d

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

build.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
extern crate gcc;
88

99
use std::env;
10+
use std::path::Path;
1011

1112
fn main() {
1213
let target = env::var("TARGET").unwrap();
@@ -18,10 +19,17 @@ fn main() {
1819
config.define("X64", None);
1920
}
2021
config.compile("lib_rust_crypto_helpers.a");
21-
} else {
22-
gcc::compile_library(
23-
"lib_rust_crypto_helpers.a",
24-
&["src/util_helpers.c", "src/aesni_helpers.c"]);
22+
}
23+
else {
24+
let mut cfg = gcc::Config::new();
25+
cfg.file("src/util_helpers.c");
26+
cfg.file("src/aesni_helpers.c");
27+
// gcc can't build this library so, unless the user has explicitly
28+
// specified a different C compiler, use clang.
29+
if env::var_os("CC").is_none() {
30+
cfg.compiler(Path::new("clang"));
31+
}
32+
cfg.compile("lib_rust_crypto_helpers.a");
2533
}
2634
}
2735

0 commit comments

Comments
 (0)