]> git.proxmox.com Git - rustc.git/blame - vendor/crossbeam-epoch/build.rs
New upstream version 1.61.0+dfsg1
[rustc.git] / vendor / crossbeam-epoch / build.rs
CommitLineData
5099ac24
FG
1// The rustc-cfg listed below are considered public API, but it is *unstable*
2// and outside of the normal semver guarantees:
3//
4// - `crossbeam_no_atomic_cas`
5// Assume the target does *not* support atomic CAS operations.
6// This is usually detected automatically by the build script, but you may
7// need to enable it manually when building for custom targets or using
8// non-cargo build systems that don't run the build script.
9//
10// With the exceptions mentioned above, the rustc-cfg emitted by the build
11// script are *not* public API.
12
17df50a5
XL
13#![warn(rust_2018_idioms)]
14
15use std::env;
16
17include!("no_atomic.rs");
18
17df50a5
XL
19fn main() {
20 let target = match env::var("TARGET") {
21 Ok(target) => target,
22 Err(e) => {
23 println!(
24 "cargo:warning={}: unable to get TARGET environment variable: {}",
25 env!("CARGO_PKG_NAME"),
26 e
27 );
28 return;
29 }
30 };
31
ee023bcb
FG
32 let cfg = match autocfg::AutoCfg::new() {
33 Ok(cfg) => cfg,
34 Err(e) => {
35 println!(
36 "cargo:warning={}: unable to determine rustc version: {}",
37 env!("CARGO_PKG_NAME"),
38 e
39 );
40 return;
41 }
42 };
43
17df50a5
XL
44 // Note that this is `no_*`, not `has_*`. This allows treating
45 // `cfg(target_has_atomic = "ptr")` as true when the build script doesn't
46 // run. This is needed for compatibility with non-cargo build systems that
47 // don't run the build script.
48 if NO_ATOMIC_CAS.contains(&&*target) {
49 println!("cargo:rustc-cfg=crossbeam_no_atomic_cas");
50 }
51
ee023bcb
FG
52 if cfg.probe_rustc_version(1, 61) {
53 // TODO: invert cfg once Rust 1.61 became stable.
54 println!("cargo:rustc-cfg=crossbeam_const_fn_trait_bound");
55 }
56
17df50a5
XL
57 println!("cargo:rerun-if-changed=no_atomic.rs");
58}