Skip to content

Commit 21fc0a8

Browse files
committed
chore: Enable CURL if curl-static is enabled
1 parent 62c9d63 commit 21fc0a8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

rdkafka-sys/build.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ fn main() {
100100
}
101101
}
102102

103+
fn needs_curl() -> bool {
104+
env::var("CARGO_FEATURE_CURL").is_ok() || env::var("CARGO_FEATURE_CURL_STATIC").is_ok()
105+
}
106+
103107
#[cfg(not(feature = "cmake-build"))]
104108
fn build_librdkafka() {
105109
let mut configure_flags: Vec<String> = Vec::new();
@@ -144,7 +148,7 @@ fn build_librdkafka() {
144148
configure_flags.push("--disable-zlib".into());
145149
}
146150

147-
if env::var("CARGO_FEATURE_CURL").is_ok() {
151+
if needs_curl() {
148152
// There is no --enable-curl option, but it is enabled by default.
149153
if let Ok(curl_root) = env::var("DEP_CURL_ROOT") {
150154
cflags.push("-DCURLSTATIC_LIB".to_string());
@@ -240,7 +244,7 @@ fn build_librdkafka() {
240244
config.define("WITH_ZLIB", "0");
241245
}
242246

243-
if env::var("CARGO_FEATURE_CURL").is_ok() {
247+
if needs_curl() {
244248
config.define("WITH_CURL", "1");
245249
config.register_dep("curl");
246250
if let Ok(curl_root) = env::var("DEP_CURL_ROOT") {

0 commit comments

Comments
 (0)