From 87e996aaebdae6e2f07c8aa650b4eebdd00f0cba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bri=C3=A8re?= Date: Mon, 12 Feb 2018 19:28:16 -0500 Subject: CMake: Check for res_init() (HAVE_RES_INIT) This check (AC_CHECK_RES_INIT) was originally defined in acinclude.m4, and was lost in the transition to CMake. --- CMakeLists.txt | 13 +++++++++++++ src/sockets/dnssrv.cpp | 1 + twinkle_config.h.in | 1 + 3 files changed, 15 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 959bd26..ce718da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") include (CheckIncludeFile) include (CheckIncludeFiles) include (CheckSymbolExists) +include (CMakePushCheckState) include (CheckCXXSourceCompiles) find_package(LibXml2 REQUIRED) @@ -137,6 +138,18 @@ if (HAVE_STRERROR_R) " STRERROR_R_CHAR_P) endif (HAVE_STRERROR_R) +cmake_push_check_state() +list(APPEND CMAKE_REQUIRED_LIBRARIES "-lresolv") +check_cxx_source_compiles(" + #include + #include + #include + #include + + int main() { res_init(); return 0; } +" HAVE_RES_INIT) +cmake_pop_check_state() + set(datadir "${CMAKE_INSTALL_PREFIX}/share/twinkle") configure_file(twinkle_config.h.in twinkle_config.h) configure_file(twinkle.desktop.in twinkle.desktop) diff --git a/src/sockets/dnssrv.cpp b/src/sockets/dnssrv.cpp index 38cd61d..246bf02 100644 --- a/src/sockets/dnssrv.cpp +++ b/src/sockets/dnssrv.cpp @@ -11,6 +11,7 @@ #include #include #include +#include "twinkle_config.h" #include #include #include diff --git a/twinkle_config.h.in b/twinkle_config.h.in index b7c678c..9e32712 100644 --- a/twinkle_config.h.in +++ b/twinkle_config.h.in @@ -10,6 +10,7 @@ #cmakedefine HAVE_LINUX_ERRQUEUE_H #cmakedefine HAVE_STRERROR_R #cmakedefine STRERROR_R_CHAR_P +#cmakedefine HAVE_RES_INIT #cmakedefine HAVE_LIBASOUND #define VERSION "${PRODUCT_VERSION}" -- cgit v1.2.3