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