build.rs 593 B

12345678910111213141516171819202122
  1. extern crate autocfg;
  2. use std::env;
  3. fn main() {
  4. let ac = autocfg::new();
  5. // If the "i128" feature is explicity requested, don't bother probing for it.
  6. // It will still cause a build error if that was set improperly.
  7. if env::var_os("CARGO_FEATURE_I128").is_some() || ac.probe_type("i128") {
  8. autocfg::emit("has_i128");
  9. }
  10. ac.emit_expression_cfg(
  11. "unsafe { 1f64.to_int_unchecked::<i32>() }",
  12. "has_to_int_unchecked",
  13. );
  14. ac.emit_expression_cfg("1u32.trailing_ones()", "has_leading_trailing_ones");
  15. autocfg::rerun_path("build.rs");
  16. }