build.rs 572 B

1234567891011121314151617181920
  1. use std::env;
  2. fn main() {
  3. let ac = autocfg::new();
  4. ac.emit_expression_cfg(
  5. "unsafe { 1f64.to_int_unchecked::<i32>() }",
  6. "has_to_int_unchecked",
  7. );
  8. ac.emit_expression_cfg("1u32.reverse_bits()", "has_reverse_bits");
  9. ac.emit_expression_cfg("1u32.trailing_ones()", "has_leading_trailing_ones");
  10. ac.emit_expression_cfg("1u32.div_euclid(1u32)", "has_div_euclid");
  11. if env::var_os("CARGO_FEATURE_STD").is_some() {
  12. ac.emit_expression_cfg("1f64.copysign(-1f64)", "has_copysign");
  13. }
  14. autocfg::rerun_path("build.rs");
  15. }