cmake: Fix ns_name_compress detection.
authorAndreas Schneider <asn@samba.org>
Tue, 13 Jan 2015 10:37:31 +0000 (11:37 +0100)
committerAndreas Schneider <asn@samba.org>
Tue, 13 Jan 2015 14:11:34 +0000 (15:11 +0100)
On some platforms it is a macro and not a function. So we need to check
if the macro exists.

Signed-off-by: Andreas Schneider <asn@samba.org>
CMakeLists.txt
ConfigureChecks.cmake

index 3e7ae6a..6db0028 100644 (file)
@@ -30,7 +30,6 @@ set(CMAKE_MODULE_PATH
 # add definitions
 include(DefineCMakeDefaults)
 include(DefinePlatformDefaults)
-include(DefineCompilerFlags)
 include(DefineInstallationPaths)
 include(DefineOptions.cmake)
 include(CPackConfig.cmake)
@@ -47,6 +46,9 @@ find_package(Threads)
 include(ConfigureChecks.cmake)
 configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
 
+# Add compiler flags for the project now.
+include(DefineCompilerFlags)
+
 # check subdirectories
 add_subdirectory(src)
 
index a68959f..be2f04c 100644 (file)
@@ -94,7 +94,7 @@ check_function_exists(__res_search HAVE___RES_SEARCH)
 check_function_exists(res_nsearch HAVE_RES_NSEARCH)
 check_function_exists(__res_nsearch HAVE___RES_NSEARCH)
 
-check_function_exists(ns_name_compress HAVE_NS_NAME_COMPRESS)
+check_symbol_exists(ns_name_compress "sys/types.h;arpa/nameser.h" HAVE_NS_NAME_COMPRESS)
 
 if (UNIX)
     if (NOT LINUX)