feat check POSIX_C
This commit is contained in:
parent
417dcb145b
commit
0e16e4ec08
13
third_party/curl/CMake/OtherTests.cmake
vendored
13
third_party/curl/CMake/OtherTests.cmake
vendored
@ -72,19 +72,6 @@ check_c_source_compiles("${_source_epilogue}
|
||||
(void)ts;
|
||||
return 0;
|
||||
}" HAVE_STRUCT_TIMEVAL)
|
||||
if (HAVE_SYS_TIME_H)
|
||||
check_c_source_compiles("${_source_epilogue}
|
||||
#include <sys/time.h>
|
||||
int main(void)
|
||||
{
|
||||
struct timeval ts;
|
||||
ts.tv_sec = 0;
|
||||
ts.tv_usec = 0;
|
||||
(void)ts;
|
||||
return 0;
|
||||
}" HAVE_STRUCT_TIMEVAL_BY_SYS_TIMEVAL)
|
||||
set(HAVE_STRUCT_TIMEVAL ${HAVE_STRUCT_TIMEVAL_BY_SYS_TIMEVAL})
|
||||
endif()
|
||||
|
||||
unset(CMAKE_TRY_COMPILE_TARGET_TYPE)
|
||||
|
||||
|
59
third_party/curl/lib/curl_setup_once.h
vendored
59
third_party/curl/lib/curl_setup_once.h
vendored
@ -24,17 +24,16 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* Inclusion of common header files.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
@ -57,8 +56,8 @@
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_STDBOOL_H) && defined(HAVE_BOOL_T)
|
||||
@ -109,13 +108,16 @@
|
||||
* Definition of timeval struct for platforms that don't have it.
|
||||
*/
|
||||
|
||||
#ifdef __GLIBC__
|
||||
#if !defined(_POSIX_C_SOURCE) && !defined(_POSIX_SOURCE)
|
||||
#ifndef HAVE_STRUCT_TIMEVAL
|
||||
struct timeval {
|
||||
long tv_sec;
|
||||
long tv_usec;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // _POSIX_C_SOURCE
|
||||
#endif // __GLIBC__
|
||||
|
||||
/*
|
||||
* If we have the MSG_NOSIGNAL define, make sure we use
|
||||
@ -128,12 +130,10 @@ struct timeval {
|
||||
#define SEND_4TH_ARG 0
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__minix)
|
||||
/* Minix doesn't support recv on TCP sockets */
|
||||
#define sread(x,y,z) (ssize_t)read((RECV_TYPE_ARG1)(x), \
|
||||
(RECV_TYPE_ARG2)(y), \
|
||||
(RECV_TYPE_ARG3)(z))
|
||||
#define sread(x, y, z) \
|
||||
(ssize_t) read((RECV_TYPE_ARG1)(x), (RECV_TYPE_ARG2)(y), (RECV_TYPE_ARG3)(z))
|
||||
|
||||
#elif defined(HAVE_RECV)
|
||||
/*
|
||||
@ -158,35 +158,30 @@ struct timeval {
|
||||
* SEND_TYPE_RETV must also be defined.
|
||||
*/
|
||||
|
||||
#define sread(x,y,z) (ssize_t)recv((RECV_TYPE_ARG1)(x), \
|
||||
(RECV_TYPE_ARG2)(y), \
|
||||
(RECV_TYPE_ARG3)(z), \
|
||||
(RECV_TYPE_ARG4)(0))
|
||||
#define sread(x, y, z) \
|
||||
(ssize_t) recv((RECV_TYPE_ARG1)(x), (RECV_TYPE_ARG2)(y), \
|
||||
(RECV_TYPE_ARG3)(z), (RECV_TYPE_ARG4)(0))
|
||||
#else /* HAVE_RECV */
|
||||
#ifndef sread
|
||||
#error "Missing definition of macro sread!"
|
||||
#endif
|
||||
#endif /* HAVE_RECV */
|
||||
|
||||
|
||||
#if defined(__minix)
|
||||
/* Minix doesn't support send on TCP sockets */
|
||||
#define swrite(x,y,z) (ssize_t)write((SEND_TYPE_ARG1)(x), \
|
||||
(SEND_TYPE_ARG2)(y), \
|
||||
(SEND_TYPE_ARG3)(z))
|
||||
#define swrite(x, y, z) \
|
||||
(ssize_t) write((SEND_TYPE_ARG1)(x), (SEND_TYPE_ARG2)(y), (SEND_TYPE_ARG3)(z))
|
||||
|
||||
#elif defined(HAVE_SEND)
|
||||
#define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), \
|
||||
(SEND_QUAL_ARG2 SEND_TYPE_ARG2)(y), \
|
||||
(SEND_TYPE_ARG3)(z), \
|
||||
(SEND_TYPE_ARG4)(SEND_4TH_ARG))
|
||||
#define swrite(x, y, z) \
|
||||
(ssize_t) send((SEND_TYPE_ARG1)(x), (SEND_QUAL_ARG2 SEND_TYPE_ARG2)(y), \
|
||||
(SEND_TYPE_ARG3)(z), (SEND_TYPE_ARG4)(SEND_4TH_ARG))
|
||||
#else /* HAVE_SEND */
|
||||
#ifndef swrite
|
||||
#error "Missing definition of macro swrite!"
|
||||
#endif
|
||||
#endif /* HAVE_SEND */
|
||||
|
||||
|
||||
/*
|
||||
* Function-like macro definition used to close a socket.
|
||||
*/
|
||||
@ -223,7 +218,6 @@ struct timeval {
|
||||
#define HAVE_BOOL_T
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* 'bool' exists on platforms with <stdbool.h>, i.e. C99 platforms.
|
||||
* On non-C99 platforms there's no bool, so define an enum for that.
|
||||
@ -232,10 +226,7 @@ struct timeval {
|
||||
*/
|
||||
|
||||
#ifndef HAVE_BOOL_T
|
||||
typedef enum {
|
||||
bool_false = 0,
|
||||
bool_true = 1
|
||||
} bool;
|
||||
typedef enum { bool_false = 0, bool_true = 1 } bool;
|
||||
|
||||
/*
|
||||
* Use a define to let 'true' and 'false' use those enums. There
|
||||
@ -273,7 +264,6 @@ typedef unsigned int bit;
|
||||
|
||||
#include "curl_ctype.h"
|
||||
|
||||
|
||||
/*
|
||||
* Macro used to include code only in debug builds.
|
||||
*/
|
||||
@ -281,10 +271,11 @@ typedef unsigned int bit;
|
||||
#ifdef DEBUGBUILD
|
||||
#define DEBUGF(x) x
|
||||
#else
|
||||
#define DEBUGF(x) do { } while(0)
|
||||
#define DEBUGF(x) \
|
||||
do { \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Macro used to include assertion code only in debug builds.
|
||||
*/
|
||||
@ -293,10 +284,11 @@ typedef unsigned int bit;
|
||||
#if defined(DEBUGBUILD)
|
||||
#define DEBUGASSERT(x) assert(x)
|
||||
#else
|
||||
#define DEBUGASSERT(x) do { } while(0)
|
||||
#define DEBUGASSERT(x) \
|
||||
do { \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Macro SOCKERRNO / SET_SOCKERRNO() returns / sets the *socket-related* errno
|
||||
* (or equivalent) on this platform to hide platform details to code using it.
|
||||
@ -310,7 +302,6 @@ typedef unsigned int bit;
|
||||
#define SET_SOCKERRNO(x) (errno = (x))
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Portable error number symbolic names defined to Winsock error codes.
|
||||
*/
|
||||
@ -402,7 +393,6 @@ typedef unsigned int bit;
|
||||
#define argv_item_t char *
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* We use this ZERO_NULL to avoid picky compiler warnings,
|
||||
* when assigning a NULL pointer to a function pointer var.
|
||||
@ -410,5 +400,4 @@ typedef unsigned int bit;
|
||||
|
||||
#define ZERO_NULL 0
|
||||
|
||||
|
||||
#endif /* HEADER_CURL_SETUP_ONCE_H */
|
||||
|
Loading…
Reference in New Issue
Block a user