aboutsummaryrefslogtreecommitdiff
path: root/build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'build.rs')
-rw-r--r--build.rs26
1 files changed, 21 insertions, 5 deletions
diff --git a/build.rs b/build.rs
index 587e058..978141a 100644
--- a/build.rs
+++ b/build.rs
@@ -15,10 +15,11 @@
use std::env;
include!("no_atomic.rs");
+include!("build-common.rs");
fn main() {
let target = match env::var("TARGET") {
- Ok(target) => target,
+ Ok(target) => convert_custom_linux_target(target),
Err(e) => {
println!(
"cargo:warning={}: unable to get TARGET environment variable: {}",
@@ -29,13 +30,28 @@ fn main() {
}
};
- // Note that this is `no_*`, not `has_*`. This allows treating
- // `cfg(target_has_atomic = "ptr")` as true when the build script doesn't
- // run. This is needed for compatibility with non-cargo build systems that
- // don't run the build script.
+ let cfg = match autocfg::AutoCfg::new() {
+ Ok(cfg) => cfg,
+ Err(e) => {
+ println!(
+ "cargo:warning={}: unable to determine rustc version: {}",
+ env!("CARGO_PKG_NAME"),
+ e
+ );
+ return;
+ }
+ };
+
+ // Note that this is `no_`*, not `has_*`. This allows treating as the latest
+ // stable rustc is used when the build script doesn't run. This is useful
+ // for non-cargo build systems that don't run the build script.
if NO_ATOMIC_CAS.contains(&&*target) {
println!("cargo:rustc-cfg=crossbeam_no_atomic_cas");
}
+ if !cfg.probe_rustc_version(1, 61) {
+ println!("cargo:rustc-cfg=crossbeam_no_const_fn_trait_bound");
+ }
+
println!("cargo:rerun-if-changed=no_atomic.rs");
}