aboutsummaryrefslogtreecommitdiff
path: root/build.rs
diff options
context:
space:
mode:
authorJoel Galenson <jgalenson@google.com>2020-08-05 11:56:59 -0700
committerJoel Galenson <jgalenson@google.com>2020-08-05 11:58:02 -0700
commita92be9e3a976baa8f5587ac11dba803daea4a401 (patch)
tree731a62de500fff479820b907113ec4890c4950f8 /build.rs
parent7332312364a07d96d81b8f08b2557ece3544a5f6 (diff)
downloadnum-traits-a92be9e3a976baa8f5587ac11dba803daea4a401.tar.gz
Import num-traits-0.2.12
Test: None Change-Id: I3af988183dbde11bc127f0ad9c3abc6068cf2672
Diffstat (limited to 'build.rs')
-rw-r--r--build.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/build.rs b/build.rs
new file mode 100644
index 0000000..891fa09
--- /dev/null
+++ b/build.rs
@@ -0,0 +1,18 @@
+extern crate autocfg;
+
+use std::env;
+
+fn main() {
+ let ac = autocfg::new();
+ if ac.probe_type("i128") {
+ println!("cargo:rustc-cfg=has_i128");
+ } else if env::var_os("CARGO_FEATURE_I128").is_some() {
+ panic!("i128 support was not detected!");
+ }
+ ac.emit_expression_cfg(
+ "unsafe { 1f64.to_int_unchecked::<i32>() }",
+ "has_to_int_unchecked",
+ );
+
+ autocfg::rerun_path("build.rs");
+}