Don't use pkg-config if any overrides are passed

This commit is contained in:
Steven Fackler 2015-02-13 23:02:08 -08:00
parent c4f8427bfd
commit c424931c75
1 changed files with 10 additions and 5 deletions

View File

@ -6,10 +6,15 @@ extern crate gcc;
use std::env; use std::env;
fn main() { fn main() {
let lib_dir = env::var("OPENSSL_LIB_DIR").ok();
let include_dir = env::var("OPENSSL_INCLUDE_DIR").ok();
if lib_dir.is_none() && include_dir.is_none() {
if let Ok(info) = pkg_config::find_library("openssl") { if let Ok(info) = pkg_config::find_library("openssl") {
build_old_openssl_shim(info.include_paths); build_old_openssl_shim(info.include_paths);
return; return;
} }
}
let (libcrypto, libssl) = if env::var("TARGET").unwrap().contains("windows") { let (libcrypto, libssl) = if env::var("TARGET").unwrap().contains("windows") {
("eay32", "ssl32") ("eay32", "ssl32")
@ -23,7 +28,7 @@ fn main() {
"dylib" "dylib"
}; };
if let Ok(lib_dir) = env::var("OPENSSL_LIB_DIR") { if let Some(lib_dir) = lib_dir {
println!("cargo:rustc-flags=-L native={}", lib_dir); println!("cargo:rustc-flags=-L native={}", lib_dir);
} }
@ -31,7 +36,7 @@ fn main() {
let mut include_dirs = vec![]; let mut include_dirs = vec![];
if let Ok(include_dir) = env::var("OPENSSL_INCLUDE_DIR") { if let Some(include_dir) = include_dir {
include_dirs.push(Path::new(include_dir)); include_dirs.push(Path::new(include_dir));
} }