summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt13
-rw-r--r--src/sockets/dnssrv.cpp1
-rw-r--r--twinkle_config.h.in1
3 files changed, 15 insertions, 0 deletions
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 <sys/types.h>
+ #include <netinet/in.h>
+ #include <arpa/nameser.h>
+ #include <resolv.h>
+
+ 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 <sys/time.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
+#include "twinkle_config.h"
#include <resolv.h>
#include <errno.h>
#include <stdlib.h>
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}"