diff --git a/CMakeLists.txt b/CMakeLists.txt index 22bd196d..651f38dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -794,6 +794,12 @@ endif () if (USE_LIBUV) find_package(Libuv) if (Libuv_FOUND) + # Check for new-style callbacks. + try_compile(HAVE_NEW_UV_TIMER_CB + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/tests/test_uv_cb.c + ) + # Copy module header to getdns include dir. file(COPY src/getdns/getdns_ext_libuv.h DESTINATION getdns) diff --git a/cmake/include/cmakeconfig.h.in b/cmake/include/cmakeconfig.h.in index 20f8c05b..052a8a91 100644 --- a/cmake/include/cmakeconfig.h.in +++ b/cmake/include/cmakeconfig.h.in @@ -207,6 +207,8 @@ #cmakedefine USE_OSX_TCP_FASTOPEN 1 +#cmakedefine HAVE_NEW_UV_TIMER_CB 1 + #cmakedefine HAVE_TARGET_ENDIANNESS #cmakedefine TARGET_IS_BIG_ENDIAN diff --git a/cmake/tests/test_uv_cb.c b/cmake/tests/test_uv_cb.c new file mode 100644 index 00000000..72524291 --- /dev/null +++ b/cmake/tests/test_uv_cb.c @@ -0,0 +1,12 @@ +#include + +void test_cb(uv_timer_t *handle) +{ + (void) handle; +} + +int main(int ac, char *av[]) +{ + uv_timer_cb cb = test_cb; + (*cb)(0); +}