Make build-config magic use memfd by default.

This commit is contained in:
Chris Fallin
2022-01-31 16:54:04 -08:00
parent ccfa245261
commit 0ff8f6ab20
9 changed files with 22 additions and 26 deletions

View File

@@ -10,4 +10,15 @@ fn main() {
)
.file("src/helpers.c")
.compile("wasmtime-helpers");
// Check to see if we are on Linux and the `memfd` feature is
// active. If so, enable the `memfd` rustc cfg so `#[cfg(memfd)]`
// will work.
let os = env::var("CARGO_CFG_TARGET_OS").unwrap();
let is_memfd = env::var("CARGO_FEATURE_MEMFD").is_ok();
let is_pooling = env::var("CARGO_FEATURE_POOLING_ALLOCATOR").is_ok();
let is_uffd = env::var("CARGO_FEATURE_UFFD").is_ok();
if &os == "linux" && is_memfd && is_pooling && !is_uffd {
println!("cargo:rustc-cfg=memfd");
}
}