diff --git a/Cargo.toml b/Cargo.toml index 8960942..271c6f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,6 +15,7 @@ rustdoc-args = ["--cfg", "docsrs"] [features] vendored = ["openssl/vendored"] alpn = ["security-framework/alpn"] +force-openssl = ["openssl", "openssl-sys", "openssl-probe", "log"] [target.'cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos"))'.dependencies] security-framework = "2.0.0" @@ -31,6 +32,13 @@ openssl = "0.10.29" openssl-sys = "0.9.55" openssl-probe = "0.1" +# Used when the force-openssl feature is enabled. +[dependencies] +log = { version = "0.4.5", optional = true } +openssl = { version = "0.10.29", optional = true } +openssl-sys = { version = "0.9.55", optional = true } +openssl-probe = { version = "0.1", optional = true } + [dev-dependencies] tempfile = "3.0" test-cert-gen = "0.9" diff --git a/src/lib.rs b/src/lib.rs index cc86502..04da52a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -104,33 +104,33 @@ use std::fmt; use std::io; use std::result; -#[cfg(not(any( +#[cfg(any(feature = "force-openssl", not(any( target_os = "macos", target_os = "windows", target_os = "ios", target_os = "watchos", target_os = "tvos" -)))] +))))] #[macro_use] extern crate log; -#[cfg(any( +#[cfg(all(not(feature = "force-openssl"), any( target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos" -))] +)))] #[path = "imp/security_framework.rs"] mod imp; #[cfg(target_os = "windows")] #[path = "imp/schannel.rs"] mod imp; -#[cfg(not(any( +#[cfg(any(feature = "force-openssl", not(any( target_os = "macos", target_os = "windows", target_os = "ios", target_os = "watchos", target_os = "tvos" -)))] +))))] #[path = "imp/openssl.rs"] mod imp;