mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-24 18:50:49 +00:00
Merge pull request #311 from proller/libanl
fix static linking with libanl.a on ubuntu 16.10
This commit is contained in:
commit
319ded229e
@ -16,11 +16,10 @@ if(WIN32)
|
||||
else()
|
||||
set(SYSLIBS ${SYSLIBS} "ws2_32.lib" "iphlpapi.lib")
|
||||
endif()
|
||||
elseif(NOT APPLE AND NOT CMAKE_SYSTEM MATCHES "FreeBSD")
|
||||
if (USE_STATIC_LIBRARIES)
|
||||
set(SYSLIBS ${SYSLIBS} "libanl.a")
|
||||
else()
|
||||
set(SYSLIBS ${SYSLIBS} "anl")
|
||||
include(cmake/test_anl.cmake)
|
||||
if (HAVE_GETADDRINFO_A)
|
||||
set(SYSLIBS ${SYSLIBS} "${ANL_LIB}")
|
||||
endif()
|
||||
endif(WIN32)
|
||||
|
||||
|
26
contrib/libpoco/Net/cmake/test_anl.cmake
Normal file
26
contrib/libpoco/Net/cmake/test_anl.cmake
Normal file
@ -0,0 +1,26 @@
|
||||
#
|
||||
# On ubuntu 16.10 static link libanl.a fails with -fPIC error
|
||||
#
|
||||
|
||||
include(CheckCXXSourceRuns)
|
||||
|
||||
if (USE_STATIC_LIBRARIES)
|
||||
set(ANL_LIB_NAME "libanl.a")
|
||||
else()
|
||||
set(ANL_LIB_NAME "anl")
|
||||
endif()
|
||||
|
||||
find_library(ANL_LIB NAMES ${ANL_LIB_NAME})
|
||||
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES} ${ANL_LIB}")
|
||||
|
||||
check_cxx_source_runs("
|
||||
#include <netdb.h>
|
||||
int main() { getaddrinfo_a(GAI_NOWAIT, nullptr, 0, nullptr); return 0;}
|
||||
" HAVE_GETADDRINFO_A)
|
||||
|
||||
#message(STATUS "test_anl: USE_STATIC_LIBRARIES=${USE_STATIC_LIBRARIES} ANL_LIB_NAME=${ANL_LIB_NAME} ANL_LIB=${ANL_LIB} HAVE_GETADDRINFO_A=${HAVE_GETADDRINFO_A}")
|
||||
|
||||
if (HAVE_GETADDRINFO_A)
|
||||
add_definitions(-DHAVE_GETADDRINFO_A=1)
|
||||
endif ()
|
@ -34,7 +34,7 @@
|
||||
/// set default DNS timeout to 60 seconds
|
||||
const Poco::Timespan Poco::Net::DNS::DEFAULT_DNS_TIMEOUT = Poco::Timespan(60, 0);
|
||||
|
||||
#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||
#if HAVE_GETADDRINFO_A
|
||||
/** getaddrinfo иногда работает бесконечно долго.
|
||||
* Этот код использует getaddrinfo_a c некоторым таймаутом.
|
||||
*
|
||||
@ -224,7 +224,7 @@ HostEntry DNS::hostByName(const std::string& hostname, const Poco::Timespan * ti
|
||||
struct addrinfo hints;
|
||||
std::memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_flags = hintFlags;
|
||||
#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||
#if HAVE_GETADDRINFO_A
|
||||
int rc = GetAddrinfo::instance().getaddrinfo(hostname.c_str(), NULL, &hints, &pAI, timeout_);
|
||||
#else
|
||||
(void)timeout_;
|
||||
@ -278,7 +278,7 @@ HostEntry DNS::hostByAddress(const IPAddress& address, const Poco::Timespan * ti
|
||||
struct addrinfo hints;
|
||||
std::memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_flags = hintFlags;
|
||||
#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||
#if HAVE_GETADDRINFO_A
|
||||
int rc = GetAddrinfo::instance().getaddrinfo(fqname, NULL, &hints, &pAI, timeout_);
|
||||
#else
|
||||
(void)timeout_;
|
||||
|
Loading…
Reference in New Issue
Block a user