~ubuntu-branches/ubuntu/precise/libssh/precise

« back to all changes in this revision

Viewing changes to ConfigureChecks.cmake

  • Committer: Bazaar Package Importer
  • Author(s): Laurent Bigonville
  • Date: 2011-06-15 15:48:07 UTC
  • mfrom: (1.1.10 upstream) (4.1.12 sid)
  • Revision ID: james.westby@ubuntu.com-20110615154807-3muklcqfftr1vtch
Tags: 0.5.0-2
* debian/patches/0002-Check-for-NULL-pointers-in-string-c.patch:
  Consolidate patch (Should fix previous REJECT)
* Support multiarch spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
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})
19
18
 
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
 
21
24
    execute_process(
22
25
        COMMAND
23
 
            ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} -dumpversion
 
26
            ${CMAKE_C_COMPILER} ${_C_COMPILER_ARG} -dumpversion
24
27
        OUTPUT_VARIABLE _COMPILER_VERSION
25
28
    )
26
29
 
40
43
# HEADER FILES
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)
 
47
 
44
48
if (WIN32)
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)
69
70
 
 
71
if (CMAKE_HAVE_PTHREAD_H)
 
72
  set(HAVE_PTHREAD_H 1)
 
73
endif (CMAKE_HAVE_PTHREAD_H)
 
74
 
70
75
# FUNCTIONS
71
76
 
72
77
check_function_exists(strncpy HAVE_STRNCPY)
81
86
endif (WIN32)
82
87
 
83
88
if (UNIX)
84
 
  # libsocket (Solaris)
85
 
  check_library_exists(socket getaddrinfo "" HAVE_LIBSOCKET)
86
 
  if (HAVE_LIBSOCKET)
87
 
    set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} socket)
88
 
  endif (HAVE_LIBSOCKET)
89
 
  # libnsl (Solaris)
90
 
  check_library_exists(nsl gethostbyname "" HAVE_LIBNSL)
91
 
  if (HAVE_LIBNSL)
92
 
    set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} nsl)
93
 
  endif (HAVE_LIBNSL)
94
 
  # libresolv
95
 
  check_library_exists(resolv hstrerror "" HAVE_LIBRESOLV)
96
 
  if (HAVE_LIBRESOLV)
97
 
    set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} resolv)
98
 
  endif (HAVE_LIBRESOLV)
99
 
  check_library_exists(rt nanosleep "" HAVE_LIBRT)
100
 
  # librt
101
 
  if (HAVE_LIBRT)
102
 
    set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} rt)
103
 
  endif (HAVE_LIBRT)
104
 
 
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)
 
89
    if (NOT LINUX)
 
90
        # libsocket (Solaris)
 
91
        check_library_exists(socket getaddrinfo "" HAVE_LIBSOCKET)
 
92
        if (HAVE_LIBSOCKET)
 
93
          set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} socket)
 
94
        endif (HAVE_LIBSOCKET)
 
95
 
 
96
        # libresolv
 
97
        check_library_exists(resolv hstrerror "" HAVE_LIBRESOLV)
 
98
        if (HAVE_LIBRESOLV)
 
99
          set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} resolv)
 
100
        endif (HAVE_LIBRESOLV)
 
101
 
 
102
        # libnsl/inet_pton (Solaris)
 
103
        check_library_exists(nsl inet_pton "" HAVE_LIBNSL)
 
104
        if (HAVE_LIBNSL)
 
105
            set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} nsl)
 
106
        endif (HAVE_LIBNSL)
 
107
 
 
108
        # librt
 
109
        check_library_exists(rt nanosleep "" HAVE_LIBRT)
 
110
    endif (NOT LINUX)
 
111
 
 
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)
 
116
 
 
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)
111
122
endif (UNIX)
112
123
 
113
124
set(LIBSSH_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CACHE INTERNAL "libssh required system libraries")
121
132
  set(HAVE_LIBGCRYPT 1)
122
133
endif (GCRYPT_FOUND)
123
134
 
124
 
if (Z_LIBRARY)
 
135
if (ZLIB_LIBRARY)
125
136
  set(HAVE_LIBZ 1)
126
 
endif (Z_LIBRARY)
 
137
endif (ZLIB_LIBRARY)
 
138
 
 
139
if (CMAKE_HAVE_THREADS_LIBRARY)
 
140
    if (CMAKE_USE_PTHREADS_INIT)
 
141
        set(HAVE_PTHREAD 1)
 
142
    endif (CMAKE_USE_PTHREADS_INIT)
 
143
endif (CMAKE_HAVE_THREADS_LIBRARY)
127
144
 
128
145
# OPTIONS
129
146
if (WITH_DEBUG_CRYPTO)