From 3fa021d7ab36b59e877082d3150d626afabc8454 Mon Sep 17 00:00:00 2001 From: Joe Richey Date: Wed, 10 Jul 2019 18:03:24 -0700 Subject: Add libc_thread_local cfg and unstable feature --- build.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'build.rs') 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 { -- cgit v1.2.1