forked from qt/qtbase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Network: link directly to libresolv instead of dlopen()ing it
There's little need for us to dynamically load it. The reasons why that was necessary aren't in the public history (Qt 4.5 already had it[1]). I remember writing the code in 2007-2008, I just don't remember why. On modern Linux and FreeBSD, there's no libresolv.so any more and those symbols have been rolled up into libc.so. It's still necessary on Darwin systems, so this commit introduces WrapResolv. It also resolves the unity build issues relating to libresolv symbols. [1] https://code.qt.io/cgit/qt/qt.git/tree/src/network/kernel/qhostinfo_unix.cpp?h=v4.5.1 Task-number: QTBUG-109394 Change-Id: Ic5799e4d000b6c9395109e008780643bac52122b Reviewed-by: Mårten Nordheim <[email protected]>
- Loading branch information
1 parent
ff9da1d
commit 68b6259
Showing
9 changed files
with
178 additions
and
314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Copyright (C) 2022 The Qt Company Ltd. | ||
# Copyright (C) 2023 Intel Corpotation. | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
# We can't create the same interface imported target multiple times, CMake will complain if we do | ||
# that. This can happen if the find_package call is done in multiple different subdirectories. | ||
if(TARGET WrapResolv::WrapResolv) | ||
set(WrapResolv_FOUND ON) | ||
return() | ||
endif() | ||
|
||
set(WrapResolv_FOUND OFF) | ||
|
||
include(CheckCXXSourceCompiles) | ||
include(CMakePushCheckState) | ||
|
||
if(QNX) | ||
find_library(LIBRESOLV socket) | ||
else() | ||
find_library(LIBRESOLV resolv) | ||
endif() | ||
|
||
cmake_push_check_state() | ||
if(LIBRESOLV) | ||
list(APPEND CMAKE_REQUIRED_LIBRARIES "${LIBRESOLV}") | ||
endif() | ||
|
||
check_cxx_source_compiles(" | ||
#include <netinet/in.h> | ||
#include <resolv.h> | ||
int main(int, char **) | ||
{ | ||
res_init(); | ||
} | ||
" HAVE_RES_INIT) | ||
|
||
cmake_pop_check_state() | ||
|
||
if(HAVE_RES_INIT) | ||
set(WrapResolv_FOUND ON) | ||
add_library(WrapResolv::WrapResolv INTERFACE IMPORTED) | ||
if(LIBRESOLV) | ||
target_link_libraries(WrapResolv::WrapResolv INTERFACE "${LIBRESOLV}") | ||
endif() | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(WrapResolv DEFAULT_MSG WrapResolv_FOUND) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.