diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..0763545d4 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,571 @@ +CMAKE_MINIMUM_REQUIRED (VERSION 2.8) +INCLUDE (CheckIncludeFiles) +INCLUDE (CheckTypeSize) +INCLUDE (CheckFunctionExists) +INCLUDE (CheckSymbolExists) +INCLUDE (CheckCSourceCompiles) +INCLUDE (CheckStructHasMember) +INCLUDE (CheckLibraryExists) + +PROJECT (cares C) + + +OPTION (CARES_STATIC "Build as a static library" OFF) +OPTION (CARES_SHARED "Build as a shared library" ON) +OPTION (CARES_INSTALL "Create installation targets (chain builders may want to disable this)" ON) +OPTION (CARES_STATIC_PIC "Build the static library as PIC (position independent)" OFF) + + +# Keep build organized. +SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) +SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) +SET (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) +SET (PACKAGE_DIRECTORY ${PROJECT_BINARY_DIR}/package) + + +# Install path helpers +IF ("${CARES_INSTALL_LOCATION_LIBS}" STREQUAL "") + SET (CARES_INSTALL_LOCATION_LIBS ${CMAKE_INSTALL_PREFIX}/lib CACHE INTERNAL "") +ENDIF () +IF ("${CARES_INSTALL_LOCATION_HEADERS}" STREQUAL "") + SET (CARES_INSTALL_LOCATION_HEADERS ${CMAKE_INSTALL_PREFIX}/include CACHE INTERNAL "") +ENDIF () +IF ("${CARES_INSTALL_LOCATION_BIN}" STREQUAL "") + SET (CARES_INSTALL_LOCATION_BIN ${CMAKE_INSTALL_PREFIX}/bin CACHE INTERNAL "") +ENDIF () + + +# When chain building C-Ares, we should set some of the same variables that a +# standard Find_Package(CAres) would set. It just references the internal +# build paths rather than an already-installed version. +SET (CARES_FOUND 1 CACHE INTERNAL "CARES LIBRARY FOUND") +SET (CARES_INCLUDE_DIRS "${PROJECT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "CARES INCLUDE DIRECTORIES") +SET (CARES_LIBRARIES ${PROJECT_NAME} CACHE INTERNAL "CARES LIBRARIES") +IF (${CARES_STATIC} AND NOT ${CARES_SHARED}) + SET (CARES_DEFINITIONS "-DCARES_STATICLIB" CACHE INTERNAL "CARES DEFINITIONS") +ENDIF () + + +# Look for dependent/required libraries +CHECK_LIBRARY_EXISTS (resolv res_servicename "" HAVE_RES_SERVICENAME_IN_LIBRESOLV) +IF (HAVE_RES_SERVICENAME_IN_LIBRESOLV) + SET (HAVE_LIBRESOLV 1) +ENDIF () + +IF (APPLE) + CHECK_C_SOURCE_COMPILES (" + #include + #include + int main() { +#if TARGET_OS_IPHONE == 0 +#error Not an iPhone target +#endif +return 0; + } + " + IOS) +ENDIF () + +IF (IOS AND HAVE_LIBRESOLV) + SET (CARES_USE_LIBRESOLV 1) +ENDIF() + +CHECK_LIBRARY_EXISTS (nsl gethostbyname "" HAVE_LIBNSL) +CHECK_LIBRARY_EXISTS (socket gethostbyname "" HAVE_LIBSOCKET) +IF (NOT ${HAVE_LIBSOCKET}) + CHECK_LIBRARY_EXISTS (socket socket "" HAVE_LIBSOCKET) +ENDIF () +CHECK_LIBRARY_EXISTS (rt clock_gettime "" HAVE_LIBRT) + + +# Look for necessary includes +CHECK_INCLUDE_FILES (sys/types.h HAVE_SYS_TYPES_H) +CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H) +CHECK_INCLUDE_FILES (arpa/inet.h HAVE_ARPA_INET_H) +CHECK_INCLUDE_FILES (arpa/nameser_compat.h HAVE_ARPA_NAMESER_COMPAT_H) +CHECK_INCLUDE_FILES (arpa/nameser.h HAVE_ARPA_NAMESER_H) +CHECK_INCLUDE_FILES (assert.h HAVE_ASSERT_H) +CHECK_INCLUDE_FILES (errno.h HAVE_ERRNO_H) +CHECK_INCLUDE_FILES (fcntl.h HAVE_FCNTL_H) +CHECK_INCLUDE_FILES (inttypes.h HAVE_INTTYPES_H) +CHECK_INCLUDE_FILES (limits.h HAVE_LIMITS_H) +CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H) +CHECK_INCLUDE_FILES (memory.h HAVE_MEMORY_H) +CHECK_INCLUDE_FILES (netdb.h HAVE_NETDB_H) +CHECK_INCLUDE_FILES (netinet/in.h HAVE_NETINET_IN_H) +CHECK_INCLUDE_FILES (netinet/tcp.h HAVE_NETINET_TCP_H) +CHECK_INCLUDE_FILES (net/if.h HAVE_NET_IF_H) +CHECK_INCLUDE_FILES (signal.h HAVE_SIGNAL_H) +CHECK_INCLUDE_FILES (socket.h HAVE_SOCKET_H) +CHECK_INCLUDE_FILES (stdbool.h HAVE_STDBOOL_H) +CHECK_INCLUDE_FILES (stdint.h HAVE_STDINT_H) +CHECK_INCLUDE_FILES (stdlib.h HAVE_STDLIB_H) +CHECK_INCLUDE_FILES (strings.h HAVE_STRINGS_H) +CHECK_INCLUDE_FILES (string.h HAVE_STRING_H) +CHECK_INCLUDE_FILES (stropts.h HAVE_STROPTS_H) +CHECK_INCLUDE_FILES (sys/ioctl.h HAVE_SYS_IOCTL_H) +CHECK_INCLUDE_FILES (sys/param.h HAVE_SYS_PARAM_H) +CHECK_INCLUDE_FILES (sys/select.h HAVE_SYS_SELECT_H) +CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H) +CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H) +CHECK_INCLUDE_FILES (sys/time.h HAVE_SYS_TIME_H) +CHECK_INCLUDE_FILES (sys/types.h HAVE_SYS_TYPES_H) +CHECK_INCLUDE_FILES (sys/uio.h HAVE_SYS_UIO_H) +CHECK_INCLUDE_FILES (time.h HAVE_TIME_H) +CHECK_INCLUDE_FILES (dlfcn.h HAVE_DLFCN_H) +CHECK_INCLUDE_FILES (unistd.h HAVE_UNISTD_H) + +# Include order matters for these windows files. +CHECK_INCLUDE_FILES ("winsock2.h;windows.h" HAVE_WINSOCK2_H) +CHECK_INCLUDE_FILES ("winsock2.h;ws2tcpip.h;windows.h" HAVE_WS2TCPIP_H) +CHECK_INCLUDE_FILES ("winsock.h;windows.h" HAVE_WINSOCK_H) +CHECK_INCLUDE_FILES (windows.h HAVE_WINDOWS_H) + + +# Set system-specific compiler flags +IF (CMAKE_SYSTEM_NAME STREQUAL "Darwin") + LIST (APPEND SYSFLAGS -D_DARWIN_C_SOURCE) +ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "Linux") + LIST (APPEND SYSFLAGS -D_GNU_SOURCE -D_POSIX_C_SOURCE=199309L -D_XOPEN_SOURCE=600) +ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "SunOS") + LIST (APPEND SYSFLAGS -D__EXTENSIONS__ -D_REENTRANT -D_XOPEN_SOURCE=600) +ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "AIX") + LIST (APPEND SYSFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=600) +ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + # Don't define _XOPEN_SOURCE on FreeBSD, it actually reduces visibility instead of increasing it +ELSEIF (WIN32) + LIST (APPEND SYSFLAGS -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE) +ENDIF () +ADD_DEFINITIONS(${SYSFLAGS}) + + + +# Tell C-Ares about libraries to depend on +IF (${HAVE_LIBRESOLV}) + LIST (APPEND CARES_DEPENDENT_LIBS resolv) +ENDIF () +IF (${HAVE_LIBNSL}) + LIST (APPEND CARES_DEPENDENT_LIBS nsl) +ENDIF () +IF (${HAVE_LIBSOCKET}) + LIST (APPEND CARES_DEPENDENT_LIBS socket) +ENDIF () +IF (${HAVE_LIBRT}) + LIST (APPEND CARES_DEPENDENT_LIBS rt) +ENDIF () +IF (WIN32) + LIST (APPEND CARES_DEPENDENT_LIBS ws2_32) +ENDIF () + + +# When checking for symbols, we need to make sure we set the proper +# headers, libraries, and definitions for the detection to work properly +# CMAKE_REQUIRED_DEFINITIONS, CMAKE_REQUIRED_LIBRARIES, and +# CMAKE_EXTRA_INCLUDE_FILES. When we're done with the detection, we'll +# unset them. + +SET (CMAKE_REQUIRED_DEFINITIONS ${SYSFLAGS}) +LIST (APPEND CMAKE_REQUIRED_LIBRARIES ${CARES_DEPENDENT_LIBS}) + +MACRO (CARES_EXTRAINCLUDE_IFSET var include) + IF (${var}) + LIST (APPEND CMAKE_EXTRA_INCLUDE_FILES ${include}) + ENDIF () +ENDMACRO () + +CARES_EXTRAINCLUDE_IFSET (HAVE_STDBOOL_H stdbool.h) +CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_TYPES_H sys/types.h) +CARES_EXTRAINCLUDE_IFSET (HAVE_ARPA_INET_H arpa/inet.h) +CARES_EXTRAINCLUDE_IFSET (HAVE_ARPA_NAMESER_H arpa/nameser.h) +CARES_EXTRAINCLUDE_IFSET (HAVE_NETDB_H netdb.h) +CARES_EXTRAINCLUDE_IFSET (HAVE_NETINET_IN_H netinet/in.h) +CARES_EXTRAINCLUDE_IFSET (HAVE_NETINET_TCP_H netinet/tcp.h) +CARES_EXTRAINCLUDE_IFSET (HAVE_SIGNAL_H signal.h) +CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_IOCTL_H sys/ioctl.h) +CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_SELECT_H sys/select.h) +CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_SOCKET_H sys/socket.h) +CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_TIME_H sys/time.h) +CARES_EXTRAINCLUDE_IFSET (HAVE_TIME_H time.h) +CARES_EXTRAINCLUDE_IFSET (HAVE_FCNTL_H fcntl.h) +CARES_EXTRAINCLUDE_IFSET (HAVE_UNISTD_H unistd.h) +CARES_EXTRAINCLUDE_IFSET (HAVE_WINSOCK2_H winsock2.h) +CARES_EXTRAINCLUDE_IFSET (HAVE_WS2TCPIP_H ws2tcpip.h) +CARES_EXTRAINCLUDE_IFSET (HAVE_WINDOWS_H windows.h) + +# Check Types +# CHECK_TYPE_SIZE can't be used to see if a type exists because on Apple when +# building multi-arch, it will throw an error. So we need to wrap +# CHECK_C_SOURCE_COMPILES for our tests. +MACRO (CARES_TYPE_EXISTS type var) + SET(_CARES_C_SOURCE " + #include + #include + ") + FOREACH(_C_HEADER ${CMAKE_EXTRA_INCLUDE_FILES}) + SET(_CARES_C_SOURCE "${_CARES_C_SOURCE} + #include <${_C_HEADER}>") + ENDFOREACH(_C_HEADER) + + SET(_CARES_C_SOURCE "${_CARES_C_SOURCE} + int main() { + ${type} var_exists; + return 0; + } + ") + CHECK_C_SOURCE_COMPILES ("${_CARES_C_SOURCE}" ${var}) +ENDMACRO () + +CARES_TYPE_EXISTS (socklen_t HAVE_SOCKLEN_T) +CARES_TYPE_EXISTS (SOCKET HAVE_TYPE_SOCKET) +CARES_TYPE_EXISTS (bool HAVE_BOOL_T) +CARES_TYPE_EXISTS (ssize_t HAVE_SSIZE_T) +CARES_TYPE_EXISTS ("long long" HAVE_LONGLONG) +CARES_TYPE_EXISTS (sig_atomic_t HAVE_SIG_ATOMIC_T) +CARES_TYPE_EXISTS ("struct addrinfo" HAVE_STRUCT_ADDRINFO) +CARES_TYPE_EXISTS ("struct in6_addr" HAVE_STRUCT_IN6_ADDR) +CARES_TYPE_EXISTS ("struct sockaddr_in6" HAVE_STRUCT_SOCKADDR_IN6) +CARES_TYPE_EXISTS ("struct sockaddr_storage" HAVE_STRUCT_SOCKADDR_STORAGE) +CARES_TYPE_EXISTS ("struct timeval" HAVE_STRUCT_TIMEVAL) + + +# Check for preprocessor defines +CHECK_SYMBOL_EXISTS (AF_INET6 "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_AF_INET6) +CHECK_SYMBOL_EXISTS (O_NONBLOCK "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_O_NONBLOCK) +CHECK_SYMBOL_EXISTS (FIONBIO "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_FIONBIO) +CHECK_SYMBOL_EXISTS (SIOCGIFADDR "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_IOCTL_SIOCGIFADDR) +CHECK_SYMBOL_EXISTS (MSG_NOSIGNAL "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_MSG_NOSIGNAL) +CHECK_SYMBOL_EXISTS (PF_INET6 "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_PF_INET6) +CHECK_SYMBOL_EXISTS (SO_NONBLOCK "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_SO_NONBLOCK) +CHECK_SYMBOL_EXISTS (CLOCK_MONOTONIC "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CLOCK_GETTIME_MONOTONIC) + +CHECK_STRUCT_HAS_MEMBER("struct sockaddr_in6" sin6_scope_id "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID LANGUAGE C) + +# Check for "LL" numeric suffix support +CHECK_C_SOURCE_COMPILES ("int main() { int n=1234LL; return 0; }" HAVE_LL) + + +# NOTE: CHECK_FUNCTION_EXISTS appears to be broken on 32bit Windows with VS2005 +# at least. It does not appear to honor CMAKE_REQUIRED_LIBRARIES for some +# reason so does not find functions that are not in the standard C library. +# For this reason, we are going to at least just make sure it is in the +# headers by using CHECK_SYMBOL_EXISTS. But we wrap it in a Macro to allow +# it to work on other systems +MACRO (CARES_FUNCTION_EXISTS func var) + IF (WIN32 AND MSVC) + CHECK_SYMBOL_EXISTS("${func}" "${CMAKE_EXTRA_INCLUDE_FILES}" "${var}") + ELSE () + CHECK_FUNCTION_EXISTS("${func}" "${var}") + ENDIF () +ENDMACRO () + +CARES_FUNCTION_EXISTS (bitncmp HAVE_BITNCMP) +CARES_FUNCTION_EXISTS (closesocket HAVE_CLOSESOCKET) +CARES_FUNCTION_EXISTS (CloseSocket HAVE_CLOSESOCKET_CAMEL) +CARES_FUNCTION_EXISTS (connect HAVE_CONNECT) +CARES_FUNCTION_EXISTS (fcntl HAVE_FCNTL) +CARES_FUNCTION_EXISTS (freeaddrinfo HAVE_FREEADDRINFO) +CARES_FUNCTION_EXISTS (getaddrinfo HAVE_GETADDRINFO) +CARES_FUNCTION_EXISTS (getenv HAVE_GETENV) +CARES_FUNCTION_EXISTS (gethostbyaddr HAVE_GETHOSTBYADDR) +CARES_FUNCTION_EXISTS (gethostbyname HAVE_GETHOSTBYNAME) +CARES_FUNCTION_EXISTS (gethostname HAVE_GETHOSTNAME) +CARES_FUNCTION_EXISTS (getnameinfo HAVE_GETNAMEINFO) +CARES_FUNCTION_EXISTS (getservbyport_r HAVE_GETSERVBYPORT_R) +CARES_FUNCTION_EXISTS (gettimeofday HAVE_GETTIMEOFDAY) +CARES_FUNCTION_EXISTS (if_indextoname HAVE_IF_INDEXTONAME) +CARES_FUNCTION_EXISTS (inet_net_pton HAVE_INET_NET_PTON) +IF (NOT WIN32) + # Disabled on windows. CARES_FUNCTION_EXISTS will say they exist, but + # it doesn't appear as though proper headers really exist for these functions + # as there are prototype warnings during the build. + CARES_FUNCTION_EXISTS (inet_ntop HAVE_INET_NTOP) + CARES_FUNCTION_EXISTS (inet_pton HAVE_INET_PTON) +ENDIF () +CARES_FUNCTION_EXISTS (ioctl HAVE_IOCTL) +CARES_FUNCTION_EXISTS (ioctlsocket HAVE_IOCTLSOCKET) +CARES_FUNCTION_EXISTS (IoctlSocket HAVE_IOCTLSOCKET_CAMEL) +CARES_FUNCTION_EXISTS (recv HAVE_RECV) +CARES_FUNCTION_EXISTS (recvfrom HAVE_RECVFROM) +CARES_FUNCTION_EXISTS (send HAVE_SEND) +CARES_FUNCTION_EXISTS (setsockopt HAVE_SETSOCKOPT) +CARES_FUNCTION_EXISTS (socket HAVE_SOCKET) +CARES_FUNCTION_EXISTS (strcasecmp HAVE_STRCASECMP) +CARES_FUNCTION_EXISTS (strcmpi HAVE_STRCMPI) +CARES_FUNCTION_EXISTS (strdup HAVE_STRDUP) +CARES_FUNCTION_EXISTS (stricmp HAVE_STRICMP) +CARES_FUNCTION_EXISTS (strncasecmp HAVE_STRNCASECMP) +CARES_FUNCTION_EXISTS (strncmpi HAVE_STRNCMPI) +CARES_FUNCTION_EXISTS (strnicmp HAVE_STRNICMP) +CARES_FUNCTION_EXISTS (writev HAVE_WRITEV) + +# Unset temporary data +SET (CMAKE_EXTRA_INCLUDE_FILES) +SET (CMAKE_REQUIRED_DEFINITIONS) +SET (CMAKE_REQUIRED_LIBRARIES) + + +################################################################################ +# recv, recvfrom, send, getnameinfo, gethostname +# ARGUMENTS AND RETURN VALUES +# +# The AutoTools build tries to be really thorough here. So much so that it +# takes forever. We really don't want to do that. Lets make some educated +# guesses based on datatypes we have available, and for others, use some 'sane' +# defaults. This should be much quicker and nearly as accurate ... and even +# if not, it probably won't matter in the least. + +IF ("${HAVE_SSIZE_T}" AND "${HAVE_SOCKLEN_T}") + # If we have ssize_t and socklen_t, the API is usually sane and uses ssize_t and size_t for lengths + SET (RECVFROM_TYPE_RETV ssize_t) + SET (RECVFROM_TYPE_ARG3 size_t) +ELSE () + SET (RECVFROM_TYPE_RETV int) + SET (RECVFROM_TYPE_ARG3 int) +ENDIF () + +IF ("${HAVE_TYPE_SOCKET}") + # If the SOCKET type is defined, it uses socket ... should be windows only + SET (RECVFROM_TYPE_ARG1 SOCKET) +ELSE () + SET (RECVFROM_TYPE_ARG1 int) +ENDIF() + +IF ("${HAVE_SOCKLEN_T}") + # If we have socklen_t the APIs pretty much always actually use it + SET (RECVFROM_TYPE_ARG6 "socklen_t *") + SET (GETNAMEINFO_TYPE_ARG2 socklen_t) + SET (GETNAMEINFO_TYPE_ARG46 socklen_t) +ELSE () + SET (RECVFROM_TYPE_ARG6 "int *") + SET (GETNAMEINFO_TYPE_ARG2 int) + SET (GETNAMEINFO_TYPE_ARG46 int) +ENDIF () + +# Functions are typically consistent so the equivalent fields map ... equivalently +SET (RECV_TYPE_RETV ${RECVFROM_TYPE_RETV}) +SET (SEND_TYPE_RETV ${RECVFROM_TYPE_RETV}) +SET (RECV_TYPE_ARG1 ${RECVFROM_TYPE_ARG1}) +SET (SEND_TYPE_ARG1 ${RECVFROM_TYPE_ARG1}) +SET (RECV_TYPE_ARG3 ${RECVFROM_TYPE_ARG3}) +SET (SEND_TYPE_ARG3 ${RECVFROM_TYPE_ARG3}) +SET (GETHOSTNAME_TYPE_ARG2 ${RECVFROM_TYPE_ARG3}) + +# These should always be "sane" values to use always +SET (RECVFROM_QUAL_ARG5 ) +SET (RECVFROM_TYPE_ARG2 "void *") +SET (RECVFROM_TYPE_ARG4 int) +SET (RECVFROM_TYPE_ARG5 "struct sockaddr *") +SET (RECV_TYPE_ARG2 "void *") +SET (RECV_TYPE_ARG4 int) +SET (GETNAMEINFO_TYPE_ARG1 "struct sockaddr *") +SET (GETNAMEINFO_TYPE_ARG7 int) +SET (SEND_TYPE_ARG2 "void *") +SET (SEND_TYPE_ARG4 int) +################################################################################ + + +# HAVE_CXX11 ?? +# HAVE_SIG_ATOMIC_T_VOLATILE ?? + + +# Set a few variables by hand that C-Ares wants, logically, based on detection +# data. + +IF (${HAVE_SOCKLEN_T}) + Set (CARES_TYPEOF_ARES_SOCKLEN_T "socklen_t") +ELSE () + Set (CARES_TYPEOF_ARES_SOCKLEN_T "int") +ENDIF () + +IF ("${HAVE_FCNTL}" AND "${HAVE_O_NONBLOCK}") + SET (HAVE_FCNTL_O_NONBLOCK 1) +ENDIF () + +IF ("${HAVE_IOCTL}" AND "${HAVE_FIONBIO}") + SET (HAVE_IOCTL_FIONBIO 1) +ENDIF () + +IF ("${HAVE_IOCTLSOCKET}" AND "${HAVE_FIONBIO}") + SET (HAVE_IOCTLSOCKET_FIONBIO 1) +ENDIF () + +IF ("${HAVE_IOCTLSOCKET_CAMEL}" AND "${HAVE_FIONBIO}") + SET (HAVE_IOCTLSOCKET_CAMEL_FIONBIO 1) +ENDIF () + +IF (${HAVE_GETADDRINFO}) + IF (CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR + CMAKE_SYSTEM_NAME STREQUAL "HPUX" OR + CMAKE_SYSTEM_NAME STREQUAL "NetBSD" OR + CMAKE_SYSTEM_NAME STREQUAL "SunOS" OR + CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR + CMAKE_SYSTEM_NAME STREQUAL "AIX" OR + WIN32) + SET (HAVE_GETADDRINFO_THREADSAFE 1) + ENDIF () +ENDIF () + +IF ("${HAVE_TIME_H}" AND "${HAVE_SYS_TIME_H}") + SET (TIME_WITH_SYS_TIME 1) +ENDIF () + +IF (${HAVE_GETSERVBYPORT_R}) + # TODO : Should probably autodetect + IF (CMAKE_SYSTEM_NAME STREQUAL "SunOS") + SET (GETSERVBYPORT_R_ARGS 5) + ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "AIX") + SET (GETSERVBYPORT_R_ARGS 4) + ELSE () + # Probably linux + SET (GETSERVBYPORT_R_ARGS 6) + ENDIF () +ENDIF () + +# Set some aliases used for ares_build.h +IF (${HAVE_SYS_TYPES_H}) + SET (CARES_HAVE_SYS_TYPES_H 1) +ENDIF () +IF (${HAVE_SYS_SOCKET_H}) + SET (CARES_HAVE_SYS_SOCKET_H 1) +ENDIF() +IF (${HAVE_WS2TCPIP_H}) + SET (CARES_HAVE_WS2TCPIP_H 1) +ENDIF() +IF (${HAVE_WINSOCK2_H}) + SET (CARES_HAVE_WINSOCK2_H 1) +ENDIF() +IF (${HAVE_WINDOWS_H}) + SET (CARES_HAVE_WINDOWS_H 1) +ENDIF() + +# Write ares_build.h configuration file. This is an installed file. +CONFIGURE_FILE (ares_build.h.cmake ${PROJECT_BINARY_DIR}/ares_build.h) + +# Write ares_config.h configuration file. This is used only for the build. +CONFIGURE_FILE (ares_config.h.cmake ${PROJECT_BINARY_DIR}/ares_config.h) + + +INCLUDE_DIRECTORIES ( + ${CARES_INCLUDE_DIRS} +) + +# Source files. +SET (CARES_SOURCES + ares__close_sockets.c + ares__get_hostent.c + ares__read_line.c + ares__timeval.c + ares_cancel.c + ares_data.c + ares_destroy.c + ares_expand_name.c + ares_expand_string.c + ares_fds.c + ares_free_hostent.c + ares_free_string.c + ares_getenv.c + ares_gethostbyaddr.c + ares_gethostbyname.c + ares_getnameinfo.c + ares_getsock.c + ares_init.c + ares_library_init.c + ares_llist.c + ares_mkquery.c + ares_create_query.c + ares_nowarn.c + ares_options.c + ares_parse_a_reply.c + ares_parse_aaaa_reply.c + ares_parse_mx_reply.c + ares_parse_naptr_reply.c + ares_parse_ns_reply.c + ares_parse_ptr_reply.c + ares_parse_soa_reply.c + ares_parse_srv_reply.c + ares_parse_txt_reply.c + ares_platform.c + ares_process.c + ares_query.c + ares_search.c + ares_send.c + ares_strcasecmp.c + ares_strdup.c + ares_strerror.c + ares_timeout.c + ares_version.c + ares_writev.c + bitncmp.c + inet_net_pton.c + inet_ntop.c + windows_port.c +) + +# Build the dynamic/shared library +IF (${CARES_SHARED}) + ADD_LIBRARY (${PROJECT_NAME} SHARED ${CARES_SOURCES}) + SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H=1 -DCARES_BUILDING_LIBRARY") + SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES SOVERSION 3.0.1) + TARGET_LINK_LIBRARIES (${PROJECT_NAME} ${CARES_DEPENDENT_LIBS}) + IF (${CARES_INSTALL}) + INSTALL (TARGETS ${PROJECT_NAME} DESTINATION ${CARES_INSTALL_LOCATION_LIBS}) + ENDIF () + + # Set a static suffix if building both shared and static libs + SET (STATIC_SUFFIX "_static") +ENDIF () + +# Build the static library +IF (${CARES_STATIC}) + ADD_LIBRARY (${PROJECT_NAME}${STATIC_SUFFIX} STATIC ${CARES_SOURCES}) + SET_TARGET_PROPERTIES (${PROJECT_NAME}${STATIC_SUFFIX} PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H=1 -DCARES_STATICLIB" OUTPUT_NAME ${PROJECT_NAME}) + SET_TARGET_PROPERTIES (${PROJECT_NAME}${STATIC_SUFFIX} PROPERTIES SOVERSION 3.0.1) + IF (${CARES_STATIC_PIC}) + SET_TARGET_PROPERTIES (${PROJECT_NAME}${STATIC_SUFFIX} PROPERTIES POSITION_INDEPENDENT_CODE True) + ENDIF () + TARGET_LINK_LIBRARIES (${PROJECT_NAME}${STATIC_SUFFIX} ${CARES_DEPENDENT_LIBS}) + IF (${CARES_INSTALL}) + INSTALL (TARGETS ${PROJECT_NAME}${STATIC_SUFFIX} DESTINATION ${CARES_INSTALL_LOCATION_LIBS}) + ENDIF () +ENDIF () + + +# Headers installation target +IF (${CARES_INSTALL}) + SET (CARES_HEADERS ares.h ares_version.h ares_dns.h "${PROJECT_BINARY_DIR}/ares_build.h" ares_rules.h) + INSTALL (FILES ${CARES_HEADERS} DESTINATION ${CARES_INSTALL_LOCATION_HEADERS}) +ENDIF () + + +# Common sources for all examples +SET (CARES_EXAMPLE_SOURCES + ares_getopt.c + ares_nowarn.c + ares_strcasecmp.c +) + +# Build ahost +ADD_EXECUTABLE (ahost ahost.c ${CARES_EXAMPLE_SOURCES}) +SET_TARGET_PROPERTIES(ahost PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H=1 ${CARES_DEFINITIONS}") +TARGET_LINK_LIBRARIES (ahost ${CARES_LIBRARIES} ${CARES_DEPENDENT_LIBS}) +IF (${CARES_INSTALL}) + INSTALL (TARGETS ahost RUNTIME DESTINATION ${CARES_INSTALL_LOCATION_BIN}) +ENDIF () + + +# Build adig +ADD_EXECUTABLE (adig adig.c ${CARES_EXAMPLE_SOURCES}) +SET_TARGET_PROPERTIES(adig PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H=1 ${CARES_DEFINITIONS}") +TARGET_LINK_LIBRARIES (adig ${CARES_LIBRARIES} ${CARES_DEPENDENT_LIBS}) +IF (${CARES_INSTALL}) + INSTALL (TARGETS adig RUNTIME DESTINATION ${CARES_INSTALL_LOCATION_BIN}) +ENDIF () + + +# Build acountry +ADD_EXECUTABLE (acountry acountry.c ${CARES_EXAMPLE_SOURCES}) +SET_TARGET_PROPERTIES(acountry PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H=1 ${CARES_DEFINITIONS}") +TARGET_LINK_LIBRARIES (acountry ${CARES_LIBRARIES} ${CARES_DEPENDENT_LIBS}) +IF (${CARES_INSTALL}) + INSTALL (TARGETS acountry RUNTIME DESTINATION ${CARES_INSTALL_LOCATION_BIN}) +ENDIF () diff --git a/ares_build.h.cmake b/ares_build.h.cmake new file mode 100644 index 000000000..e1e746dde --- /dev/null +++ b/ares_build.h.cmake @@ -0,0 +1,39 @@ +#ifndef __CARES_BUILD_H +#define __CARES_BUILD_H + +#define CARES_TYPEOF_ARES_SOCKLEN_T @CARES_TYPEOF_ARES_SOCKLEN_T@ + +/* Prefix names with CARES_ to make sure they don't conflict with other config.h + * files. We need to include some dependent headers that may be system specific + * for C-Ares */ +#cmakedefine CARES_HAVE_SYS_TYPES_H +#cmakedefine CARES_HAVE_SYS_SOCKET_H +#cmakedefine CARES_HAVE_WINDOWS_H +#cmakedefine CARES_HAVE_WS2TCPIP_H +#cmakedefine CARES_HAVE_WINSOCK2_H +#cmakedefine CARES_HAVE_WINDOWS_H + +#ifdef CARES_HAVE_SYS_TYPES_H +# include +#endif + +#ifdef CARES_HAVE_SYS_SOCKET_H +# include +#endif + +#ifdef CARES_HAVE_WINSOCK2_H +# include +#endif + +#ifdef CARES_HAVE_WS2TCPIP_H +# include +#endif + +#ifdef CARES_HAVE_WINDOWS_H +# include +#endif + + +typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t; + +#endif /* __CARES_BUILD_H */ diff --git a/ares_config.h.cmake b/ares_config.h.cmake new file mode 100644 index 000000000..acbef810e --- /dev/null +++ b/ares_config.h.cmake @@ -0,0 +1,433 @@ +/* Generated from ares_config.h.cmake*/ + +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* define this if ares is built for a big endian system */ +#undef ARES_BIG_ENDIAN + +/* when building as static part of libcurl */ +#undef BUILDING_LIBCURL + +/* Defined for build that exposes internal static functions for testing. */ +#undef CARES_EXPOSE_STATICS + +/* Defined for build with symbol hiding. */ +#undef CARES_SYMBOL_HIDING + +/* Definition to make a library symbol externally visible. */ +#undef CARES_SYMBOL_SCOPE_EXTERN + +/* Use resolver library to configure cares */ +#cmakedefine CARES_USE_LIBRESOLV + +/* if a /etc/inet dir is being used */ +#undef ETC_INET + +/* Define to the type of arg 2 for gethostname. */ +#define GETHOSTNAME_TYPE_ARG2 @GETHOSTNAME_TYPE_ARG2@ + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +#define GETNAMEINFO_QUAL_ARG1 @GETNAMEINFO_QUAL_ARG1@ + +/* Define to the type of arg 1 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG1 @GETNAMEINFO_TYPE_ARG1@ + +/* Define to the type of arg 2 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG2 @GETNAMEINFO_TYPE_ARG2@ + +/* Define to the type of args 4 and 6 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG46 @GETNAMEINFO_TYPE_ARG46@ + +/* Define to the type of arg 7 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG7 @GETNAMEINFO_TYPE_ARG7@ + +/* Specifies the number of arguments to getservbyport_r */ +#define GETSERVBYPORT_R_ARGS @GETSERVBYPORT_R_ARGS@ + +/* Define to 1 if you have AF_INET6. */ +#cmakedefine HAVE_AF_INET6 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ARPA_INET_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ARPA_NAMESER_COMPAT_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ARPA_NAMESER_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ASSERT_H + +/* Define to 1 if you have the `bitncmp' function. */ +#cmakedefine HAVE_BITNCMP + +/* Define to 1 if bool is an available type. */ +#cmakedefine HAVE_BOOL_T + +/* Define to 1 if you have the clock_gettime function and monotonic timer. */ +#cmakedefine HAVE_CLOCK_GETTIME_MONOTONIC + +/* Define to 1 if you have the closesocket function. */ +#cmakedefine HAVE_CLOSESOCKET + +/* Define to 1 if you have the CloseSocket camel case function. */ +#cmakedefine HAVE_CLOSESOCKET_CAMEL + +/* Define to 1 if you have the connect function. */ +#cmakedefine HAVE_CONNECT + +/* define if the compiler supports basic C++11 syntax */ +#cmakedefine HAVE_CXX11 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ERRNO_H + +/* Define to 1 if you have the fcntl function. */ +#cmakedefine HAVE_FCNTL + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_FCNTL_H + +/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ +#cmakedefine HAVE_FCNTL_O_NONBLOCK + +/* Define to 1 if you have the freeaddrinfo function. */ +#cmakedefine HAVE_FREEADDRINFO + +/* Define to 1 if you have a working getaddrinfo function. */ +#cmakedefine HAVE_GETADDRINFO + +/* Define to 1 if the getaddrinfo function is threadsafe. */ +#cmakedefine HAVE_GETADDRINFO_THREADSAFE + +/* Define to 1 if you have the getenv function. */ +#cmakedefine HAVE_GETENV + +/* Define to 1 if you have the gethostbyaddr function. */ +#cmakedefine HAVE_GETHOSTBYADDR + +/* Define to 1 if you have the gethostbyname function. */ +#cmakedefine HAVE_GETHOSTBYNAME + +/* Define to 1 if you have the gethostname function. */ +#cmakedefine HAVE_GETHOSTNAME + +/* Define to 1 if you have the getnameinfo function. */ +#cmakedefine HAVE_GETNAMEINFO + +/* Define to 1 if you have the getservbyport_r function. */ +#cmakedefine HAVE_GETSERVBYPORT_R + +/* Define to 1 if you have the `gettimeofday' function. */ +#cmakedefine HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the `if_indextoname' function. */ +#cmakedefine HAVE_IF_INDEXTONAME + +/* Define to 1 if you have a IPv6 capable working inet_net_pton function. */ +#cmakedefine HAVE_INET_NET_PTON + +/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ +#cmakedefine HAVE_INET_NTOP + +/* Define to 1 if you have a IPv6 capable working inet_pton function. */ +#cmakedefine HAVE_INET_PTON + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_INTTYPES_H + +/* Define to 1 if you have the ioctl function. */ +#cmakedefine HAVE_IOCTL + +/* Define to 1 if you have the ioctlsocket function. */ +#cmakedefine HAVE_IOCTLSOCKET + +/* Define to 1 if you have the IoctlSocket camel case function. */ +#cmakedefine HAVE_IOCTLSOCKET_CAMEL + +/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function. + */ +#cmakedefine HAVE_IOCTLSOCKET_CAMEL_FIONBIO + +/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ +#cmakedefine HAVE_IOCTLSOCKET_FIONBIO + +/* Define to 1 if you have a working ioctl FIONBIO function. */ +#cmakedefine HAVE_IOCTL_FIONBIO + +/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */ +#cmakedefine HAVE_IOCTL_SIOCGIFADDR + +/* Define to 1 if you have the `resolve' library (-lresolve). */ +#cmakedefine HAVE_LIBRESOLV + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LIMITS_H + +/* if your compiler supports LL */ +#cmakedefine HAVE_LL + +/* Define to 1 if the compiler supports the 'long long' data type. */ +#cmakedefine HAVE_LONGLONG + +/* Define to 1 if you have the malloc.h header file. */ +#cmakedefine HAVE_MALLOC_H + +/* Define to 1 if you have the memory.h header file. */ +#cmakedefine HAVE_MEMORY_H + +/* Define to 1 if you have the MSG_NOSIGNAL flag. */ +#cmakedefine HAVE_MSG_NOSIGNAL + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETINET_TCP_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NET_IF_H + +/* Define to 1 if you have PF_INET6. */ +#cmakedefine HAVE_PF_INET6 + +/* Define to 1 if you have the recv function. */ +#cmakedefine HAVE_RECV + +/* Define to 1 if you have the recvfrom function. */ +#cmakedefine HAVE_RECVFROM + +/* Define to 1 if you have the send function. */ +#cmakedefine HAVE_SEND + +/* Define to 1 if you have the setsockopt function. */ +#cmakedefine HAVE_SETSOCKOPT + +/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ +#cmakedefine HAVE_SETSOCKOPT_SO_NONBLOCK + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SIGNAL_H + +/* Define to 1 if sig_atomic_t is an available typedef. */ +#cmakedefine HAVE_SIG_ATOMIC_T + +/* Define to 1 if sig_atomic_t is already defined as volatile. */ +#cmakedefine HAVE_SIG_ATOMIC_T_VOLATILE + +/* Define to 1 if your struct sockaddr_in6 has sin6_scope_id. */ +#cmakedefine HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID + +/* Define to 1 if you have the socket function. */ +#cmakedefine HAVE_SOCKET + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SOCKET_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDLIB_H + +/* Define to 1 if you have the strcasecmp function. */ +#cmakedefine HAVE_STRCASECMP + +/* Define to 1 if you have the strcmpi function. */ +#cmakedefine HAVE_STRCMPI + +/* Define to 1 if you have the strdup function. */ +#cmakedefine HAVE_STRDUP + +/* Define to 1 if you have the stricmp function. */ +#cmakedefine HAVE_STRICMP + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRING_H + +/* Define to 1 if you have the strncasecmp function. */ +#cmakedefine HAVE_STRNCASECMP + +/* Define to 1 if you have the strncmpi function. */ +#cmakedefine HAVE_STRNCMPI + +/* Define to 1 if you have the strnicmp function. */ +#cmakedefine HAVE_STRNICMP + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STROPTS_H + +/* Define to 1 if you have struct addrinfo. */ +#cmakedefine HAVE_STRUCT_ADDRINFO + +/* Define to 1 if you have struct in6_addr. */ +#cmakedefine HAVE_STRUCT_IN6_ADDR + +/* Define to 1 if you have struct sockaddr_in6. */ +#cmakedefine HAVE_STRUCT_SOCKADDR_IN6 + +/* if struct sockaddr_storage is defined */ +#cmakedefine HAVE_STRUCT_SOCKADDR_STORAGE + +/* Define to 1 if you have the timeval struct. */ +#cmakedefine HAVE_STRUCT_TIMEVAL + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_IOCTL_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SELECT_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_UIO_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_TIME_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UNISTD_H + +/* Define to 1 if you have the windows.h header file. */ +#cmakedefine HAVE_WINDOWS_H + +/* Define to 1 if you have the winsock2.h header file. */ +#cmakedefine HAVE_WINSOCK2_H + +/* Define to 1 if you have the winsock.h header file. */ +#cmakedefine HAVE_WINSOCK_H + +/* Define to 1 if you have the writev function. */ +#cmakedefine HAVE_WRITEV + +/* Define to 1 if you have the ws2tcpip.h header file. */ +#cmakedefine HAVE_WS2TCPIP_H + +/* Define to 1 if you need the malloc.h header file even with stdlib.h */ +#cmakedefine NEED_MALLOC_H + +/* Define to 1 if you need the memory.h header file even with stdlib.h */ +#cmakedefine NEED_MEMORY_H + +/* a suitable file/device to read random data from */ +#cmakedefine RANDOM_FILE + +/* Define to the type qualifier pointed by arg 5 for recvfrom. */ +#define RECVFROM_QUAL_ARG5 @RECVFROM_QUAL_ARG5@ + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 @RECVFROM_TYPE_ARG1@ + +/* Define to the type pointed by arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 @RECVFROM_TYPE_ARG2@ + +/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */ +#cmakedefine01 RECVFROM_TYPE_ARG2_IS_VOID + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 @RECVFROM_TYPE_ARG3@ + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 @RECVFROM_TYPE_ARG4@ + +/* Define to the type pointed by arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 @RECVFROM_TYPE_ARG5@ + +/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */ +#cmakedefine01 RECVFROM_TYPE_ARG5_IS_VOID + +/* Define to the type pointed by arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 @RECVFROM_TYPE_ARG6@ + +/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */ +#cmakedefine01 RECVFROM_TYPE_ARG6_IS_VOID + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV @RECVFROM_TYPE_RETV@ + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 @RECV_TYPE_ARG1@ + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 @RECV_TYPE_ARG2@ + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 @RECV_TYPE_ARG3@ + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 @RECV_TYPE_ARG4@ + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV @RECV_TYPE_RETV@ + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE @RETSIGTYPE@ + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 @SEND_QUAL_ARG2@ + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 @SEND_TYPE_ARG1@ + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 @SEND_TYPE_ARG2@ + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 @SEND_TYPE_ARG3@ + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 @SEND_TYPE_ARG4@ + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV @SEND_TYPE_RETV@ + +/* Define to 1 if you can safely include both and . */ +#cmakedefine TIME_WITH_SYS_TIME + +/* Define to disable non-blocking sockets. */ +#undef USE_BLOCKING_SOCKETS + +/* Define to avoid automatic inclusion of winsock.h */ +#undef WIN32_LEAN_AND_MEAN + +/* Type to use in place of in_addr_t when system does not provide it. */ +#undef in_addr_t + +#cmakedefine HAVE_SSIZE_T + +/* Create our own ssize_t */ +#ifndef HAVE_SSIZE_T +# ifdef _WIN64 +typedef __int64 ssize_t; +# else +typedef long ssize_t; +# endif +#endif