diff options
author | kinichiro <kinichiro.inoguchi@gmail.com> | 2016-04-04 11:28:46 +0900 |
---|---|---|
committer | kinichiro <kinichiro.inoguchi@gmail.com> | 2016-04-04 14:27:43 +0900 |
commit | 3207606f117fe4844c5eb18019a4f0939349ece7 (patch) | |
tree | 9d245cfc79e840affb460a19f0d4aff943dd28e8 | |
parent | 8131b377bffdacb8789c78ef31160b3bf4ee054b (diff) | |
download | portable-3207606f117fe4844c5eb18019a4f0939349ece7.tar.gz portable-3207606f117fe4844c5eb18019a4f0939349ece7.tar.bz2 portable-3207606f117fe4844c5eb18019a4f0939349ece7.zip |
fix cmake on HP-UX
- CMakeLists.txt
* add OS specific compiler flags and library
* add checking size of time_t
* add checking memmem()
- tests/CMakeLists.txt
* add if(HAVE_MEMMEM) for explicit_bzero
* add checking SMALL_TIME_T for rfc5280time
- crypto/CMakeLists.txt
* add getentropy_hpux.c
- tls/CMakeLists.txt
* fix checking strsep
-rw-r--r-- | CMakeLists.txt | 27 | ||||
-rw-r--r-- | crypto/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 15 | ||||
-rw-r--r-- | tls/CMakeLists.txt | 2 |
4 files changed, 40 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 710d8a9..788a052 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -2,6 +2,7 @@ cmake_minimum_required (VERSION 2.8) | |||
2 | include(CheckFunctionExists) | 2 | include(CheckFunctionExists) |
3 | include(CheckLibraryExists) | 3 | include(CheckLibraryExists) |
4 | include(CheckIncludeFiles) | 4 | include(CheckIncludeFiles) |
5 | include(CheckTypeSize) | ||
5 | 6 | ||
6 | project (LibreSSL) | 7 | project (LibreSSL) |
7 | 8 | ||
@@ -33,6 +34,16 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux") | |||
33 | add_definitions(-D_GNU_SOURCE) | 34 | add_definitions(-D_GNU_SOURCE) |
34 | endif() | 35 | endif() |
35 | 36 | ||
37 | if(CMAKE_SYSTEM_NAME MATCHES "HP-UX") | ||
38 | if(CMAKE_C_COMPILER MATCHES "gcc") | ||
39 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=gnu99 -fno-strict-aliasing") | ||
40 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mlp64") | ||
41 | else() | ||
42 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O2 +DD64 +Otype_safety=off") | ||
43 | endif() | ||
44 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=600 -D__STRICT_ALIGNMENT") | ||
45 | endif() | ||
46 | |||
36 | add_definitions(-DLIBRESSL_INTERNAL) | 47 | add_definitions(-DLIBRESSL_INTERNAL) |
37 | add_definitions(-DOPENSSL_NO_HW_PADLOCK) | 48 | add_definitions(-DOPENSSL_NO_HW_PADLOCK) |
38 | add_definitions(-DOPENSSL_NO_ASM) | 49 | add_definitions(-DOPENSSL_NO_ASM) |
@@ -156,6 +167,11 @@ if(HAVE_MEMCMP) | |||
156 | add_definitions(-DHAVE_MEMCMP) | 167 | add_definitions(-DHAVE_MEMCMP) |
157 | endif() | 168 | endif() |
158 | 169 | ||
170 | check_function_exists(memmem HAVE_MEMMEM) | ||
171 | if(HAVE_MEMMEM) | ||
172 | add_definitions(-DHAVE_MEMMEM) | ||
173 | endif() | ||
174 | |||
159 | check_include_files(err.h HAVE_ERR_H) | 175 | check_include_files(err.h HAVE_ERR_H) |
160 | if(HAVE_ERR_H) | 176 | if(HAVE_ERR_H) |
161 | add_definitions(-DHAVE_ERR_H) | 177 | add_definitions(-DHAVE_ERR_H) |
@@ -171,11 +187,22 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux") | |||
171 | set(OPENSSL_LIBS ${OPENSSL_LIBS} rt) | 187 | set(OPENSSL_LIBS ${OPENSSL_LIBS} rt) |
172 | endif() | 188 | endif() |
173 | endif() | 189 | endif() |
190 | if(CMAKE_SYSTEM_NAME MATCHES "HP-UX") | ||
191 | set(OPENSSL_LIBS ${OPENSSL_LIBS} pthread) | ||
192 | endif() | ||
174 | 193 | ||
175 | if(NOT (CMAKE_SYSTEM_NAME MATCHES "Darwin" OR MSVC)) | 194 | if(NOT (CMAKE_SYSTEM_NAME MATCHES "Darwin" OR MSVC)) |
176 | set(BUILD_SHARED true) | 195 | set(BUILD_SHARED true) |
177 | endif() | 196 | endif() |
178 | 197 | ||
198 | check_type_size(time_t SIZEOF_TIME_T) | ||
199 | if(SIZEOF_TIME_T STREQUAL "4") | ||
200 | set(SMALL_TIME_T true) | ||
201 | message(WARNING " ** Warning, this system is unable to represent times past 2038") | ||
202 | message(WARNING " ** It will behave incorrectly when handling valid RFC5280 dates") | ||
203 | endif() | ||
204 | add_definitions(-DSIZEOF_TIME_T=${SIZEOF_TIME_T}) | ||
205 | |||
179 | add_subdirectory(crypto) | 206 | add_subdirectory(crypto) |
180 | add_subdirectory(ssl) | 207 | add_subdirectory(ssl) |
181 | add_subdirectory(apps) | 208 | add_subdirectory(apps) |
diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index 0e44da7..904e69f 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt | |||
@@ -617,6 +617,8 @@ if(NOT HAVE_ARC4RANDOM_BUF) | |||
617 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_aix.c) | 617 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_aix.c) |
618 | elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") | 618 | elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") |
619 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_freebsd.c) | 619 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_freebsd.c) |
620 | elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX") | ||
621 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_hpux.c) | ||
620 | elseif(CMAKE_SYSTEM_NAME MATCHES "Linux") | 622 | elseif(CMAKE_SYSTEM_NAME MATCHES "Linux") |
621 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_linux.c) | 623 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_linux.c) |
622 | elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD") | 624 | elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD") |
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3ca41a2..f98a266 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt | |||
@@ -134,12 +134,13 @@ add_test(enginetest enginetest) | |||
134 | # explicit_bzero | 134 | # explicit_bzero |
135 | # explicit_bzero relies on SA_ONSTACK, which is unavailable on Windows | 135 | # explicit_bzero relies on SA_ONSTACK, which is unavailable on Windows |
136 | if(NOT CMAKE_HOST_WIN32) | 136 | if(NOT CMAKE_HOST_WIN32) |
137 | add_executable(explicit_bzero explicit_bzero.c) | 137 | if(HAVE_MEMMEM) |
138 | add_executable(explicit_bzero explicit_bzero.c) | ||
139 | else() | ||
140 | add_executable(explicit_bzero explicit_bzero.c memmem.c) | ||
141 | endif() | ||
138 | target_link_libraries(explicit_bzero ${OPENSSL_LIBS}) | 142 | target_link_libraries(explicit_bzero ${OPENSSL_LIBS}) |
139 | add_test(explicit_bzero explicit_bzero) | 143 | add_test(explicit_bzero explicit_bzero) |
140 | #if !HAVE_MEMMEM | ||
141 | #explicit_bzero_SOURCES += memmem.c | ||
142 | #endif | ||
143 | endif() | 144 | endif() |
144 | 145 | ||
145 | # exptest | 146 | # exptest |
@@ -230,7 +231,11 @@ add_test(rc4test rc4test) | |||
230 | # rfc5280time | 231 | # rfc5280time |
231 | add_executable(rfc5280time rfc5280time.c) | 232 | add_executable(rfc5280time rfc5280time.c) |
232 | target_link_libraries(rfc5280time ${OPENSSL_LIBS}) | 233 | target_link_libraries(rfc5280time ${OPENSSL_LIBS}) |
233 | add_test(rfc5280time rfc5280time) | 234 | if(SMALL_TIME_T) |
235 | add_test(rfc5280time ${CMAKE_CURRENT_SOURCE_DIR}/rfc5280time_small.test) | ||
236 | else() | ||
237 | add_test(rfc5280time rfc5280time) | ||
238 | endif() | ||
234 | 239 | ||
235 | # rmdtest | 240 | # rmdtest |
236 | add_executable(rmdtest rmdtest.c) | 241 | add_executable(rmdtest rmdtest.c) |
diff --git a/tls/CMakeLists.txt b/tls/CMakeLists.txt index ad6fe49..929d30c 100644 --- a/tls/CMakeLists.txt +++ b/tls/CMakeLists.txt | |||
@@ -17,7 +17,7 @@ set( | |||
17 | ) | 17 | ) |
18 | 18 | ||
19 | 19 | ||
20 | if(NOT HAVE_STRCASECMP) | 20 | if(NOT HAVE_STRSEP) |
21 | set(TLS_SRC ${TLS_SRC} strsep.c) | 21 | set(TLS_SRC ${TLS_SRC} strsep.c) |
22 | endif() | 22 | endif() |
23 | 23 | ||