1
1
include(CheckIncludeFile)
2
include(CheckIncludeFiles)
3
2
include(CheckSymbolExists)
4
3
include(CheckFunctionExists)
5
4
include(CheckLibraryExists)
18
17
set(SOURCEDIR ${CMAKE_SOURCE_DIR})
20
19
function(COMPILER_DUMPVERSION _OUTPUT_VERSION)
20
# Remove whitespaces from the argument.
21
# This is needed for CC="ccache gcc" cmake ..
22
string(REPLACE " " "" _C_COMPILER_ARG "${CMAKE_C_COMPILER_ARG1}")
23
${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} -dumpversion
26
${CMAKE_C_COMPILER} ${_C_COMPILER_ARG} -dumpversion
24
27
OUTPUT_VARIABLE _COMPILER_VERSION
41
44
check_include_file(argp.h HAVE_ARGP_H)
42
45
check_include_file(pty.h HAVE_PTY_H)
43
check_include_file(terminos.h HAVE_TERMIOS_H)
46
check_include_file(termios.h HAVE_TERMIOS_H)
45
check_include_files("winsock2.h;ws2tcpip.h;wspiapi.h" HAVE_WSPIAPI_H)
49
check_include_file(wspiapi.h HAVE_WSPIAPI_H)
46
50
if (NOT HAVE_WSPIAPI_H)
47
message(STATUS "WARNING: Without wspiapi.h (or dependencies), this build will only work on Windows XP and newer versions")
51
message(STATUS "WARNING: Without wspiapi.h, this build will only work on Windows XP and newer versions")
48
52
endif (NOT HAVE_WSPIAPI_H)
49
check_include_files("winsock2.h;ws2tcpip.h" HAVE_WS2TCPIP_H)
50
if (NOT HAVE_WS2TCPIP_H)
51
message(ERROR "WARNING: Does not have ws2tcpip.h or winsock2.h")
52
endif (NOT HAVE_WS2TCPIP_H)
53
check_include_file(ws2tcpip.h HAVE_WS2TCPIP_H)
53
54
if (HAVE_WSPIAPI_H OR HAVE_WS2TCPIP_H)
54
55
set(HAVE_GETADDRINFO TRUE)
55
56
set(HAVE_GETHOSTBYNAME TRUE)
67
68
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIRS})
68
69
check_include_file(openssl/des.h HAVE_OPENSSL_DES_H)
71
if (CMAKE_HAVE_PTHREAD_H)
73
endif (CMAKE_HAVE_PTHREAD_H)
72
77
check_function_exists(strncpy HAVE_STRNCPY)
85
check_library_exists(socket getaddrinfo "" HAVE_LIBSOCKET)
87
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} socket)
88
endif (HAVE_LIBSOCKET)
90
check_library_exists(nsl gethostbyname "" HAVE_LIBNSL)
92
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} nsl)
95
check_library_exists(resolv hstrerror "" HAVE_LIBRESOLV)
97
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} resolv)
98
endif (HAVE_LIBRESOLV)
99
check_library_exists(rt nanosleep "" HAVE_LIBRT)
102
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} rt)
105
check_function_exists(getaddrinfo HAVE_GETADDRINFO)
106
check_function_exists(gethostbyname HAVE_GETHOSTBYNAME)
107
check_function_exists(poll HAVE_POLL)
108
check_function_exists(select HAVE_SELECT)
109
check_function_exists(cfmakeraw HAVE_CFMAKERAW)
110
check_function_exists(regcomp HAVE_REGCOMP)
91
check_library_exists(socket getaddrinfo "" HAVE_LIBSOCKET)
93
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} socket)
94
endif (HAVE_LIBSOCKET)
97
check_library_exists(resolv hstrerror "" HAVE_LIBRESOLV)
99
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} resolv)
100
endif (HAVE_LIBRESOLV)
102
# libnsl/inet_pton (Solaris)
103
check_library_exists(nsl inet_pton "" HAVE_LIBNSL)
105
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} nsl)
109
check_library_exists(rt nanosleep "" HAVE_LIBRT)
112
check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME)
113
if (HAVE_LIBRT OR HAVE_CLOCK_GETTIME)
114
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} rt)
115
endif (HAVE_LIBRT OR HAVE_CLOCK_GETTIME)
117
check_function_exists(getaddrinfo HAVE_GETADDRINFO)
118
check_function_exists(poll HAVE_POLL)
119
check_function_exists(select HAVE_SELECT)
120
check_function_exists(cfmakeraw HAVE_CFMAKERAW)
121
check_function_exists(regcomp HAVE_REGCOMP)
113
124
set(LIBSSH_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CACHE INTERNAL "libssh required system libraries")