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()
|
else()
|
||||||
set(SYSLIBS ${SYSLIBS} "ws2_32.lib" "iphlpapi.lib")
|
set(SYSLIBS ${SYSLIBS} "ws2_32.lib" "iphlpapi.lib")
|
||||||
endif()
|
endif()
|
||||||
elseif(NOT APPLE AND NOT CMAKE_SYSTEM MATCHES "FreeBSD")
|
else()
|
||||||
if (USE_STATIC_LIBRARIES)
|
include(cmake/test_anl.cmake)
|
||||||
set(SYSLIBS ${SYSLIBS} "libanl.a")
|
if (HAVE_GETADDRINFO_A)
|
||||||
else()
|
set(SYSLIBS ${SYSLIBS} "${ANL_LIB}")
|
||||||
set(SYSLIBS ${SYSLIBS} "anl")
|
|
||||||
endif()
|
endif()
|
||||||
endif(WIN32)
|
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
|
/// set default DNS timeout to 60 seconds
|
||||||
const Poco::Timespan Poco::Net::DNS::DEFAULT_DNS_TIMEOUT = Poco::Timespan(60, 0);
|
const Poco::Timespan Poco::Net::DNS::DEFAULT_DNS_TIMEOUT = Poco::Timespan(60, 0);
|
||||||
|
|
||||||
#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
#if HAVE_GETADDRINFO_A
|
||||||
/** getaddrinfo иногда работает бесконечно долго.
|
/** getaddrinfo иногда работает бесконечно долго.
|
||||||
* Этот код использует getaddrinfo_a c некоторым таймаутом.
|
* Этот код использует getaddrinfo_a c некоторым таймаутом.
|
||||||
*
|
*
|
||||||
@ -224,7 +224,7 @@ HostEntry DNS::hostByName(const std::string& hostname, const Poco::Timespan * ti
|
|||||||
struct addrinfo hints;
|
struct addrinfo hints;
|
||||||
std::memset(&hints, 0, sizeof(hints));
|
std::memset(&hints, 0, sizeof(hints));
|
||||||
hints.ai_flags = hintFlags;
|
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_);
|
int rc = GetAddrinfo::instance().getaddrinfo(hostname.c_str(), NULL, &hints, &pAI, timeout_);
|
||||||
#else
|
#else
|
||||||
(void)timeout_;
|
(void)timeout_;
|
||||||
@ -278,7 +278,7 @@ HostEntry DNS::hostByAddress(const IPAddress& address, const Poco::Timespan * ti
|
|||||||
struct addrinfo hints;
|
struct addrinfo hints;
|
||||||
std::memset(&hints, 0, sizeof(hints));
|
std::memset(&hints, 0, sizeof(hints));
|
||||||
hints.ai_flags = hintFlags;
|
hints.ai_flags = hintFlags;
|
||||||
#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
#if HAVE_GETADDRINFO_A
|
||||||
int rc = GetAddrinfo::instance().getaddrinfo(fqname, NULL, &hints, &pAI, timeout_);
|
int rc = GetAddrinfo::instance().getaddrinfo(fqname, NULL, &hints, &pAI, timeout_);
|
||||||
#else
|
#else
|
||||||
(void)timeout_;
|
(void)timeout_;
|
||||||
|
Loading…
Reference in New Issue
Block a user