summary refs log tree commit diff
path: root/tpm2-sys/build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tpm2-sys/build.rs')
-rw-r--r--tpm2-sys/build.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/tpm2-sys/build.rs b/tpm2-sys/build.rs
index f1abd4a..604d936 100644
--- a/tpm2-sys/build.rs
+++ b/tpm2-sys/build.rs
@@ -8,10 +8,11 @@ use std::path::Path;
 use std::process::{self, Command};
 
 fn main() -> io::Result<()> {
-    println!("cargo:rustc-link-lib=ssl");
-    println!("cargo:rustc-link-lib=crypto");
-
-    if pkg_config::probe_library("libtpm2").is_ok() {
+    if pkg_config::Config::new()
+        .statik(true)
+        .probe("libtpm2")
+        .is_ok()
+    {
         // Use tpm2 package from the standard system location if available.
         return Ok(());
     }
@@ -44,5 +45,7 @@ fn main() -> io::Result<()> {
     let dir = env::var("CARGO_MANIFEST_DIR").unwrap();
     println!("cargo:rustc-link-search={}/libtpm2/build", dir);
     println!("cargo:rustc-link-lib=static=tpm2");
+    println!("cargo:rustc-link-lib=ssl");
+    println!("cargo:rustc-link-lib=crypto");
     Ok(())
 }