Skip to content

Fix configure and cmake mistakes/differences#11973

Closed
bagder wants to merge 3 commits intomasterfrom
bagder/configure-cmake
Closed

Fix configure and cmake mistakes/differences#11973
bagder wants to merge 3 commits intomasterfrom
bagder/configure-cmake

Conversation

@bagder
Copy link
Member

@bagder bagder commented Sep 28, 2023

Part of the cleanup work of #11964

- for sys/uio.h
- for fork
- for connect

Ref: #11964
- check for arc4random. To make rand.c use it accordingly.
- check for fcntl
- fix fseek detection
- add SIZEOF_CURL_SOCKET_T
- fix USE_UNIX_SOCKETS
- define HAVE_SNPRINTF to 1
- check for fnmatch
- check for sched_yield
- remove HAVE_GETPPID duplicate from curl_config.h
- add HAVE_SENDMSG

Ref: #11964
Co-authored-by: Viktor Szakats <vszakats@users.noreply.github.com>
@bagder bagder closed this in 2ba8049 Sep 28, 2023
bagder added a commit that referenced this pull request Sep 28, 2023
- check for arc4random. To make rand.c use it accordingly.
- check for fcntl
- fix fseek detection
- add SIZEOF_CURL_SOCKET_T
- fix USE_UNIX_SOCKETS
- define HAVE_SNPRINTF to 1
- check for fnmatch
- check for sched_yield
- remove HAVE_GETPPID duplicate from curl_config.h
- add HAVE_SENDMSG

Ref: #11964

Co-authored-by: Viktor Szakats
Closes #11973
@bagder bagder deleted the bagder/configure-cmake branch September 28, 2023 21:01
vszakats added a commit to vszakats/curl that referenced this pull request Jan 16, 2025
vszakats added a commit to vszakats/curl that referenced this pull request Jan 17, 2025
On Windows this function is exported from winpthread, but winpthread
is never used in Windows builds by curl itself.

In cmake it was marked as never available, but autotools did check
for this function. It found it sometimes (presumable when a dependency
linked to pthread), resulting in a different `curl_config.h`.

Sync the build systems by skipping this check in both, for Windows.

Follow-up to 9b517c8 curl#11973
Follow-up to 23af112 curl#8680
vszakats added a commit that referenced this pull request Jan 17, 2025
On Windows a successful `sched_yield()` detection requires mingw-w64
built with POSIX threads (not Win32 threads) and GCC (not llvm/clang).
(linking to `winpthread` via custom options may also work.)

In CMake builds, it was pre-cached as unavailable before this patch.

When detected (via autotools), it got only used for Windows XP or older
targets combined with a non-GCC, non-clang compiler that doesn't support
`__builtin_ia32_pause()`, or with the Intel C compiler. According to
`lib/easy_lock.h`.

mingw-w64 only supports GCC and clang, leaving a very narrow chance when
`shed_yield()` gets called on Windows. Even then, `sched_yield()` is
implemented in `winpthread` as `Sleep(0)`, which may or not be a useful.
It's also trivial to implement locally if it is, and such rare build
combination is also deemed useful.

Thus, this patch marks `sched_yields()` permanently unavailable on the
Windows platform also with autotools, and instead of pre-caching, skip
this feature check with CMake.

This syncs `HAVE_SCHED_YIELDS` between builds methods on Windows.

Follow-up to 9b517c8 #11973
Follow-up to 23af112 #8680

Closes #16037
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
On Windows a successful `sched_yield()` detection requires mingw-w64
built with POSIX threads (not Win32 threads) and GCC (not llvm/clang).
(linking to `winpthread` via custom options may also work.)

In CMake builds, it was pre-cached as unavailable before this patch.

When detected (via autotools), it got only used for Windows XP or older
targets combined with a non-GCC, non-clang compiler that doesn't support
`__builtin_ia32_pause()`, or with the Intel C compiler. According to
`lib/easy_lock.h`.

mingw-w64 only supports GCC and clang, leaving a very narrow chance when
`shed_yield()` gets called on Windows. Even then, `sched_yield()` is
implemented in `winpthread` as `Sleep(0)`, which may or not be a useful.
It's also trivial to implement locally if it is, and such rare build
combination is also deemed useful.

Thus, this patch marks `sched_yields()` permanently unavailable on the
Windows platform also with autotools, and instead of pre-caching, skip
this feature check with CMake.

This syncs `HAVE_SCHED_YIELDS` between builds methods on Windows.

Follow-up to 9b517c8 curl#11973
Follow-up to 23af112 curl#8680

Closes curl#16037
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants