cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
include(CheckCSourceCompiles)
|
|
|
|
# The begin of the sources (macros and includes)
|
|
|
|
set(_source_epilogue "#undef inline")
|
2009-04-02 21:14:53 +08:00
|
|
|
|
2009-06-10 01:29:16 +08:00
|
|
|
macro(add_header_include check header)
|
|
|
|
if(${check})
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
set(_source_epilogue "${_source_epilogue}\n#include <${header}>")
|
2009-06-10 01:29:16 +08:00
|
|
|
endif(${check})
|
|
|
|
endmacro(add_header_include)
|
2009-04-02 21:14:53 +08:00
|
|
|
|
2009-06-10 01:29:16 +08:00
|
|
|
set(signature_call_conv)
|
|
|
|
if(HAVE_WINDOWS_H)
|
2009-04-02 21:14:53 +08:00
|
|
|
add_header_include(HAVE_WINSOCK2_H "winsock2.h")
|
2015-09-16 23:27:13 +08:00
|
|
|
add_header_include(HAVE_WINDOWS_H "windows.h")
|
2009-04-02 21:14:53 +08:00
|
|
|
add_header_include(HAVE_WINSOCK_H "winsock.h")
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
set(_source_epilogue
|
|
|
|
"${_source_epilogue}\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#endif")
|
2009-06-10 01:29:16 +08:00
|
|
|
set(signature_call_conv "PASCAL")
|
2014-08-08 16:23:26 +08:00
|
|
|
if(HAVE_LIBWS2_32)
|
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ws2_32)
|
|
|
|
endif()
|
2009-06-10 01:29:16 +08:00
|
|
|
else(HAVE_WINDOWS_H)
|
2009-04-02 21:14:53 +08:00
|
|
|
add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
|
|
|
|
add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h")
|
2009-06-10 01:29:16 +08:00
|
|
|
endif(HAVE_WINDOWS_H)
|
2009-04-02 21:14:53 +08:00
|
|
|
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
check_c_source_compiles("${_source_epilogue}
|
|
|
|
int main(void) {
|
|
|
|
recv(0, 0, 0, 0);
|
|
|
|
return 0;
|
|
|
|
}" curl_cv_recv)
|
2009-06-10 01:29:16 +08:00
|
|
|
if(curl_cv_recv)
|
|
|
|
if(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown")
|
|
|
|
foreach(recv_retv "int" "ssize_t" )
|
|
|
|
foreach(recv_arg1 "int" "ssize_t" "SOCKET")
|
|
|
|
foreach(recv_arg2 "void *" "char *")
|
|
|
|
foreach(recv_arg3 "size_t" "int" "socklen_t" "unsigned int")
|
|
|
|
foreach(recv_arg4 "int" "unsigned int")
|
|
|
|
if(NOT curl_cv_func_recv_done)
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
unset(curl_cv_func_recv_test CACHE)
|
|
|
|
check_c_source_compiles("
|
|
|
|
${_source_epilogue}
|
|
|
|
extern ${recv_retv} ${signature_call_conv}
|
|
|
|
recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4});
|
|
|
|
int main(void) {
|
2009-04-02 21:14:53 +08:00
|
|
|
${recv_arg1} s=0;
|
|
|
|
${recv_arg2} buf=0;
|
|
|
|
${recv_arg3} len=0;
|
|
|
|
${recv_arg4} flags=0;
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
${recv_retv} res = recv(s, buf, len, flags);
|
|
|
|
(void) res;
|
|
|
|
return 0;
|
|
|
|
}"
|
|
|
|
curl_cv_func_recv_test)
|
|
|
|
message(STATUS
|
|
|
|
"Tested: ${recv_retv} recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4})")
|
2009-06-10 01:29:16 +08:00
|
|
|
if(curl_cv_func_recv_test)
|
|
|
|
set(curl_cv_func_recv_args
|
2009-04-02 21:14:53 +08:00
|
|
|
"${recv_arg1},${recv_arg2},${recv_arg3},${recv_arg4},${recv_retv}")
|
2009-06-10 01:29:16 +08:00
|
|
|
set(RECV_TYPE_ARG1 "${recv_arg1}")
|
|
|
|
set(RECV_TYPE_ARG2 "${recv_arg2}")
|
|
|
|
set(RECV_TYPE_ARG3 "${recv_arg3}")
|
|
|
|
set(RECV_TYPE_ARG4 "${recv_arg4}")
|
|
|
|
set(RECV_TYPE_RETV "${recv_retv}")
|
|
|
|
set(HAVE_RECV 1)
|
|
|
|
set(curl_cv_func_recv_done 1)
|
|
|
|
endif(curl_cv_func_recv_test)
|
|
|
|
endif(NOT curl_cv_func_recv_done)
|
|
|
|
endforeach(recv_arg4)
|
|
|
|
endforeach(recv_arg3)
|
|
|
|
endforeach(recv_arg2)
|
|
|
|
endforeach(recv_arg1)
|
2010-02-15 03:40:18 +08:00
|
|
|
endforeach(recv_retv)
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
else()
|
2009-06-10 01:29:16 +08:00
|
|
|
string(REGEX REPLACE "^([^,]*),[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG1 "${curl_cv_func_recv_args}")
|
|
|
|
string(REGEX REPLACE "^[^,]*,([^,]*),[^,]*,[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG2 "${curl_cv_func_recv_args}")
|
|
|
|
string(REGEX REPLACE "^[^,]*,[^,]*,([^,]*),[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG3 "${curl_cv_func_recv_args}")
|
|
|
|
string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,([^,]*),[^,]*$" "\\1" RECV_TYPE_ARG4 "${curl_cv_func_recv_args}")
|
|
|
|
string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,([^,]*)$" "\\1" RECV_TYPE_RETV "${curl_cv_func_recv_args}")
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
endif()
|
2010-02-15 03:40:18 +08:00
|
|
|
|
2009-06-10 01:29:16 +08:00
|
|
|
if("${curl_cv_func_recv_args}" STREQUAL "unknown")
|
|
|
|
message(FATAL_ERROR "Cannot find proper types to use for recv args")
|
|
|
|
endif("${curl_cv_func_recv_args}" STREQUAL "unknown")
|
|
|
|
else(curl_cv_recv)
|
|
|
|
message(FATAL_ERROR "Unable to link function recv")
|
|
|
|
endif(curl_cv_recv)
|
|
|
|
set(curl_cv_func_recv_args "${curl_cv_func_recv_args}" CACHE INTERNAL "Arguments for recv")
|
|
|
|
set(HAVE_RECV 1)
|
2009-04-02 21:14:53 +08:00
|
|
|
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
check_c_source_compiles("${_source_epilogue}
|
|
|
|
int main(void) {
|
|
|
|
send(0, 0, 0, 0);
|
|
|
|
return 0;
|
|
|
|
}" curl_cv_send)
|
2009-06-10 01:29:16 +08:00
|
|
|
if(curl_cv_send)
|
|
|
|
if(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown")
|
|
|
|
foreach(send_retv "int" "ssize_t" )
|
|
|
|
foreach(send_arg1 "int" "ssize_t" "SOCKET")
|
|
|
|
foreach(send_arg2 "const void *" "void *" "char *" "const char *")
|
|
|
|
foreach(send_arg3 "size_t" "int" "socklen_t" "unsigned int")
|
|
|
|
foreach(send_arg4 "int" "unsigned int")
|
|
|
|
if(NOT curl_cv_func_send_done)
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
unset(curl_cv_func_send_test CACHE)
|
|
|
|
check_c_source_compiles("
|
|
|
|
${_source_epilogue}
|
|
|
|
extern ${send_retv} ${signature_call_conv}
|
|
|
|
send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4});
|
|
|
|
int main(void) {
|
2009-04-02 21:14:53 +08:00
|
|
|
${send_arg1} s=0;
|
|
|
|
${send_arg2} buf=0;
|
|
|
|
${send_arg3} len=0;
|
|
|
|
${send_arg4} flags=0;
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
${send_retv} res = send(s, buf, len, flags);
|
|
|
|
(void) res;
|
|
|
|
return 0;
|
|
|
|
}"
|
|
|
|
curl_cv_func_send_test)
|
|
|
|
message(STATUS
|
|
|
|
"Tested: ${send_retv} send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4})")
|
2009-06-10 01:29:16 +08:00
|
|
|
if(curl_cv_func_send_test)
|
|
|
|
string(REGEX REPLACE "(const) .*" "\\1" send_qual_arg2 "${send_arg2}")
|
|
|
|
string(REGEX REPLACE "const (.*)" "\\1" send_arg2 "${send_arg2}")
|
|
|
|
set(curl_cv_func_send_args
|
2009-04-02 21:14:53 +08:00
|
|
|
"${send_arg1},${send_arg2},${send_arg3},${send_arg4},${send_retv},${send_qual_arg2}")
|
2009-06-10 01:29:16 +08:00
|
|
|
set(SEND_TYPE_ARG1 "${send_arg1}")
|
|
|
|
set(SEND_TYPE_ARG2 "${send_arg2}")
|
|
|
|
set(SEND_TYPE_ARG3 "${send_arg3}")
|
|
|
|
set(SEND_TYPE_ARG4 "${send_arg4}")
|
|
|
|
set(SEND_TYPE_RETV "${send_retv}")
|
|
|
|
set(HAVE_SEND 1)
|
|
|
|
set(curl_cv_func_send_done 1)
|
|
|
|
endif(curl_cv_func_send_test)
|
|
|
|
endif(NOT curl_cv_func_send_done)
|
|
|
|
endforeach(send_arg4)
|
|
|
|
endforeach(send_arg3)
|
|
|
|
endforeach(send_arg2)
|
|
|
|
endforeach(send_arg1)
|
2010-02-15 03:40:18 +08:00
|
|
|
endforeach(send_retv)
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
else()
|
2009-06-10 01:29:16 +08:00
|
|
|
string(REGEX REPLACE "^([^,]*),[^,]*,[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG1 "${curl_cv_func_send_args}")
|
|
|
|
string(REGEX REPLACE "^[^,]*,([^,]*),[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG2 "${curl_cv_func_send_args}")
|
|
|
|
string(REGEX REPLACE "^[^,]*,[^,]*,([^,]*),[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG3 "${curl_cv_func_send_args}")
|
|
|
|
string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,([^,]*),[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG4 "${curl_cv_func_send_args}")
|
|
|
|
string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,([^,]*),[^,]*$" "\\1" SEND_TYPE_RETV "${curl_cv_func_send_args}")
|
|
|
|
string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,([^,]*)$" "\\1" SEND_QUAL_ARG2 "${curl_cv_func_send_args}")
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
endif()
|
2010-02-15 03:40:18 +08:00
|
|
|
|
2009-06-10 01:29:16 +08:00
|
|
|
if("${curl_cv_func_send_args}" STREQUAL "unknown")
|
|
|
|
message(FATAL_ERROR "Cannot find proper types to use for send args")
|
|
|
|
endif("${curl_cv_func_send_args}" STREQUAL "unknown")
|
|
|
|
set(SEND_QUAL_ARG2 "const")
|
|
|
|
else(curl_cv_send)
|
|
|
|
message(FATAL_ERROR "Unable to link function send")
|
|
|
|
endif(curl_cv_send)
|
|
|
|
set(curl_cv_func_send_args "${curl_cv_func_send_args}" CACHE INTERNAL "Arguments for send")
|
|
|
|
set(HAVE_SEND 1)
|
2009-04-02 21:14:53 +08:00
|
|
|
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
check_c_source_compiles("${_source_epilogue}
|
|
|
|
int main(void) {
|
|
|
|
int flag = MSG_NOSIGNAL;
|
|
|
|
(void)flag;
|
|
|
|
return 0;
|
|
|
|
}" HAVE_MSG_NOSIGNAL)
|
2009-04-02 21:14:53 +08:00
|
|
|
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
if(NOT HAVE_WINDOWS_H)
|
2009-04-02 21:14:53 +08:00
|
|
|
add_header_include(HAVE_SYS_TIME_H "sys/time.h")
|
|
|
|
add_header_include(TIME_WITH_SYS_TIME "time.h")
|
|
|
|
add_header_include(HAVE_TIME_H "time.h")
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
endif()
|
|
|
|
check_c_source_compiles("${_source_epilogue}
|
|
|
|
int main(void) {
|
|
|
|
struct timeval ts;
|
|
|
|
ts.tv_sec = 0;
|
|
|
|
ts.tv_usec = 0;
|
|
|
|
(void)ts;
|
|
|
|
return 0;
|
|
|
|
}" HAVE_STRUCT_TIMEVAL)
|
2009-04-02 21:14:53 +08:00
|
|
|
|
|
|
|
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
include(CheckCSourceRuns)
|
|
|
|
set(CMAKE_REQUIRED_FLAGS)
|
2009-06-10 01:29:16 +08:00
|
|
|
if(HAVE_SYS_POLL_H)
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
set(CMAKE_REQUIRED_FLAGS "-DHAVE_SYS_POLL_H")
|
2009-06-10 01:29:16 +08:00
|
|
|
endif(HAVE_SYS_POLL_H)
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
check_c_source_runs("
|
|
|
|
#ifdef HAVE_SYS_POLL_H
|
|
|
|
# include <sys/poll.h>
|
|
|
|
#endif
|
|
|
|
int main(void) {
|
|
|
|
return poll((void *)0, 0, 10 /*ms*/);
|
|
|
|
}" HAVE_POLL_FINE)
|
2009-04-02 21:14:53 +08:00
|
|
|
|
2009-06-10 01:29:16 +08:00
|
|
|
set(HAVE_SIG_ATOMIC_T 1)
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
set(CMAKE_REQUIRED_FLAGS)
|
2009-06-10 01:29:16 +08:00
|
|
|
if(HAVE_SIGNAL_H)
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
set(CMAKE_REQUIRED_FLAGS "-DHAVE_SIGNAL_H")
|
2009-06-10 01:29:16 +08:00
|
|
|
set(CMAKE_EXTRA_INCLUDE_FILES "signal.h")
|
|
|
|
endif(HAVE_SIGNAL_H)
|
|
|
|
check_type_size("sig_atomic_t" SIZEOF_SIG_ATOMIC_T)
|
|
|
|
if(HAVE_SIZEOF_SIG_ATOMIC_T)
|
cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).
After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.
Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed
Since check_c_source_compiles prints the varname, now you see:
Performing Test curl_cv_func_send_test
Performing Test curl_cv_func_send_test - Failed
Tested: int send(int, const void *, size_t, int)
Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-10-31 19:32:40 +08:00
|
|
|
check_c_source_compiles("
|
|
|
|
#ifdef HAVE_SIGNAL_H
|
|
|
|
# include <signal.h>
|
|
|
|
#endif
|
|
|
|
int main(void) {
|
|
|
|
static volatile sig_atomic_t dummy = 0;
|
|
|
|
(void)dummy;
|
|
|
|
return 0;
|
|
|
|
}" HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
|
2009-06-10 01:29:16 +08:00
|
|
|
if(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
|
|
|
|
set(HAVE_SIG_ATOMIC_T_VOLATILE 1)
|
|
|
|
endif(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
|
|
|
|
endif(HAVE_SIZEOF_SIG_ATOMIC_T)
|
2009-04-02 21:14:53 +08:00
|
|
|
|
2009-06-10 01:29:16 +08:00
|
|
|
if(HAVE_WINDOWS_H)
|
2014-10-31 19:32:41 +08:00
|
|
|
set(CMAKE_EXTRA_INCLUDE_FILES winsock2.h)
|
|
|
|
else()
|
|
|
|
set(CMAKE_EXTRA_INCLUDE_FILES)
|
2009-06-10 01:29:16 +08:00
|
|
|
if(HAVE_SYS_SOCKET_H)
|
2014-10-31 19:32:41 +08:00
|
|
|
set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
|
2009-06-10 01:29:16 +08:00
|
|
|
endif(HAVE_SYS_SOCKET_H)
|
2014-10-31 19:32:41 +08:00
|
|
|
endif()
|
2009-04-02 21:14:53 +08:00
|
|
|
|
2009-06-10 01:29:16 +08:00
|
|
|
check_type_size("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE)
|
|
|
|
if(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE)
|
|
|
|
set(HAVE_STRUCT_SOCKADDR_STORAGE 1)
|
|
|
|
endif(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE)
|
2009-04-02 21:14:53 +08:00
|
|
|
|