use std::io::Write;
use std::env;
fn link_libraries(target_os: &str) {
match target_os {
"linux" | "android" => println!("cargo:rustc-link-lib=dl"),
"freebsd" | "dragonfly" => println!("cargo:rustc-link-lib=c"),
"openbsd" | "bitrig" | "netbsd" | "macos" | "ios" => {}
"solaris" | "illumos" => {}
"haiku" => {}
"redox" => {}
"fuchsia" => {}
"windows" => {}
tos => {
writeln!(::std::io::stderr(),
"Building for an unknown target_os=`{:?}`!\nPlease report an issue ",
tos).expect("could not report the error");
::std::process::exit(0xfc);
}
}
}
fn main() {
match env::var("CARGO_CFG_TARGET_OS") {
Ok(target_os) => {
link_libraries(&target_os);
}
Err(e) => {
writeln!(::std::io::stderr(), "Unable to get target_os=`{}`!", e).expect("could not report the error");
::std::process::exit(0xfd);
}
}
}