From: Viktor Szakats Date: Sat, 18 Oct 2025 11:08:53 +0000 (+0200) Subject: cmake: fix Linux pre-fills for non-glibc (when `_CURL_PREFILL=ON`) X-Git-Tag: rc-8_17_0-2~31 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f30f1307c1d9d70a96557359f039ba7ef9b077fb;p=thirdparty%2Fcurl.git cmake: fix Linux pre-fills for non-glibc (when `_CURL_PREFILL=ON`) - do not pre-fill `HAVE_LINUX_TCP_H` on Linux. `linux/tcp.h` is a Linux kernel userspace header. It's likely installed when using glibc and likely missing by default when using something else, e.g. MUSL (e.g. on Alpine). Therefore always detect it for Linux targets, and only pre-fill it for non-Linux ones. - do not pre-fill `HAVE_GLIBC_STRERROR_R` on Linux. To fix it for non-glibc envs, e.g. MUSL (e.g. on Alpine). Note, the pre-fill option is a disabled by default, internal option and strongly not recommended outside of curl development. Closes #19116 --- diff --git a/CMake/unix-cache.cmake b/CMake/unix-cache.cmake index 2c85626a49..a0369e84e5 100644 --- a/CMake/unix-cache.cmake +++ b/CMake/unix-cache.cmake @@ -142,7 +142,7 @@ set(HAVE_GETRLIMIT 1) set(HAVE_GETSOCKNAME 1) set(HAVE_GETTIMEOFDAY 1) if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - set(HAVE_GLIBC_STRERROR_R 1) + # Depends on C library. else() set(HAVE_GLIBC_STRERROR_R 0) endif() @@ -164,7 +164,7 @@ else() endif() set(HAVE_LIBGEN_H 1) if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - set(HAVE_LINUX_TCP_H 1) + # Requires Linux kernel userspace headers. Expected with glibc. May be missing by default with MUSL. else() set(HAVE_LINUX_TCP_H 0) endif()