diff --git a/agent/Cargo.toml b/agent/Cargo.toml index 29a550a578d..5ec7b62c468 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -143,6 +143,7 @@ tonic-build = "0.8.0" [features] enterprise = ["off_cpu", "enterprise-utils"] off_cpu = [] +dylib_pcap = [] [[bench]] name = "common" diff --git a/agent/build.rs b/agent/build.rs index dbb1d9286d8..351707e497a 100644 --- a/agent/build.rs +++ b/agent/build.rs @@ -132,7 +132,10 @@ fn set_linkage() -> Result<(), Box> { println!("cargo:rustc-link-lib=dylib=pthread"); println!("cargo:rustc-link-lib=dylib=z"); println!("cargo:rustc-link-lib=dylib=stdc++"); + #[cfg(feature = "dylib_pcap")] println!("cargo:rustc-link-lib=dylib=pcap"); + #[cfg(not(feature = "dylib_pcap"))] + println!("cargo:rustc-link-lib=static=pcap"); } "musl" => { #[cfg(target_arch = "x86_64")]