cmake: add missing checks

- 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
This commit is contained in:
Daniel Stenberg 2023-09-27 13:37:43 +02:00
parent 2ba804942f
commit 9b517c8b69
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 30 additions and 5 deletions

View file

@ -52,6 +52,9 @@ if(NOT UNIX)
set(HAVE_GETHOSTNAME 1)
set(HAVE_LIBZ 0)
set(HAVE_ARC4RANDOM 0)
set(HAVE_FNMATCH 0)
set(HAVE_SCHED_YIELD 0)
set(HAVE_ARPA_INET_H 0)
set(HAVE_FCNTL_H 1)
set(HAVE_IFADDRS_H 0)

View file

@ -1102,8 +1102,10 @@ elseif(HAVE_LIBSOCKET)
endif()
check_symbol_exists(fchmod "${CURL_INCLUDES}" HAVE_FCHMOD)
check_symbol_exists(fnmatch "${CURL_INCLUDES};fnmatch.h" HAVE_FNMATCH)
check_symbol_exists(basename "${CURL_INCLUDES};string.h" HAVE_BASENAME)
check_symbol_exists(socket "${CURL_INCLUDES}" HAVE_SOCKET)
check_symbol_exists(sched_yield "${CURL_INCLUDES};sched.h" HAVE_SCHED_YIELD)
check_symbol_exists(socketpair "${CURL_INCLUDES}" HAVE_SOCKETPAIR)
check_symbol_exists(recv "${CURL_INCLUDES}" HAVE_RECV)
check_symbol_exists(send "${CURL_INCLUDES}" HAVE_SEND)
@ -1116,6 +1118,8 @@ check_symbol_exists(stricmp "${CURL_INCLUDES};string.h" HAVE_STRICMP)
check_symbol_exists(strcmpi "${CURL_INCLUDES};string.h" HAVE_STRCMPI)
check_symbol_exists(memrchr "${CURL_INCLUDES};string.h" HAVE_MEMRCHR)
check_symbol_exists(alarm "${CURL_INCLUDES}" HAVE_ALARM)
check_symbol_exists(arc4random "${CURL_INCLUDES};stdlib.h" HAVE_ARC4RANDOM)
check_symbol_exists(fcntl "${CURL_INCLUDES}" HAVE_FCNTL)
check_symbol_exists(getppid "${CURL_INCLUDES}" HAVE_GETPPID)
check_symbol_exists(utimes "${CURL_INCLUDES}" HAVE_UTIMES)

View file

@ -159,6 +159,9 @@
/* Define to 1 if you have the alarm function. */
#cmakedefine HAVE_ALARM 1
/* Define to 1 if you have the arc4random function. */
#cmakedefine HAVE_ARC4RANDOM 1
/* Define to 1 if you have the <arpa/inet.h> header file. */
#cmakedefine HAVE_ARPA_INET_H 1
@ -168,6 +171,9 @@
/* Define to 1 if you have the `fchmod' function. */
#cmakedefine HAVE_FCHMOD 1
/* Define to 1 if you have the `fnmatch' function. */
#cmakedefine HAVE_FNMATCH 1
/* Define to 1 if you have the `basename' function. */
#cmakedefine HAVE_BASENAME 1
@ -195,6 +201,12 @@
/* Define to 1 if you have the freeaddrinfo function. */
#cmakedefine HAVE_FREEADDRINFO 1
/* Define to 1 if you have the fseeko function. */
#cmakedefine HAVE_FSEEKO 1
/* Define to 1 if you have the _fseeki64 function. */
#cmakedefine HAVE__FSEEKI64 1
/* Define to 1 if you have the ftruncate function. */
#cmakedefine HAVE_FTRUNCATE 1
@ -231,9 +243,6 @@
/* Define to 1 if you have the `getpass_r' function. */
#cmakedefine HAVE_GETPASS_R 1
/* Define to 1 if you have the `getppid' function. */
#cmakedefine HAVE_GETPPID 1
/* Define to 1 if you have the `getpeername' function. */
#cmakedefine HAVE_GETPEERNAME 1
@ -421,9 +430,15 @@
/* 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
/* Define to 1 if you have the send function. */
#cmakedefine HAVE_SEND 1
/* Define to 1 if you have the sendmsg function. */
#cmakedefine HAVE_SENDMSG 1
/* Define to 1 if you have the 'fsetxattr' function. */
#cmakedefine HAVE_FSETXATTR 1
@ -458,7 +473,7 @@
#cmakedefine HAVE_SIGSETJMP 1
/* Define to 1 if you have the `snprintf' function. */
#cmakedefine HAVE_SNPRINTF
#cmakedefine HAVE_SNPRINTF 1
/* Define to 1 if struct sockaddr_in6 has the sin6_scope_id member */
#cmakedefine HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
@ -646,6 +661,9 @@ ${SIZEOF_OFF_T_CODE}
/* The size of `curl_off_t', as computed by sizeof. */
${SIZEOF_CURL_OFF_T_CODE}
/* The size of `curl_socket_t', as computed by sizeof. */
${SIZEOF_CURL_SOCKET_T_CODE}
/* The size of `size_t', as computed by sizeof. */
${SIZEOF_SIZE_T_CODE}
@ -720,7 +738,7 @@ ${SIZEOF_TIME_T_CODE}
#cmakedefine USE_MSH3 1
/* if Unix domain sockets are enabled */
#cmakedefine USE_UNIX_SOCKETS
#cmakedefine USE_UNIX_SOCKETS 1
/* Define to 1 if you are building a Windows target with large file support. */
#cmakedefine USE_WIN32_LARGE_FILES 1