build.rs 432 B

123456789101112131415161718
  1. extern crate autocfg;
  2. use std::env;
  3. fn main() {
  4. let ac = autocfg::new();
  5. if ac.probe_type("i128") {
  6. println!("cargo:rustc-cfg=has_i128");
  7. } else if env::var_os("CARGO_FEATURE_I128").is_some() {
  8. panic!("i128 support was not detected!");
  9. }
  10. ac.emit_expression_cfg(
  11. "unsafe { 1f64.to_int_unchecked::<i32>() }",
  12. "has_to_int_unchecked",
  13. );
  14. autocfg::rerun_path("build.rs");
  15. }