Skip to content

Commit 67b361a

Browse files
authored
Fix TCP_NODELAY not defined for static builds on Unix (#381)
* Fix TCP_NODELAY not defined for static builds on Unix The `TCP_NODELAY` macro/constant was not being defined during compilation for the bundled libcurl build on Unix systems because `netinet/tcp.h` was not being included. It is difficult to verify that this is working properly without a debugger or strace. I've confirmed this fix on Linux and macOS. Also rearrange some of the defines to help keep the build script somewhat organized. Fixes #379. * Linux-specific headers are unnecessary
1 parent 205117b commit 67b361a

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

curl-sys/build.rs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,6 @@ fn main() {
238238
.file("curl/lib/vauth/vauth.c");
239239
}
240240

241-
if !windows {
242-
cfg.define("USE_UNIX_SOCKETS", None)
243-
.define("HAVE_SYS_UN_H", None);
244-
}
245-
246241
// Configure TLS backend. Since Cargo does not support mutually exclusive
247242
// features, make sure we only compile one vtls.
248243
if cfg!(feature = "mesalink") {
@@ -288,6 +283,7 @@ fn main() {
288283
}
289284
}
290285

286+
// Configure platform-specific details.
291287
if windows {
292288
cfg.define("WIN32", None)
293289
.define("USE_THREADS_WIN32", None)
@@ -301,22 +297,14 @@ fn main() {
301297
cfg.file("curl/lib/vauth/spnego_sspi.c");
302298
}
303299
} else {
304-
if target.contains("-apple-") {
305-
cfg.define("__APPLE__", None)
306-
.define("macintosh", None)
307-
.define("HAVE_MACH_ABSOLUTE_TIME", None);
308-
} else {
309-
cfg.define("HAVE_CLOCK_GETTIME_MONOTONIC", None)
310-
.define("HAVE_GETTIMEOFDAY", None);
311-
}
312-
313300
cfg.define("RECV_TYPE_ARG1", "int")
314301
.define("HAVE_PTHREAD_H", None)
315302
.define("HAVE_ARPA_INET_H", None)
316303
.define("HAVE_ERRNO_H", None)
317304
.define("HAVE_FCNTL_H", None)
318305
.define("HAVE_NETDB_H", None)
319306
.define("HAVE_NETINET_IN_H", None)
307+
.define("HAVE_NETINET_TCP_H", None)
320308
.define("HAVE_POLL_FINE", None)
321309
.define("HAVE_POLL_H", None)
322310
.define("HAVE_FCNTL_O_NONBLOCK", None)
@@ -330,7 +318,9 @@ fn main() {
330318
.define("HAVE_STERRROR_R", None)
331319
.define("HAVE_SOCKETPAIR", None)
332320
.define("HAVE_STRUCT_TIMEVAL", None)
321+
.define("HAVE_SYS_UN_H", None)
333322
.define("USE_THREADS_POSIX", None)
323+
.define("USE_UNIX_SOCKETS", None)
334324
.define("RECV_TYPE_ARG2", "void*")
335325
.define("RECV_TYPE_ARG3", "size_t")
336326
.define("RECV_TYPE_ARG4", "int")
@@ -345,6 +335,15 @@ fn main() {
345335
.define("SIZEOF_INT", "4")
346336
.define("SIZEOF_SHORT", "2");
347337

338+
if target.contains("-apple-") {
339+
cfg.define("__APPLE__", None)
340+
.define("macintosh", None)
341+
.define("HAVE_MACH_ABSOLUTE_TIME", None);
342+
} else {
343+
cfg.define("HAVE_CLOCK_GETTIME_MONOTONIC", None)
344+
.define("HAVE_GETTIMEOFDAY", None);
345+
}
346+
348347
if cfg!(feature = "spnego") {
349348
cfg.define("HAVE_GSSAPI", None)
350349
.file("curl/lib/curl_gssapi.c")

0 commit comments

Comments
 (0)