diff --git a/CMakeLists.txt b/CMakeLists.txt index 0058b52570..75317c917b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1083,6 +1083,23 @@ if(CURL_USE_GSSAPI) endif() endif() +# libuv +option(CURL_USE_LIBUV "Use libuv for event-based tests" OFF) +if(CURL_USE_LIBUV) + if(NOT ENABLE_DEBUG) + message(FATAL_ERROR "Using libuv without debug support enabled is useless") + endif() + find_package(PkgConfig QUIET) + pkg_check_modules(LIBUV "libuv") + if(LIBUV_FOUND) + list(APPEND CURL_LIBS ${LIBUV_LINK_LIBRARIES}) + list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libuv") + include_directories(${LIBUV_INCLUDE_DIRS}) + set(USE_LIBUV ON) + set(HAVE_UV_H ON) + endif() +endif() + option(USE_LIBRTMP "Enable librtmp from rtmpdump" OFF) if(USE_LIBRTMP) cmake_push_check_state() diff --git a/lib/curl_config.h.cmake b/lib/curl_config.h.cmake index 666a7bae46..bff17bc493 100644 --- a/lib/curl_config.h.cmake +++ b/lib/curl_config.h.cmake @@ -722,6 +722,12 @@ ${SIZEOF_TIME_T_CODE} /* if GSASL is in use */ #cmakedefine USE_GSASL 1 +/* if libuv is in use */ +#cmakedefine USE_LIBUV 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UV_H 1 + /* Define to 1 if you do not want the OpenSSL configuration to be loaded automatically */ #cmakedefine CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG 1 diff --git a/src/tool_operate.c b/src/tool_operate.c index 48cc6db633..c3bd3f3743 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -50,6 +50,12 @@ #endif #ifdef HAVE_UV_H +/* Hack for Unity mode */ +#ifdef HEADER_CURL_MEMDEBUG_H +#undef HEADER_CURL_MEMDEBUG_H +#undef freeaddrinfo +#undef getaddrinfo +#endif /* this is for libuv-enabled debug builds only */ #include #endif