Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Utilities / cmcurl-7.19.0 / CMake / OtherTests.cmake
blobbcb714b62b5a5356092fcf488bca07dd557ca40e
1 include(CurlCheckCSourceCompiles)
2 set(EXTRA_DEFINES "__unused1\n#undef inline\n#define __unused2")
3 set(HEADER_INCLUDES)
4 set(headers_hack)
6 macro(add_header_include check header)
7   if(${check})
8     set(headers_hack
9       "${headers_hack}\n#include <${header}>")
10     #SET(HEADER_INCLUDES
11     #  ${HEADER_INCLUDES}
12     #  "${header}")
13   endif(${check})
14 endmacro(add_header_include)
16 set(signature_call_conv)
17 if(HAVE_WINDOWS_H)
18   add_header_include(HAVE_WINDOWS_H "windows.h")
19   add_header_include(HAVE_WINSOCK2_H "winsock2.h")
20   add_header_include(HAVE_WINSOCK_H "winsock.h")
21   set(EXTRA_DEFINES ${EXTRA_DEFINES}
22     "__unused7\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#endif\n#define __unused3")
23   set(signature_call_conv "PASCAL")
24 else(HAVE_WINDOWS_H)
25   add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
26   add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h")
27   add_header_include(HAVE_SYS_TIME_H "sys/time.h")
28 endif(HAVE_WINDOWS_H)
30 set(EXTRA_DEFINES_BACKUP "${EXTRA_DEFINES}")
31 set(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5")
32 curl_check_c_source_compiles(
33 " struct timeval ts;
34   ts.tv_sec  = 0;
35   ts.tv_usec = 0;"
36 HAVE_STRUCT_TIMEVAL)
39 # function to find and set curl_typeof_curl_off_t
40 # trytypes should be the name of a variable that 
41 # has the list of types to try, and size is the size in bytes
42 # we are trying to find
43 function(curl_find_curl_off_t trytypes size)
44   if(DEFINED curl_typeof_curl_off_t)
45     return()
46   endif(DEFINED curl_typeof_curl_off_t)
47   foreach(type ${${trytypes}}) 
48     # force the try compile to try until it works
49     set(curl_typeof_curl_off_t "UNKNOWN")
50     set(EXTRA_DEFINES 
51       "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5")
52     curl_check_c_source_compiles(
53       "
54         typedef ${type} curl_off_t;
55         typedef char dummy_arr[sizeof(curl_off_t) == ${size} ? 1 : -1];
56         curl_off_t dummy;
57        "
58       curl_typeof_curl_off_t
59       )
60     if(curl_typeof_curl_off_t)
61       # this means it found the type and we can return
62       set(CURL_TYPEOF_CURL_OFF_T "${type}" CACHE INTERNAL "type of curl_off_t")
63       return()
64     endif(curl_typeof_curl_off_t)
65   endforeach(type)
66 endfunction(curl_find_curl_off_t)
69 if(NOT DEFINED curl_typeof_curl_off_t)
70   set(curl_show_typeof_status 1)
71 endif(NOT DEFINED curl_typeof_curl_off_t)
72 # check for an 8 byte off_t type
73 set(try_types_8 "long" "__int64" "long long"
74     "int64_t" "__longlong" "__longlog_t")
75 curl_find_curl_off_t(try_types_8 8 )
76 # check for a 4 byte off_t type
77 set(try_types_4 "long" "int32_t" "__int32" "int")
78 curl_find_curl_off_t(try_types_4 4 )
79 set(try_types_2 "long" "ubt16_t" "__int16" "int")
80 curl_find_curl_off_t(try_types_2 2 )
81 if(curl_show_typeof_status)
82   message(STATUS "curl_typeof_curl_off_t = ${curl_typeof_curl_off_t}") 
83   check_type_size("${CURL_TYPEOF_CURL_OFF_T}" CURL_SIZEOF_CURL_OFF_T)
84   message(STATUS "sizeof ${curl_typeof_curl_off_t} = ${CURL_SIZEOF_CURL_OFF_T}") 
85 endif(curl_show_typeof_status)
88 # need to set the format strings used in printf for off_t
89 # curl_format_curl_off_t   - signed 
90 # curl_format_curl_off_tu  - unsigned
91
92 # First see if the type is 2 4 or 8 bytes
93 if(CURL_SIZEOF_CURL_OFF_T EQUAL 2)
94   set(PRI_MACRO "PRId16")
95 endif(CURL_SIZEOF_CURL_OFF_T EQUAL 2)
96 if(CURL_SIZEOF_CURL_OFF_T EQUAL 4)
97   set(PRI_MACRO "PRId32")
98 endif(CURL_SIZEOF_CURL_OFF_T EQUAL 4)
99 if(CURL_SIZEOF_CURL_OFF_T EQUAL 8)
100   set(PRI_MACRO "PRId64")
101 endif(CURL_SIZEOF_CURL_OFF_T EQUAL 8)
102 # now see if PRI macros are defined for printing
103 set(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5")
104 curl_check_c_source_compiles("char f[] = ${PRI_MACRO};" curl_pri_macro)
105 if(curl_pri_macro)
106   string(REPLACE i u "${PRI_MACRO}" PRI_MACROU)
107   string(REPLACE d u "${PRI_MACRO}" PRI_MACROU)
108   string(REPLACE D U "${PRI_MACRO}" PRI_MACROU)
109   set(CURL_FORMAT_CURL_OFF_T "${PRI_MACRO}" CACHE INTERNAL "print curl_off_t format string")
110   set(CURL_FORMAT_CURL_OFF_TU "${PRI_MACROU}" CACHE INTERNAL "print curl_off_t format string")
111 else(curl_pri_macro)
112   if(CURL_TYPEOF_CURL_OFF_T MATCHES "long.*long")
113     set(CURL_FORMAT_CURL_OFF_T  "lld" CACHE INTERNAL "print curl_off_t format string")
114     set(CURL_FORMAT_CURL_OFF_TU "llu" CACHE INTERNAL "print curl_off_t format string")
115   endif()
116   if(CURL_TYPEOF_CURL_OFF_T STREQUAL "long")
117     set(CURL_FORMAT_CURL_OFF_T  "ld" CACHE INTERNAL "print curl_off_t format string")
118     set(CURL_FORMAT_CURL_OFF_TU "lu" CACHE INTERNAL "print curl_off_t format string")
119   endif()
120   if(CURL_TYPEOF_CURL_OFF_T STREQUAL "int")
121     set(CURL_FORMAT_CURL_OFF_T  "d" CACHE INTERNAL "print curl_off_t format string")
122     set(CURL_FORMAT_CURL_OFF_TU "u" CACHE INTERNAL "print curl_off_t format string")
123   endif()
124   if(CURL_TYPEOF_CURL_OFF_T STREQUAL "__int64")
125     set(CURL_FORMAT_CURL_OFF_T  "I64d" CACHE INTERNAL "print curl_off_t format string")
126     set(CURL_FORMAT_CURL_OFF_TU "I64u" CACHE INTERNAL "print curl_off_t format string")
127   endif()
128   if(CURL_TYPEOF_CURL_OFF_T STREQUAL "__int32")
129     set(CURL_FORMAT_CURL_OFF_T  "I32d" CACHE INTERNAL "print curl_off_t format string")
130     set(CURL_FORMAT_CURL_OFF_TU "I32u" CACHE INTERNAL "print curl_off_t format string")
131   endif()
132   if(CURL_TYPEOF_CURL_OFF_T STREQUAL "__int16")
133     set(CURL_FORMAT_CURL_OFF_T  "I16d" CACHE INTERNAL "print curl_off_t format string")
134     set(CURL_FORMAT_CURL_OFF_TU "I16u" CACHE INTERNAL "print curl_off_t format string")
135   endif()
136   message(STATUS "CURL_FORMAT_CURL_OFF_T = ${CURL_FORMAT_CURL_OFF_T}")
137   message(STATUS "CURL_FORMAT_CURL_OFF_TU = ${CURL_FORMAT_CURL_OFF_TU}")
138 endif(curl_pri_macro)
140 function (check_curl_off_t_suffix )
141   if(DEFINED CURL_SUFFIX_CURL_OFF_T)
142     return()
143   endif()
144   set(CURL_TYPEOF_CURL_OFF_T "long long")
145   if(CURL_TYPEOF_CURL_OFF_T MATCHES "long.*long")
146     set(curl_test_suffix "LL")
147   endif()
148   if(CURL_TYPEOF_CURL_OFF_T STREQUAL "long")
149     set(curl_test_suffix "L")
150   endif()
151   if(CURL_TYPEOF_CURL_OFF_T STREQUAL "int")
152     set(curl_test_suffix "")
153   endif()
154   if(CURL_TYPEOF_CURL_OFF_T STREQUAL "__int64")
155     set(curl_test_suffix "LL" "i64")
156   endif()
157   if(CURL_TYPEOF_CURL_OFF_T STREQUAL "__int32")
158     set(curl_test_suffix "L" "i32")
159   endif()
160   if(CURL_TYPEOF_CURL_OFF_T STREQUAL "__int16")
161     set(curl_test_suffix "L" "i16")
162   endif()
163   foreach (suffix ${curl_test_suffix})
164     set(curl_suffix_curl_off_t_test "unknown")
165     if(suffix MATCHES "i64|i32|i16")
166       set(curl_test_suffix_u "u${suffix}")
167     endif(suffix MATCHES "i64|i32|i16")
168     if(suffix MATCHES "LL|L")
169       set(curl_test_suffix_u "U${suffix}")
170     endif(suffix MATCHES "LL|L")
171     message(STATUS "testing ${suffix} ${curl_test_suffix_u}") 
172     set(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}")
173     curl_check_c_source_compiles("
174     typedef ${curl_typeof_curl_off_t} new_t;
175     new_t s1;
176     new_t s2;
177     s1 = -10${suffix};
178     s2 = 20${suffix};
179     if(s1 > s2)
180       return 1;
181     " curl_suffix_curl_off_t_test)
182     if(curl_suffix_curl_off_t_test)
183       set(CURL_SUFFIX_CURL_OFF_T ${suffix} CACHE INTERNAL "signed suffix for off_t")
184       set(CURL_SUFFIX_CURL_OFF_TU ${curl_test_suffix_u} CACHE INTERNAL "unsigned suffix for off_t")
185     endif(curl_suffix_curl_off_t_test)
186   endforeach(suffix)
187   if(NOT DEFINED CURL_SUFFIX_CURL_OFF_T)
188     set(CURL_SUFFIX_CURL_OFF_T "" CACHE INTERNAL "signed suffix for off_t")
189     set(CURL_SUFFIX_CURL_OFF_TU "" CACHE INTERNAL "unsigned suffix for off_t")
190   endif()
191 endfunction(check_curl_off_t_suffix)
192 # find the suffix to add to a literal number for the off_t type
193 check_curl_off_t_suffix()
194 message(STATUS "CURL_SUFFIX_CURL_OFF_T = ${CURL_SUFFIX_CURL_OFF_T} ")
195 message(STATUS "CURL_SUFFIX_CURL_OFF_TU = ${CURL_SUFFIX_CURL_OFF_TU} ")
196 message(STATUS "CURL_TYPEOF_CURL_OFF_T = ${CURL_TYPEOF_CURL_OFF_T} ")
197 message(STATUS "CURL_FORMAT_CURL_OFF_T = ${CURL_FORMAT_CURL_OFF_T} ")
198 message(STATUS "CURL_FORMAT_OFF_T = ${CURL_FORMAT_OFF_T}")
199 curl_check_c_source_compiles("recv(0, 0, 0, 0)" curl_cv_recv)
200 if(curl_cv_recv)
201   #    AC_CACHE_CHECK([types of arguments and return type for recv],
202   #[curl_cv_func_recv_args], [
203   #SET(curl_cv_func_recv_args "unknown")
204   #for recv_retv in 'int' 'ssize_t'; do
205   if(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown")
206     foreach(recv_retv "int" "ssize_t" )
207       foreach(recv_arg1 "int" "ssize_t" "SOCKET")
208         foreach(recv_arg2 "void *" "char *")
209           foreach(recv_arg3 "size_t" "int" "socklen_t" "unsigned int")
210             foreach(recv_arg4 "int" "unsigned int")
211               if(NOT curl_cv_func_recv_done)
212                 set(curl_cv_func_recv_test "UNKNOWN")
213                 set(extern_line "extern ${recv_retv} ${signature_call_conv} recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4})\;")
214                 set(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5")
215                 curl_check_c_source_compiles("
216                     ${recv_arg1} s=0;
217                     ${recv_arg2} buf=0;
218                     ${recv_arg3} len=0;
219                     ${recv_arg4} flags=0;
220                     ${recv_retv} res = recv(s, buf, len, flags)"
221                     curl_cv_func_recv_test
222                     "${recv_retv} recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4})")
223                 if(curl_cv_func_recv_test)
224                   set(curl_cv_func_recv_args
225                     "${recv_arg1},${recv_arg2},${recv_arg3},${recv_arg4},${recv_retv}")
226                   set(RECV_TYPE_ARG1 "${recv_arg1}")
227                   set(RECV_TYPE_ARG2 "${recv_arg2}")
228                   set(RECV_TYPE_ARG3 "${recv_arg3}")
229                   set(RECV_TYPE_ARG4 "${recv_arg4}")
230                   set(RECV_TYPE_RETV "${recv_retv}")
231                   set(HAVE_RECV 1)
232                   set(curl_cv_func_recv_done 1)
233                 endif(curl_cv_func_recv_test)
234               endif(NOT curl_cv_func_recv_done)
235             endforeach(recv_arg4)
236           endforeach(recv_arg3)
237         endforeach(recv_arg2)
238       endforeach(recv_arg1)
239     endforeach(recv_retv) 
240   else(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown")
241     string(REGEX REPLACE "^([^,]*),[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG1 "${curl_cv_func_recv_args}")
242     string(REGEX REPLACE "^[^,]*,([^,]*),[^,]*,[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG2 "${curl_cv_func_recv_args}")
243     string(REGEX REPLACE "^[^,]*,[^,]*,([^,]*),[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG3 "${curl_cv_func_recv_args}")
244     string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,([^,]*),[^,]*$" "\\1" RECV_TYPE_ARG4 "${curl_cv_func_recv_args}")
245     string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,([^,]*)$" "\\1" RECV_TYPE_RETV "${curl_cv_func_recv_args}")
246     #MESSAGE("RECV_TYPE_ARG1 ${RECV_TYPE_ARG1}")
247     #MESSAGE("RECV_TYPE_ARG2 ${RECV_TYPE_ARG2}")
248     #MESSAGE("RECV_TYPE_ARG3 ${RECV_TYPE_ARG3}")
249     #MESSAGE("RECV_TYPE_ARG4 ${RECV_TYPE_ARG4}")
250     #MESSAGE("RECV_TYPE_RETV ${RECV_TYPE_RETV}")
251   endif(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown")
252   
253   if("${curl_cv_func_recv_args}" STREQUAL "unknown")
254     message(FATAL_ERROR "Cannot find proper types to use for recv args")
255   endif("${curl_cv_func_recv_args}" STREQUAL "unknown")
256 else(curl_cv_recv)
257   message(FATAL_ERROR "Unable to link function recv")
258 endif(curl_cv_recv)
259 set(curl_cv_func_recv_args "${curl_cv_func_recv_args}" CACHE INTERNAL "Arguments for recv")
260 set(HAVE_RECV 1)
262 curl_check_c_source_compiles("send(0, 0, 0, 0)" curl_cv_send)
263 if(curl_cv_send)
264   #    AC_CACHE_CHECK([types of arguments and return type for send],
265   #[curl_cv_func_send_args], [
266   #SET(curl_cv_func_send_args "unknown")
267   #for send_retv in 'int' 'ssize_t'; do
268   if(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown")
269     foreach(send_retv "int" "ssize_t" )
270       foreach(send_arg1 "int" "ssize_t" "SOCKET")
271         foreach(send_arg2 "const void *" "void *" "char *" "const char *")
272           foreach(send_arg3 "size_t" "int" "socklen_t" "unsigned int")
273             foreach(send_arg4 "int" "unsigned int")
274               if(NOT curl_cv_func_send_done)
275                 set(curl_cv_func_send_test "UNKNOWN")
276                 set(extern_line "extern ${send_retv} ${signature_call_conv} send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4})\;")
277                 set(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5")
278                 curl_check_c_source_compiles("
279                     ${send_arg1} s=0;
280                     ${send_arg2} buf=0;
281                     ${send_arg3} len=0;
282                     ${send_arg4} flags=0;
283                     ${send_retv} res = send(s, buf, len, flags)"
284                     curl_cv_func_send_test
285                     "${send_retv} send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4})")
286                 if(curl_cv_func_send_test)
287                   #MESSAGE("Found arguments: ${curl_cv_func_send_test}")
288                   string(REGEX REPLACE "(const) .*" "\\1" send_qual_arg2 "${send_arg2}")
289                   string(REGEX REPLACE "const (.*)" "\\1" send_arg2 "${send_arg2}")
290                   set(curl_cv_func_send_args
291                     "${send_arg1},${send_arg2},${send_arg3},${send_arg4},${send_retv},${send_qual_arg2}")
292                   set(SEND_TYPE_ARG1 "${send_arg1}")
293                   set(SEND_TYPE_ARG2 "${send_arg2}")
294                   set(SEND_TYPE_ARG3 "${send_arg3}")
295                   set(SEND_TYPE_ARG4 "${send_arg4}")
296                   set(SEND_TYPE_RETV "${send_retv}")
297                   set(HAVE_SEND 1)
298                   set(curl_cv_func_send_done 1)
299                 endif(curl_cv_func_send_test)
300               endif(NOT curl_cv_func_send_done)
301             endforeach(send_arg4)
302           endforeach(send_arg3)
303         endforeach(send_arg2)
304       endforeach(send_arg1)
305     endforeach(send_retv) 
306   else(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown")
307     string(REGEX REPLACE "^([^,]*),[^,]*,[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG1 "${curl_cv_func_send_args}")
308     string(REGEX REPLACE "^[^,]*,([^,]*),[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG2 "${curl_cv_func_send_args}")
309     string(REGEX REPLACE "^[^,]*,[^,]*,([^,]*),[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG3 "${curl_cv_func_send_args}")
310     string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,([^,]*),[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG4 "${curl_cv_func_send_args}")
311     string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,([^,]*),[^,]*$" "\\1" SEND_TYPE_RETV "${curl_cv_func_send_args}")
312     string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,([^,]*)$" "\\1" SEND_QUAL_ARG2 "${curl_cv_func_send_args}")
313     #MESSAGE("SEND_TYPE_ARG1 ${SEND_TYPE_ARG1}")
314     #MESSAGE("SEND_TYPE_ARG2 ${SEND_TYPE_ARG2}")
315     #MESSAGE("SEND_TYPE_ARG3 ${SEND_TYPE_ARG3}")
316     #MESSAGE("SEND_TYPE_ARG4 ${SEND_TYPE_ARG4}")
317     #MESSAGE("SEND_TYPE_RETV ${SEND_TYPE_RETV}")
318     #MESSAGE("SEND_QUAL_ARG2 ${SEND_QUAL_ARG2}")
319   endif(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown")
320   
321   if("${curl_cv_func_send_args}" STREQUAL "unknown")
322     message(FATAL_ERROR "Cannot find proper types to use for send args")
323   endif("${curl_cv_func_send_args}" STREQUAL "unknown")
324   set(SEND_QUAL_ARG2 "const")
325 else(curl_cv_send)
326   message(FATAL_ERROR "Unable to link function send")
327 endif(curl_cv_send)
328 set(curl_cv_func_send_args "${curl_cv_func_send_args}" CACHE INTERNAL "Arguments for send")
329 set(HAVE_SEND 1)
331 set(EXTRA_DEFINES "${EXTRA_DEFINES}\n${headers_hack}\n#define __unused5")
332 curl_check_c_source_compiles("int flag = MSG_NOSIGNAL" HAVE_MSG_NOSIGNAL)
334 set(EXTRA_DEFINES "__unused1\n#undef inline\n#define __unused2")
335 set(HEADER_INCLUDES)
336 set(headers_hack)
338 macro(add_header_include check header)
339   if(${check})
340     set(headers_hack
341       "${headers_hack}\n#include <${header}>")
342     #SET(HEADER_INCLUDES
343     #  ${HEADER_INCLUDES}
344     #  "${header}")
345   endif(${check})
346 endmacro(add_header_include header)
348 if(HAVE_WINDOWS_H)
349   set(EXTRA_DEFINES ${EXTRA_DEFINES}
350     "__unused7\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#endif\n#define __unused3")
351   add_header_include(HAVE_WINDOWS_H "windows.h")
352   add_header_include(HAVE_WINSOCK2_H "winsock2.h")
353   add_header_include(HAVE_WINSOCK_H "winsock.h")
354 else(HAVE_WINDOWS_H)
355   add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
356   add_header_include(HAVE_SYS_TIME_H "sys/time.h")
357   add_header_include(TIME_WITH_SYS_TIME "time.h")
358   add_header_include(HAVE_TIME_H "time.h")
359 endif(HAVE_WINDOWS_H)
360 set(EXTRA_DEFINES "${EXTRA_DEFINES}\n${headers_hack}\n#define __unused5")
361 curl_check_c_source_compiles("struct timeval ts;\nts.tv_sec  = 0;\nts.tv_usec = 0" HAVE_STRUCT_TIMEVAL)
364 include(CurlCheckCSourceRuns)
365 set(EXTRA_DEFINES)
366 set(HEADER_INCLUDES)
367 if(HAVE_SYS_POLL_H)
368   set(HEADER_INCLUDES "sys/poll.h")
369 endif(HAVE_SYS_POLL_H)
370 curl_check_c_source_runs("return poll((void *)0, 0, 10 /*ms*/)" HAVE_POLL_FINE)
372 set(HAVE_SIG_ATOMIC_T 1)
373 set(EXTRA_DEFINES)
374 set(HEADER_INCLUDES)
375 if(HAVE_SIGNAL_H)
376   set(HEADER_INCLUDES "signal.h")
377   set(CMAKE_EXTRA_INCLUDE_FILES "signal.h")
378 endif(HAVE_SIGNAL_H)
379 check_type_size("sig_atomic_t" SIZEOF_SIG_ATOMIC_T)
380 if(HAVE_SIZEOF_SIG_ATOMIC_T)
381   curl_check_c_source_compiles("static volatile sig_atomic_t dummy = 0" HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
382   if(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
383     set(HAVE_SIG_ATOMIC_T_VOLATILE 1)
384   endif(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
385 endif(HAVE_SIZEOF_SIG_ATOMIC_T)
387 set(CHECK_TYPE_SIZE_PREINCLUDE
388   "#undef inline")
390 if(HAVE_WINDOWS_H)
391   set(CHECK_TYPE_SIZE_PREINCLUDE "${CHECK_TYPE_SIZE_PREINCLUDE}
392   #ifndef WIN32_LEAN_AND_MEAN
393   #define WIN32_LEAN_AND_MEAN
394   #endif
395   #include <windows.h>")
396   if(HAVE_WINSOCK2_H)
397     set(CHECK_TYPE_SIZE_PREINCLUDE "${CHECK_TYPE_SIZE_PREINCLUDE}\n#include <winsock2.h>")
398   endif(HAVE_WINSOCK2_H)
399 else(HAVE_WINDOWS_H)
400   if(HAVE_SYS_SOCKET_H)
401     set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES}
402       "sys/socket.h")
403   endif(HAVE_SYS_SOCKET_H)
404   if(HAVE_NETINET_IN_H)
405     set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES}
406       "netinet/in.h")
407   endif(HAVE_NETINET_IN_H)
408   if(HAVE_ARPA_INET_H)
409     set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES}
410       "arpa/inet.h")
411   endif(HAVE_ARPA_INET_H)
412 endif(HAVE_WINDOWS_H)
414 check_type_size("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE)
415 if(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE)
416   set(HAVE_STRUCT_SOCKADDR_STORAGE 1)
417 endif(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE)