summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Brière <fbriere@fbriere.net>2018-02-12 19:28:16 -0500
committerFrédéric Brière <fbriere@fbriere.net>2019-12-29 02:39:51 -0500
commit87e996aaebdae6e2f07c8aa650b4eebdd00f0cba (patch)
tree0dbdaa065a964f75b2df296dfc96e45bf65d713f
parent4df6baa5ac4c9d96d5209b4f49390dc52a25f09d (diff)
downloadtwinkle-87e996aaebdae6e2f07c8aa650b4eebdd00f0cba.tar
twinkle-87e996aaebdae6e2f07c8aa650b4eebdd00f0cba.tar.gz
twinkle-87e996aaebdae6e2f07c8aa650b4eebdd00f0cba.tar.lz
twinkle-87e996aaebdae6e2f07c8aa650b4eebdd00f0cba.tar.xz
twinkle-87e996aaebdae6e2f07c8aa650b4eebdd00f0cba.zip
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.
-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}"