add warning if uint128_t detection fails

This commit is contained in:
Andrew Poelstra 2018-08-21 18:41:42 +00:00
parent 5a27abab52
commit 5cd4533375
1 changed files with 13 additions and 4 deletions

View File

@ -23,14 +23,23 @@
extern crate cc;
use std::io::{self, Write};
fn main() {
// Check whether we can use 64-bit compilation
#[cfg(target_pointer_width = "64")]
let use_64bit_compilation = {
cc::Build::new().file("depend/check_uint128_t.c")
.cargo_metadata(false)
.try_compile("check_uint128_t")
.is_ok()
let check = cc::Build::new().file("depend/check_uint128_t.c")
.cargo_metadata(false)
.try_compile("check_uint128_t")
.is_ok();
if !check {
writeln!(
&mut io::stderr(),
"Warning: Compiling in 32-bit mode on a 64-bit architecture due to lack of uint128_t support."
).expect("print to stderr")
}
check
};
#[cfg(not(target_pointer_width = "64"))]
let use_64bit_compilation = false;