| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 70e88cf commit 942e10f
301 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,8 @@ | |||
| 1 | 1 | # Copyright (C) The c-ares project and its contributors | |
| 2 | 2 | # SPDX-License-Identifier: MIT | |
| 3 | - CMAKE_MINIMUM_REQUIRED (VERSION 3.1.0) | ||
| 3 | + CMAKE_MINIMUM_REQUIRED (VERSION 3.5.0) | ||
| 4 | + | ||
| 5 | + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") | ||
| 4 | 6 | ||
| 5 | 7 | INCLUDE (CheckIncludeFiles) | |
| 6 | 8 | INCLUDE (CheckTypeSize) | |
@@ -10,10 +12,10 @@ INCLUDE (CheckCSourceCompiles) | |||
| 10 | 12 | INCLUDE (CheckStructHasMember) | |
| 11 | 13 | INCLUDE (CheckLibraryExists) | |
| 12 | 14 | ||
| 13 | - PROJECT (c-ares LANGUAGES C VERSION "1.20.1" ) | ||
| 15 | + PROJECT (c-ares LANGUAGES C VERSION "1.25.0" ) | ||
| 14 | 16 | ||
| 15 | 17 | # Set this version before release | |
| 16 | - SET (CARES_VERSION "1.20.1") | ||
| 18 | + SET (CARES_VERSION "1.25.0") | ||
| 17 | 19 | ||
| 18 | 20 | INCLUDE (GNUInstallDirs) # include this *AFTER* PROJECT(), otherwise paths are wrong. | |
| 19 | 21 | ||
@@ -28,26 +30,38 @@ INCLUDE (GNUInstallDirs) # include this *AFTER* PROJECT(), otherwise paths are w | |||
| 28 | 30 | # For example, a version of 4:0:2 would generate output such as: | |
| 29 | 31 | # libname.so -> libname.so.2 | |
| 30 | 32 | # libname.so.2 -> libname.so.2.2.0 | |
| 31 | - SET (CARES_LIB_VERSIONINFO "9:1:7") | ||
| 33 | + SET (CARES_LIB_VERSIONINFO "12:1:10") | ||
| 32 | 34 | ||
| 33 | 35 | ||
| 34 | - OPTION (CARES_STATIC "Build as a static library" OFF) | ||
| 35 | - OPTION (CARES_SHARED "Build as a shared library" ON) | ||
| 36 | - OPTION (CARES_INSTALL "Create installation targets (chain builders may want to disable this)" ON) | ||
| 37 | - OPTION (CARES_STATIC_PIC "Build the static library as PIC (position independent)" OFF) | ||
| 38 | - OPTION (CARES_BUILD_TESTS "Build and run tests" OFF) | ||
| 36 | + OPTION (CARES_STATIC "Build as a static library" OFF) | ||
| 37 | + OPTION (CARES_SHARED "Build as a shared library" ON) | ||
| 38 | + OPTION (CARES_INSTALL "Create installation targets (chain builders may want to disable this)" ON) | ||
| 39 | + OPTION (CARES_STATIC_PIC "Build the static library as PIC (position independent)" OFF) | ||
| 40 | + OPTION (CARES_BUILD_TESTS "Build and run tests" OFF) | ||
| 39 | 41 | OPTION (CARES_BUILD_CONTAINER_TESTS "Build and run container tests (implies CARES_BUILD_TESTS, Linux only)" OFF) | |
| 40 | - OPTION (CARES_BUILD_TOOLS "Build tools" ON) | ||
| 42 | + OPTION (CARES_BUILD_TOOLS "Build tools" ON) | ||
| 43 | + OPTION (CARES_SYMBOL_HIDING "Hide private symbols in shared libraries" OFF) | ||
| 44 | + OPTION (CARES_THREADS "Build with thread-safety support" ON) | ||
| 41 | 45 | SET (CARES_RANDOM_FILE "/dev/urandom" CACHE STRING "Suitable File / Device Path for entropy, such as /dev/urandom") | |
| 42 | 46 | ||
| 43 | 47 | ||
| 48 | + # Tests require a C++14 compiler | ||
| 49 | + IF (CARES_BUILD_TESTS OR CARES_BUILD_CONTAINER_TESTS) | ||
| 50 | + set(CMAKE_CXX_STANDARD 14) | ||
| 51 | + set(CMAKE_CXX_STANDARD_REQUIRED TRUE) | ||
| 52 | + set(CMAKE_CXX_EXTENSIONS FALSE) | ||
| 53 | + enable_language(CXX) | ||
| 54 | + ENDIF () | ||
| 55 | + | ||
| 44 | 56 | # Tests require static to be enabled on Windows to be able to access otherwise hidden symbols | |
| 45 | - IF (CARES_BUILD_TESTS AND (NOT CARES_STATIC) AND WIN32) | ||
| 57 | + IF ((CARES_BUILD_TESTS OR CARES_BUILD_CONTAINER_TESTS) AND (NOT CARES_STATIC) AND WIN32) | ||
| 46 | 58 | SET (CARES_STATIC ON) | |
| 47 | 59 | SET (CARES_STATIC_PIC ON) | |
| 48 | - MESSAGE (WARNING "Static building was requested be disabled, but reenabled to support tests") | ||
| 60 | + MESSAGE (WARNING "Static building was requested be disabled, but re-enabled to support tests") | ||
| 49 | 61 | ENDIF () | |
| 50 | 62 | ||
| 63 | + INCLUDE (EnableWarnings) | ||
| 64 | + | ||
| 51 | 65 | # allow linking against the static runtime library in msvc | |
| 52 | 66 | IF (MSVC) | |
| 53 | 67 | OPTION (CARES_MSVC_STATIC_RUNTIME "Link against the static runtime library" OFF) | |
@@ -70,6 +84,13 @@ IF (MSVC) | |||
| 70 | 84 | ENDIF () | |
| 71 | 85 | ENDIF () | |
| 72 | 86 | ||
| 87 | + IF (CARES_SYMBOL_HIDING) | ||
| 88 | + IF (CMAKE_VERSION VERSION_LESS 3.12) | ||
| 89 | + MESSAGE (FATAL_ERROR "Hiding symbols requires CMake 3.12") | ||
| 90 | + ENDIF () | ||
| 91 | + CMAKE_POLICY (SET CMP0063 NEW) | ||
| 92 | + ENDIF () | ||
| 93 | + | ||
| 73 | 94 | # Keep build organized. | |
| 74 | 95 | SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}") | |
| 75 | 96 | SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}") | |
@@ -181,7 +202,12 @@ CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H) | |||
| 181 | 202 | CHECK_INCLUDE_FILES (memory.h HAVE_MEMORY_H) | |
| 182 | 203 | CHECK_INCLUDE_FILES (netdb.h HAVE_NETDB_H) | |
| 183 | 204 | CHECK_INCLUDE_FILES (netinet/in.h HAVE_NETINET_IN_H) | |
| 184 | - CHECK_INCLUDE_FILES (net/if.h HAVE_NET_IF_H) | ||
| 205 | + # On old MacOS SDK versions, you must include sys/socket.h before net/if.h | ||
| 206 | + IF (HAVE_SYS_SOCKET_H) | ||
| 207 | + CHECK_INCLUDE_FILES ("sys/socket.h;net/if.h" HAVE_NET_IF_H) | ||
| 208 | + ELSE () | ||
| 209 | + CHECK_INCLUDE_FILES (net/if.h HAVE_NET_IF_H) | ||
| 210 | + ENDIF () | ||
| 185 | 211 | CHECK_INCLUDE_FILES (signal.h HAVE_SIGNAL_H) | |
| 186 | 212 | CHECK_INCLUDE_FILES (socket.h HAVE_SOCKET_H) | |
| 187 | 213 | CHECK_INCLUDE_FILES (stdbool.h HAVE_STDBOOL_H) | |
@@ -196,10 +222,11 @@ CHECK_INCLUDE_FILES (sys/select.h HAVE_SYS_SELECT_H) | |||
| 196 | 222 | CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H) | |
| 197 | 223 | CHECK_INCLUDE_FILES (sys/time.h HAVE_SYS_TIME_H) | |
| 198 | 224 | CHECK_INCLUDE_FILES (sys/uio.h HAVE_SYS_UIO_H) | |
| 225 | + CHECK_INCLUDE_FILES (sys/random.h HAVE_SYS_RANDOM_H) | ||
| 226 | + CHECK_INCLUDE_FILES (ifaddrs.h HAVE_IFADDRS_H) | ||
| 199 | 227 | CHECK_INCLUDE_FILES (time.h HAVE_TIME_H) | |
| 200 | 228 | CHECK_INCLUDE_FILES (dlfcn.h HAVE_DLFCN_H) | |
| 201 | 229 | CHECK_INCLUDE_FILES (unistd.h HAVE_UNISTD_H) | |
| 202 | - | ||
| 203 | 230 | # On OpenBSD, you must include sys/types.h before netinet/tcp.h | |
| 204 | 231 | IF (HAVE_SYS_TYPES_H) | |
| 205 | 232 | CHECK_INCLUDE_FILES ("sys/types.h;netinet/tcp.h" HAVE_NETINET_TCP_H) | |
@@ -213,6 +240,8 @@ ENDIF () | |||
| 213 | 240 | IF (WIN32) | |
| 214 | 241 | CHECK_INCLUDE_FILES ("winsock2.h;windows.h" HAVE_WINSOCK2_H) | |
| 215 | 242 | CHECK_INCLUDE_FILES ("winsock2.h;ws2tcpip.h;windows.h" HAVE_WS2TCPIP_H) | |
| 243 | + CHECK_INCLUDE_FILES ("winsock2.h;iphlpapi.h;windows.h" HAVE_IPHLPAPI_H) | ||
| 244 | + CHECK_INCLUDE_FILES ("winsock2.h;netioapi.h;windows.h" HAVE_NETIOAPI_H) | ||
| 216 | 245 | CHECK_INCLUDE_FILES ("winsock.h;windows.h" HAVE_WINSOCK_H) | |
| 217 | 246 | CHECK_INCLUDE_FILES (windows.h HAVE_WINDOWS_H) | |
| 218 | 247 | ENDIF () | |
@@ -221,15 +250,15 @@ ENDIF () | |||
| 221 | 250 | IF (CMAKE_SYSTEM_NAME STREQUAL "Darwin") | |
| 222 | 251 | LIST (APPEND SYSFLAGS -D_DARWIN_C_SOURCE) | |
| 223 | 252 | ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "Linux") | |
| 224 | - LIST (APPEND SYSFLAGS -D_GNU_SOURCE -D_POSIX_C_SOURCE=199309L -D_XOPEN_SOURCE=600) | ||
| 253 | + LIST (APPEND SYSFLAGS -D_GNU_SOURCE -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700) | ||
| 225 | 254 | ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "SunOS") | |
| 226 | - LIST (APPEND SYSFLAGS -D__EXTENSIONS__ -D_REENTRANT -D_XOPEN_SOURCE=600) | ||
| 255 | + LIST (APPEND SYSFLAGS -D__EXTENSIONS__ -D_REENTRANT -D_XOPEN_SOURCE=700) | ||
| 227 | 256 | ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "AIX") | |
| 228 | - LIST (APPEND SYSFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=600 -D_USE_IRS) | ||
| 257 | + LIST (APPEND SYSFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=700 -D_USE_IRS) | ||
| 229 | 258 | ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") | |
| 230 | 259 | # Don't define _XOPEN_SOURCE on FreeBSD, it actually reduces visibility instead of increasing it | |
| 231 | 260 | ELSEIF (WIN32) | |
| 232 | - LIST (APPEND SYSFLAGS -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_WIN32_WINNT=0x0600) | ||
| 261 | + LIST (APPEND SYSFLAGS -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_WIN32_WINNT=0x0602) | ||
| 233 | 262 | ENDIF () | |
| 234 | 263 | ADD_DEFINITIONS(${SYSFLAGS}) | |
| 235 | 264 | ||
@@ -277,6 +306,7 @@ CARES_EXTRAINCLUDE_IFSET (HAVE_ARPA_INET_H arpa/inet.h) | |||
| 277 | 306 | CARES_EXTRAINCLUDE_IFSET (HAVE_ARPA_NAMESER_H arpa/nameser.h) | |
| 278 | 307 | CARES_EXTRAINCLUDE_IFSET (HAVE_NETDB_H netdb.h) | |
| 279 | 308 | CARES_EXTRAINCLUDE_IFSET (HAVE_NET_IF_H net/if.h) | |
| 309 | + CARES_EXTRAINCLUDE_IFSET (HAVE_IFADDRS_H ifaddrs.h) | ||
| 280 | 310 | CARES_EXTRAINCLUDE_IFSET (HAVE_NETINET_IN_H netinet/in.h) | |
| 281 | 311 | CARES_EXTRAINCLUDE_IFSET (HAVE_NETINET_TCP_H netinet/tcp.h) | |
| 282 | 312 | CARES_EXTRAINCLUDE_IFSET (HAVE_SIGNAL_H signal.h) | |
@@ -289,12 +319,15 @@ CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_SELECT_H sys/select.h) | |||
| 289 | 319 | CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_SOCKET_H sys/socket.h) | |
| 290 | 320 | CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_SOCKIO_H sys/sockio.h) | |
| 291 | 321 | CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_TIME_H sys/time.h) | |
| 322 | + CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_STAT_H sys/stat.h) | ||
| 292 | 323 | CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_UIO_H sys/uio.h) | |
| 324 | + CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_RANDOM_H sys/random.h) | ||
| 293 | 325 | CARES_EXTRAINCLUDE_IFSET (HAVE_TIME_H time.h) | |
| 294 | 326 | CARES_EXTRAINCLUDE_IFSET (HAVE_FCNTL_H fcntl.h) | |
| 295 | 327 | CARES_EXTRAINCLUDE_IFSET (HAVE_UNISTD_H unistd.h) | |
| 296 | 328 | CARES_EXTRAINCLUDE_IFSET (HAVE_WINSOCK2_H winsock2.h) | |
| 297 | 329 | CARES_EXTRAINCLUDE_IFSET (HAVE_WS2TCPIP_H ws2tcpip.h) | |
| 330 | + CARES_EXTRAINCLUDE_IFSET (HAVE_IPHLPAPI_H iphlpapi.h) | ||
| 298 | 331 | CARES_EXTRAINCLUDE_IFSET (HAVE_WINDOWS_H windows.h) | |
| 299 | 332 | ||
| 300 | 333 | # Check Types | |
@@ -323,10 +356,8 @@ ENDMACRO () | |||
| 323 | 356 | ||
| 324 | 357 | CARES_TYPE_EXISTS (socklen_t HAVE_SOCKLEN_T) | |
| 325 | 358 | CARES_TYPE_EXISTS (SOCKET HAVE_TYPE_SOCKET) | |
| 326 | - CARES_TYPE_EXISTS (bool HAVE_BOOL_T) | ||
| 327 | 359 | CARES_TYPE_EXISTS (ssize_t HAVE_SSIZE_T) | |
| 328 | 360 | CARES_TYPE_EXISTS ("long long" HAVE_LONGLONG) | |
| 329 | - CARES_TYPE_EXISTS (sig_atomic_t HAVE_SIG_ATOMIC_T) | ||
| 330 | 361 | CARES_TYPE_EXISTS ("struct addrinfo" HAVE_STRUCT_ADDRINFO) | |
| 331 | 362 | CARES_TYPE_EXISTS ("struct in6_addr" HAVE_STRUCT_IN6_ADDR) | |
| 332 | 363 | CARES_TYPE_EXISTS ("struct sockaddr_in6" HAVE_STRUCT_SOCKADDR_IN6) | |
@@ -351,29 +382,26 @@ IF ((NOT APPLE) OR IOS_V10 OR MACOS_V1012) | |||
| 351 | 382 | CHECK_SYMBOL_EXISTS (CLOCK_MONOTONIC "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CLOCK_GETTIME_MONOTONIC) | |
| 352 | 383 | ENDIF () | |
| 353 | 384 | ||
| 354 | - CHECK_STRUCT_HAS_MEMBER("struct sockaddr_in6" sin6_scope_id "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID LANGUAGE C) | ||
| 355 | - | ||
| 356 | - # Check for "LL" numeric suffix support | ||
| 357 | - CHECK_C_SOURCE_COMPILES ("int main() { int n=1234LL; return 0; }" HAVE_LL) | ||
| 385 | + CHECK_STRUCT_HAS_MEMBER("struct sockaddr_in6" sin6_scope_id "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID LANGUAGE C) | ||
| 358 | 386 | ||
| 359 | 387 | ||
| 360 | - CHECK_SYMBOL_EXISTS (bitncmp "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_BITNCMP) | ||
| 361 | 388 | CHECK_SYMBOL_EXISTS (closesocket "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CLOSESOCKET) | |
| 362 | 389 | CHECK_SYMBOL_EXISTS (CloseSocket "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CLOSESOCKET_CAMEL) | |
| 363 | 390 | CHECK_SYMBOL_EXISTS (connect "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CONNECT) | |
| 364 | 391 | CHECK_SYMBOL_EXISTS (fcntl "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_FCNTL) | |
| 365 | 392 | CHECK_SYMBOL_EXISTS (freeaddrinfo "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_FREEADDRINFO) | |
| 366 | 393 | CHECK_SYMBOL_EXISTS (getaddrinfo "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETADDRINFO) | |
| 367 | 394 | CHECK_SYMBOL_EXISTS (getenv "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETENV) | |
| 368 | - CHECK_SYMBOL_EXISTS (gethostbyaddr "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETHOSTBYADDR) | ||
| 369 | - CHECK_SYMBOL_EXISTS (gethostbyname "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETHOSTBYNAME) | ||
| 370 | 395 | CHECK_SYMBOL_EXISTS (gethostname "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETHOSTNAME) | |
| 371 | 396 | CHECK_SYMBOL_EXISTS (getnameinfo "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETNAMEINFO) | |
| 372 | 397 | CHECK_SYMBOL_EXISTS (getrandom "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETRANDOM) | |
| 373 | 398 | CHECK_SYMBOL_EXISTS (getservbyport_r "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETSERVBYPORT_R) | |
| 374 | 399 | CHECK_SYMBOL_EXISTS (getservbyname_r "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETSERVBYNAME_R) | |
| 375 | 400 | CHECK_SYMBOL_EXISTS (gettimeofday "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETTIMEOFDAY) | |
| 376 | 401 | CHECK_SYMBOL_EXISTS (if_indextoname "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_IF_INDEXTONAME) | |
| 402 | + CHECK_SYMBOL_EXISTS (if_nametoindex "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_IF_NAMETOINDEX) | ||
| 403 | + CHECK_SYMBOL_EXISTS (ConvertInterfaceIndexToLuid "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CONVERTINTERFACEINDEXTOLUID) | ||
| 404 | + CHECK_SYMBOL_EXISTS (ConvertInterfaceLuidToNameA "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CONVERTINTERFACELUIDTONAMEA) | ||
| 377 | 405 | CHECK_SYMBOL_EXISTS (inet_net_pton "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_INET_NET_PTON) | |
| 378 | 406 | IF (NOT WIN32) | |
| 379 | 407 | # Disabled on Windows, because these functions are only really supported on Windows | |
@@ -399,7 +427,8 @@ CHECK_SYMBOL_EXISTS (strncmpi "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRNCMP | |||
| 399 | 427 | CHECK_SYMBOL_EXISTS (strnicmp "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRNICMP) | |
| 400 | 428 | CHECK_SYMBOL_EXISTS (writev "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_WRITEV) | |
| 401 | 429 | CHECK_SYMBOL_EXISTS (arc4random_buf "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_ARC4RANDOM_BUF) | |
| 402 | - | ||
| 430 | + CHECK_SYMBOL_EXISTS (stat "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STAT) | ||
| 431 | + CHECK_SYMBOL_EXISTS (getifaddrs "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETIFADDRS) | ||
| 403 | 432 | ||
| 404 | 433 | # On Android, the system headers may define __system_property_get(), but excluded | |
| 405 | 434 | # from libc. We need to perform a link test instead of a header/symbol test. | |
@@ -411,6 +440,43 @@ SET (CMAKE_REQUIRED_DEFINITIONS) | |||
| 411 | 440 | SET (CMAKE_REQUIRED_LIBRARIES) | |
| 412 | 441 | ||
| 413 | 442 | ||
| 443 | + ################################################################################ | ||
| 444 | + # Threading Support | ||
| 445 | + # | ||
| 446 | + IF (CARES_THREADS) | ||
| 447 | + IF (WIN32) | ||
| 448 | + # Do nothing, always has threads | ||
| 449 | + ELSE () | ||
| 450 | + # Need to prefer pthreads on platforms that may have more threading choices | ||
| 451 | + # (e.g. Solaris) | ||
| 452 | + SET (CMAKE_THREAD_PREFER_PTHREAD TRUE) | ||
| 453 | + FIND_PACKAGE (Threads) | ||
| 454 | + | ||
| 455 | + IF (Threads_FOUND) | ||
| 456 | + # Fix solaris9 bug due to libc having pthread_create() stubs that always fail. CMake | ||
| 457 | + # doesn't realize that the real pthread functions aren't in libc, so sets the pthread | ||
| 458 | + # library CAKE_THREAD_LIBS_INIT variable to blank instead of to the correct "-lpthread". | ||
| 459 | + IF (CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND NOT CMAKE_THREAD_LIBS_INIT) | ||
| 460 | + SET (CMAKE_THREAD_LIBS_INIT "-lpthread") | ||
| 461 | + ENDIF () | ||
| 462 | + | ||
| 463 | + # PThread functions. | ||
| 464 | + CHECK_INCLUDE_FILES (pthread.h HAVE_PTHREAD_H) | ||
| 465 | + CHECK_INCLUDE_FILES (pthread_np.h HAVE_PTHREAD_NP_H) | ||
| 466 | + CARES_EXTRAINCLUDE_IFSET (HAVE_PTHREAD_H pthread.h) | ||
| 467 | + CARES_EXTRAINCLUDE_IFSET (HAVE_PTHREAD_NP_H pthread_np.h) | ||
| 468 | + CHECK_SYMBOL_EXISTS (pthread_init "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_PTHREAD_INIT) | ||
| 469 | + # Make sure libcares.pc.cmake knows about thread libraries on static builds | ||
| 470 | + LIST (APPEND CARES_DEPENDENT_LIBS ${CMAKE_THREAD_LIBS_INIT}) | ||
| 471 | + ELSE () | ||
| 472 | + MESSAGE (WARNING "Threading support not found, disabling...") | ||
| 473 | + SET (CARES_THREADS OFF) | ||
| 474 | + ENDIF () | ||
| 475 | + ENDIF () | ||
| 476 | + ENDIF () | ||
| 477 | + | ||
| 478 | + | ||
| 479 | + | ||
| 414 | 480 | ################################################################################ | |
| 415 | 481 | # recv, recvfrom, send, getnameinfo, gethostname | |
| 416 | 482 | # ARGUMENTS AND RETURN VALUES | |
@@ -421,7 +487,7 @@ SET (CMAKE_REQUIRED_LIBRARIES) | |||
| 421 | 487 | # defaults. This should be much quicker and nearly as accurate ... and even | |
| 422 | 488 | # if not, it probably won't matter in the least. | |
| 423 | 489 | ||
| 424 | - IF (HAVE_SSIZE_T AND HAVE_SOCKLEN_T) | ||
| 490 | + IF (HAVE_SSIZE_T AND HAVE_SOCKLEN_T AND NOT WIN32) | ||
| 425 | 491 | # If we have ssize_t and socklen_t, the API is usually sane and uses ssize_t and size_t for lengths | |
| 426 | 492 | SET (RECVFROM_TYPE_RETV ssize_t) | |
| 427 | 493 | SET (RECVFROM_TYPE_ARG3 size_t) | |
@@ -656,7 +722,6 @@ IF (CARES_INSTALL) | |||
| 656 | 722 | ||
| 657 | 723 | # pkgconfig support | |
| 658 | 724 | IF (NOT CARES_SHARED) | |
| 659 | - SET (CPPFLAG_CARES_STATICLIB "-DCARES_STATICLIB") | ||
| 660 | 725 | FOREACH (LIB ${CARES_DEPENDENT_LIBS}) | |
| 661 | 726 | SET (CARES_PRIVATE_LIBS "${CARES_PRIVATE_LIBS} -l${LIB}") | |
| 662 | 727 | ENDFOREACH () | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,7 +32,7 @@ the same for both Git and official release tarballs. | |||
| 32 | 32 | AutoTools Build | |
| 33 | 33 | =============== | |
| 34 | 34 | ||
| 35 | - ### General Information, works on most Unix Platforms (Linux, FreeBSD, etc) | ||
| 35 | + ### General Information, works on most Unix Platforms (Linux, FreeBSD, etc.) | ||
| 36 | 36 | ||
| 37 | 37 | A normal Unix installation is made in three or four steps (after you've | |
| 38 | 38 | unpacked the source archive): | |
@@ -57,7 +57,7 @@ you need to specify that already when running configure: | |||
| 57 | 57 | ||
| 58 | 58 | If you happen to have write permission in that directory, you can do `make | |
| 59 | 59 | install` without being root. An example of this would be to make a local | |
| 60 | - install in your own home directory: | ||
| 60 | + installation in your own home directory: | ||
| 61 | 61 | ||
| 62 | 62 | ./configure --prefix=$HOME | |
| 63 | 63 | make | |
@@ -183,7 +183,7 @@ Method using a configure cross-compile (tested with Android NDK r7b): | |||
| 183 | 183 | ||
| 184 | 184 | ./tools/make-standalone-toolchain.sh | |
| 185 | 185 | ||
| 186 | - which creates a usual cross-compile toolchain. Lets assume that you put | ||
| 186 | + which creates a usual cross-compile toolchain. Let's assume that you put | ||
| 187 | 187 | this toolchain below `/opt` then invoke configure with something | |
| 188 | 188 | like: | |
| 189 | 189 | ||
@@ -213,7 +213,7 @@ CMake builds | |||
| 213 | 213 | ============ | |
| 214 | 214 | ||
| 215 | 215 | Current releases of c-ares introduce a CMake v3+ build system that has been | |
| 216 | - tested on most platforms including Windows, Linux, FreeBSD, MacOS, AIX and | ||
| 216 | + tested on most platforms including Windows, Linux, FreeBSD, macOS, AIX and | ||
| 217 | 217 | Solaris. | |
| 218 | 218 | ||
| 219 | 219 | In the most basic form, building with CMake might look like: | |
@@ -233,18 +233,23 @@ Options | |||
| 233 | 233 | Options to CMake are passed on the command line using "-D${OPTION}=${VALUE}". | |
| 234 | 234 | The values defined are all boolean and take values like On, Off, True, False. | |
| 235 | 235 | ||
| 236 | - * CARES_STATIC - Build the static library (off by default) | ||
| 237 | - * CARES_SHARED - Build the shared library (on by default) | ||
| 238 | - * CARES_INSTALL - Hook in installation, useful to disable if chain building | ||
| 239 | - * CARES_STATIC_PIC - Build the static library as position-independent (off by | ||
| 240 | - default) | ||
| 241 | - | ||
| 236 | + | Option Name | Description | Default Value | | ||
| 237 | + |-----------------------------|-----------------------------------------------------------------------|----------------| | ||
| 238 | + | CARES_STATIC | Build the static library | Off | | ||
| 239 | + | CARES_SHARED | Build the shared library | On | | ||
| 240 | + | CARES_INSTALL | Hook in installation, useful to disable if chain building | On | | ||
| 241 | + | CARES_STATIC_PIC | Build the static library as position-independent | Off | | ||
| 242 | + | CARES_BUILD_TESTS | Build and run tests | Off | | ||
| 243 | + | CARES_BUILD_CONTAINER_TESTS | Build and run container tests (implies CARES_BUILD_TESTS, Linux only) | Off | | ||
| 244 | + | CARES_BUILD_TOOLS | Build tools | On | | ||
| 245 | + | CARES_SYMBOL_HIDING | Hide private symbols in shared libraries | Off | | ||
| 246 | + | CARES_THREADS | Build with thread-safety support | On | | ||
| 242 | 247 | ||
| 243 | 248 | Ninja | |
| 244 | 249 | ----- | |
| 245 | 250 | ||
| 246 | 251 | Ninja is the next-generation build system meant for generators like CMake that | |
| 247 | - heavily parallize builds. Its use is very similar to the normal build: | ||
| 252 | + heavily parallelize builds. Its use is very similar to the normal build: | ||
| 248 | 253 | ||
| 249 | 254 | ```sh | |
| 250 | 255 | cd /path/to/cmake/source | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -41,9 +41,9 @@ MD = mkdir | |||
| 41 | 41 | RD = rmdir /q /s 2>NUL | |
| 42 | 42 | CP = copy | |
| 43 | 43 | ||
| 44 | - CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm -aa & | ||
| 45 | - -wcd=201 -bt=nt -d+ -dWIN32 -dCARES_BUILDING_LIBRARY & | ||
| 46 | - -dNTDDI_VERSION=0x06000000 -I. -I.\include -I.\src\lib $(SYS_INCL) | ||
| 44 | + CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm -aa & | ||
| 45 | + -wcd=201 -bt=nt -d+ -dWIN32 -dCARES_BUILDING_LIBRARY & | ||
| 46 | + -dNTDDI_VERSION=0x06020000 -I. -I.\include -I.\src\lib $(SYS_INCL) | ||
| 47 | 47 | ||
| 48 | 48 | LFLAGS = option quiet, map, caseexact, eliminate | |
| 49 | 49 | ||
@@ -55,7 +55,7 @@ LFLAGS += debug all | |||
| 55 | 55 | CFLAGS += -d0 | |
| 56 | 56 | !endif | |
| 57 | 57 | ||
| 58 | - CFLAGS += -d_WIN32_WINNT=0x0600 | ||
| 58 | + CFLAGS += -d_WIN32_WINNT=0x0602 | ||
| 59 | 59 | ||
| 60 | 60 | # | |
| 61 | 61 | # Change to suite. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,8 +30,8 @@ EXTRA_DIST = AUTHORS CHANGES README.cares $(man_MANS) RELEASE-NOTES \ | |||
| 30 | 30 | c-ares-config.cmake.in libcares.pc.cmake libcares.pc.in buildconf get_ver.awk \ | |
| 31 | 31 | maketgz TODO README.msvc $(MSVCFILES) INSTALL.md README.md LICENSE.md \ | |
| 32 | 32 | CMakeLists.txt Makefile.dj Makefile.m32 Makefile.netware Makefile.msvc \ | |
| 33 | - Makefile.Watcom AUTHORS CONTRIBUTING.md SECURITY.md TODO | ||
| 34 | - | ||
| 33 | + Makefile.Watcom AUTHORS CONTRIBUTING.md SECURITY.md TODO \ | ||
| 34 | + cmake/EnableWarnings.cmake | ||
| 35 | 35 | ||
| 36 | 36 | CLEANFILES = $(PDFPAGES) $(HTMLPAGES) | |
| 37 | 37 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments