Ver código fonte

CMake: Do not use -lresolv if res_init exists in libc

Gbp-Dch: ignore
Julian Andres Klode 10 anos atrás
pai
commit
ad5282bb0c
3 arquivos alterados com 10 adições e 2 exclusões
  1. 8 0
      CMakeLists.txt
  2. 1 1
      apt-pkg/CMakeLists.txt
  3. 1 1
      methods/CMakeLists.txt

+ 8 - 0
CMakeLists.txt

@@ -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>")

+ 1 - 1
apt-pkg/CMakeLists.txt

@@ -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}

+ 1 - 1
methods/CMakeLists.txt

@@ -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)