summaryrefslogtreecommitdiff
path: root/build.rs
diff options
context:
space:
mode:
authorJoe Richey <joerichey@google.com>2019-07-10 18:03:24 -0700
committerJoe Richey <joerichey@google.com>2019-07-10 19:47:40 -0700
commit3fa021d7ab36b59e877082d3150d626afabc8454 (patch)
treef2db3dde05af1d2447afc606f232ed30f6b9b948 /build.rs
parent956ba427538edb63338aaaffe8372379459ac431 (diff)
downloadrust-libc-3fa021d7ab36b59e877082d3150d626afabc8454.tar.gz
Add libc_thread_local cfg and unstable feature
Diffstat (limited to 'build.rs')
-rw-r--r--build.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/build.rs b/build.rs
index 8452940074..c997e6acfd 100644
--- a/build.rs
+++ b/build.rs
@@ -5,18 +5,18 @@ use std::str;
fn main() {
let rustc_minor_ver =
rustc_minor_version().expect("Failed to get rustc version");
- let rustc_dep_of_std =
- std::env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
- let align_cargo_feature = std::env::var("CARGO_FEATURE_ALIGN").is_ok();
+ let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
+ let align_cargo_feature = env::var("CARGO_FEATURE_ALIGN").is_ok();
+ let unstable_cargo_feature = env::var("CARGO_FEATURE_UNSTABLE").is_ok();
- if std::env::var("CARGO_FEATURE_USE_STD").is_ok() {
+ if env::var("CARGO_FEATURE_USE_STD").is_ok() {
println!(
"cargo:warning=\"libc's use_std cargo feature is deprecated since libc 0.2.55; \
please consider using the `std` cargo feature instead\""
);
}
- if std::env::var("LIBC_CI").is_ok() {
+ if env::var("LIBC_CI").is_ok() {
if let Some(12) = which_freebsd() {
println!("cargo:rustc-cfg=freebsd12");
}
@@ -53,6 +53,11 @@ fn main() {
if rustc_minor_ver >= 33 || rustc_dep_of_std {
println!("cargo:rustc-cfg=libc_packedN");
}
+
+ // #[thread_local] is currently unstable
+ if unstable_cargo_feature || rustc_dep_of_std {
+ println!("cargo:rustc-cfg=libc_thread_local");
+ }
}
fn rustc_minor_version() -> Option<u32> {