]> git.saurik.com Git - apt.git/commitdiff
CMake: Do not use -lresolv if res_init exists in libc
authorJulian Andres Klode <jak@debian.org>
Tue, 23 Aug 2016 11:42:54 +0000 (13:42 +0200)
committerJulian Andres Klode <jak@debian.org>
Fri, 26 Aug 2016 13:49:14 +0000 (15:49 +0200)
Gbp-Dch: ignore

CMakeLists.txt
apt-pkg/CMakeLists.txt
methods/CMakeLists.txt

index 08e43174037760058274b6c0dbb3478903f8ebe1..8c41534adac0147d09dbcfa2afa698997f25a002 100644 (file)
@@ -143,6 +143,14 @@ if (NOT HAVE_SIGHANDLER_T)
   endif()
 endif()
 
+# Handle resolving
+check_function_exists(res_init HAVE_LIBC_RESOLV)
+if(HAVE_LIBC_RESOLV)
+    set(RESOLV_LIBRARIES)
+else()
+    set(RESOLV_LIBRARIES -lresolv)
+endif()
+
 # Configure some variables like package, version and architecture.
 set(PACKAGE ${PROJECT_NAME})
 set(PACKAGE_MAIL "APT Development Team <deity@lists.debian.org>")
index 9bbc6bd98cd4379316942b356f2cdbd45130aa82..3f85bc1434ac3dcb2ee0f610a8b97a609685a741 100644 (file)
@@ -30,7 +30,7 @@ target_include_directories(apt-pkg
                                    ${LZMA_INCLUDE_DIRS}
                                    ${LZ4_INCLUDE_DIRS})
 target_link_libraries(apt-pkg
-                      PRIVATE -lutil ${CMAKE_DL_LIBS} -lresolv
+                      PRIVATE -lutil ${CMAKE_DL_LIBS} ${RESOLV_LIBRARIES}
                              ${CMAKE_THREAD_LIBS_INIT}
                              ${ZLIB_LIBRARIES}
                              ${BZIP2_LIBRARIES}
index 2417c4dc10384b96c9d9a44f1fc573064ae293c9..82ae70e7d10366673a7479c5955c6e5605108e92 100644 (file)
@@ -21,7 +21,7 @@ target_link_libraries(store apt-pkg)
 target_link_libraries(gpgv apt-pkg)
 target_link_libraries(cdrom apt-pkg)
 target_link_libraries(http apt-pkg)
-target_link_libraries(mirror apt-pkg -lresolv)
+target_link_libraries(mirror apt-pkg ${RESOLV_LIBRARIES})
 target_link_libraries(https apt-pkg ${CURL_LIBRARIES})
 target_link_libraries(ftp apt-pkg)
 target_link_libraries(rred apt-pkg)