]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
build: assume POSIX `select()` is available
authorViktor Szakats <commit@vsz.me>
Thu, 30 Jul 2026 12:20:59 +0000 (14:20 +0200)
committerViktor Szakats <commit@vsz.me>
Fri, 31 Jul 2026 10:38:52 +0000 (12:38 +0200)
This change effectively replaces an explicit compile-time #error with
a missing prototype error in environments not offering `select()`, and
saves curl-compatible systems from performing an explicit feature check.

Refs:
https://pubs.opengroup.org/onlinepubs/009695399/functions/pselect.html
https://linux.die.net/man/2/select

Closes #22448

12 files changed:
CMake/unix-cache.cmake
CMake/win32-cache.cmake
CMakeLists.txt
acinclude.m4
configure.ac
lib/config-mac.h
lib/config-os400.h
lib/config-riscos.h
lib/config-win32.h
lib/curl_config-cmake.h.in
lib/curlx/wait.c
lib/select.c

index 287c3fdf9ef6f907ce5443a9ab07e375ba9b3143..4ee28f7eb7ac95d9978ba7de58afbe101c9dfc73 100644 (file)
@@ -226,7 +226,6 @@ set(HAVE_REALPATH 1)
 set(HAVE_RECV 1)
 set(HAVE_SA_FAMILY_T 1)
 set(HAVE_SCHED_YIELD 1)
-set(HAVE_SELECT 1)
 set(HAVE_SEND 1)
 if(APPLE OR
    CYGWIN OR
index a684b459b08543ee0788517911050f5bb2b784d5..87e0879ab2b72e30d3340deb23f2314b44ecf8cb 100644 (file)
@@ -128,7 +128,6 @@ set(HAVE_POLL_H 0)
 set(HAVE_POSIX_STRERROR_R 0)
 set(HAVE_PWD_H 0)
 set(HAVE_RECV 1)
-set(HAVE_SELECT 1)
 set(HAVE_SEND 1)
 set(HAVE_SENDMMSG 0)
 set(HAVE_SENDMSG 0)
index ec6d1dc367365f61479fa22688b514bfa43c23c2..ae1152c9b3f9ddbb2202bfbe5fefc939b5dbce83 100644 (file)
@@ -1640,7 +1640,6 @@ check_symbol_exists("recv"            "${CURL_INCLUDES}" HAVE_RECV)  # proto/bsd
 check_symbol_exists("send"            "${CURL_INCLUDES}" HAVE_SEND)  # proto/bsdsocket.h sys/types.h sys/socket.h
 check_function_exists("sendmsg"       HAVE_SENDMSG)
 check_function_exists("sendmmsg"      HAVE_SENDMMSG)
-check_symbol_exists("select"          "${CURL_INCLUDES}" HAVE_SELECT)  # proto/bsdsocket.h sys/select.h sys/socket.h
 check_symbol_exists("memrchr"         "string.h" HAVE_MEMRCHR)
 check_symbol_exists("alarm"           "unistd.h" HAVE_ALARM)
 check_symbol_exists("fcntl"           "fcntl.h" HAVE_FCNTL)
index 3528b8507e1d44521f614e48e43061dd84911f9b..310d680600c3788f32262fdaa44933d4e939a87a 100644 (file)
@@ -972,59 +972,6 @@ AC_DEFUN([CURL_CHECK_LIBS_CONNECT], [
 ])
 
 
-dnl CURL_CHECK_FUNC_SELECT
-dnl -------------------------------------------------
-dnl Test if the socket select() function is available.
-
-AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
-  AC_REQUIRE([CURL_CHECK_STRUCT_TIMEVAL])
-  AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])
-  AC_CHECK_HEADERS(sys/select.h)
-
-  AC_MSG_CHECKING([for select])
-  AC_LINK_IFELSE([
-    AC_LANG_PROGRAM([[
-      #undef inline
-      #ifdef _WIN32
-      #ifndef WIN32_LEAN_AND_MEAN
-      #define WIN32_LEAN_AND_MEAN
-      #endif
-      #include <winsock2.h>
-      #else
-      #include <sys/socket.h>
-      #include <sys/time.h>
-      #endif
-      #ifdef HAVE_SYS_TYPES_H
-      #include <sys/types.h>
-      #endif
-      #include <time.h>
-      #ifndef _WIN32
-      #ifdef HAVE_SYS_SELECT_H
-      #include <sys/select.h>
-      #elif defined(HAVE_UNISTD_H)
-      #include <unistd.h>
-      #endif
-      $curl_includes_bsdsocket
-      #endif
-    ]],[[
-      select(0, 0, 0, 0, 0);
-    ]])
-  ],[
-    AC_MSG_RESULT([yes])
-    curl_cv_select="yes"
-  ],[
-    AC_MSG_RESULT([no])
-    curl_cv_select="no"
-  ])
-
-  if test "$curl_cv_select" = "yes"; then
-    AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
-      [Define to 1 if you have the select function.])
-    curl_cv_func_select="yes"
-  fi
-])
-
-
 dnl CURL_VERIFY_RUNTIMELIBS
 dnl -------------------------------------------------
 dnl Verify that the shared libs found so far can be used when running
index 5e9f1ac2e47ddbb7e58a970e4030aacbee6591d4..a00a2f8aa65c153f53354cfe948c69fd977b219d 100644 (file)
@@ -4178,8 +4178,6 @@ esac
 
 TYPE_SOCKADDR_STORAGE
 
-CURL_CHECK_FUNC_SELECT
-
 CURL_CHECK_FUNC_RECV
 CURL_CHECK_FUNC_SEND
 
index fd9d3e7b603206d0f845cc7a88ed6e5b9a24827a..9037dbf5c77fbc74450ef26ce2c9c12a2632488a 100644 (file)
@@ -52,7 +52,6 @@
 #define HAVE_SYS_IOCTL_H        1
 #define HAVE_ALARM              1
 #define HAVE_UTIME              1
-#define HAVE_SELECT             1
 #define HAVE_SOCKET             1
 #define HAVE_STRUCT_TIMEVAL     1
 
index 050fd9d7dac6432be55601b137551528eb631cf4..8ff560c920448d9e32a98ec3159880165ed71675 100644 (file)
 /* Define to 1 if symbol `sa_family_t' exists */
 #define HAVE_SA_FAMILY_T        1
 
-/* Define to 1 if you have the select function. */
-#define HAVE_SELECT             1
-
 /* Define to 1 if you have the send function. */
 #define HAVE_SEND               1
 
index afff218a76c778fc23335e513d2e0e4ebb323f68..358544fb3cb9b2b06bf270e734f66551c65db861 100644 (file)
@@ -69,9 +69,6 @@
 /* Define if you have the <net/if.h> header file. */
 #define HAVE_NET_IF_H
 
-/* Define if you have the `select' function. */
-#define HAVE_SELECT
-
 /* Define if you have the `signal' function. */
 #define HAVE_SIGNAL
 
index 1f4f12f433a2d563fedcd2f382b97ea173fb80e5..81f1e51ceed7ab56cba20e7caf220953be1857e0 100644 (file)
 /* Define if you have a working ioctlsocket FIONBIO function. */
 #define HAVE_IOCTLSOCKET_FIONBIO 1
 
-/* Define if you have the select function. */
-#define HAVE_SELECT 1
-
 /* Define if you have the setlocale function. */
 #define HAVE_SETLOCALE 1
 
index 26379e88a9921322811e34efd96b5e7cfe8788fe..7b0dd9a28236006289f6d183f58b7552e7ccd02f 100644 (file)
 /* Define to 1 if you have the recv function. */
 #cmakedefine HAVE_RECV 1
 
-/* Define to 1 if you have the select function. */
-#cmakedefine HAVE_SELECT 1
-
 /* Define to 1 if you have the sched_yield function. */
 #cmakedefine HAVE_SCHED_YIELD 1
 
index e50a0f0af69759db2c421b4f651682c9475cce5c..7610a4ba367c96071207abda25ea9a4391495c11 100644 (file)
  ***************************************************************************/
 #include "curl_setup.h"
 
-#ifndef HAVE_SELECT
-#error "We cannot compile without select() support."
-#endif
-
 #ifdef HAVE_SYS_SELECT_H
 #include <sys/select.h>
 #elif defined(HAVE_UNISTD_H)
index 281917bd70c4f4e0027c0cb5ae9c4f3c58d38b6d..76b56bc0426b2b1abd6ad3fc5ff3e87f974abc1e 100644 (file)
  ***************************************************************************/
 #include "curl_setup.h"
 
-#if !defined(HAVE_SELECT) && !defined(HAVE_POLL)
-#error "We cannot compile without select() or poll() support."
-#endif
-
 #ifdef HAVE_SYS_SELECT_H
 #include <sys/select.h>
 #elif defined(HAVE_UNISTD_H)
@@ -40,7 +36,7 @@
 #include "curlx/timediff.h"
 #include "curlx/wait.h"
 
-#ifndef HAVE_POLL
+#ifndef HAVE_POLL  /* use select() */
 /*
  * This is a wrapper around select() to aid in Windows compatibility. A
  * negative timeout value makes this function wait indefinitely, unless no