Репозиторий Sisyphus
Последнее обновление: 16 августа 2019 | Пакетов: 17338 | Посещений: 14648822
en ru br
Репозитории ALT

Группа :: Базы Данных
Пакет: mariadb

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: mariadb-10.3.10-alt-link-with-latomic-if-needed.patch
Скачать


diff --git a/configure.cmake b/configure.cmake
index d840dd4e565..cce5f0fb7a3 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -919,6 +919,7 @@ int main()
   return 0;
 }"
 HAVE_GCC_ATOMIC_BUILTINS)
+
 CHECK_CXX_SOURCE_COMPILES("
 int main()
 {
@@ -926,7 +927,32 @@ int main()
   long long int *ptr= &var;
   return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST);
 }"
-HAVE_GCC_C11_ATOMICS)
+HAVE_GCC_C11_ATOMICS_NO_LIB)
+
+# check if we need to link with libatomic for c11 atomics
+IF(UNIX AND NOT (HAVE_GCC_ATOMIC_BUILTINS OR HAVE_GCC_C11_ATOMICS_NO_LIB))
+  SET(SAVE_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
+  SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} atomic)
+  CHECK_CXX_SOURCE_COMPILES("
+  int main()
+  {
+    long long int var= 1;
+    long long int *ptr= &var;
+    return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST);
+  }"
+  HAVE_GCC_C11_ATOMICS_LIB)
+  IF(HAVE_GCC_C11_ATOMICS_LIB)
+    SET(LIBATOMIC "atomic")
+  ELSE()
+    SET(CMAKE_REQUIRED_LIBRARIES ${SAVE_CMAKE_REQUIRED_LIBRARIES})
+  ENDIF()
+ENDIF()
+
+IF (HAVE_GCC_C11_ATOMICS_NO_LIB OR HAVE_GCC_C11_ATOMICS_LIB)
+  SET(HAVE_GCC_C11_ATOMICS 1 CACHE INTERNAL "C11 atomic functions found")
+ELSE()
+  SET(HAVE_GCC_C11_ATOMICS "" CACHE INTERNAL "C11 atomic functions NOT found")
+ENDIF()
 IF(WITH_VALGRIND)
   SET(HAVE_valgrind 1)
diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt
index 93fca192b3a..94a99205cb9 100644
--- a/mysys/CMakeLists.txt
+++ b/mysys/CMakeLists.txt
@@ -74,7 +74,7 @@ ENDIF()
 ADD_CONVENIENCE_LIBRARY(mysys ${MYSYS_SOURCES})
 TARGET_LINK_LIBRARIES(mysys dbug strings mysys_ssl ${ZLIB_LIBRARY} 
- ${LIBNSL} ${LIBM} ${LIBRT} ${LIBDL} ${LIBSOCKET} ${LIBEXECINFO} ${CRC32_LIBRARY})
+ ${LIBNSL} ${LIBM} ${LIBRT} ${LIBDL} ${LIBSOCKET} ${LIBEXECINFO} ${CRC32_LIBRARY} ${LIBATOMIC})
 DTRACE_INSTRUMENT(mysys)
 IF(HAVE_BFD_H)
diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake
index c36c761f92f..ffb654b8f98 100644
--- a/storage/rocksdb/build_rocksdb.cmake
+++ b/storage/rocksdb/build_rocksdb.cmake
@@ -142,7 +142,7 @@ find_package(Threads REQUIRED)
 if(WIN32)
   set(SYSTEM_LIBS ${SYSTEM_LIBS} Shlwapi.lib Rpcrt4.lib)
 else()
-  set(SYSTEM_LIBS ${CMAKE_THREAD_LIBS_INIT} ${LIBRT})
+  set(SYSTEM_LIBS ${CMAKE_THREAD_LIBS_INIT} ${LIBRT} ${LIBATOMIC})
 endif()
 set(ROCKSDB_LIBS rocksdblib})
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin