ENH: partial working configure for curlbuild.h

This commit is contained in:
Bill Hoffman 2008-09-23 16:49:25 -04:00
parent 5d7762c7c0
commit 8554d51631
2 changed files with 198 additions and 171 deletions

View File

@ -1,56 +1,80 @@
INCLUDE(CurlCheckCSourceCompiles) include(CurlCheckCSourceCompiles)
SET(EXTRA_DEFINES "__unused1\n#undef inline\n#define __unused2") set(EXTRA_DEFINES "__unused1\n#undef inline\n#define __unused2")
SET(HEADER_INCLUDES) set(HEADER_INCLUDES)
SET(headers_hack) set(headers_hack)
MACRO(add_header_include check header) macro(add_header_include check header)
IF(${check}) if(${check})
SET(headers_hack set(headers_hack
"${headers_hack}\n#include <${header}>") "${headers_hack}\n#include <${header}>")
#SET(HEADER_INCLUDES #SET(HEADER_INCLUDES
# ${HEADER_INCLUDES} # ${HEADER_INCLUDES}
# "${header}") # "${header}")
ENDIF(${check}) endif(${check})
ENDMACRO(add_header_include) endmacro(add_header_include)
SET(signature_call_conv) set(signature_call_conv)
IF(HAVE_WINDOWS_H) if(HAVE_WINDOWS_H)
add_header_include(HAVE_WINDOWS_H "windows.h") add_header_include(HAVE_WINDOWS_H "windows.h")
add_header_include(HAVE_WINSOCK2_H "winsock2.h") add_header_include(HAVE_WINSOCK2_H "winsock2.h")
add_header_include(HAVE_WINSOCK_H "winsock.h") add_header_include(HAVE_WINSOCK_H "winsock.h")
SET(EXTRA_DEFINES ${EXTRA_DEFINES} set(EXTRA_DEFINES ${EXTRA_DEFINES}
"__unused7\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#endif\n#define __unused3") "__unused7\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#endif\n#define __unused3")
SET(signature_call_conv "PASCAL") set(signature_call_conv "PASCAL")
ELSE(HAVE_WINDOWS_H) else(HAVE_WINDOWS_H)
add_header_include(HAVE_SYS_TYPES_H "sys/types.h") add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h") add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h")
add_header_include(HAVE_SYS_TIME_H "sys/time.h") add_header_include(HAVE_SYS_TIME_H "sys/time.h")
ENDIF(HAVE_WINDOWS_H) endif(HAVE_WINDOWS_H)
SET(EXTRA_DEFINES_BACKUP "${EXTRA_DEFINES}") set(EXTRA_DEFINES_BACKUP "${EXTRA_DEFINES}")
SET(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5") set(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5")
CURL_CHECK_C_SOURCE_COMPILES( curl_check_c_source_compiles(
" struct timeval ts; " struct timeval ts;
ts.tv_sec = 0; ts.tv_sec = 0;
ts.tv_usec = 0;" ts.tv_usec = 0;"
HAVE_STRUCT_TIMEVAL) HAVE_STRUCT_TIMEVAL)
CURL_CHECK_C_SOURCE_COMPILES("recv(0, 0, 0, 0)" curl_cv_recv)
IF(curl_cv_recv) foreach(TYPE_8_SIZE "long" "__int64" "long long"
"int64_t" "__longlong" "__longlog_t")
if(NOT CURL_TYPEOF_CURL_OFF_T)
curl_check_c_source_compiles(
"
typedef ${TYPE_8_SIZE} curl_off_t;
typedef char dummy_arr[sizeof(curl_off_t) == 8 ? 1 : -1];
int
main ()
{
curl_off_t dummy;
return 0;
}
"
CURL_TYPEOF_CURL_OFF_T)
if(CURL_TYPEOF_CURL_OFF_T)
set(CURL_TYPEOF_CURL_OFF_T "${TYPE_8_SIZE}")
set(type_of_curl_off_t "${TYPE_8_SIZE}")
check_type_size("${type_of_curl_off_t}" CURL_SIZEOF_CURL_OFF_T)
endif(CURL_TYPEOF_CURL_OFF_T)
endif(NOT CURL_TYPEOF_CURL_OFF_T)
endforeach(TYPE_8_SIZE)
curl_check_c_source_compiles("recv(0, 0, 0, 0)" curl_cv_recv)
if(curl_cv_recv)
# AC_CACHE_CHECK([types of arguments and return type for recv], # AC_CACHE_CHECK([types of arguments and return type for recv],
#[curl_cv_func_recv_args], [ #[curl_cv_func_recv_args], [
#SET(curl_cv_func_recv_args "unknown") #SET(curl_cv_func_recv_args "unknown")
#for recv_retv in 'int' 'ssize_t'; do #for recv_retv in 'int' 'ssize_t'; do
IF(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown") if(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown")
FOREACH(recv_retv "int" "ssize_t" ) foreach(recv_retv "int" "ssize_t" )
FOREACH(recv_arg1 "int" "ssize_t" "SOCKET") foreach(recv_arg1 "int" "ssize_t" "SOCKET")
FOREACH(recv_arg2 "void *" "char *") foreach(recv_arg2 "void *" "char *")
FOREACH(recv_arg3 "size_t" "int" "socklen_t" "unsigned int") foreach(recv_arg3 "size_t" "int" "socklen_t" "unsigned int")
FOREACH(recv_arg4 "int" "unsigned int") foreach(recv_arg4 "int" "unsigned int")
IF(NOT curl_cv_func_recv_done) if(NOT curl_cv_func_recv_done)
SET(curl_cv_func_recv_test "UNKNOWN") set(curl_cv_func_recv_test "UNKNOWN")
SET(extern_line "extern ${recv_retv} ${signature_call_conv} recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4})\;") set(extern_line "extern ${recv_retv} ${signature_call_conv} recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4})\;")
SET(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5") set(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5")
CURL_CHECK_C_SOURCE_COMPILES(" curl_check_c_source_compiles("
${recv_arg1} s=0; ${recv_arg1} s=0;
${recv_arg2} buf=0; ${recv_arg2} buf=0;
${recv_arg3} len=0; ${recv_arg3} len=0;
@ -58,62 +82,62 @@ IF(curl_cv_recv)
${recv_retv} res = recv(s, buf, len, flags)" ${recv_retv} res = recv(s, buf, len, flags)"
curl_cv_func_recv_test curl_cv_func_recv_test
"${recv_retv} recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4})") "${recv_retv} recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4})")
IF(curl_cv_func_recv_test) if(curl_cv_func_recv_test)
SET(curl_cv_func_recv_args set(curl_cv_func_recv_args
"${recv_arg1},${recv_arg2},${recv_arg3},${recv_arg4},${recv_retv}") "${recv_arg1},${recv_arg2},${recv_arg3},${recv_arg4},${recv_retv}")
SET(RECV_TYPE_ARG1 "${recv_arg1}") set(RECV_TYPE_ARG1 "${recv_arg1}")
SET(RECV_TYPE_ARG2 "${recv_arg2}") set(RECV_TYPE_ARG2 "${recv_arg2}")
SET(RECV_TYPE_ARG3 "${recv_arg3}") set(RECV_TYPE_ARG3 "${recv_arg3}")
SET(RECV_TYPE_ARG4 "${recv_arg4}") set(RECV_TYPE_ARG4 "${recv_arg4}")
SET(RECV_TYPE_RETV "${recv_retv}") set(RECV_TYPE_RETV "${recv_retv}")
SET(HAVE_RECV 1) set(HAVE_RECV 1)
SET(curl_cv_func_recv_done 1) set(curl_cv_func_recv_done 1)
ENDIF(curl_cv_func_recv_test) endif(curl_cv_func_recv_test)
ENDIF(NOT curl_cv_func_recv_done) endif(NOT curl_cv_func_recv_done)
ENDFOREACH(recv_arg4) endforeach(recv_arg4)
ENDFOREACH(recv_arg3) endforeach(recv_arg3)
ENDFOREACH(recv_arg2) endforeach(recv_arg2)
ENDFOREACH(recv_arg1) endforeach(recv_arg1)
ENDFOREACH(recv_retv) endforeach(recv_retv)
ELSE(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown") else(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown")
STRING(REGEX REPLACE "^([^,]*),[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG1 "${curl_cv_func_recv_args}") 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_ARG2 "${curl_cv_func_recv_args}")
STRING(REGEX REPLACE "^[^,]*,[^,]*,([^,]*),[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG3 "${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_ARG4 "${curl_cv_func_recv_args}")
STRING(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,([^,]*)$" "\\1" RECV_TYPE_RETV "${curl_cv_func_recv_args}") string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,([^,]*)$" "\\1" RECV_TYPE_RETV "${curl_cv_func_recv_args}")
#MESSAGE("RECV_TYPE_ARG1 ${RECV_TYPE_ARG1}") #MESSAGE("RECV_TYPE_ARG1 ${RECV_TYPE_ARG1}")
#MESSAGE("RECV_TYPE_ARG2 ${RECV_TYPE_ARG2}") #MESSAGE("RECV_TYPE_ARG2 ${RECV_TYPE_ARG2}")
#MESSAGE("RECV_TYPE_ARG3 ${RECV_TYPE_ARG3}") #MESSAGE("RECV_TYPE_ARG3 ${RECV_TYPE_ARG3}")
#MESSAGE("RECV_TYPE_ARG4 ${RECV_TYPE_ARG4}") #MESSAGE("RECV_TYPE_ARG4 ${RECV_TYPE_ARG4}")
#MESSAGE("RECV_TYPE_RETV ${RECV_TYPE_RETV}") #MESSAGE("RECV_TYPE_RETV ${RECV_TYPE_RETV}")
ENDIF(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown") endif(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown")
IF("${curl_cv_func_recv_args}" STREQUAL "unknown") if("${curl_cv_func_recv_args}" STREQUAL "unknown")
MESSAGE(FATAL_ERROR "Cannot find proper types to use for recv args") message(FATAL_ERROR "Cannot find proper types to use for recv args")
ENDIF("${curl_cv_func_recv_args}" STREQUAL "unknown") endif("${curl_cv_func_recv_args}" STREQUAL "unknown")
ELSE(curl_cv_recv) else(curl_cv_recv)
MESSAGE(FATAL_ERROR "Unable to link function recv") message(FATAL_ERROR "Unable to link function recv")
ENDIF(curl_cv_recv) endif(curl_cv_recv)
SET(curl_cv_func_recv_args "${curl_cv_func_recv_args}" CACHE INTERNAL "Arguments for recv") set(curl_cv_func_recv_args "${curl_cv_func_recv_args}" CACHE INTERNAL "Arguments for recv")
SET(HAVE_RECV 1) set(HAVE_RECV 1)
CURL_CHECK_C_SOURCE_COMPILES("send(0, 0, 0, 0)" curl_cv_send) curl_check_c_source_compiles("send(0, 0, 0, 0)" curl_cv_send)
IF(curl_cv_send) if(curl_cv_send)
# AC_CACHE_CHECK([types of arguments and return type for send], # AC_CACHE_CHECK([types of arguments and return type for send],
#[curl_cv_func_send_args], [ #[curl_cv_func_send_args], [
#SET(curl_cv_func_send_args "unknown") #SET(curl_cv_func_send_args "unknown")
#for send_retv in 'int' 'ssize_t'; do #for send_retv in 'int' 'ssize_t'; do
IF(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown") if(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown")
FOREACH(send_retv "int" "ssize_t" ) foreach(send_retv "int" "ssize_t" )
FOREACH(send_arg1 "int" "ssize_t" "SOCKET") foreach(send_arg1 "int" "ssize_t" "SOCKET")
FOREACH(send_arg2 "const void *" "void *" "char *" "const char *") foreach(send_arg2 "const void *" "void *" "char *" "const char *")
FOREACH(send_arg3 "size_t" "int" "socklen_t" "unsigned int") foreach(send_arg3 "size_t" "int" "socklen_t" "unsigned int")
FOREACH(send_arg4 "int" "unsigned int") foreach(send_arg4 "int" "unsigned int")
IF(NOT curl_cv_func_send_done) if(NOT curl_cv_func_send_done)
SET(curl_cv_func_send_test "UNKNOWN") set(curl_cv_func_send_test "UNKNOWN")
SET(extern_line "extern ${send_retv} ${signature_call_conv} send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4})\;") set(extern_line "extern ${send_retv} ${signature_call_conv} send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4})\;")
SET(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5") set(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5")
CURL_CHECK_C_SOURCE_COMPILES(" curl_check_c_source_compiles("
${send_arg1} s=0; ${send_arg1} s=0;
${send_arg2} buf=0; ${send_arg2} buf=0;
${send_arg3} len=0; ${send_arg3} len=0;
@ -121,136 +145,136 @@ IF(curl_cv_send)
${send_retv} res = send(s, buf, len, flags)" ${send_retv} res = send(s, buf, len, flags)"
curl_cv_func_send_test curl_cv_func_send_test
"${send_retv} send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4})") "${send_retv} send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4})")
IF(curl_cv_func_send_test) if(curl_cv_func_send_test)
#MESSAGE("Found arguments: ${curl_cv_func_send_test}") #MESSAGE("Found arguments: ${curl_cv_func_send_test}")
STRING(REGEX REPLACE "(const) .*" "\\1" send_qual_arg2 "${send_arg2}") string(REGEX REPLACE "(const) .*" "\\1" send_qual_arg2 "${send_arg2}")
STRING(REGEX REPLACE "const (.*)" "\\1" send_arg2 "${send_arg2}") string(REGEX REPLACE "const (.*)" "\\1" send_arg2 "${send_arg2}")
SET(curl_cv_func_send_args set(curl_cv_func_send_args
"${send_arg1},${send_arg2},${send_arg3},${send_arg4},${send_retv},${send_qual_arg2}") "${send_arg1},${send_arg2},${send_arg3},${send_arg4},${send_retv},${send_qual_arg2}")
SET(SEND_TYPE_ARG1 "${send_arg1}") set(SEND_TYPE_ARG1 "${send_arg1}")
SET(SEND_TYPE_ARG2 "${send_arg2}") set(SEND_TYPE_ARG2 "${send_arg2}")
SET(SEND_TYPE_ARG3 "${send_arg3}") set(SEND_TYPE_ARG3 "${send_arg3}")
SET(SEND_TYPE_ARG4 "${send_arg4}") set(SEND_TYPE_ARG4 "${send_arg4}")
SET(SEND_TYPE_RETV "${send_retv}") set(SEND_TYPE_RETV "${send_retv}")
SET(HAVE_SEND 1) set(HAVE_SEND 1)
SET(curl_cv_func_send_done 1) set(curl_cv_func_send_done 1)
ENDIF(curl_cv_func_send_test) endif(curl_cv_func_send_test)
ENDIF(NOT curl_cv_func_send_done) endif(NOT curl_cv_func_send_done)
ENDFOREACH(send_arg4) endforeach(send_arg4)
ENDFOREACH(send_arg3) endforeach(send_arg3)
ENDFOREACH(send_arg2) endforeach(send_arg2)
ENDFOREACH(send_arg1) endforeach(send_arg1)
ENDFOREACH(send_retv) endforeach(send_retv)
ELSE(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown") else(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown")
STRING(REGEX REPLACE "^([^,]*),[^,]*,[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG1 "${curl_cv_func_send_args}") 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_ARG2 "${curl_cv_func_send_args}")
STRING(REGEX REPLACE "^[^,]*,[^,]*,([^,]*),[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG3 "${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_ARG4 "${curl_cv_func_send_args}")
STRING(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,([^,]*),[^,]*$" "\\1" SEND_TYPE_RETV "${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}") string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,([^,]*)$" "\\1" SEND_QUAL_ARG2 "${curl_cv_func_send_args}")
#MESSAGE("SEND_TYPE_ARG1 ${SEND_TYPE_ARG1}") #MESSAGE("SEND_TYPE_ARG1 ${SEND_TYPE_ARG1}")
#MESSAGE("SEND_TYPE_ARG2 ${SEND_TYPE_ARG2}") #MESSAGE("SEND_TYPE_ARG2 ${SEND_TYPE_ARG2}")
#MESSAGE("SEND_TYPE_ARG3 ${SEND_TYPE_ARG3}") #MESSAGE("SEND_TYPE_ARG3 ${SEND_TYPE_ARG3}")
#MESSAGE("SEND_TYPE_ARG4 ${SEND_TYPE_ARG4}") #MESSAGE("SEND_TYPE_ARG4 ${SEND_TYPE_ARG4}")
#MESSAGE("SEND_TYPE_RETV ${SEND_TYPE_RETV}") #MESSAGE("SEND_TYPE_RETV ${SEND_TYPE_RETV}")
#MESSAGE("SEND_QUAL_ARG2 ${SEND_QUAL_ARG2}") #MESSAGE("SEND_QUAL_ARG2 ${SEND_QUAL_ARG2}")
ENDIF(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown") endif(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown")
IF("${curl_cv_func_send_args}" STREQUAL "unknown") if("${curl_cv_func_send_args}" STREQUAL "unknown")
MESSAGE(FATAL_ERROR "Cannot find proper types to use for send args") message(FATAL_ERROR "Cannot find proper types to use for send args")
ENDIF("${curl_cv_func_send_args}" STREQUAL "unknown") endif("${curl_cv_func_send_args}" STREQUAL "unknown")
SET(SEND_QUAL_ARG2 "const") set(SEND_QUAL_ARG2 "const")
ELSE(curl_cv_send) else(curl_cv_send)
MESSAGE(FATAL_ERROR "Unable to link function send") message(FATAL_ERROR "Unable to link function send")
ENDIF(curl_cv_send) endif(curl_cv_send)
SET(curl_cv_func_send_args "${curl_cv_func_send_args}" CACHE INTERNAL "Arguments for send") set(curl_cv_func_send_args "${curl_cv_func_send_args}" CACHE INTERNAL "Arguments for send")
SET(HAVE_SEND 1) set(HAVE_SEND 1)
SET(EXTRA_DEFINES "${EXTRA_DEFINES}\n${headers_hack}\n#define __unused5") set(EXTRA_DEFINES "${EXTRA_DEFINES}\n${headers_hack}\n#define __unused5")
CURL_CHECK_C_SOURCE_COMPILES("int flag = MSG_NOSIGNAL" HAVE_MSG_NOSIGNAL) curl_check_c_source_compiles("int flag = MSG_NOSIGNAL" HAVE_MSG_NOSIGNAL)
SET(EXTRA_DEFINES "__unused1\n#undef inline\n#define __unused2") set(EXTRA_DEFINES "__unused1\n#undef inline\n#define __unused2")
SET(HEADER_INCLUDES) set(HEADER_INCLUDES)
SET(headers_hack) set(headers_hack)
MACRO(add_header_include check header) macro(add_header_include check header)
IF(${check}) if(${check})
SET(headers_hack set(headers_hack
"${headers_hack}\n#include <${header}>") "${headers_hack}\n#include <${header}>")
#SET(HEADER_INCLUDES #SET(HEADER_INCLUDES
# ${HEADER_INCLUDES} # ${HEADER_INCLUDES}
# "${header}") # "${header}")
ENDIF(${check}) endif(${check})
ENDMACRO(add_header_include header) endmacro(add_header_include header)
IF(HAVE_WINDOWS_H) if(HAVE_WINDOWS_H)
SET(EXTRA_DEFINES ${EXTRA_DEFINES} set(EXTRA_DEFINES ${EXTRA_DEFINES}
"__unused7\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#endif\n#define __unused3") "__unused7\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#endif\n#define __unused3")
add_header_include(HAVE_WINDOWS_H "windows.h") add_header_include(HAVE_WINDOWS_H "windows.h")
add_header_include(HAVE_WINSOCK2_H "winsock2.h") add_header_include(HAVE_WINSOCK2_H "winsock2.h")
add_header_include(HAVE_WINSOCK_H "winsock.h") add_header_include(HAVE_WINSOCK_H "winsock.h")
ELSE(HAVE_WINDOWS_H) else(HAVE_WINDOWS_H)
add_header_include(HAVE_SYS_TYPES_H "sys/types.h") add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
add_header_include(HAVE_SYS_TIME_H "sys/time.h") add_header_include(HAVE_SYS_TIME_H "sys/time.h")
add_header_include(TIME_WITH_SYS_TIME "time.h") add_header_include(TIME_WITH_SYS_TIME "time.h")
add_header_include(HAVE_TIME_H "time.h") add_header_include(HAVE_TIME_H "time.h")
ENDIF(HAVE_WINDOWS_H) endif(HAVE_WINDOWS_H)
SET(EXTRA_DEFINES "${EXTRA_DEFINES}\n${headers_hack}\n#define __unused5") set(EXTRA_DEFINES "${EXTRA_DEFINES}\n${headers_hack}\n#define __unused5")
CURL_CHECK_C_SOURCE_COMPILES("struct timeval ts;\nts.tv_sec = 0;\nts.tv_usec = 0" HAVE_STRUCT_TIMEVAL) curl_check_c_source_compiles("struct timeval ts;\nts.tv_sec = 0;\nts.tv_usec = 0" HAVE_STRUCT_TIMEVAL)
INCLUDE(CurlCheckCSourceRuns) include(CurlCheckCSourceRuns)
SET(EXTRA_DEFINES) set(EXTRA_DEFINES)
SET(HEADER_INCLUDES) set(HEADER_INCLUDES)
IF(HAVE_SYS_POLL_H) if(HAVE_SYS_POLL_H)
SET(HEADER_INCLUDES "sys/poll.h") set(HEADER_INCLUDES "sys/poll.h")
ENDIF(HAVE_SYS_POLL_H) endif(HAVE_SYS_POLL_H)
CURL_CHECK_C_SOURCE_RUNS("return poll((void *)0, 0, 10 /*ms*/)" HAVE_POLL_FINE) curl_check_c_source_runs("return poll((void *)0, 0, 10 /*ms*/)" HAVE_POLL_FINE)
SET(HAVE_SIG_ATOMIC_T 1) set(HAVE_SIG_ATOMIC_T 1)
SET(EXTRA_DEFINES) set(EXTRA_DEFINES)
SET(HEADER_INCLUDES) set(HEADER_INCLUDES)
IF(HAVE_SIGNAL_H) if(HAVE_SIGNAL_H)
SET(HEADER_INCLUDES "signal.h") set(HEADER_INCLUDES "signal.h")
SET(CMAKE_EXTRA_INCLUDE_FILES "signal.h") set(CMAKE_EXTRA_INCLUDE_FILES "signal.h")
ENDIF(HAVE_SIGNAL_H) endif(HAVE_SIGNAL_H)
CHECK_TYPE_SIZE("sig_atomic_t" SIZEOF_SIG_ATOMIC_T) check_type_size("sig_atomic_t" SIZEOF_SIG_ATOMIC_T)
IF(HAVE_SIZEOF_SIG_ATOMIC_T) if(HAVE_SIZEOF_SIG_ATOMIC_T)
CURL_CHECK_C_SOURCE_COMPILES("static volatile sig_atomic_t dummy = 0" HAVE_SIG_ATOMIC_T_NOT_VOLATILE) curl_check_c_source_compiles("static volatile sig_atomic_t dummy = 0" HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
IF(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE) if(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
SET(HAVE_SIG_ATOMIC_T_VOLATILE 1) set(HAVE_SIG_ATOMIC_T_VOLATILE 1)
ENDIF(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE) endif(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
ENDIF(HAVE_SIZEOF_SIG_ATOMIC_T) endif(HAVE_SIZEOF_SIG_ATOMIC_T)
SET(CHECK_TYPE_SIZE_PREINCLUDE set(CHECK_TYPE_SIZE_PREINCLUDE
"#undef inline") "#undef inline")
IF(HAVE_WINDOWS_H) if(HAVE_WINDOWS_H)
SET(CHECK_TYPE_SIZE_PREINCLUDE "${CHECK_TYPE_SIZE_PREINCLUDE} set(CHECK_TYPE_SIZE_PREINCLUDE "${CHECK_TYPE_SIZE_PREINCLUDE}
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
#include <windows.h>") #include <windows.h>")
IF(HAVE_WINSOCK2_H) if(HAVE_WINSOCK2_H)
SET(CHECK_TYPE_SIZE_PREINCLUDE "${CHECK_TYPE_SIZE_PREINCLUDE}\n#include <winsock2.h>") set(CHECK_TYPE_SIZE_PREINCLUDE "${CHECK_TYPE_SIZE_PREINCLUDE}\n#include <winsock2.h>")
ENDIF(HAVE_WINSOCK2_H) endif(HAVE_WINSOCK2_H)
ELSE(HAVE_WINDOWS_H) else(HAVE_WINDOWS_H)
IF(HAVE_SYS_SOCKET_H) if(HAVE_SYS_SOCKET_H)
SET(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES}
"sys/socket.h") "sys/socket.h")
ENDIF(HAVE_SYS_SOCKET_H) endif(HAVE_SYS_SOCKET_H)
IF(HAVE_NETINET_IN_H) if(HAVE_NETINET_IN_H)
SET(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES}
"netinet/in.h") "netinet/in.h")
ENDIF(HAVE_NETINET_IN_H) endif(HAVE_NETINET_IN_H)
IF(HAVE_ARPA_INET_H) if(HAVE_ARPA_INET_H)
SET(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES}
"arpa/inet.h") "arpa/inet.h")
ENDIF(HAVE_ARPA_INET_H) endif(HAVE_ARPA_INET_H)
ENDIF(HAVE_WINDOWS_H) endif(HAVE_WINDOWS_H)
CHECK_TYPE_SIZE("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE) check_type_size("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE)
IF(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE) if(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE)
SET(HAVE_STRUCT_SOCKADDR_STORAGE 1) set(HAVE_STRUCT_SOCKADDR_STORAGE 1)
ENDIF(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE) endif(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE)

View File

@ -16,7 +16,7 @@ endif(CMAKE_CROSSCOMPILING)
set(libCurl_SRCS set(libCurl_SRCS
file.c timeval.c base64.c hostip.c progress.c formdata.c file.c timeval.c base64.c hostip.c progress.c formdata.c
cookie.c http.c sendf.c ftp.c url.c dict.c if2ip.c speedcheck.c cookie.c http.c sendf.c ftp.c url.c dict.c if2ip.c speedcheck.c
ldap.c ssluse.c version.c getenv.c escape.c mprintf.c telnet.c ldap.c ssluse.c version.c getenv.c escape.c mprintf.c telnet.c
netrc.c getinfo.c transfer.c strequal.c easy.c security.c krb4.c netrc.c getinfo.c transfer.c strequal.c easy.c security.c krb4.c
@ -26,13 +26,13 @@ set(libCurl_SRCS
hostares.c hostasyn.c hostip4.c hostip6.c hostsyn.c hostthre.c hostares.c hostasyn.c hostip4.c hostip6.c hostsyn.c hostthre.c
inet_ntop.c parsedate.c select.c gtls.c sslgen.c tftp.c splay.c inet_ntop.c parsedate.c select.c gtls.c sslgen.c tftp.c splay.c
strdup.c socks.c ssh.c nss.c qssl.c strdup.c socks.c ssh.c nss.c qssl.c
arpa_telnet.h netrc.h file.h timeval.h qssl.h hostip.h arpa_telnet.h netrc.h file.h timeval.h qssl.h hostip.h
progress.h formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h progress.h formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h
if2ip.h speedcheck.h urldata.h curl_ldap.h ssluse.h escape.h telnet.h if2ip.h speedcheck.h urldata.h curl_ldap.h ssluse.h escape.h telnet.h
getinfo.h strequal.h krb4.h memdebug.h inet_ntoa_r.h http_chunks.h getinfo.h strequal.h krb4.h memdebug.h inet_ntoa_r.h http_chunks.h
strtok.h connect.h llist.h hash.h content_encoding.h share.h strtok.h connect.h llist.h hash.h content_encoding.h share.h
curl_md5.h http_digest.h http_negotiate.h http_ntlm.h inet_pton.h curl_md5.h http_digest.h http_negotiate.h http_ntlm.h inet_pton.h
strtoofft.h strerror.h inet_ntop.h curlx.h memory.h setup.h strtoofft.h strerror.h inet_ntop.h curlx.h memory.h setup.h
transfer.h select.h easyif.h multiif.h parsedate.h sslgen.h gtls.h transfer.h select.h easyif.h multiif.h parsedate.h sslgen.h gtls.h
tftp.h sockaddr.h splay.h strdup.h setup_once.h socks.h ssh.h nssg.h tftp.h sockaddr.h splay.h strdup.h setup_once.h socks.h ssh.h nssg.h
curl_base64.h curl_base64.h
@ -561,6 +561,9 @@ endif(WIN32)
configure_file(${CURL_SOURCE_DIR}/lib/config.cmake.h.in configure_file(${CURL_SOURCE_DIR}/lib/config.cmake.h.in
${CURL_BINARY_DIR}/lib/config.h) ${CURL_BINARY_DIR}/lib/config.h)
set(CURL_SIZEOF_LONG ${SIZEOF_LONG})
configure_file(${CURL_SOURCE_DIR}/include/curl/curlbuild.cmake.h.in
${CURL_BINARY_DIR}/include/curl/configbuild.h)
add_library(cmcurl ${libCurl_SRCS}) add_library(cmcurl ${libCurl_SRCS})
target_link_libraries(cmcurl ${CURL_LIBS}) target_link_libraries(cmcurl ${CURL_LIBS})