#
93e6e4b8 |
| 12-Nov-2024 |
Viktor Szakats |
cmake: work around `ios.toolchain.cmake` breaking feature-detections Fix builds with CMake configured to falsely return successful detection when using `check_function_exists()` (and `ch
cmake: work around `ios.toolchain.cmake` breaking feature-detections Fix builds with CMake configured to falsely return successful detection when using `check_function_exists()` (and `check_library_exists()`, and anything based on `try_compile()` that's relying on the linker). After such mis-detection the build fails when trying to use the feature that doesn't in fact exist. The mis-detection is caused by this CMake setting: ``` set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) ``` It is set by default (or on conditions) when using 3rd-party toolchain: https://github.com/leetal/ios-cmake/blob/master/ios.toolchain.cmake After this patch the curl build overrides this setting for the duration of feature tests, and logs a message about it. Also preset and skip feature tests for known mis-detections: - `connect()` in `libsocket` - `getpass_r()` - `eventfd()` (did not cause an issue due to a separate bug) - `sendmmsg()` (did not cause an issue because it's Linux-only) If mis-detections are still seen, the workaround is to force-set the specific feature by passing `-DHAVE_*=OFF` to cmake. Also consider passing `-DENABLE_STRICT_TRY_COMPILE=ON` for `ios.toolchain.cmake` to fix the root cause. Interestingly curl itself uses this setting to speed up compile-only detections: be17f298ff508d62d493d4a8d43e56a1e2861a50 #3744 Also: - OtherTests.cmake: restore original value of `CMAKE_TRY_COMPILE_TARGET_TYPE`. Before this patch it reset it to empty. - OtherTests.cmake: unset a local variable after use, quote a string. Follow-up to 8e345057761a8f796403923a96f2c8fd3edca647 #15164 Follow-up to 8b76a8aeb21c8ae2261147af1bddd0d4637c252c #15525 Ref: https://github.com/leetal/ios-cmake/issues/47 Ref: https://gitlab.kitware.com/cmake/cmake/-/issues/18121 Ref: https://cmake.org/cmake/help/latest/variable/CMAKE_TRY_COMPILE_TARGET_TYPE.html Reported-by: Dan Rosser Fixes #15557 Closes #15559
show more ...
|
#
825a800e |
| 22-Oct-2024 |
Viktor Szakats |
cmake: use the `BSD` variable - use `BSD` in addition to backwards-compatible method. - add `BSD` to the configuration log and `buildinfo.txt` if detected. - add `BSD` tag to `buildi
cmake: use the `BSD` variable - use `BSD` in addition to backwards-compatible method. - add `BSD` to the configuration log and `buildinfo.txt` if detected. - add `BSD` tag to `buildinfo.txt` also via `./configure`. The `BSD` variable is supported by CMake 3.25.0 and upper. Ref: https://cmake.org/cmake/help/latest/variable/BSD.html Closes #15367
show more ...
|
#
dfd36d3e |
| 10-Oct-2024 |
Viktor Szakats |
cmake: apply `WIN32_LEAN_AND_MEAN` to all feature checks Enable `WIN32_LEAN_AND_MEAN` for all feature detections on Windows. (Also drop it from individual detections.) Cher
cmake: apply `WIN32_LEAN_AND_MEAN` to all feature checks Enable `WIN32_LEAN_AND_MEAN` for all feature detections on Windows. (Also drop it from individual detections.) Cherry-picked from #15164
show more ...
|
#
91519bfb |
| 04-Oct-2024 |
Viktor Szakats |
cmake: use `cmake_push_check_state()` around feature checks Enclose `CMAKE_EXTRA_INCLUDE_FILES`, `CMAKE_REQUIRED_DEFINITIONS`, `CMAKE_REQUIRED_FLAGS`, `CMAKE_REQUIRED_INCLUDE
cmake: use `cmake_push_check_state()` around feature checks Enclose `CMAKE_EXTRA_INCLUDE_FILES`, `CMAKE_REQUIRED_DEFINITIONS`, `CMAKE_REQUIRED_FLAGS`, `CMAKE_REQUIRED_INCLUDES`, `CMAKE_REQUIRED_LIBRARIES`, `CMAKE_REQUIRED_LINK_OPTIONS`, settings within `cmake_push_check_state()`/`cmake_pop_check_state()` calls. It prevents spilling them into other feature checks. It also replaces manual resets found in some places (which can have the undesired side-effect of destroying values meant for global use.) Cherry-picked from #15157 Closes #15251
show more ...
|
#
c72cefea |
| 30-Sep-2024 |
Daniel Stenberg |
select: use poll() if existing, avoid poll() with no sockets poll() on macOS 10.12 was deemed broken in 2016 when we discovered that it misbehaves when provided with no sockets to wait f
select: use poll() if existing, avoid poll() with no sockets poll() on macOS 10.12 was deemed broken in 2016 when we discovered that it misbehaves when provided with no sockets to wait for. The HAVE_POLL_FINE is used to mark a poll() implementation that behaves correctly: it *should* still wait the timeout time. curl has therefore opted to use select() on Apple operating systems ever since. To avoid the risk that this or other breakage cause problems. However, using select() internally is also bad because it suffers from problems when using file descriptors beyond 1024. This change makes poll() used if it is present, but if there is no sockets to wait for it avoids using poll() and instead falls back to select() - but without any sockets to wait for there is no 1024 problem. This removes all previous special-handling involving HAVE_POLL_FINE. ref: https://daniel.haxx.se/blog/2016/10/11/poll-on-mac-10-12-is-broken/ Closes #15096
show more ...
|
#
7060b9b0 |
| 25-Sep-2024 |
Daniel Stenberg |
build: fix cross-compile check for poll with bionic Since it seems the _POSIX_C_SOURCE "trick" does not work there, the check does not find poll(). Fixes #15013 Reported-by:
build: fix cross-compile check for poll with bionic Since it seems the _POSIX_C_SOURCE "trick" does not work there, the check does not find poll(). Fixes #15013 Reported-by: vvb2060 on github Closes #15037
show more ...
|
#
04e3621d |
| 29-Aug-2024 |
Viktor Szakats |
build: add `poll()` detection for cross-builds For cross-builds rely on `_POSIX_C_SOURCE` to decide if `poll()` is supported, rather than just assuming it isn't. This may still
build: add `poll()` detection for cross-builds For cross-builds rely on `_POSIX_C_SOURCE` to decide if `poll()` is supported, rather than just assuming it isn't. This may still miss to detect `poll()` support, as seen for example with Linux MUSL cross-builds. Also: - GHA/curl-for-win: enable RISC-V 64 cross-target for Linux MUSL. (to test this case with cmake, with a false-negative.) The first RISC-V 64 build in curl's CI. - GHA/curl-for-win: add arm64/intel64 job for Linux glibc. (to test this case with cmake, and succeed.) - cmake: delete unnecessary `#include <sys/time.h>` from non-cross-build `poll()` detection snippet. Follow-up tp cc8b8137659e1733fdd3810c19ff5ec8db438509 #14718 Fixes #14714 Closes #14734
show more ...
|
#
cc8b8137 |
| 29-Aug-2024 |
Viktor Szakats |
build: drop unused feature-detection code for Apple `poll()` Drop Apple-specific detection logic for `poll()`. This detection snippet has been disabled for Apple in both configure and cm
build: drop unused feature-detection code for Apple `poll()` Drop Apple-specific detection logic for `poll()`. This detection snippet has been disabled for Apple in both configure and cmake, for `poll()` being broken on Apple since 10.12 Sierra (2016). Also replace `exit(1);` with `return 1;` in configure, to make the snippets match. Added in 9297ca49f5f3caca938a679b9c1feeb719e61ddb #1057 (2016-10-11). Disabled for: configure/darwin in a34c7ce7546f39f24692925d66c2f42324dd94e9 (2016-10-18) cmake/macOS in 825911be587bbabc3b7e4777ed3bd1bb7c858b58 #7619 cmake/iOS in d14831233df3a15b14db563156614c9ea60fcf06 #8244 cmake/all Apple in a86254b39307af1a53735b065a382567805cd9b8 #12515 Closes #14718
show more ...
|
#
8b091380 |
| 19-Aug-2024 |
Viktor Szakats |
cmake: minor tidy-ups - show `OpenSSL v3+` when detected (as in `./configure`). (this string also makes its way to `curl-config`.) - prefer `unset(VAR)` over `set(VAR)`. Same
cmake: minor tidy-ups - show `OpenSSL v3+` when detected (as in `./configure`). (this string also makes its way to `curl-config`.) - prefer `unset(VAR)` over `set(VAR)`. Same effect, but `unset()` tells the intent unambiguously. https://cmake.org/cmake/help/latest/command/set.html - drop "implementation" from an `option()` description. - FindGSS: replace legacy keyword alias with modern alternative. https://cmake.org/cmake/help/latest/command/get_filename_component.html - move `CURL_STATIC_CRT` logic next to its `option()`. - improve order of `libcurl.pc`/`curl-config` variable init lines. - tests: drop/shorten custom target names. They inflated generated make files by 550KB. Keep target name logic for sync between code snippets. Follow-up to a2ef5d36b3cdec8120a4a9b782d18d58a70d4236 #14660 - clear a variable after use. - restore `STATUS` for `Features:`/`Protocols:` `message()`s: Without it the output goes to stderr, and appears in red in CMake GUI. It doesn't seem possible to show a line on stdout without leading underscores to match `curl -V` and `./configure` output. Partial revert of acbc6b703f6b0ee568d053f6f2565fbc107b5fd3 #14197 - WindowsCache: move `HAVE_LINUX_TCP_H` into the header group. - move strings to the same line as their `STRING` keyword. - formatting in generated code. - delete bogus comment. - unfold lines for readability. - fix a too long line. (for cmakelint) - missing quotes, whitespace, comments. Closes #14610
show more ...
|
#
c2889a7b |
| 04-Aug-2024 |
Viktor Szakats |
cmake: more syntax tidy-up - quote string literals. In the hope it improves syntax-highlighting and readability. - use lowercase, underscore-prefixed local var names. As
cmake: more syntax tidy-up - quote string literals. In the hope it improves syntax-highlighting and readability. - use lowercase, underscore-prefixed local var names. As a hint for scope, to help readability. - prefer `pkg_search_module` (over `pkg_check_modules`). They are the same, but `pkg_search_module` stops searching at the first hit. - more `IN LISTS` in `foreach()`. - OtherTests.cmake: clear `CMAKE_EXTRA_INCLUDE_FILES` after use. - add `PROJECT_LABEL` for http/client and unit test targets. - sync `Find*` module comments and formatting. - drop a few local variables. - drop bogus `CARES_LIBRARIES` from comment. - unquote numeric literal. Follow-up to acbc6b703f6b0ee568d053f6f2565fbc107b5fd3 #14197 Closes #14388
show more ...
|
#
4c22d97b |
| 13-Jul-2024 |
Viktor Szakats |
build: use `#error` instead of invalid syntax It reduces configure log noise. Follow-up to 20c1b2d75ee38189ffa75d21ed04108e1e0630ae #13287 Closes #14181
|
#
68d80a8f |
| 18-Dec-2023 |
Viktor Szakats |
cmake: tidy-up `OtherTests.cmake` - make more obvious which detection uses which prep steps. - merge and streamline conditions. - these should not alter detection results. A
cmake: tidy-up `OtherTests.cmake` - make more obvious which detection uses which prep steps. - merge and streamline conditions. - these should not alter detection results. Also align log output messages from `Macros.cmake` / `curl_internal_test` with rest of the build. Closes #12551
show more ...
|
#
7e8fdad2 |
| 12-Dec-2023 |
Viktor Szakats |
cmake: prefill/cache `HAVE_STRUCT_SOCKADDR_STORAGE` Also add missing include to `OtherTests.cmake`. It didn't cause an issue because the parent already included this earlier by chance.
cmake: prefill/cache `HAVE_STRUCT_SOCKADDR_STORAGE` Also add missing include to `OtherTests.cmake`. It didn't cause an issue because the parent already included this earlier by chance. Closes #12537
show more ...
|
#
17e61d4e |
| 12-Dec-2023 |
Viktor Szakats |
cmake: whitespace tidy-up in `OtherTests.cmake` Closes #12538
|
#
a86254b3 |
| 14-Dec-2023 |
Mark Sinkovics |
cmake: fix generation for system name iOS This PR fixes a problem that happens during CMake configuration when the `CMAKE_SYSTEM_NAME` set to `iOS` and not `Darwin`. This value is av
cmake: fix generation for system name iOS This PR fixes a problem that happens during CMake configuration when the `CMAKE_SYSTEM_NAME` set to `iOS` and not `Darwin`. This value is available (as far as I remember) version 3.14. The final solution (thanks to @vszakats) is to use `APPLE` which contains all the Apple platforms https://cmake.org/cmake/help/latest/variable/APPLE.html. This issue was found when during vcpkg installation. Running command `vcpkg install curl:arm64-ios` and `vcpkg install curl:x64-ios` failed with message: ``` CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately: HAVE_H_ERRNO_ASSIGNABLE_EXITCODE (advanced) ``` After this fix, I was able to compile the compile the binary without any issue. In addition to that fix, this PR also contains an simplification to check if the platform is not APPLE. Co-authored-by: Viktor Szakats Closes #12515
show more ...
|
#
c1bc090d |
| 09-Dec-2023 |
Viktor Szakats |
windows: simplify detecting and using system headers - autotools, cmake: assume that if we detect Windows, `windows.h`, `winsock2.h` and `ws2tcpip.h` do exist. - lib: fix 3 outlier
windows: simplify detecting and using system headers - autotools, cmake: assume that if we detect Windows, `windows.h`, `winsock2.h` and `ws2tcpip.h` do exist. - lib: fix 3 outlier `#if` conditions to use `USE_WINSOCK` instead of looking for `winsock2.h`. - autotools: merge 3 Windows check methods into one. - move Watt-32 and lwIP socket support to `setup-win32.h` from `config-win32.h`. It opens up using these with all build tools. Also merge logic with Windows Sockets. - fix to assume Windows sockets with the mingw32ce toolchain. Follow-up to: 2748c64d605b19fb419ae56810ad8da36487a2d4 - cmake: delete unused variable `signature_call_conv` since eb33ccd5332435fa50f1758e5debb869c6942b7f. - autotools: simplify `CURL_CHECK_WIN32_LARGEFILE` detection. - examples/externalsocket: fix header order. - cmake/OtherTests.cmake: delete Windows-specific `_source_epilogue` that wasn't used anymore. - cmake/OtherTests.cmake: set `WIN32_LEAN_AND_MEAN` for test `SIZEOF_STRUCT_SOCKADDR_STORAGE`. After this patch curl universally uses `_WIN32` to guard Windows-specific logic. It guards Windows Sockets-specific logic with `USE_WINSOCK` (this might need further work). Reviewed-by: Jay Satiro Closes #12495
show more ...
|
#
2100d9fd |
| 05-Oct-2023 |
Viktor Szakats |
cmake: pre-fill rest of detection values for Windows The goal of this patch is to avoid unnecessary feature detection work when doing Windows builds with CMake. Do this by pre-filling we
cmake: pre-fill rest of detection values for Windows The goal of this patch is to avoid unnecessary feature detection work when doing Windows builds with CMake. Do this by pre-filling well-known detection results for Windows and specifically for mingw-w64 and MSVC compilers. Also limit feature checks to platforms where the results are actually used. Drop a few redundant ones. And some tidying up. - pre-fill remaining detection values in Windows CMake builds. Based on actual detection results observed in CI runs, preceding similar work over libssh2 and matching up values with `lib/config-win32.h`. This brings down CMake configuration time from 58 to 14 seconds on the same local machine. On AppVeyor CI this translates to: - 128 seconds -> 50 seconds VS2022 MSVC with OpenSSL (per CMake job): https://ci.appveyor.com/project/curlorg/curl/builds/48208419/job/4gw66ecrjpy7necb#L296 https://ci.appveyor.com/project/curlorg/curl/builds/48217440/job/8m4fwrr2fe249uo8#L186 - 62 seconds -> 16 seconds VS2017 MINGW (per CMake job): https://ci.appveyor.com/project/curlorg/curl/builds/48208419/job/s1y8q5ivlcs7ub29?fullLog=true#L290 https://ci.appveyor.com/project/curlorg/curl/builds/48217440/job/pchpxyjsyc9kl13a?fullLog=true#L194 The formula is about 1-3 seconds delay for each detection. Almost all of these trigger a full compile-link cycle behind the scenes, slow even today, both cross and native, mingw-w64 and apparently MSVC too. Enabling .map files or other custom build features slows it down further. (Similar is expected for autotools configure.) - stop detecting `idn2.h` if idn2 was deselected. autotools does this. - stop detecting `idn2.h` if idn2 was not found. This deviates from autotools. Source code requires both header and lib, so this is still correct, but faster. - limit `ADDRESS_FAMILY` detection to Windows. - normalize `HAVE_WIN32_WINNT` value to lowercase `0x0a12` format. - pre-fill `HAVE_WIN32_WINNT`-dependent detection results. Saving 4 (slow) feature-detections in most builds: `getaddrinfo`, `freeaddrinfo`, `inet_ntop`, `inet_pton` - fix pre-filled `HAVE_SYS_TIME_H`, `HAVE_SYS_PARAM_H`, `HAVE_GETTIMEOFDAY` for mingw-w64. Luckily this do not change build results, as `WIN32` took priority over `HAVE_GETTIMEOFDAY` with the current source code. - limit `HAVE_CLOCK_GETTIME_MONOTONIC_RAW` and `HAVE_CLOCK_GETTIME_MONOTONIC` detections to non-Windows. We're not using these in the source code for Windows. - reduce compiler warning noise in CMake internal logs: - fix to include `winsock2.h` before `windows.h`. Apply it to autotools test snippets too. - delete previous `-D_WINSOCKAPI_=` hack that aimed to fix the above. - cleanup `CMake/CurlTests.c` to emit less warnings. - delete redundant `HAVE_MACRO_SIGSETJMP` feature check. It was the same check as `HAVE_SIGSETJMP`. - delete 'experimental' marking from `CURL_USE_OPENSSL`. - show CMake version via `CMakeLists.txt`. Credit to the `zlib-ng` project for the idea: https://github.com/zlib-ng/zlib-ng/blob/61e181c8ae93dbf56040336179c9954078bd1399/CMakeLists.txt#L7 - make `CMake/CurlTests.c` pass `checksrc`. - `CMake/WindowsCache.cmake` tidy-ups. - replace `WIN32` guard with `_WIN32` in `CMake/CurlTests.c`. Closes #12044
show more ...
|
#
104767ae |
| 11-Oct-2023 |
Viktor Szakats |
cmake: fix `HAVE_H_ERRNO_ASSIGNABLE` detection Fix `HAVE_H_ERRNO_ASSIGNABLE` to not run, only compile its test snippet, aligning this with autotools. This fixes an error when doing c
cmake: fix `HAVE_H_ERRNO_ASSIGNABLE` detection Fix `HAVE_H_ERRNO_ASSIGNABLE` to not run, only compile its test snippet, aligning this with autotools. This fixes an error when doing cross-builds and also actually detects this feature. It affected systems not allowlisted into this, e.g. SerenityOS. We used this detection result to enable `HAVE_GETADDRINFO_THREADSAFE`. Follow-up to 04a3a377d83fd72c4cf7a96c9cb6d44785e33264 #11979 Ref: #12095 (closed in favour of this patch) Ref: #11964 (effort to sync cmake detections with autotools) Reported-by: Kartatz on Github Assisted-by: Kartatz on Github Fixes #12093 Closes #12094
show more ...
|
#
da5dcb70 |
| 29-Sep-2023 |
Viktor Szakats |
cmake: detect `HAVE_CLOCK_GETTIME_MONOTONIC_RAW` Based on existing autotools logic. Ref: #11964 (effort to sync cmake detections with autotools) Closes #11981
|
#
04a3a377 |
| 29-Sep-2023 |
Viktor Szakats |
cmake: detect `HAVE_GETADDRINFO_THREADSAFE` Based on existing autotools logic. autotools checks for old versions of the allowlisted target OSes and disables this feature when se
cmake: detect `HAVE_GETADDRINFO_THREADSAFE` Based on existing autotools logic. autotools checks for old versions of the allowlisted target OSes and disables this feature when seeing them. In CMake we assume we're running on newer systems and enable regardless of OS version. autotools always runs all 3 probes for non-fast-tracked systems and enables this feature if any one of them was successful. To save configuration time, CMake stops at the first successful check. OpenBSD is not fast-tracked and then gets blocklisted as a generic BSD system. I haven't double-checked if this is correct, but looks odd. Ref: #11964 (effort to sync cmake detections with autotools) Closes #11979
show more ...
|
#
db07376a |
| 28-Sep-2023 |
Daniel Stenberg |
lib: remove TIME_WITH_SYS_TIME It is not used in any code anywhere. Ref: #11964 Closes #11975
|
#
96c29900 |
| 25-Sep-2023 |
Viktor Szakats |
build: delete checks for C89 standard headers Delete checks and guards for standard C89 headers and assume these are available: `stdio.h`, `string.h`, `time.h`, `setjmp.h`, `stdlib.h`,
build: delete checks for C89 standard headers Delete checks and guards for standard C89 headers and assume these are available: `stdio.h`, `string.h`, `time.h`, `setjmp.h`, `stdlib.h`, `stddef.h`, `signal.h`. Some of these we already used unconditionally, some others we only used for feature checks. Follow-up to 9c7165e96a3a9a2d0b7059c87c699b5ca8cdae93 #11918 (for `stdio.h` in CMake) Closes #11940
show more ...
|
#
762740f4 |
| 07-Aug-2023 |
Viktor Szakats |
cmake: drop `HAVE_LIBWINMM` and `HAVE_LIBWS2_32` feature checks - `HAVE_LIBWINMM` was detected but unused. The `winmm` system library is also not used by curl, but it is by its optiona
cmake: drop `HAVE_LIBWINMM` and `HAVE_LIBWS2_32` feature checks - `HAVE_LIBWINMM` was detected but unused. The `winmm` system library is also not used by curl, but it is by its optional dependency `librtmp`. Change the logic to always add `winmm` when `USE_LIBRTMP` is set. This library has been available since the early days of Windows. - `HAVE_LIBWS2_32` detected `ws2_32` lib on Windows. This lib is present since Windows 95 OSR2 (AFAIR). Winsock1 already wasn't supported and other existing logic already assumed this lib being present, so delete the check and replace the detection variable with `WIN32` and always add `ws2_32` on Windows. Closes #11612
show more ...
|
#
2bc1d775 |
| 02-Jan-2023 |
Daniel Stenberg |
copyright: update all copyright lines and remove year ranges - they are mostly pointless in all major jurisdictions - many big corporations and projects already don't use them - save
copyright: update all copyright lines and remove year ranges - they are mostly pointless in all major jurisdictions - many big corporations and projects already don't use them - saves us from pointless churn - git keeps history for us - the year range is kept in COPYING checksrc is updated to allow non-year using copyright statements Closes #10205
show more ...
|
#
14d55890 |
| 16-Nov-2022 |
Daniel Stenberg |
OtherTests.cmake: check for cross-compile, not for toolchain Build systems like vcpkg alway sets `CMAKE_TOOLCHAIN_FILE` so it should not be used as a sign that this is a cross-compile.
OtherTests.cmake: check for cross-compile, not for toolchain Build systems like vcpkg alway sets `CMAKE_TOOLCHAIN_FILE` so it should not be used as a sign that this is a cross-compile. Also indented the function correctly. Reported-by: Philip Chan Fixes #9921 Closes #9923
show more ...
|