Remove optional dependencies on Boost's dynamic libraries.

Using precompiled Boost libraries can lead to depending on external dynamic libraries.
This commit is contained in:
Tsuda Kageyu
2016-12-09 09:42:29 +09:00
parent 8eda5d5053
commit 250c59f783
5 changed files with 33 additions and 107 deletions

View File

@ -54,61 +54,47 @@ check_cxx_source_compiles("
" HAVE_STD_ATOMIC)
if(NOT HAVE_STD_ATOMIC)
# We will not find BOOST_ATOMIC on macOS when BUILD_FRAMEWORK is set, since we don't want to link
# to `libboost_atomic-mt.dylib` within `tag.framework`.
if(NOT BUILD_FRAMEWORK)
find_package(Boost COMPONENTS atomic)
if(Boost_ATOMIC_FOUND)
set(HAVE_BOOST_ATOMIC 1)
else()
set(HAVE_BOOST_ATOMIC 0)
endif()
endif()
check_cxx_source_compiles("
int main() {
volatile int x;
__sync_add_and_fetch(&x, 1);
int y = __sync_sub_and_fetch(&x, 1);
return 0;
}
" HAVE_GCC_ATOMIC)
if(NOT HAVE_BOOST_ATOMIC)
if(NOT HAVE_GCC_ATOMIC)
check_cxx_source_compiles("
#include <libkern/OSAtomic.h>
int main() {
volatile int x;
__sync_add_and_fetch(&x, 1);
int y = __sync_sub_and_fetch(&x, 1);
volatile int32_t x;
OSAtomicIncrement32Barrier(&x);
int32_t y = OSAtomicDecrement32Barrier(&x);
return 0;
}
" HAVE_GCC_ATOMIC)
" HAVE_MAC_ATOMIC)
if(NOT HAVE_GCC_ATOMIC)
if(NOT HAVE_MAC_ATOMIC)
check_cxx_source_compiles("
#include <libkern/OSAtomic.h>
#include <windows.h>
int main() {
volatile int32_t x;
OSAtomicIncrement32Barrier(&x);
int32_t y = OSAtomicDecrement32Barrier(&x);
volatile LONG x;
InterlockedIncrement(&x);
LONG y = InterlockedDecrement(&x);
return 0;
}
" HAVE_MAC_ATOMIC)
" HAVE_WIN_ATOMIC)
if(NOT HAVE_MAC_ATOMIC)
if(NOT HAVE_WIN_ATOMIC)
check_cxx_source_compiles("
#include <windows.h>
#include <ia64intrin.h>
int main() {
volatile LONG x;
InterlockedIncrement(&x);
LONG y = InterlockedDecrement(&x);
volatile int x;
__sync_add_and_fetch(&x, 1);
int y = __sync_sub_and_fetch(&x, 1);
return 0;
}
" HAVE_WIN_ATOMIC)
if(NOT HAVE_WIN_ATOMIC)
check_cxx_source_compiles("
#include <ia64intrin.h>
int main() {
volatile int x;
__sync_add_and_fetch(&x, 1);
int y = __sync_sub_and_fetch(&x, 1);
return 0;
}
" HAVE_IA64_ATOMIC)
endif()
" HAVE_IA64_ATOMIC)
endif()
endif()
endif()
@ -230,15 +216,6 @@ if(NOT ZLIB_SOURCE)
else()
set(HAVE_ZLIB 0)
endif()
if(NOT HAVE_ZLIB)
find_package(Boost COMPONENTS iostreams zlib)
if(Boost_IOSTREAMS_FOUND AND Boost_ZLIB_FOUND)
set(HAVE_BOOST_ZLIB 1)
else()
set(HAVE_BOOST_ZLIB 0)
endif()
endif()
endif()
# Determine whether CppUnit is installed.