mirror of
https://github.com/curl/curl.git
synced 2026-01-18 17:21:26 +01:00
build: assume sys/socket.h, sys/time.h on non-Windows (as in curl/curl.h)
Public `curl/curl.h` includes these headers for non-Windows platforms without further conditions. This makes it safe to assume these headers do exist, allowing to save two feature checks for non-Windows targets. `sys/time.h` is also assumed on Windows with mingw-w64, for declaring `gettimeofday()`. Closes #17522
This commit is contained in:
@@ -280,7 +280,6 @@ set(HAVE_SYS_PARAM_H 1)
|
||||
set(HAVE_SYS_POLL_H 1)
|
||||
set(HAVE_SYS_RESOURCE_H 1)
|
||||
set(HAVE_SYS_SELECT_H 1)
|
||||
set(HAVE_SYS_SOCKET_H 1)
|
||||
if(CYGWIN OR
|
||||
CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
set(HAVE_SYS_SOCKIO_H 0)
|
||||
|
||||
@@ -39,7 +39,6 @@ if(MINGW)
|
||||
set(HAVE_STDINT_H 1) # detected by CMake internally in check_type_size()
|
||||
set(HAVE_STRINGS_H 1) # wrapper to string.h
|
||||
set(HAVE_SYS_PARAM_H 1)
|
||||
set(HAVE_SYS_TIME_H 1)
|
||||
set(HAVE_UNISTD_H 1)
|
||||
set(HAVE_UTIME_H 1) # wrapper to sys/utime.h
|
||||
else()
|
||||
@@ -50,7 +49,6 @@ else()
|
||||
set(HAVE_OPENDIR 0)
|
||||
set(HAVE_STRINGS_H 0)
|
||||
set(HAVE_SYS_PARAM_H 0)
|
||||
set(HAVE_SYS_TIME_H 0)
|
||||
set(HAVE_UTIME_H 0)
|
||||
if(MSVC)
|
||||
set(HAVE_UNISTD_H 0)
|
||||
@@ -170,7 +168,6 @@ set(HAVE_SYS_IOCTL_H 0)
|
||||
set(HAVE_SYS_POLL_H 0)
|
||||
set(HAVE_SYS_RESOURCE_H 0)
|
||||
set(HAVE_SYS_SELECT_H 0)
|
||||
set(HAVE_SYS_SOCKET_H 0)
|
||||
set(HAVE_SYS_SOCKIO_H 0)
|
||||
set(HAVE_SYS_STAT_H 1)
|
||||
set(HAVE_SYS_TYPES_H 1)
|
||||
|
||||
@@ -1663,6 +1663,18 @@ if(WIN32)
|
||||
set(HAVE_IF_NAMETOINDEX 0)
|
||||
endif()
|
||||
unset(HAVE_IF_NAMETOINDEX CACHE)
|
||||
|
||||
set(HAVE_SYS_TIME_H ${MINGW})
|
||||
else()
|
||||
set(HAVE_SYS_SOCKET_H 1)
|
||||
set(HAVE_SYS_TIME_H 1)
|
||||
endif()
|
||||
|
||||
if(HAVE_SYS_SOCKET_H)
|
||||
list(APPEND CURL_INCLUDES "sys/socket.h")
|
||||
endif()
|
||||
if(HAVE_SYS_TIME_H)
|
||||
list(APPEND CURL_INCLUDES "sys/time.h")
|
||||
endif()
|
||||
|
||||
# Detect headers
|
||||
@@ -1677,10 +1689,8 @@ check_include_file("sys/param.h" HAVE_SYS_PARAM_H)
|
||||
check_include_file("sys/poll.h" HAVE_SYS_POLL_H)
|
||||
check_include_file("sys/resource.h" HAVE_SYS_RESOURCE_H)
|
||||
check_include_file_concat_curl("sys/select.h" HAVE_SYS_SELECT_H)
|
||||
check_include_file_concat_curl("sys/socket.h" HAVE_SYS_SOCKET_H)
|
||||
check_include_file("sys/sockio.h" HAVE_SYS_SOCKIO_H)
|
||||
check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
|
||||
check_include_file_concat_curl("sys/time.h" HAVE_SYS_TIME_H)
|
||||
check_include_file_concat_curl("sys/types.h" HAVE_SYS_TYPES_H)
|
||||
check_include_file("sys/un.h" HAVE_SYS_UN_H)
|
||||
check_include_file_concat_curl("sys/utime.h" HAVE_SYS_UTIME_H) # sys/types.h (AmigaOS)
|
||||
|
||||
@@ -3959,13 +3959,18 @@ case "$OPT_FISH_FPATH" in
|
||||
esac
|
||||
AM_CONDITIONAL(USE_FISH_COMPLETION, test x"$FISH_FUNCTIONS_DIR" != x)
|
||||
|
||||
if test "$curl_cv_native_windows" != 'yes'; then
|
||||
AC_DEFINE(HAVE_SYS_SOCKET_H, 1, [if you have <sys/socket.h>])
|
||||
AC_DEFINE(HAVE_SYS_TIME_H, 1, [if you have <sys/time.h>])
|
||||
HAVE_SYS_SOCKET_H=1
|
||||
HAVE_SYS_TIME_H=1
|
||||
fi
|
||||
|
||||
dnl Now check for the very most basic headers. Then we can use these
|
||||
dnl ones as default-headers when checking for the rest!
|
||||
AC_CHECK_HEADERS(
|
||||
sys/types.h \
|
||||
sys/time.h \
|
||||
sys/select.h \
|
||||
sys/socket.h \
|
||||
sys/ioctl.h \
|
||||
unistd.h \
|
||||
arpa/inet.h \
|
||||
|
||||
Reference in New Issue
Block a user