summaryrefslogtreecommitdiffstats
path: root/src/ceph/cmake
diff options
context:
space:
mode:
authorQiaowei Ren <qiaowei.ren@intel.com>2018-01-04 13:43:33 +0800
committerQiaowei Ren <qiaowei.ren@intel.com>2018-01-05 11:59:39 +0800
commit812ff6ca9fcd3e629e49d4328905f33eee8ca3f5 (patch)
tree04ece7b4da00d9d2f98093774594f4057ae561d4 /src/ceph/cmake
parent15280273faafb77777eab341909a3f495cf248d9 (diff)
initial code repo
This patch creates initial code repo. For ceph, luminous stable release will be used for base code, and next changes and optimization for ceph will be added to it. For opensds, currently any changes can be upstreamed into original opensds repo (https://github.com/opensds/opensds), and so stor4nfv will directly clone opensds code to deploy stor4nfv environment. And the scripts for deployment based on ceph and opensds will be put into 'ci' directory. Change-Id: I46a32218884c75dda2936337604ff03c554648e4 Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Diffstat (limited to 'src/ceph/cmake')
-rw-r--r--src/ceph/cmake/modules/AddCephTest.cmake30
-rw-r--r--src/ceph/cmake/modules/BuildBoost.cmake193
-rw-r--r--src/ceph/cmake/modules/CTags.cmake40
-rw-r--r--src/ceph/cmake/modules/Distutils.cmake89
-rw-r--r--src/ceph/cmake/modules/FindBacktrace.cmake101
-rw-r--r--src/ceph/cmake/modules/FindCython.cmake26
-rw-r--r--src/ceph/cmake/modules/FindJeMalloc.cmake20
-rw-r--r--src/ceph/cmake/modules/FindLTTngUST.cmake111
-rw-r--r--src/ceph/cmake/modules/FindLZ4.cmake34
-rw-r--r--src/ceph/cmake/modules/FindNSPR.cmake104
-rw-r--r--src/ceph/cmake/modules/FindNSS.cmake126
-rw-r--r--src/ceph/cmake/modules/FindOpenLdap.cmake22
-rw-r--r--src/ceph/cmake/modules/FindPython3Interp.cmake148
-rw-r--r--src/ceph/cmake/modules/FindPython3Libs.cmake369
-rw-r--r--src/ceph/cmake/modules/Findaio.cmake18
-rw-r--r--src/ceph/cmake/modules/Findbabeltrace.cmake22
-rw-r--r--src/ceph/cmake/modules/Findblkid.cmake33
-rw-r--r--src/ceph/cmake/modules/Findcryptopp.cmake108
-rw-r--r--src/ceph/cmake/modules/Finddpdk.cmake75
-rw-r--r--src/ceph/cmake/modules/Findfcgi.cmake22
-rw-r--r--src/ceph/cmake/modules/Findfio.cmake12
-rw-r--r--src/ceph/cmake/modules/Findfuse.cmake28
-rw-r--r--src/ceph/cmake/modules/Findgperftools.cmake23
-rw-r--r--src/ceph/cmake/modules/Findkeyutils.cmake27
-rw-r--r--src/ceph/cmake/modules/Findleveldb.cmake18
-rw-r--r--src/ceph/cmake/modules/Findpmem.cmake15
-rw-r--r--src/ceph/cmake/modules/Findrdma.cmake49
-rw-r--r--src/ceph/cmake/modules/Findrocksdb.cmake18
-rw-r--r--src/ceph/cmake/modules/Findsnappy.cmake23
-rw-r--r--src/ceph/cmake/modules/Findudev.cmake34
-rw-r--r--src/ceph/cmake/modules/Findxfs.cmake33
-rw-r--r--src/ceph/cmake/modules/Findxio.cmake24
-rw-r--r--src/ceph/cmake/modules/Findzfs.cmake28
-rw-r--r--src/ceph/cmake/modules/GetGitRevisionDescription.cmake130
-rw-r--r--src/ceph/cmake/modules/GetGitRevisionDescription.cmake.in41
-rw-r--r--src/ceph/cmake/modules/MergeStaticLibraries.cmake85
-rw-r--r--src/ceph/cmake/modules/SIMDExt.cmake123
37 files changed, 2402 insertions, 0 deletions
diff --git a/src/ceph/cmake/modules/AddCephTest.cmake b/src/ceph/cmake/modules/AddCephTest.cmake
new file mode 100644
index 0000000..f6f6447
--- /dev/null
+++ b/src/ceph/cmake/modules/AddCephTest.cmake
@@ -0,0 +1,30 @@
+#AddCephTest is a module for adding tests to the "make check" target which runs CTest
+
+#adds makes target/script into a test, test to check target, sets necessary environment variables
+function(add_ceph_test test_name test_path)
+ add_test(NAME ${test_name} COMMAND ${test_path} ${ARGN})
+ add_dependencies(tests ${test_name})
+ set_property(TEST
+ ${test_name}
+ PROPERTY ENVIRONMENT
+ CEPH_ROOT=${CMAKE_SOURCE_DIR}
+ CEPH_BIN=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+ CEPH_LIB=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+ CEPH_BUILD_DIR=${CMAKE_BINARY_DIR}
+ LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib
+ PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}:${CMAKE_SOURCE_DIR}/src:$ENV{PATH}
+ PYTHONPATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cython_modules/lib.${PYTHON${PYTHON_VERSION}_VERSION_MAJOR}:${CMAKE_SOURCE_DIR}/src/pybind
+ CEPH_BUILD_VIRTUALENV=${CEPH_BUILD_VIRTUALENV})
+ # none of the tests should take more than 1 hour to complete
+ set_property(TEST
+ ${test_name}
+ PROPERTY TIMEOUT 3600)
+endfunction()
+
+#sets uniform compiler flags and link libraries
+function(add_ceph_unittest unittest_name unittest_path)
+ add_ceph_test(${unittest_name} ${unittest_path})
+ target_link_libraries(${unittest_name} ${UNITTEST_LIBS})
+ set_target_properties(${unittest_name} PROPERTIES COMPILE_FLAGS ${UNITTEST_CXX_FLAGS})
+endfunction()
+
diff --git a/src/ceph/cmake/modules/BuildBoost.cmake b/src/ceph/cmake/modules/BuildBoost.cmake
new file mode 100644
index 0000000..1e5bcd5
--- /dev/null
+++ b/src/ceph/cmake/modules/BuildBoost.cmake
@@ -0,0 +1,193 @@
+# This module builds Boost
+# executables are. It sets the following variables:
+#
+# Boost_FOUND : boolean - system has Boost
+# Boost_LIBRARIES : list(filepath) - the libraries needed to use Boost
+# Boost_INCLUDE_DIRS : list(path) - the Boost include directories
+#
+# Following hints are respected
+#
+# Boost_USE_STATIC_LIBS : boolean (default: OFF)
+# Boost_USE_MULTITHREADED : boolean (default: OFF)
+# BOOST_J: integer (defanult 1)
+
+function(do_build_boost version)
+ cmake_parse_arguments(Boost_BUILD "" "" COMPONENTS ${ARGN})
+ set(boost_features "variant=release")
+ if(Boost_USE_MULTITHREADED)
+ list(APPEND boost_features "threading=multi")
+ else()
+ list(APPEND boost_features "threading=single")
+ endif()
+ if(Boost_USE_STATIC_LIBS)
+ list(APPEND boost_features "link=static")
+ else()
+ list(APPEND boost_features "link=shared")
+ endif()
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ list(APPEND boost_features "address-model=64")
+ else()
+ list(APPEND boost_features "address-model=32")
+ endif()
+ set(BOOST_CXXFLAGS "-fPIC -w") # check on arm, etc <---XXX
+ list(APPEND boost_features "cxxflags=${BOOST_CXXFLAGS}")
+
+ string(REPLACE ";" "," boost_with_libs "${Boost_BUILD_COMPONENTS}")
+ # build b2 and prepare the project-config.jam for boost
+ set(configure_command
+ ./bootstrap.sh --prefix=<INSTALL_DIR>
+ --with-libraries=${boost_with_libs})
+
+ set(b2 ./b2)
+ if(BOOST_J)
+ message(STATUS "BUILDING Boost Libraries at j ${BOOST_J}")
+ list(APPEND b2 -j${BOOST_J})
+ endif()
+ if(CMAKE_VERBOSE_MAKEFILE)
+ list(APPEND b2 -d1)
+ else()
+ list(APPEND b2 -d0)
+ endif()
+
+ if(NOT CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL CMAKE_SYSTEM_PROCESSOR)
+ # we are crosscompiling
+ if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
+ set(b2_cc gcc)
+ elseif(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
+ set(b2_cc clang)
+ else()
+ message(SEND_ERROR "unknown compiler: ${CMAKE_CXX_COMPILER_ID}")
+ endif()
+ # edit the config.jam so, b2 will be able to use the specified toolset
+ execute_process(
+ COMMAND
+ sed -i
+ "s|using ${b2_cc} ;|using ${b2_cc} : ${CMAKE_SYSTEM_PROCESSOR} : ${CMAKE_CXX_COMPILER} ;|"
+ ${PROJECT_SOURCE_DIR}/src/boost/project-config.jam)
+ # use ${CMAKE_SYSTEM_PROCESSOR} as the version identifier of compiler
+ list(APPEND b2 toolset=${b2_cc}-${CMAKE_SYSTEM_PROCESSOR})
+ endif()
+
+ set(build_command
+ ${b2} headers stage
+ #"--buildid=ceph" # changes lib names--can omit for static
+ ${boost_features})
+ set(install_command
+ ${b2} install)
+ set(boost_root_dir "${CMAKE_BINARY_DIR}/boost")
+ if(EXISTS "${PROJECT_SOURCE_DIR}/src/boost/libs/config/include/boost/config.hpp")
+ message(STATUS "boost already in src")
+ set(source_dir
+ SOURCE_DIR "${PROJECT_SOURCE_DIR}/src/boost")
+ elseif(version VERSION_GREATER 1.63)
+ message(FATAL_ERROR "Unknown BOOST_REQUESTED_VERSION: ${version}")
+ else()
+ message(STATUS "boost will be downloaded...")
+ # NOTE: If you change this version number make sure the package is available
+ # at the three URLs below (may involve uploading to download.ceph.com)
+ set(boost_version 1.63.0)
+ set(boost_md5 1c837ecd990bb022d07e7aab32b09847)
+ string(REPLACE "." "_" boost_version_underscore ${boost_version} )
+ set(boost_url
+ https://dl.bintray.com/boostorg/release/${boost_version}/source/boost_${boost_version_underscore}.tar.bz2)
+ if(CMAKE_VERSION VERSION_GREATER 3.7)
+ set(boost_url
+ "${boost_url} http://downloads.sourceforge.net/project/boost/boost/${boost_version}/boost_${boost_version_underscore}.tar.bz2")
+ set(boost_url
+ "${boost_url} https://download.ceph.com/qa/boost_${boost_version_underscore}.tar.bz2")
+ endif()
+ set(source_dir
+ URL ${boost_url}
+ URL_MD5 ${boost_md5})
+ if(CMAKE_VERSION VERSION_GREATER 3.0)
+ list(APPEND source_dir DOWNLOAD_NO_PROGRESS 1)
+ endif()
+ endif()
+ # build all components in a single shot
+ include(ExternalProject)
+ ExternalProject_Add(Boost
+ ${source_dir}
+ CONFIGURE_COMMAND CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} ${configure_command}
+ BUILD_COMMAND CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} ${build_command}
+ BUILD_IN_SOURCE 1
+ INSTALL_COMMAND ${install_command}
+ PREFIX "${boost_root_dir}")
+endfunction()
+
+macro(build_boost version)
+ do_build_boost(version ${ARGN})
+ ExternalProject_Get_Property(Boost install_dir)
+ set(Boost_INCLUDE_DIRS ${install_dir}/include)
+ set(Boost_INCLUDE_DIR ${install_dir}/include)
+ # create the directory so cmake won't complain when looking at the imported
+ # target
+ file(MAKE_DIRECTORY ${Boost_INCLUDE_DIRS})
+ cmake_parse_arguments(Boost_BUILD "" "" COMPONENTS ${ARGN})
+ foreach(c ${Boost_BUILD_COMPONENTS})
+ string(TOUPPER ${c} upper_c)
+ if(Boost_USE_STATIC_LIBS)
+ add_library(Boost::${c} STATIC IMPORTED)
+ else()
+ add_library(Boost::${c} SHARED IMPORTED)
+ endif()
+ add_dependencies(Boost::${c} Boost)
+ if(Boost_USE_STATIC_LIBS)
+ set(Boost_${upper_c}_LIBRARY
+ ${install_dir}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}boost_${c}${CMAKE_STATIC_LIBRARY_SUFFIX})
+ else()
+ set(Boost_${upper_c}_LIBRARY
+ ${install_dir}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}boost_${c}${CMAKE_SHARED_LIBRARY_SUFFIX})
+ endif()
+ set_target_properties(Boost::${c} PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
+ IMPORTED_LOCATION "${Boost_${upper_c}_LIBRARY}")
+ list(APPEND Boost_LIBRARIES ${Boost_${upper_c}_LIBRARY})
+ endforeach()
+
+ # for header-only libraries
+ if(CMAKE_VERSION VERSION_LESS 3.3)
+ # only ALIAS and INTERFACE target names allow ":" in it, but
+ # INTERFACE library is not allowed until cmake 3.1
+ add_custom_target(Boost.boost DEPENDS Boost)
+ else()
+ add_library(Boost.boost INTERFACE IMPORTED)
+ set_target_properties(Boost.boost PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}")
+ add_dependencies(Boost.boost Boost)
+ endif()
+ find_package_handle_standard_args(Boost DEFAULT_MSG
+ Boost_INCLUDE_DIRS Boost_LIBRARIES)
+ mark_as_advanced(Boost_LIBRARIES BOOST_INCLUDE_DIRS)
+endmacro()
+
+function(maybe_add_boost_dep target)
+ get_target_property(imported ${target} IMPORTED)
+ if(imported)
+ return()
+ endif()
+ get_target_property(type ${target} TYPE)
+ if(NOT type MATCHES "OBJECT_LIBRARY|STATIC_LIBRARY|SHARED_LIBRARY|EXECUTABLE")
+ return()
+ endif()
+ get_target_property(sources ${target} SOURCES)
+ foreach(src ${sources})
+ get_filename_component(ext ${src} EXT)
+ # assuming all cxx source files include boost header(s)
+ if(ext MATCHES ".cc|.cpp|.cxx")
+ add_dependencies(${target} Boost.boost)
+ return()
+ endif()
+ endforeach()
+endfunction()
+
+# override add_library() to add Boost headers dependency
+function(add_library target)
+ _add_library(${target} ${ARGN})
+ maybe_add_boost_dep(${target})
+endfunction()
+
+function(add_executable target)
+ _add_executable(${target} ${ARGN})
+ maybe_add_boost_dep(${target})
+endfunction()
diff --git a/src/ceph/cmake/modules/CTags.cmake b/src/ceph/cmake/modules/CTags.cmake
new file mode 100644
index 0000000..55b2288
--- /dev/null
+++ b/src/ceph/cmake/modules/CTags.cmake
@@ -0,0 +1,40 @@
+find_program(CTAGS_EXECUTABLE ctags)
+
+function(add_tags name)
+ cmake_parse_arguments(TAGS "" "SRC_DIR;TAG_FILE" "EXCLUDE_OPTS;EXCLUDES" ${ARGN})
+ set(excludes ${TAGS_EXCLUDES})
+ if(TAGS_EXCLUDE_OPTS)
+ # always respect EXCLUDES_OPTS
+ list(APPEND excludes ${TAGS_EXCLUDE_OPTS})
+ else()
+ # exclude the submodules under SRC_DIR by default
+ execute_process(
+ COMMAND git config --file .gitmodules --get-regexp path
+ COMMAND awk "/${TAGS_SRC_DIR}/ { print $2 }"
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
+ RESULT_VARIABLE result_code
+ OUTPUT_VARIABLE submodules
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(${result_code} EQUAL 0)
+ string(REPLACE "${TAGS_SRC_DIR}/" "" submodules ${submodules})
+ # cmake list uses ";" as the delimiter, so split the string manually
+ # before iterating in it.
+ string(REPLACE "\n" ";" submodules ${submodules})
+ list(APPEND excludes ${submodules})
+ endif()
+ endif()
+ message(STATUS "exclude following files under ${TAGS_SRC_DIR}: ${excludes}")
+ # add_custom_target() accepts a list after "COMMAND" keyword, so we should
+ # make exclude_arg a list, otherwise cmake will quote it. and ctags will
+ # take it as as a single argument.
+ foreach(exclude ${excludes})
+ list(APPEND exclude_args --exclude=${exclude})
+ endforeach()
+ add_custom_target(${name}
+ COMMAND ${CTAGS_EXECUTABLE} -R --c++-kinds=+p --fields=+iaS --extra=+q ${exclude_args}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/${TAGS_SRC_DIR}
+ COMMENT "Building ctags file ${TAGS_TAG_FILE}"
+ VERBATIM)
+ set_source_files_properties(${CMAKE_SOURCE_DIR}/${TAGS_TAG_FILE} PROPERTIES
+ GENERATED true)
+endfunction()
diff --git a/src/ceph/cmake/modules/Distutils.cmake b/src/ceph/cmake/modules/Distutils.cmake
new file mode 100644
index 0000000..24d1a50
--- /dev/null
+++ b/src/ceph/cmake/modules/Distutils.cmake
@@ -0,0 +1,89 @@
+include(CMakeParseArguments)
+
+function(distutils_install_module name)
+ set(py_srcs setup.py README.rst requirements.txt test-requirements.txt bin ${name})
+ foreach(src ${py_srcs})
+ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${src})
+ list(APPEND py_clone ${CMAKE_CURRENT_BINARY_DIR}/${src})
+ add_custom_command(
+ OUTPUT ${src}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${src}
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/${src} ${src})
+ endif()
+ endforeach()
+ add_custom_target(${name}-clone ALL
+ DEPENDS ${py_clone})
+ cmake_parse_arguments(DU "" INSTALL_SCRIPT "" ${ARGN})
+ install(CODE "
+ set(options --prefix=${CMAKE_INSTALL_PREFIX})
+ if(DEFINED ENV{DESTDIR})
+ if(EXISTS /etc/debian_version)
+ list(APPEND options --install-layout=deb)
+ endif()
+ list(APPEND options --root=\$ENV{DESTDIR})
+ if(NOT \"${DU_INSTALL_SCRIPT}\" STREQUAL \"\")
+ list(APPEND options --install-script=${DU_INSTALL_SCRIPT})
+ endif()
+ endif()
+ execute_process(
+ COMMAND ${PYTHON${PYTHON_VERSION}_EXECUTABLE}
+ setup.py install \${options}
+ WORKING_DIRECTORY \"${CMAKE_CURRENT_BINARY_DIR}\")")
+endfunction(distutils_install_module)
+
+function(distutils_add_cython_module name src)
+ get_property(compiler_launcher GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
+ get_property(link_launcher GLOBAL PROPERTY RULE_LAUNCH_LINK)
+ set(PY_CC \"${compiler_launcher} ${CMAKE_C_COMPILER}\")
+ set(PY_CXX \"${compiler_launcher} ${CMAKE_CXX_COMPILER}\")
+ set(PY_LDSHARED \"${link_launcher} ${CMAKE_C_COMPILER} -shared\")
+ add_custom_target(${name} ALL
+ COMMAND
+ env
+ CC=${PY_CC}
+ CXX=${PY_CXX}
+ LDSHARED=${PY_LDSHARED}
+ OPT=\"-DNDEBUG -g -fwrapv -O2 -w\"
+ LDFLAGS=-L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+ CYTHON_BUILD_DIR=${CMAKE_CURRENT_BINARY_DIR}
+ CEPH_LIBDIR=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+ CFLAGS=\"-iquote${CMAKE_SOURCE_DIR}/src/include -w\"
+ ${PYTHON${PYTHON_VERSION}_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/setup.py
+ build --verbose --build-base ${CYTHON_MODULE_DIR}
+ --build-platlib ${CYTHON_MODULE_DIR}/lib.${PYTHON${PYTHON_VERSION}_VERSION_MAJOR}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ DEPENDS ${src})
+endfunction(distutils_add_cython_module)
+
+function(distutils_install_cython_module name)
+ install(CODE "
+ set(options --prefix=${CMAKE_INSTALL_PREFIX})
+ if(DEFINED ENV{DESTDIR})
+ if(EXISTS /etc/debian_version)
+ list(APPEND options --install-layout=deb)
+ endif()
+ list(APPEND options --root=\$ENV{DESTDIR})
+ else()
+ list(APPEND options --root=/)
+ endif()
+ execute_process(
+ COMMAND env
+ CYTHON_BUILD_DIR=${CMAKE_CURRENT_BINARY_DIR}
+ CEPH_LIBDIR=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+ CC=${CMAKE_C_COMPILER}
+ CPPFLAGS=\"-iquote${CMAKE_SOURCE_DIR}/src/include\"
+ LDFLAGS=\"-L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}\"
+ ${PYTHON${PYTHON_VERSION}_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/setup.py
+ build --verbose --build-base ${CYTHON_MODULE_DIR}
+ --build-platlib ${CYTHON_MODULE_DIR}/lib.${PYTHON${PYTHON_VERSION}_VERSION_MAJOR}
+ build_ext --cython-c-in-temp --build-temp ${CMAKE_CURRENT_BINARY_DIR} --cython-include-dirs ${PROJECT_SOURCE_DIR}/src/pybind/rados
+ install \${options} --single-version-externally-managed --record /dev/null
+ egg_info --egg-base ${CMAKE_CURRENT_BINARY_DIR}
+ --verbose
+ WORKING_DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}\"
+ RESULT_VARIABLE install_res)
+ if(NOT \"\${install_res}\" STREQUAL 0)
+ message(FATAL_ERROR \"Failed to build and install ${name} python module\")
+ endif()
+ ")
+endfunction(distutils_install_cython_module)
diff --git a/src/ceph/cmake/modules/FindBacktrace.cmake b/src/ceph/cmake/modules/FindBacktrace.cmake
new file mode 100644
index 0000000..936875c
--- /dev/null
+++ b/src/ceph/cmake/modules/FindBacktrace.cmake
@@ -0,0 +1,101 @@
+#.rst:
+# FindBacktrace
+# -------------
+#
+# Find provider for backtrace(3).
+#
+# Checks if OS supports backtrace(3) via either libc or custom library.
+# This module defines the following variables:
+#
+# ``Backtrace_HEADER``
+# The header file needed for backtrace(3). Cached.
+# Could be forcibly set by user.
+# ``Backtrace_INCLUDE_DIRS``
+# The include directories needed to use backtrace(3) header.
+# ``Backtrace_LIBRARIES``
+# The libraries (linker flags) needed to use backtrace(3), if any.
+# ``Backtrace_FOUND``
+# Is set if and only if backtrace(3) support detected.
+#
+# The following cache variables are also available to set or use:
+#
+# ``Backtrace_LIBRARY``
+# The external library providing backtrace, if any.
+# ``Backtrace_INCLUDE_DIR``
+# The directory holding the backtrace(3) header.
+#
+# Typical usage is to generate of header file using configure_file() with the
+# contents like the following::
+#
+# #cmakedefine01 Backtrace_FOUND
+# #if Backtrace_FOUND
+# # include <${Backtrace_HEADER}>
+# #endif
+#
+# And then reference that generated header file in actual source.
+
+#=============================================================================
+# Copyright 2013 Vadim Zhukov
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+
+include(CMakePushCheckState)
+include(CheckSymbolExists)
+include(FindPackageHandleStandardArgs)
+
+# List of variables to be provided to find_package_handle_standard_args()
+set(_Backtrace_STD_ARGS Backtrace_INCLUDE_DIR)
+
+if(Backtrace_HEADER)
+ set(_Backtrace_HEADER_TRY "${Backtrace_HEADER}")
+else(Backtrace_HEADER)
+ set(_Backtrace_HEADER_TRY "execinfo.h")
+endif(Backtrace_HEADER)
+
+find_path(Backtrace_INCLUDE_DIR "${_Backtrace_HEADER_TRY}")
+set(Backtrace_INCLUDE_DIRS ${Backtrace_INCLUDE_DIR})
+
+if (NOT DEFINED Backtrace_LIBRARY)
+ # First, check if we already have backtrace(), e.g., in libc
+ cmake_push_check_state(RESET)
+ set(CMAKE_REQUIRED_INCLUDES ${Backtrace_INCLUDE_DIRS})
+ set(CMAKE_REQUIRED_QUIET ${Backtrace_FIND_QUIETLY})
+ check_symbol_exists("backtrace" "${_Backtrace_HEADER_TRY}" _Backtrace_SYM_FOUND)
+ cmake_pop_check_state()
+endif()
+
+if(_Backtrace_SYM_FOUND)
+ # Avoid repeating the message() call below each time CMake is run.
+ if(NOT Backtrace_FIND_QUIETLY AND NOT DEFINED Backtrace_LIBRARY)
+ message(STATUS "backtrace facility detected in default set of libraries")
+ endif()
+ set(Backtrace_LIBRARY "" CACHE FILEPATH "Library providing backtrace(3), empty for default set of libraries")
+else()
+ # Check for external library, for non-glibc systems
+ if(Backtrace_INCLUDE_DIR)
+ # OpenBSD has libbacktrace renamed to libexecinfo
+ find_library(Backtrace_LIBRARY "execinfo")
+ elseif() # respect user wishes
+ set(_Backtrace_HEADER_TRY "backtrace.h")
+ find_path(Backtrace_INCLUDE_DIR ${_Backtrace_HEADER_TRY})
+ find_library(Backtrace_LIBRARY "backtrace")
+ endif()
+
+ # Prepend list with library path as it's more common practice
+ set(_Backtrace_STD_ARGS Backtrace_LIBRARY ${_Backtrace_STD_ARGS})
+endif()
+
+set(Backtrace_LIBRARIES ${Backtrace_LIBRARY})
+set(Backtrace_HEADER "${_Backtrace_HEADER_TRY}" CACHE STRING "Header providing backtrace(3) facility")
+
+find_package_handle_standard_args(Backtrace FOUND_VAR Backtrace_FOUND REQUIRED_VARS ${_Backtrace_STD_ARGS})
+mark_as_advanced(Backtrace_HEADER Backtrace_INCLUDE_DIR Backtrace_LIBRARY)
diff --git a/src/ceph/cmake/modules/FindCython.cmake b/src/ceph/cmake/modules/FindCython.cmake
new file mode 100644
index 0000000..0048bf7
--- /dev/null
+++ b/src/ceph/cmake/modules/FindCython.cmake
@@ -0,0 +1,26 @@
+#
+# Cython
+#
+
+SET(Cython${PYTHON_VERSION}_FOUND FALSE)
+# Try to run Cython, to make sure it works:
+execute_process(
+ COMMAND ${PYTHON${PYTHON_VERSION}_EXECUTABLE} -m cython --version
+ RESULT_VARIABLE CYTHON_RESULT
+ OUTPUT_QUIET
+ ERROR_QUIET
+ )
+if (CYTHON_RESULT EQUAL 0)
+ SET(Cython${PYTHON_VERSION}_FOUND TRUE)
+endif (CYTHON_RESULT EQUAL 0)
+
+
+IF (Cython${PYTHON_VERSION}_FOUND)
+ IF (NOT Cython_FIND_QUIETLY)
+ MESSAGE(STATUS "Found cython${PYTHON_VERSION}")
+ ENDIF (NOT Cython_FIND_QUIETLY)
+ELSE (Cython${PYTHON_VERSION}_FOUND)
+ IF (Cython_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find cython${PYTHON_VERSION}. Please install Cython.")
+ ENDIF (Cython_FIND_REQUIRED)
+ENDIF (Cython${PYTHON_VERSION}_FOUND)
diff --git a/src/ceph/cmake/modules/FindJeMalloc.cmake b/src/ceph/cmake/modules/FindJeMalloc.cmake
new file mode 100644
index 0000000..784560d
--- /dev/null
+++ b/src/ceph/cmake/modules/FindJeMalloc.cmake
@@ -0,0 +1,20 @@
+# Find the native JeMalloc includes and library
+# This module defines
+# JEMALLOC_INCLUDE_DIRS, where to find jemalloc.h, Set when
+# JEMALLOC_INCLUDE_DIR is found.
+# JEMALLOC_LIBRARIES, libraries to link against to use JeMalloc.
+# JEMALLOC_FOUND, If false, do not try to use JeMalloc.
+#
+
+find_path(JEMALLOC_INCLUDE_DIR jemalloc/jemalloc.h)
+
+find_library(JEMALLOC_LIBRARIES jemalloc)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(JeMalloc DEFAULT_MSG
+ JEMALLOC_LIBRARIES JEMALLOC_INCLUDE_DIR)
+
+mark_as_advanced(
+ JEMALLOC_INCLUDE_DIR
+ JEMALLOC_LIBRARIES)
+
diff --git a/src/ceph/cmake/modules/FindLTTngUST.cmake b/src/ceph/cmake/modules/FindLTTngUST.cmake
new file mode 100644
index 0000000..ac8f14c
--- /dev/null
+++ b/src/ceph/cmake/modules/FindLTTngUST.cmake
@@ -0,0 +1,111 @@
+#.rst:
+# FindLTTngUST
+# ------------
+#
+# This module finds the `LTTng-UST <http://lttng.org/>`__ library.
+#
+# Imported target
+# ^^^^^^^^^^^^^^^
+#
+# This module defines the following :prop_tgt:`IMPORTED` target:
+#
+# ``LTTng::UST``
+# The LTTng-UST library, if found
+#
+# Result variables
+# ^^^^^^^^^^^^^^^^
+#
+# This module sets the following
+#
+# ``LTTNGUST_FOUND``
+# ``TRUE`` if system has LTTng-UST
+# ``LTTNGUST_INCLUDE_DIRS``
+# The LTTng-UST include directories
+# ``LTTNGUST_LIBRARIES``
+# The libraries needed to use LTTng-UST
+# ``LTTNGUST_VERSION_STRING``
+# The LTTng-UST version
+# ``LTTNGUST_HAS_TRACEF``
+# ``TRUE`` if the ``tracef()`` API is available in the system's LTTng-UST
+# ``LTTNGUST_HAS_TRACELOG``
+# ``TRUE`` if the ``tracelog()`` API is available in the system's LTTng-UST
+
+#=============================================================================
+# Copyright 2016 Kitware, Inc.
+# Copyright 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+find_path(LTTNGUST_INCLUDE_DIRS NAMES lttng/tracepoint.h)
+find_library(LTTNGUST_LIBRARIES NAMES lttng-ust)
+
+if(LTTNGUST_INCLUDE_DIRS AND LTTNGUST_LIBRARIES)
+ # find tracef() and tracelog() support
+ set(LTTNGUST_HAS_TRACEF 0)
+ set(LTTNGUST_HAS_TRACELOG 0)
+
+ if(EXISTS "${LTTNGUST_INCLUDE_DIRS}/lttng/tracef.h")
+ set(LTTNGUST_HAS_TRACEF TRUE)
+ endif()
+
+ if(EXISTS "${LTTNGUST_INCLUDE_DIRS}/lttng/tracelog.h")
+ set(LTTNGUST_HAS_TRACELOG TRUE)
+ endif()
+
+ # get version
+ set(lttngust_version_file "${LTTNGUST_INCLUDE_DIRS}/lttng/ust-version.h")
+
+ if(EXISTS "${lttngust_version_file}")
+ file(STRINGS "${lttngust_version_file}" lttngust_version_major_string
+ REGEX "^[\t ]*#define[\t ]+LTTNG_UST_MAJOR_VERSION[\t ]+[0-9]+[\t ]*$")
+ file(STRINGS "${lttngust_version_file}" lttngust_version_minor_string
+ REGEX "^[\t ]*#define[\t ]+LTTNG_UST_MINOR_VERSION[\t ]+[0-9]+[\t ]*$")
+ file(STRINGS "${lttngust_version_file}" lttngust_version_patch_string
+ REGEX "^[\t ]*#define[\t ]+LTTNG_UST_PATCHLEVEL_VERSION[\t ]+[0-9]+[\t ]*$")
+ string(REGEX REPLACE ".*([0-9]+).*" "\\1"
+ lttngust_v_major "${lttngust_version_major_string}")
+ string(REGEX REPLACE ".*([0-9]+).*" "\\1"
+ lttngust_v_minor "${lttngust_version_minor_string}")
+ string(REGEX REPLACE ".*([0-9]+).*" "\\1"
+ lttngust_v_patch "${lttngust_version_patch_string}")
+ set(LTTNGUST_VERSION_STRING
+ "${lttngust_v_major}.${lttngust_v_minor}.${lttngust_v_patch}")
+ unset(lttngust_version_major_string)
+ unset(lttngust_version_minor_string)
+ unset(lttngust_version_patch_string)
+ unset(lttngust_v_major)
+ unset(lttngust_v_minor)
+ unset(lttngust_v_patch)
+ endif()
+
+ unset(lttngust_version_file)
+
+ if(NOT TARGET LTTng::UST)
+ add_library(LTTng::UST UNKNOWN IMPORTED)
+ set_target_properties(LTTng::UST PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${LTTNGUST_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS}
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${LTTNGUST_LIBRARIES}")
+ endif()
+
+ # add libdl to required libraries
+ set(LTTNGUST_LIBRARIES ${LTTNGUST_LIBRARIES} ${CMAKE_DL_LIBS})
+endif()
+
+# handle the QUIETLY and REQUIRED arguments and set LTTNGUST_FOUND to
+# TRUE if all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LTTngUST FOUND_VAR LTTNGUST_FOUND
+ REQUIRED_VARS LTTNGUST_LIBRARIES
+ LTTNGUST_INCLUDE_DIRS
+ VERSION_VAR LTTNGUST_VERSION_STRING)
+mark_as_advanced(LTTNGUST_LIBRARIES LTTNGUST_INCLUDE_DIRS)
diff --git a/src/ceph/cmake/modules/FindLZ4.cmake b/src/ceph/cmake/modules/FindLZ4.cmake
new file mode 100644
index 0000000..27d4bc5
--- /dev/null
+++ b/src/ceph/cmake/modules/FindLZ4.cmake
@@ -0,0 +1,34 @@
+# Try to find liblz4
+#
+# Once done, this will define
+#
+# LZ4_FOUND
+# LZ4_INCLUDE_DIR
+# LZ4_LIBRARY
+# LZ4_VERSION_STRING
+# LZ4_VERSION_MAJOR
+# LZ4_VERSION_MINOR
+# LZ4_VERSION_RELEASE
+
+find_path(LZ4_INCLUDE_DIR NAMES lz4.h)
+
+if(LZ4_INCLUDE_DIR AND EXISTS "${LZ4_INCLUDE_DIR}/lz4.h")
+ foreach(ver "MAJOR" "MINOR" "RELEASE")
+ file(STRINGS "${LZ4_INCLUDE_DIR}/lz4.h" LZ4_VER_${ver}_LINE
+ REGEX "^#define[ \t]+LZ4_VERSION_${ver}[ \t]+[0-9]+[ \t]+.*$")
+ string(REGEX REPLACE "^#define[ \t]+LZ4_VERSION_${ver}[ \t]+([0-9]+)[ \t]+.*$"
+ "\\1" LZ4_VERSION_${ver} "${LZ4_VER_${ver}_LINE}")
+ unset(${LZ4_VER_${ver}_LINE})
+ endforeach()
+ set(LZ4_VERSION_STRING
+ "${LZ4_VERSION_MAJOR}.${LZ4_VERSION_MINOR}.${LZ4_VERSION_RELEASE}")
+endif()
+
+find_library(LZ4_LIBRARY NAMES lz4)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LZ4
+ REQUIRED_VARS LZ4_LIBRARY LZ4_INCLUDE_DIR
+ VERSION_VAR LZ4_VERSION_STRING)
+
+mark_as_advanced(LZ4_INCLUDE_DIR LZ4_LIBRARY)
diff --git a/src/ceph/cmake/modules/FindNSPR.cmake b/src/ceph/cmake/modules/FindNSPR.cmake
new file mode 100644
index 0000000..94d6a06
--- /dev/null
+++ b/src/ceph/cmake/modules/FindNSPR.cmake
@@ -0,0 +1,104 @@
+# - Try to find NSPR
+# Once done this will define
+#
+# NSPR_FOUND - system has NSPR
+# NSPR_INCLUDE_DIRS - the NSPR include directory
+# NSPR_LIBRARIES - Link these to use NSPR
+# NSPR_DEFINITIONS - Compiler switches required for using NSPR
+#
+# Copyright (c) 2010 Andreas Schneider <asn@redhat.com>
+#
+# Redistribution and use is allowed according to the terms of the New
+# BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+
+if (NSPR_LIBRARIES AND NSPR_INCLUDE_DIRS)
+ # in cache already
+ set(NSPR_FOUND TRUE)
+else (NSPR_LIBRARIES AND NSPR_INCLUDE_DIRS)
+ find_package(PkgConfig)
+ if (PKG_CONFIG_FOUND)
+ pkg_check_modules(_NSPR nspr)
+ endif (PKG_CONFIG_FOUND)
+
+ find_path(NSPR_INCLUDE_DIR
+ NAMES
+ nspr.h
+ PATHS
+ ${_NSPR_INCLUDEDIR}
+ /usr/include
+ /usr/local/include
+ /opt/local/include
+ /sw/include
+ PATH_SUFFIXES
+ nspr4
+ nspr
+ )
+
+ find_library(PLDS4_LIBRARY
+ NAMES
+ plds4
+ PATHS
+ ${_NSPR_LIBDIR}
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ )
+
+ find_library(PLC4_LIBRARY
+ NAMES
+ plc4
+ PATHS
+ ${_NSPR_LIBDIR}
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ )
+
+ find_library(NSPR4_LIBRARY
+ NAMES
+ nspr4
+ PATHS
+ ${_NSPR_LIBDIR}
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ )
+
+ set(NSPR_INCLUDE_DIRS
+ ${NSPR_INCLUDE_DIR}
+ )
+
+ if (PLDS4_LIBRARY)
+ set(NSPR_LIBRARIES
+ ${NSPR_LIBRARIES}
+ ${PLDS4_LIBRARY}
+ )
+ endif (PLDS4_LIBRARY)
+
+ if (PLC4_LIBRARY)
+ set(NSPR_LIBRARIES
+ ${NSPR_LIBRARIES}
+ ${PLC4_LIBRARY}
+ )
+ endif (PLC4_LIBRARY)
+
+ if (NSPR4_LIBRARY)
+ set(NSPR_LIBRARIES
+ ${NSPR_LIBRARIES}
+ ${NSPR4_LIBRARY}
+ )
+ endif (NSPR4_LIBRARY)
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(NSPR DEFAULT_MSG NSPR_LIBRARIES NSPR_INCLUDE_DIRS)
+
+ # show the NSPR_INCLUDE_DIRS and NSPR_LIBRARIES variables only in the advanced view
+ mark_as_advanced(NSPR_INCLUDE_DIRS NSPR_LIBRARIES)
+
+endif (NSPR_LIBRARIES AND NSPR_INCLUDE_DIRS)
diff --git a/src/ceph/cmake/modules/FindNSS.cmake b/src/ceph/cmake/modules/FindNSS.cmake
new file mode 100644
index 0000000..a22e0f7
--- /dev/null
+++ b/src/ceph/cmake/modules/FindNSS.cmake
@@ -0,0 +1,126 @@
+# - Try to find NSS
+# Once done this will define
+#
+# NSS_FOUND - system has NSS
+# NSS_INCLUDE_DIRS - the NSS include directory
+# NSS_LIBRARIES - Link these to use NSS
+# NSS_DEFINITIONS - Compiler switches required for using NSS
+#
+# Copyright (c) 2010 Andreas Schneider <asn@redhat.com>
+#
+# Redistribution and use is allowed according to the terms of the New
+# BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+
+if (NSS_LIBRARIES AND NSS_INCLUDE_DIRS)
+ # in cache already
+ set(NSS_FOUND TRUE)
+else (NSS_LIBRARIES AND NSS_INCLUDE_DIRS)
+ find_package(PkgConfig)
+ if (PKG_CONFIG_FOUND)
+ pkg_check_modules(_NSS nss)
+ endif (PKG_CONFIG_FOUND)
+
+ find_path(NSS_INCLUDE_DIR
+ NAMES
+ pk11pub.h
+ PATHS
+ ${_NSS_INCLUDEDIR}
+ /usr/include
+ /usr/local/include
+ /opt/local/include
+ /sw/include
+ /usr/local/include/nss
+ PATH_SUFFIXES
+ nss3
+ nss
+ )
+
+ find_library(SSL3_LIBRARY
+ NAMES
+ ssl3
+ PATHS
+ ${_NSS_LIBDIR}
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ )
+
+ find_library(SMIME3_LIBRARY
+ NAMES
+ smime3
+ PATHS
+ ${_NSS_LIBDIR}
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ )
+
+ find_library(NSS3_LIBRARY
+ NAMES
+ nss3
+ PATHS
+ ${_NSS_LIBDIR}
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ /usr/lib/x86_64-linux-gnu
+ )
+
+ find_library(NSSUTIL3_LIBRARY
+ NAMES
+ nssutil3
+ PATHS
+ ${_NSS_LIBDIR}
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ )
+
+ set(NSS_INCLUDE_DIRS
+ ${NSS_INCLUDE_DIR}
+ )
+
+ if (SSL3_LIBRARY)
+ set(NSS_LIBRARIES
+ ${NSS_LIBRARIES}
+ ${SSL3_LIBRARY}
+ )
+ endif (SSL3_LIBRARY)
+
+ if (SMIME3_LIBRARY)
+ set(NSS_LIBRARIES
+ ${NSS_LIBRARIES}
+ ${SMIME3_LIBRARY}
+ )
+ endif (SMIME3_LIBRARY)
+
+ if (NSS3_LIBRARY)
+ set(NSS_LIBRARIES
+ ${NSS_LIBRARIES}
+ ${NSS3_LIBRARY}
+ )
+ endif (NSS3_LIBRARY)
+
+ if (NSSUTIL3_LIBRARY)
+ set(NSS_LIBRARIES
+ ${NSS_LIBRARIES}
+ ${NSSUTIL3_LIBRARY}
+ )
+ endif (NSSUTIL3_LIBRARY)
+
+ include(FindPackageHandleStandardArgs)
+ message(STATUS "NSS_LIBRARIES: ${NSS_LIBRARIES}")
+ message(STATUS "NSS_INCLUDE_DIRS: ${NSS_INCLUDE_DIRS}")
+ find_package_handle_standard_args(NSS DEFAULT_MSG NSS_LIBRARIES NSS_INCLUDE_DIRS)
+
+ # show the NSS_INCLUDE_DIRS and NSS_LIBRARIES variables only in the advanced view
+ mark_as_advanced(NSS_INCLUDE_DIRS NSS_LIBRARIES)
+
+endif (NSS_LIBRARIES AND NSS_INCLUDE_DIRS)
diff --git a/src/ceph/cmake/modules/FindOpenLdap.cmake b/src/ceph/cmake/modules/FindOpenLdap.cmake
new file mode 100644
index 0000000..35b711d
--- /dev/null
+++ b/src/ceph/cmake/modules/FindOpenLdap.cmake
@@ -0,0 +1,22 @@
+# - Find OpenLDAP C Libraries
+#
+# OPENLDAP_FOUND - True if found.
+# OPENLDAP_INCLUDE_DIR - Path to the openldap include directory
+# OPENLDAP_LIBRARIES - Paths to the ldap and lber libraries
+
+find_path(OPENLDAP_INCLUDE_DIR ldap.h PATHS
+ /usr/include
+ /opt/local/include
+ /usr/local/include)
+
+find_library(LDAP_LIBRARY ldap)
+find_library(LBER_LIBRARY lber)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(OpenLdap DEFAULT_MSG
+ OPENLDAP_INCLUDE_DIR LDAP_LIBRARY LBER_LIBRARY)
+
+set(OPENLDAP_LIBRARIES ${LDAP_LIBRARY} ${LBER_LIBRARY})
+
+mark_as_advanced(
+ OPENLDAP_INCLUDE_DIR LDAP_LIBRARY LBER_LIBRARY)
diff --git a/src/ceph/cmake/modules/FindPython3Interp.cmake b/src/ceph/cmake/modules/FindPython3Interp.cmake
new file mode 100644
index 0000000..a1d076f
--- /dev/null
+++ b/src/ceph/cmake/modules/FindPython3Interp.cmake
@@ -0,0 +1,148 @@
+#.rst:
+# FindPython3Interp
+# ----------------
+#
+# Find python interpreter
+#
+# This module finds if Python interpreter is installed and determines
+# where the executables are. This code sets the following variables:
+#
+# ::
+#
+# PYTHON3INTERP_FOUND - Was the Python executable found
+# PYTHON3_EXECUTABLE - path to the Python interpreter
+#
+#
+#
+# ::
+#
+# PYTHON3_VERSION_STRING - Python version found e.g. 2.5.2
+# PYTHON3_VERSION_MAJOR - Python major version found e.g. 2
+# PYTHON3_VERSION_MINOR - Python minor version found e.g. 5
+# PYTHON3_VERSION_PATCH - Python patch version found e.g. 2
+#
+#
+#
+# The Python3_ADDITIONAL_VERSIONS variable can be used to specify a list
+# of version numbers that should be taken into account when searching
+# for Python. You need to set this variable before calling
+# find_package(Python3Interp).
+#
+# If calling both ``find_package(Python3Interp)`` and
+# ``find_package(Python3Libs)``, call ``find_package(Python3Interp)`` first to
+# get the currently active Python version by default with a consistent version
+# of PYTHON3_LIBRARIES.
+
+#=============================================================================
+# Copyright 2005-2010 Kitware, Inc.
+# Copyright 2011 Bjoern Ricks <bjoern.ricks@gmail.com>
+# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+# nor the names of their contributors may be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#=============================================================================
+
+unset(_Python3_NAMES)
+
+set(_PYTHON3_VERSIONS 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
+
+if(Python3Interp_FIND_VERSION)
+ if(Python3Interp_FIND_VERSION_COUNT GREATER 1)
+ set(_PYTHON3_FIND_MAJ_MIN "${Python3Interp_FIND_VERSION_MAJOR}.${Python3Interp_FIND_VERSION_MINOR}")
+ list(APPEND _Python3_NAMES
+ python${_PYTHON3_FIND_MAJ_MIN}
+ python${Python3Interp_FIND_VERSION_MAJOR})
+ unset(_PYTHON3_FIND_OTHER_VERSIONS)
+ if(NOT Python3Interp_FIND_VERSION_EXACT)
+ foreach(_PYTHON3_V ${_PYTHON${Python3Interp_FIND_VERSION_MAJOR}_VERSIONS})
+ if(NOT _PYTHON3_V VERSION_LESS _PYTHON3_FIND_MAJ_MIN)
+ list(APPEND _PYTHON3_FIND_OTHER_VERSIONS ${_PYTHON3_V})
+ endif()
+ endforeach()
+ endif()
+ unset(_PYTHON3_FIND_MAJ_MIN)
+ else()
+ list(APPEND _Python3_NAMES python${Python3Interp_FIND_VERSION_MAJOR})
+ set(_PYTHON3_FIND_OTHER_VERSIONS ${_PYTHON${Python3Interp_FIND_VERSION_MAJOR}_VERSIONS})
+ endif()
+else()
+ set(_PYTHON3_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS})
+endif()
+find_program(PYTHON3_EXECUTABLE NAMES ${_Python3_NAMES})
+
+# Set up the versions we know about, in the order we will search. Always add
+# the user supplied additional versions to the front.
+set(_Python3_VERSIONS ${Python3_ADDITIONAL_VERSIONS})
+# If FindPython3Interp has already found the major and minor version,
+# insert that version next to get consistent versions of the interpreter and
+# library.
+if(DEFINED PYTHON3LIBS_VERSION_STRING)
+ string(REPLACE "." ";" _PYTHON3LIBS_VERSION "${PYTHON3LIBS_VERSION_STRING}")
+ list(GET _PYTHON3LIBS_VERSION 0 _PYTHON3LIBS_VERSION_MAJOR)
+ list(GET _PYTHON3LIBS_VERSION 1 _PYTHON3LIBS_VERSION_MINOR)
+ list(APPEND _Python3_VERSIONS ${_PYTHON3LIBS_VERSION_MAJOR}.${_PYTHON3LIBS_VERSION_MINOR})
+endif()
+# Search for the current active python version first
+list(APPEND _Python3_VERSIONS ";")
+list(APPEND _Python3_VERSIONS ${_PYTHON3_FIND_OTHER_VERSIONS})
+
+unset(_PYTHON3_FIND_OTHER_VERSIONS)
+unset(_PYTHON3_VERSIONS)
+
+# Search for newest python version if python executable isn't found
+if(NOT PYTHON3_EXECUTABLE)
+ foreach(_CURRENT_VERSION IN LISTS _Python3_VERSIONS)
+ set(_Python3_NAMES python${_CURRENT_VERSION})
+ if(WIN32)
+ list(APPEND _Python3_NAMES python)
+ endif()
+ find_program(PYTHON3_EXECUTABLE
+ NAMES ${_Python3_NAMES}
+ PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]
+ )
+ endforeach()
+endif()
+
+# determine python version string
+if(PYTHON3_EXECUTABLE)
+ execute_process(COMMAND "${PYTHON3_EXECUTABLE}" -c
+ "import sys; sys.stdout.write(';'.join([str(x) for x in sys.version_info[:3]]))"
+ OUTPUT_VARIABLE _VERSION)
+ string(REPLACE ";" "." PYTHON3_VERSION_STRING "${_VERSION}")
+ list(GET _VERSION 0 PYTHON3_VERSION_MAJOR)
+ list(GET _VERSION 1 PYTHON3_VERSION_MINOR)
+ list(GET _VERSION 2 PYTHON3_VERSION_PATCH)
+ unset(_VERSION)
+endif()
+
+# handle the QUIETLY and REQUIRED arguments and set PYTHON3INTERP_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Python3Interp REQUIRED_VARS PYTHON3_EXECUTABLE VERSION_VAR PYTHON3_VERSION_STRING)
+
+mark_as_advanced(PYTHON3_EXECUTABLE)
diff --git a/src/ceph/cmake/modules/FindPython3Libs.cmake b/src/ceph/cmake/modules/FindPython3Libs.cmake
new file mode 100644
index 0000000..38b44e2
--- /dev/null
+++ b/src/ceph/cmake/modules/FindPython3Libs.cmake
@@ -0,0 +1,369 @@
+#.rst:
+# FindPython3Libs
+# --------------
+#
+# Find python libraries
+#
+# This module finds if Python is installed and determines where the
+# include files and libraries are. It also determines what the name of
+# the library is. This code sets the following variables:
+#
+# ::
+#
+# PYTHON3LIBS_FOUND - have the Python libs been found
+# PYTHON3_LIBRARIES - path to the python library
+# PYTHON3_INCLUDE_PATH - path to where Python.h is found (deprecated)
+# PYTHON3_INCLUDE_DIRS - path to where Python.h is found
+# PYTHON3_DEBUG_LIBRARIES - path to the debug library (deprecated)
+# PYTHON3LIBS_VERSION_STRING - version of the Python libs found (since CMake 2.8.8)
+#
+#
+#
+# The Python3_ADDITIONAL_VERSIONS variable can be used to specify a list
+# of version numbers that should be taken into account when searching
+# for Python. You need to set this variable before calling
+# find_package(Python3Libs).
+#
+# If you'd like to specify the installation of Python to use, you should
+# modify the following cache variables:
+#
+# ::
+#
+# PYTHON3_LIBRARY - path to the python library
+# PYTHON3_INCLUDE_DIR - path to where Python.h is found
+#
+# If calling both ``find_package(PythonInterp)`` and
+# ``find_package(Python3Libs)``, call ``find_package(PythonInterp)`` first to
+# get the currently active Python version by default with a consistent version
+# of PYTHON3_LIBRARIES.
+
+#=============================================================================
+# Copyright 2001-2009 Kitware, Inc.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+# nor the names of their contributors may be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#=============================================================================
+
+# Use the executable's path as a hint
+set(_Python3_LIBRARY_PATH_HINT)
+if(PYTHON3_EXECUTABLE)
+ if(WIN32)
+ get_filename_component(_Python3_PREFIX ${PYTHON3_EXECUTABLE} PATH)
+ if(_Python3_PREFIX)
+ set(_Python3_LIBRARY_PATH_HINT ${_Python3_PREFIX}/libs)
+ endif()
+ unset(_Python3_PREFIX)
+ else()
+ get_filename_component(_Python3_PREFIX ${PYTHON3_EXECUTABLE} PATH)
+ get_filename_component(_Python3_PREFIX ${_Python3_PREFIX} PATH)
+ if(_Python3_PREFIX)
+ set(_Python3_LIBRARY_PATH_HINT ${_Python3_PREFIX}/lib)
+ endif()
+ unset(_Python3_PREFIX)
+ endif()
+endif()
+
+include(CMakeFindFrameworks)
+# Search for the python framework on Apple.
+CMAKE_FIND_FRAMEWORKS(Python)
+
+# Save CMAKE_FIND_FRAMEWORK
+if(DEFINED CMAKE_FIND_FRAMEWORK)
+ set(_Python3Libs_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK})
+else()
+ unset(_Python3Libs_CMAKE_FIND_FRAMEWORK)
+endif()
+# To avoid picking up the system Python.h pre-maturely.
+set(CMAKE_FIND_FRAMEWORK LAST)
+
+set(_PYTHON3_VERSIONS 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
+
+if(Python3Libs_FIND_VERSION)
+ if(Python3Libs_FIND_VERSION_COUNT GREATER 1)
+ set(_PYTHON3_FIND_MAJ_MIN "${Python3Libs_FIND_VERSION_MAJOR}.${Python3Libs_FIND_VERSION_MINOR}")
+ unset(_PYTHON3_FIND_OTHER_VERSIONS)
+ if(Python3Libs_FIND_VERSION_EXACT)
+ if(_PYTHON3_FIND_MAJ_MIN STREQUAL Python3Libs_FIND_VERSION)
+ set(_PYTHON3_FIND_OTHER_VERSIONS "${Python3Libs_FIND_VERSION}")
+ else()
+ set(_PYTHON3_FIND_OTHER_VERSIONS "${Python3Libs_FIND_VERSION}" "${_PYTHON3_FIND_MAJ_MIN}")
+ endif()
+ else()
+ foreach(_PYTHON3_V ${_PYTHON${Python3Libs_FIND_VERSION_MAJOR}_VERSIONS})
+ if(NOT _PYTHON3_V VERSION_LESS _PYTHON3_FIND_MAJ_MIN)
+ list(APPEND _PYTHON3_FIND_OTHER_VERSIONS ${_PYTHON3_V})
+ endif()
+ endforeach()
+ endif()
+ unset(_PYTHON3_FIND_MAJ_MIN)
+ else()
+ set(_PYTHON3_FIND_OTHER_VERSIONS ${_PYTHON${Python3Libs_FIND_VERSION_MAJOR}_VERSIONS})
+ endif()
+else()
+ set(_PYTHON3_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS})
+endif()
+
+# Set up the versions we know about, in the order we will search. Always add
+# the user supplied additional versions to the front.
+# If FindPythonInterp has already found the major and minor version,
+# insert that version between the user supplied versions and the stock
+# version list.
+set(_Python3_VERSIONS ${Python3_ADDITIONAL_VERSIONS})
+if(DEFINED PYTHON3_VERSION_MAJOR AND DEFINED PYTHON3_VERSION_MINOR)
+ list(APPEND _Python3_VERSIONS ${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR})
+endif()
+list(APPEND _Python3_VERSIONS ${_PYTHON3_FIND_OTHER_VERSIONS})
+
+unset(_PYTHON3_FIND_OTHER_VERSIONS)
+unset(_PYTHON3_VERSIONS)
+
+foreach(_CURRENT_VERSION ${_Python3_VERSIONS})
+ string(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION})
+ if(WIN32)
+ find_library(PYTHON3_DEBUG_LIBRARY
+ NAMES python${_CURRENT_VERSION_NO_DOTS}_d python
+ HINTS ${_Python3_LIBRARY_PATH_HINT}
+ PATHS
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
+ )
+ endif()
+
+ set(PYTHON3_FRAMEWORK_LIBRARIES)
+ if(Python3_FRAMEWORKS AND NOT PYTHON3_LIBRARY)
+ foreach(dir ${Python3_FRAMEWORKS})
+ list(APPEND PYTHON3_FRAMEWORK_LIBRARIES
+ ${dir}/Versions/${_CURRENT_VERSION}/lib)
+ endforeach()
+ endif()
+ find_library(PYTHON3_LIBRARY
+ NAMES
+ python${_CURRENT_VERSION_NO_DOTS}
+ python${_CURRENT_VERSION}mu
+ python${_CURRENT_VERSION}m
+ python${_CURRENT_VERSION}u
+ python${_CURRENT_VERSION}
+ HINTS
+ ${_Python3_LIBRARY_PATH_HINT}
+ PATHS
+ ${PYTHON3_FRAMEWORK_LIBRARIES}
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
+ # Avoid finding the .dll in the PATH. We want the .lib.
+ NO_SYSTEM_ENVIRONMENT_PATH
+ )
+ # Look for the static library in the Python config directory
+ find_library(PYTHON3_LIBRARY
+ NAMES python${_CURRENT_VERSION_NO_DOTS} python${_CURRENT_VERSION}
+ # Avoid finding the .dll in the PATH. We want the .lib.
+ NO_SYSTEM_ENVIRONMENT_PATH
+ # This is where the static library is usually located
+ PATH_SUFFIXES python${_CURRENT_VERSION}/config
+ )
+
+ # Don't search for include dir until library location is known
+ if(PYTHON3_LIBRARY)
+
+ # Use the library's install prefix as a hint
+ set(_Python3_INCLUDE_PATH_HINT)
+ get_filename_component(_Python3_PREFIX ${PYTHON3_LIBRARY} PATH)
+ get_filename_component(_Python3_PREFIX ${_Python3_PREFIX} PATH)
+ if(_Python3_PREFIX)
+ set(_Python3_INCLUDE_PATH_HINT ${_Python3_PREFIX}/include)
+ endif()
+ unset(_Python3_PREFIX)
+
+ # Add framework directories to the search paths
+ set(PYTHON3_FRAMEWORK_INCLUDES)
+ if(Python3_FRAMEWORKS AND NOT PYTHON3_INCLUDE_DIR)
+ foreach(dir ${Python3_FRAMEWORKS})
+ list(APPEND PYTHON3_FRAMEWORK_INCLUDES
+ ${dir}/Versions/${_CURRENT_VERSION}/include)
+ endforeach()
+ endif()
+
+ find_path(PYTHON3_INCLUDE_DIR
+ NAMES Python.h
+ HINTS
+ ${_Python3_INCLUDE_PATH_HINT}
+ PATHS
+ ${PYTHON3_FRAMEWORK_INCLUDES}
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include
+ PATH_SUFFIXES
+ python${_CURRENT_VERSION}mu
+ python${_CURRENT_VERSION}m
+ python${_CURRENT_VERSION}u
+ python${_CURRENT_VERSION}
+ )
+ endif()
+
+ # For backward compatibility, set PYTHON3_INCLUDE_PATH.
+ set(PYTHON3_INCLUDE_PATH "${PYTHON3_INCLUDE_DIR}")
+
+ if(PYTHON3_INCLUDE_DIR AND EXISTS "${PYTHON3_INCLUDE_DIR}/patchlevel.h")
+ file(STRINGS "${PYTHON3_INCLUDE_DIR}/patchlevel.h" python3_version_str
+ REGEX "^#define[ \t]+PY_VERSION[ \t]+\"[^\"]+\"")
+ string(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"]+)\".*" "\\1"
+ PYTHON3LIBS_VERSION_STRING "${python3_version_str}")
+ unset(python3_version_str)
+ endif()
+
+ if(PYTHON3_LIBRARY AND PYTHON3_INCLUDE_DIR)
+ break()
+ endif()
+endforeach()
+
+unset(_Python3_INCLUDE_PATH_HINT)
+unset(_Python3_LIBRARY_PATH_HINT)
+
+mark_as_advanced(
+ PYTHON3_DEBUG_LIBRARY
+ PYTHON3_LIBRARY
+ PYTHON3_INCLUDE_DIR
+)
+
+# We use PYTHON3_INCLUDE_DIR, PYTHON3_LIBRARY and PYTHON3_DEBUG_LIBRARY for the
+# cache entries because they are meant to specify the location of a single
+# library. We now set the variables listed by the documentation for this
+# module.
+set(PYTHON3_INCLUDE_DIRS "${PYTHON3_INCLUDE_DIR}")
+set(PYTHON3_DEBUG_LIBRARIES "${PYTHON3_DEBUG_LIBRARY}")
+
+# These variables have been historically named in this module different from
+# what SELECT_LIBRARY_CONFIGURATIONS() expects.
+set(PYTHON3_LIBRARY_DEBUG "${PYTHON3_DEBUG_LIBRARY}")
+set(PYTHON3_LIBRARY_RELEASE "${PYTHON3_LIBRARY}")
+include(SelectLibraryConfigurations)
+SELECT_LIBRARY_CONFIGURATIONS(PYTHON3)
+# SELECT_LIBRARY_CONFIGURATIONS() sets ${PREFIX}_FOUND if it has a library.
+# Unset this, this prefix doesn't match the module prefix, they are different
+# for historical reasons.
+unset(PYTHON3_FOUND)
+
+# Restore CMAKE_FIND_FRAMEWORK
+if(DEFINED _Python3Libs_CMAKE_FIND_FRAMEWORK)
+ set(CMAKE_FIND_FRAMEWORK ${_Python3Libs_CMAKE_FIND_FRAMEWORK})
+ unset(_Python3Libs_CMAKE_FIND_FRAMEWORK)
+else()
+ unset(CMAKE_FIND_FRAMEWORK)
+endif()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Python3Libs
+ REQUIRED_VARS PYTHON3_LIBRARIES PYTHON3_INCLUDE_DIRS
+ VERSION_VAR PYTHON3LIBS_VERSION_STRING)
+
+# PYTHON3_ADD_MODULE(<name> src1 src2 ... srcN) is used to build modules for python.
+# PYTHON3_WRITE_MODULES_HEADER(<filename>) writes a header file you can include
+# in your sources to initialize the static python modules
+function(PYTHON3_ADD_MODULE _NAME )
+ get_property(_TARGET_SUPPORTS_SHARED_LIBS
+ GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
+ option(PYTHON3_ENABLE_MODULE_${_NAME} "Add module ${_NAME}" TRUE)
+ option(PYTHON3_MODULE_${_NAME}_BUILD_SHARED
+ "Add module ${_NAME} shared" ${_TARGET_SUPPORTS_SHARED_LIBS})
+
+ # Mark these options as advanced
+ mark_as_advanced(PYTHON3_ENABLE_MODULE_${_NAME}
+ PYTHON3_MODULE_${_NAME}_BUILD_SHARED)
+
+ if(PYTHON3_ENABLE_MODULE_${_NAME})
+ if(PYTHON3_MODULE_${_NAME}_BUILD_SHARED)
+ set(PY_MODULE_TYPE MODULE)
+ else()
+ set(PY_MODULE_TYPE STATIC)
+ set_property(GLOBAL APPEND PROPERTY PY_STATIC_MODULES_LIST ${_NAME})
+ endif()
+
+ set_property(GLOBAL APPEND PROPERTY PY_MODULES_LIST ${_NAME})
+ add_library(${_NAME} ${PY_MODULE_TYPE} ${ARGN})
+# target_link_libraries(${_NAME} ${PYTHON3_LIBRARIES})
+
+ if(PYTHON3_MODULE_${_NAME}_BUILD_SHARED)
+ set_target_properties(${_NAME} PROPERTIES PREFIX "${PYTHON3_MODULE_PREFIX}")
+ if(WIN32 AND NOT CYGWIN)
+ set_target_properties(${_NAME} PROPERTIES SUFFIX ".pyd")
+ endif()
+ endif()
+
+ endif()
+endfunction()
+
+function(PYTHON3_WRITE_MODULES_HEADER _filename)
+
+ get_property(PY_STATIC_MODULES_LIST GLOBAL PROPERTY PY_STATIC_MODULES_LIST)
+
+ get_filename_component(_name "${_filename}" NAME)
+ string(REPLACE "." "_" _name "${_name}")
+ string(TOUPPER ${_name} _nameUpper)
+ set(_filename ${CMAKE_CURRENT_BINARY_DIR}/${_filename})
+
+ set(_filenameTmp "${_filename}.in")
+ file(WRITE ${_filenameTmp} "/*Created by cmake, do not edit, changes will be lost*/\n")
+ file(APPEND ${_filenameTmp}
+"#ifndef ${_nameUpper}
+#define ${_nameUpper}
+
+#include <Python.h>
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif /* __cplusplus */
+
+")
+
+ foreach(_currentModule ${PY_STATIC_MODULES_LIST})
+ file(APPEND ${_filenameTmp} "extern void init${PYTHON3_MODULE_PREFIX}${_currentModule}(void);\n\n")
+ endforeach()
+
+ file(APPEND ${_filenameTmp}
+"#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+")
+
+
+ foreach(_currentModule ${PY_STATIC_MODULES_LIST})
+ file(APPEND ${_filenameTmp} "int ${_name}_${_currentModule}(void) \n{\n static char name[]=\"${PYTHON3_MODULE_PREFIX}${_currentModule}\"; return PyImport_AppendInittab(name, init${PYTHON3_MODULE_PREFIX}${_currentModule});\n}\n\n")
+ endforeach()
+
+ file(APPEND ${_filenameTmp} "void ${_name}_LoadAllPythonModules(void)\n{\n")
+ foreach(_currentModule ${PY_STATIC_MODULES_LIST})
+ file(APPEND ${_filenameTmp} " ${_name}_${_currentModule}();\n")
+ endforeach()
+ file(APPEND ${_filenameTmp} "}\n\n")
+ file(APPEND ${_filenameTmp} "#ifndef EXCLUDE_LOAD_ALL_FUNCTION\nvoid CMakeLoadAllPythonModules(void)\n{\n ${_name}_LoadAllPythonModules();\n}\n#endif\n\n#endif\n")
+
+# with configure_file() cmake complains that you may not use a file created using file(WRITE) as input file for configure_file()
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_filenameTmp}" "${_filename}" OUTPUT_QUIET ERROR_QUIET)
+
+endfunction()
diff --git a/src/ceph/cmake/modules/Findaio.cmake b/src/ceph/cmake/modules/Findaio.cmake
new file mode 100644
index 0000000..04b0642
--- /dev/null
+++ b/src/ceph/cmake/modules/Findaio.cmake
@@ -0,0 +1,18 @@
+# - Find AIO
+#
+# AIO_INCLUDE - Where to find libaio.h
+# AIO_LIBS - List of libraries when using AIO.
+# AIO_FOUND - True if AIO found.
+
+find_path(AIO_INCLUDE_DIR
+ libaio.h
+ HINTS $ENV{AIO_ROOT}/include)
+
+find_library(AIO_LIBRARIES
+ aio
+ HINTS $ENV{AIO_ROOT}/lib)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(aio DEFAULT_MSG AIO_LIBRARIES AIO_INCLUDE_DIR)
+
+mark_as_advanced(AIO_INCLUDE_DIR AIO_LIBRARIES)
diff --git a/src/ceph/cmake/modules/Findbabeltrace.cmake b/src/ceph/cmake/modules/Findbabeltrace.cmake
new file mode 100644
index 0000000..6b29a24
--- /dev/null
+++ b/src/ceph/cmake/modules/Findbabeltrace.cmake
@@ -0,0 +1,22 @@
+# - Find Babeltrace
+# This module defines the following variables:
+# BABELTRACE_FOUND = Was Babeltrace found or not?
+# BABELTRACE_EXECUTABLE = The path to lttng command
+# BABELTRACE_LIBRARIES = The list of libraries to link to when using Babeltrace
+# BABELTRACE_INCLUDE_DIR = The path to Babeltrace include directory
+#
+
+find_path(BABELTRACE_INCLUDE_DIR
+ NAMES babeltrace/babeltrace.h babeltrace/ctf/events.h babeltrace/ctf/iterator.h)
+
+find_library(BABELTRACE_LIBRARY
+ NAMES babeltrace babeltrace-ctf)
+
+find_program(BABELTRACE_EXECUTABLE
+ NAMES babeltrace babeltrace-ctf)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(babeltrace DEFAULT_MSG
+ BABELTRACE_INCLUDE_DIR BABELTRACE_LIBRARY)
+set(BABELTRACE_LIBRARIES ${BABELTRACE_LIBRARY})
+mark_as_advanced(BABELTRACE_INCLUDE_DIR BABELTRACE_LIBRARY)
diff --git a/src/ceph/cmake/modules/Findblkid.cmake b/src/ceph/cmake/modules/Findblkid.cmake
new file mode 100644
index 0000000..66de92f
--- /dev/null
+++ b/src/ceph/cmake/modules/Findblkid.cmake
@@ -0,0 +1,33 @@
+# Copyright (C) 2007-2012 Hypertable, Inc.
+#
+# This file is part of Hypertable.
+#
+# Hypertable is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or any later version.
+#
+# Hypertable is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Hypertable. If not, see <http://www.gnu.org/licenses/>
+#
+
+# - Find libblkid
+# Find the blkid library and includes
+#
+# BLKID_INCLUDE_DIR - where to find blkid.h, etc.
+# BLKID_LIBRARIES - List of libraries when using blkid.
+# BLKID_FOUND - True if blkid found.
+
+find_path(BLKID_INCLUDE_DIR blkid/blkid.h)
+
+find_library(BLKID_LIBRARIES blkid)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(blkid DEFAULT_MSG BLKID_LIBRARIES BLKID_INCLUDE_DIR)
+
+mark_as_advanced(BLKID_LIBRARIES BLKID_INCLUDE_DIR)
diff --git a/src/ceph/cmake/modules/Findcryptopp.cmake b/src/ceph/cmake/modules/Findcryptopp.cmake
new file mode 100644
index 0000000..f7c3b9b
--- /dev/null
+++ b/src/ceph/cmake/modules/Findcryptopp.cmake
@@ -0,0 +1,108 @@
+# Module for locating the Crypto++ encryption library.
+#
+# Customizable variables:
+# CRYPTOPP_ROOT_DIR
+# This variable points to the CryptoPP root directory. On Windows the
+# library location typically will have to be provided explicitly using the
+# -D command-line option. The directory should include the include/cryptopp,
+# lib and/or bin sub-directories.
+#
+# Read-only variables:
+# CRYPTOPP_FOUND
+# Indicates whether the library has been found.
+#
+# CRYPTOPP_INCLUDE_DIRS
+# Points to the CryptoPP include directory.
+#
+# CRYPTOPP_LIBRARIES
+# Points to the CryptoPP libraries that should be passed to
+# target_link_libararies.
+#
+#
+# Copyright (c) 2012 Sergiu Dotenco
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+INCLUDE (FindPackageHandleStandardArgs)
+
+FIND_PATH (CRYPTOPP_ROOT_DIR
+ NAMES cryptopp/cryptlib.h include/cryptopp/cryptlib.h
+ PATHS ENV CRYPTOPPROOT
+ DOC "CryptoPP root directory")
+
+# Re-use the previous path:
+FIND_PATH (CRYPTOPP_INCLUDE_DIR
+ NAMES cryptopp/cryptlib.h
+ HINTS ${CRYPTOPP_ROOT_DIR}
+ PATH_SUFFIXES include
+ DOC "CryptoPP include directory")
+
+FIND_LIBRARY (CRYPTOPP_LIBRARY_DEBUG
+ NAMES cryptlibd cryptoppd
+ HINTS ${CRYPTOPP_ROOT_DIR}
+ PATH_SUFFIXES lib
+ DOC "CryptoPP debug library")
+
+FIND_LIBRARY (CRYPTOPP_LIBRARY_RELEASE
+ NAMES cryptlib cryptopp
+ HINTS ${CRYPTOPP_ROOT_DIR}
+ PATH_SUFFIXES lib
+ DOC "CryptoPP release library")
+
+IF (CRYPTOPP_LIBRARY_DEBUG AND CRYPTOPP_LIBRARY_RELEASE)
+ SET (CRYPTOPP_LIBRARY
+ optimized ${CRYPTOPP_LIBRARY_RELEASE}
+ debug ${CRYPTOPP_LIBRARY_DEBUG} CACHE DOC "CryptoPP library")
+ELSEIF (CRYPTOPP_LIBRARY_RELEASE)
+ SET (CRYPTOPP_LIBRARY ${CRYPTOPP_LIBRARY_RELEASE} CACHE DOC
+ "CryptoPP library")
+ENDIF (CRYPTOPP_LIBRARY_DEBUG AND CRYPTOPP_LIBRARY_RELEASE)
+
+IF (CRYPTOPP_INCLUDE_DIR)
+ SET (_CRYPTOPP_VERSION_HEADER ${CRYPTOPP_INCLUDE_DIR}/cryptopp/config.h)
+
+ IF (EXISTS ${_CRYPTOPP_VERSION_HEADER})
+ FILE (STRINGS ${_CRYPTOPP_VERSION_HEADER} _CRYPTOPP_VERSION_TMP REGEX
+ "^#define CRYPTOPP_VERSION[ \t]+[0-9]+$")
+
+ STRING (REGEX REPLACE
+ "^#define CRYPTOPP_VERSION[ \t]+([0-9]+)" "\\1" _CRYPTOPP_VERSION_TMP
+ ${_CRYPTOPP_VERSION_TMP})
+
+ STRING (REGEX REPLACE "([0-9]+)[0-9][0-9]" "\\1" CRYPTOPP_VERSION_MAJOR
+ ${_CRYPTOPP_VERSION_TMP})
+ STRING (REGEX REPLACE "[0-9]([0-9])[0-9]" "\\1" CRYPTOPP_VERSION_MINOR
+ ${_CRYPTOPP_VERSION_TMP})
+ STRING (REGEX REPLACE "[0-9][0-9]([0-9])" "\\1" CRYPTOPP_VERSION_PATCH
+ ${_CRYPTOPP_VERSION_TMP})
+
+ SET (CRYPTOPP_VERSION_COUNT 3)
+ SET (CRYPTOPP_VERSION
+ ${CRYPTOPP_VERSION_MAJOR}.${CRYPTOPP_VERSION_MINOR}.${CRYPTOPP_VERSION_PATCH})
+ ENDIF (EXISTS ${_CRYPTOPP_VERSION_HEADER})
+ENDIF (CRYPTOPP_INCLUDE_DIR)
+
+SET (CRYPTOPP_INCLUDE_DIRS ${CRYPTOPP_INCLUDE_DIR})
+SET (CRYPTOPP_LIBRARIES ${CRYPTOPP_LIBRARY})
+
+MARK_AS_ADVANCED (CRYPTOPP_INCLUDE_DIR CRYPTOPP_LIBRARY CRYPTOPP_LIBRARY_DEBUG
+ CRYPTOPP_LIBRARY_RELEASE)
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS (cryptopp REQUIRED_VARS CRYPTOPP_ROOT_DIR
+ CRYPTOPP_INCLUDE_DIR CRYPTOPP_LIBRARY VERSION_VAR CRYPTOPP_VERSION)
diff --git a/src/ceph/cmake/modules/Finddpdk.cmake b/src/ceph/cmake/modules/Finddpdk.cmake
new file mode 100644
index 0000000..343420a
--- /dev/null
+++ b/src/ceph/cmake/modules/Finddpdk.cmake
@@ -0,0 +1,75 @@
+# Try to find dpdk
+#
+# Once done, this will define
+#
+# DPDK_FOUND
+# DPDK_INCLUDE_DIR
+# DPDK_LIBRARIES
+
+find_path(DPDK_INCLUDE_DIR rte_config.h
+ PATH_SUFFIXES dpdk)
+find_library(DPDK_rte_hash_LIBRARY rte_hash)
+find_library(DPDK_rte_kvargs_LIBRARY rte_kvargs)
+find_library(DPDK_rte_mbuf_LIBRARY rte_mbuf)
+find_library(DPDK_rte_ethdev_LIBRARY rte_ethdev)
+find_library(DPDK_rte_mempool_LIBRARY rte_mempool)
+find_library(DPDK_rte_ring_LIBRARY rte_ring)
+find_library(DPDK_rte_eal_LIBRARY rte_eal)
+find_library(DPDK_rte_cmdline_LIBRARY rte_cmdline)
+find_library(DPDK_rte_pmd_bond_LIBRARY rte_pmd_bond)
+find_library(DPDK_rte_pmd_vmxnet3_uio_LIBRARY rte_pmd_vmxnet3_uio)
+find_library(DPDK_rte_pmd_ixgbe_LIBRARY rte_pmd_ixgbe)
+find_library(DPDK_rte_pmd_i40e_LIBRARY rte_pmd_i40e)
+find_library(DPDK_rte_pmd_ring_LIBRARY rte_pmd_ring)
+find_library(DPDK_rte_pmd_af_packet_LIBRARY rte_pmd_af_packet)
+
+set(check_LIBRARIES
+ ${DPDK_rte_hash_LIBRARY}
+ ${DPDK_rte_kvargs_LIBRARY}
+ ${DPDK_rte_mbuf_LIBRARY}
+ ${DPDK_rte_ethdev_LIBRARY}
+ ${DPDK_rte_mempool_LIBRARY}
+ ${DPDK_rte_ring_LIBRARY}
+ ${DPDK_rte_eal_LIBRARY}
+ ${DPDK_rte_cmdline_LIBRARY}
+ ${DPDK_rte_pmd_bond_LIBRARY}
+ ${DPDK_rte_pmd_vmxnet3_uio_LIBRARY}
+ ${DPDK_rte_pmd_ixgbe_LIBRARY}
+ ${DPDK_rte_pmd_i40e_LIBRARY}
+ ${DPDK_rte_pmd_ring_LIBRARY}
+ ${DPDK_rte_pmd_af_packet_LIBRARY})
+
+mark_as_advanced(DPDK_INCLUDE_DIR
+ DPDK_rte_hash_LIBRARY
+ DPDK_rte_kvargs_LIBRARY
+ DPDK_rte_mbuf_LIBRARY
+ DPDK_rte_ethdev_LIBRARY
+ DPDK_rte_mempool_LIBRARY
+ DPDK_rte_ring_LIBRARY
+ DPDK_rte_eal_LIBRARY
+ DPDK_rte_cmdline_LIBRARY
+ DPDK_rte_pmd_bond_LIBRARY
+ DPDK_rte_pmd_vmxnet3_uio_LIBRARY
+ DPDK_rte_pmd_ixgbe_LIBRARY
+ DPDK_rte_pmd_i40e_LIBRARY
+ DPDK_rte_pmd_ring_LIBRARY
+ DPDK_rte_pmd_af_packet_LIBRARY)
+
+if (EXISTS ${WITH_DPDK_MLX5})
+ find_library(DPDK_rte_pmd_mlx5_LIBRARY rte_pmd_mlx5)
+ list(APPEND check_LIBRARIES ${DPDK_rte_pmd_mlx5_LIBRARY})
+ mark_as_advanced(DPDK_rte_pmd_mlx5_LIBRARY)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(dpdk DEFAULT_MSG
+ DPDK_INCLUDE_DIR
+ check_LIBRARIES)
+
+if(DPDK_FOUND)
+if (EXISTS ${WITH_DPDK_MLX5})
+ list(APPEND check_LIBRARIES -libverbs)
+endif()
+ set(DPDK_LIBRARIES
+ -Wl,--whole-archive ${check_LIBRARIES} -Wl,--no-whole-archive)
+endif(DPDK_FOUND)
diff --git a/src/ceph/cmake/modules/Findfcgi.cmake b/src/ceph/cmake/modules/Findfcgi.cmake
new file mode 100644
index 0000000..f355b92
--- /dev/null
+++ b/src/ceph/cmake/modules/Findfcgi.cmake
@@ -0,0 +1,22 @@
+# CMake module to search for FastCGI headers
+#
+# If it's found it sets FCGI_FOUND to TRUE
+# and following variables are set:
+# FCGI_INCLUDE_DIR
+# FCGI_LIBRARY
+find_path(FCGI_INCLUDE_DIR
+ fcgio.h
+ PATHS
+ /usr/include
+ /usr/local/include
+ /usr/include/fastcgi)
+find_library(FCGI_LIBRARY NAMES fcgi libfcgi PATHS
+ /usr/local/lib
+ /usr/lib)
+
+# handle the QUIETLY and REQUIRED arguments and set UUID_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(fcgi DEFAULT_MSG FCGI_LIBRARY FCGI_INCLUDE_DIR)
+
+mark_as_advanced(FCGI_LIBRARY FCGI_INCLUDE_DIR)
diff --git a/src/ceph/cmake/modules/Findfio.cmake b/src/ceph/cmake/modules/Findfio.cmake
new file mode 100644
index 0000000..194f919
--- /dev/null
+++ b/src/ceph/cmake/modules/Findfio.cmake
@@ -0,0 +1,12 @@
+# - Find Fio
+# Find the fio includes
+#
+# FIO_INCLUDE_DIR - where to find fio.h
+# FIO_FOUND - True if fio is found.
+
+find_path(FIO_INCLUDE_DIR NAMES fio.h HINTS ${FIO_ROOT_DIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(fio DEFAULT_MSG FIO_INCLUDE_DIR)
+
+mark_as_advanced(FIO_INCLUDE_DIR)
diff --git a/src/ceph/cmake/modules/Findfuse.cmake b/src/ceph/cmake/modules/Findfuse.cmake
new file mode 100644
index 0000000..e7a7ff0
--- /dev/null
+++ b/src/ceph/cmake/modules/Findfuse.cmake
@@ -0,0 +1,28 @@
+# This module can find FUSE Library
+#
+# The following variables will be defined for your use:
+# - FUSE_FOUND : was FUSE found?
+# - FUSE_INCLUDE_DIRS : FUSE include directory
+# - FUSE_LIBRARIES : FUSE library
+
+find_path(
+ FUSE_INCLUDE_DIRS
+ NAMES fuse_common.h fuse_lowlevel.h fuse.h
+ PATHS /usr/local/include/osxfuse /usr/local/include
+ PATH_SUFFIXES fuse)
+
+set(fuse_names fuse)
+if(APPLE)
+ list(APPEND fuse_names libosxfuse.dylib)
+endif()
+
+find_library(FUSE_LIBRARIES
+ NAMES ${fuse_names}
+ PATHS /usr/local/lib64 /usr/local/lib)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(fuse DEFAULT_MSG
+ FUSE_INCLUDE_DIRS FUSE_LIBRARIES)
+
+mark_as_advanced(
+ FUSE_INCLUDE_DIRS FUSE_LIBRARIES)
diff --git a/src/ceph/cmake/modules/Findgperftools.cmake b/src/ceph/cmake/modules/Findgperftools.cmake
new file mode 100644
index 0000000..c4db922
--- /dev/null
+++ b/src/ceph/cmake/modules/Findgperftools.cmake
@@ -0,0 +1,23 @@
+# Try to find gperftools
+# Once done, this will define
+#
+# GPERFTOOLS_FOUND - system has Profiler
+# GPERFTOOLS_INCLUDE_DIR - the Profiler include directories
+# Tcmalloc_INCLUDE_DIR - where to find Tcmalloc.h
+# GPERFTOOLS_TCMALLOC_LIBRARY - link it to use tcmalloc
+# GPERFTOOLS_TCMALLOC_MINIMAL_LIBRARY - link it to use tcmalloc_minimal
+# GPERFTOOLS_PROFILER_LIBRARY - link it to use Profiler
+
+find_path(GPERFTOOLS_INCLUDE_DIR gperftools/profiler.h)
+find_path(Tcmalloc_INCLUDE_DIR gperftools/tcmalloc.h)
+
+foreach(component tcmalloc tcmalloc_minimal profiler)
+ string(TOUPPER ${component} COMPONENT)
+ find_library(GPERFTOOLS_${COMPONENT}_LIBRARY ${component})
+ list(APPEND GPERFTOOLS_LIBRARIES GPERFTOOLS_${COMPONENT}_LIBRARY)
+endforeach()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(gperftools DEFAULT_MSG GPERFTOOLS_LIBRARIES GPERFTOOLS_INCLUDE_DIR)
+
+mark_as_advanced(GPERFTOOLS_LIBRARIES GPERFTOOLS_INCLUDE_DIR)
diff --git a/src/ceph/cmake/modules/Findkeyutils.cmake b/src/ceph/cmake/modules/Findkeyutils.cmake
new file mode 100644
index 0000000..e34be8b
--- /dev/null
+++ b/src/ceph/cmake/modules/Findkeyutils.cmake
@@ -0,0 +1,27 @@
+# Try to find Keyutils
+# Once done, this will define
+#
+# KEYUTILS_FOUND - system has keyutils
+# KEYUTILS_INCLUDE_DIR - the keyutils include directories
+# KEYUTILS_LIBRARIES - link these to use keyutils
+
+if(KEYUTILS_INCLUDE_DIR AND KEYUTILS_LIBRARIES)
+ set(KEYUTILS_FIND_QUIETLY TRUE)
+endif(KEYUTILS_INCLUDE_DIR AND KEYUTILS_LIBRARIES)
+
+# include dir
+find_path(KEYUTILS_INCLUDE_DIR keyutils.h PATHS
+ /opt/local/include
+ /usr/local/include
+)
+
+# finally the library itself
+find_library(LIBKEYUTILS NAMES keyutils)
+set(KEYUTILS_LIBRARIES ${LIBKEYUTILS})
+
+# handle the QUIETLY and REQUIRED arguments and set KEYUTILS_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(keyutils DEFAULT_MSG KEYUTILS_LIBRARIES KEYUTILS_INCLUDE_DIR)
+
+mark_as_advanced(KEYUTILS_LIBRARIES KEYUTILS_INCLUDE_DIR)
diff --git a/src/ceph/cmake/modules/Findleveldb.cmake b/src/ceph/cmake/modules/Findleveldb.cmake
new file mode 100644
index 0000000..32786e9
--- /dev/null
+++ b/src/ceph/cmake/modules/Findleveldb.cmake
@@ -0,0 +1,18 @@
+# - Find LevelDB
+#
+# LEVELDB_INCLUDE_DIR - Where to find leveldb/db.h
+# LEVELDB_LIBRARIES - List of libraries when using LevelDB.
+# LEVELDB_FOUND - True if LevelDB found.
+
+find_path(LEVELDB_INCLUDE_DIR leveldb/db.h
+ HINTS $ENV{LEVELDB_ROOT}/include
+ DOC "Path in which the file leveldb/db.h is located." )
+
+find_library(LEVELDB_LIBRARIES leveldb
+ HINTS $ENV{LEVELDB_ROOT}/lib
+ DOC "Path to leveldb library." )
+
+mark_as_advanced(LEVELDB_INCLUDE_DIR LEVELDB_LIBRARIES)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(leveldb DEFAULT_MSG LEVELDB_LIBRARIES LEVELDB_INCLUDE_DIR)
diff --git a/src/ceph/cmake/modules/Findpmem.cmake b/src/ceph/cmake/modules/Findpmem.cmake
new file mode 100644
index 0000000..efcf682
--- /dev/null
+++ b/src/ceph/cmake/modules/Findpmem.cmake
@@ -0,0 +1,15 @@
+# Try to find libpmem
+#
+# Once done, this will define
+#
+# PMEM_FOUND
+# PMEM_INCLUDE_DIR
+# PMEM_LIBRARY
+
+find_path(PMEM_INCLUDE_DIR NAMES libpmem.h)
+find_library(PMEM_LIBRARY NAMES pmem)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(pmem DEFAULT_MSG PMEM_LIBRARY PMEM_INCLUDE_DIR)
+
+mark_as_advanced(PMEM_INCLUDE_DIR PMEM_LIBRARY)
diff --git a/src/ceph/cmake/modules/Findrdma.cmake b/src/ceph/cmake/modules/Findrdma.cmake
new file mode 100644
index 0000000..eb31f79
--- /dev/null
+++ b/src/ceph/cmake/modules/Findrdma.cmake
@@ -0,0 +1,49 @@
+# - Find rdma
+# Find the rdma library and includes
+#
+# RDMA_INCLUDE_DIR - where to find ibverbs.h, etc.
+# RDMA_LIBRARIES - List of libraries when using ibverbs.
+# RDMA_FOUND - True if ibverbs found.
+
+find_path(RDMA_INCLUDE_DIR infiniband/verbs.h)
+
+set(RDMA_NAMES ${RDMA_NAMES} ibverbs)
+find_library(RDMA_LIBRARY NAMES ${RDMA_NAMES})
+
+if (RDMA_INCLUDE_DIR AND RDMA_LIBRARY)
+ set(RDMA_FOUND TRUE)
+ set(RDMA_LIBRARIES ${RDMA_LIBRARY})
+else ()
+ set(RDMA_FOUND FALSE)
+ set( RDMA_LIBRARIES )
+endif ()
+
+if (RDMA_FOUND)
+ message(STATUS "Found libibverbs: ${RDMA_LIBRARY}")
+
+ include(CheckCXXSourceCompiles)
+ CHECK_CXX_SOURCE_COMPILES("
+ #include <infiniband/verbs.h>
+ int main() {
+ struct ibv_context* ctxt;
+ struct ibv_exp_gid_attr gid_attr;
+ ibv_exp_query_gid_attr(ctxt, 1, 0, &gid_attr);
+ return 0;
+ } " HAVE_IBV_EXP)
+
+else ()
+ message(STATUS "Not Found libibverbs: ${RDMA_LIBRARY}")
+ if (RDMA_FIND_REQUIRED)
+ message(STATUS "Looked for libibverbs named ${RDMA_NAMES}.")
+ message(FATAL_ERROR "Could NOT find libibverbs")
+ endif ()
+endif ()
+
+# handle the QUIETLY and REQUIRED arguments and set UUID_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(ibverbs DEFAULT_MSG RDMA_LIBRARIES RDMA_INCLUDE_DIR)
+
+mark_as_advanced(
+ RDMA_LIBRARY
+)
diff --git a/src/ceph/cmake/modules/Findrocksdb.cmake b/src/ceph/cmake/modules/Findrocksdb.cmake
new file mode 100644
index 0000000..e1aac57
--- /dev/null
+++ b/src/ceph/cmake/modules/Findrocksdb.cmake
@@ -0,0 +1,18 @@
+# Find the native Rocksdb includes and library
+# This module defines
+# ROCKSDB_INCLUDE_DIR, where to find rocksdb/db.h, Set when
+# ROCKSDB_INCLUDE_DIR is found.
+# ROCKSDB_LIBRARIES, libraries to link against to use Rocksdb.
+# ROCKSDB_FOUND, If false, do not try to use Rocksdb.
+
+find_path(ROCKSDB_INCLUDE_DIR rocksdb/db.h)
+
+find_library(ROCKSDB_LIBRARIES rocksdb)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(rocksdb DEFAULT_MSG
+ ROCKSDB_LIBRARIES ROCKSDB_INCLUDE_DIR)
+
+mark_as_advanced(
+ ROCKSDB_INCLUDE_DIR
+ ROCKSDB_LIBRARIES)
diff --git a/src/ceph/cmake/modules/Findsnappy.cmake b/src/ceph/cmake/modules/Findsnappy.cmake
new file mode 100644
index 0000000..b298cd2
--- /dev/null
+++ b/src/ceph/cmake/modules/Findsnappy.cmake
@@ -0,0 +1,23 @@
+# - Find Snappy
+# Find the snappy compression library and includes
+#
+# SNAPPY_INCLUDE_DIR - where to find snappy.h, etc.
+# SNAPPY_LIBRARIES - List of libraries when using snappy.
+# SNAPPY_FOUND - True if snappy found.
+
+find_path(SNAPPY_INCLUDE_DIR
+ NAMES snappy.h
+ HINTS ${SNAPPY_ROOT_DIR}/include)
+
+find_library(SNAPPY_LIBRARIES
+ NAMES snappy
+ HINTS ${SNAPPY_ROOT_DIR}/lib)
+
+# handle the QUIETLY and REQUIRED arguments and set UUID_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(snappy DEFAULT_MSG SNAPPY_LIBRARIES SNAPPY_INCLUDE_DIR)
+
+mark_as_advanced(
+ SNAPPY_LIBRARIES
+ SNAPPY_INCLUDE_DIR)
diff --git a/src/ceph/cmake/modules/Findudev.cmake b/src/ceph/cmake/modules/Findudev.cmake
new file mode 100644
index 0000000..fd936fc
--- /dev/null
+++ b/src/ceph/cmake/modules/Findudev.cmake
@@ -0,0 +1,34 @@
+# Copyright (C) 2007-2012 Hypertable, Inc.
+#
+# This file is part of Hypertable.
+#
+# Hypertable is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or any later version.
+#
+# Hypertable is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Hypertable. If not, see <http://www.gnu.org/licenses/>
+#
+
+# - Find libudev
+# Find the udev library and includes
+#
+# UDEV_INCLUDE_DIR - where to find libudev.h, etc.
+# UDEV_LIBRARIES - List of libraries when using udev.
+# UDEV_FOUND - True if udev found.
+
+find_path(UDEV_INCLUDE_DIR libudev.h)
+find_library(UDEV_LIBRARIES udev)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(udev DEFAULT_MSG UDEV_LIBRARIES UDEV_INCLUDE_DIR)
+
+mark_as_advanced(
+ UDEV_LIBRARIES
+ UDEV_INCLUDE_DIR)
diff --git a/src/ceph/cmake/modules/Findxfs.cmake b/src/ceph/cmake/modules/Findxfs.cmake
new file mode 100644
index 0000000..6171e32
--- /dev/null
+++ b/src/ceph/cmake/modules/Findxfs.cmake
@@ -0,0 +1,33 @@
+# Try to find xfs
+# Once done, this will define
+#
+# XFS_FOUND - system has libxfs
+# XFS_INCLUDE_DIR - the libxfs include directories
+# XFS_LIBRARIES - link these to use libxfs
+
+if(XFS_INCLUDE_DIR AND XFS_LIBRARIES)
+ set(XFS_FIND_QUIETLY TRUE)
+endif(XFS_INCLUDE_DIR AND XFS_LIBRARIES)
+
+INCLUDE(CheckCXXSymbolExists)
+
+# include dir
+
+find_path(XFS_INCLUDE_DIR xfs.h NO_DEFAULT_PATH PATHS
+ /usr/include
+ /usr/include/xfs
+ /opt/local/include
+ /usr/local/include
+)
+
+
+# finally the library itself
+find_library(LIBXFS NAMES handle)
+set(XFS_LIBRARIES ${LIBXFS})
+
+# handle the QUIETLY and REQUIRED arguments and set XFS_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(xfs DEFAULT_MSG XFS_LIBRARIES XFS_INCLUDE_DIR)
+
+mark_as_advanced(XFS_LIBRARIES XFS_INCLUDE_DIR)
diff --git a/src/ceph/cmake/modules/Findxio.cmake b/src/ceph/cmake/modules/Findxio.cmake
new file mode 100644
index 0000000..938af03
--- /dev/null
+++ b/src/ceph/cmake/modules/Findxio.cmake
@@ -0,0 +1,24 @@
+# - Find libxio
+# Find libxio transport library
+#
+# XIO_INCLUDE_DIR - libxio include dir
+# XIO_LIBRARIES - List of libraries
+# XIO_FOUND - True if libxio found.
+
+if(WITH_XIO AND EXISTS ${WITH_XIO})
+ find_path(XIO_INCLUDE_DIR libxio.h HINTS "${WITH_XIO}/include")
+ find_library(XIO_LIBRARY xio HINTS "${WITH_XIO}/lib")
+else()
+ find_path(XIO_INCLUDE_DIR libxio.h)
+ find_library(XIO_LIBRARY xio)
+endif()
+
+set(XIO_LIBRARIES ${XIO_LIBRARY})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(xio DEFAULT_MSG XIO_LIBRARY XIO_INCLUDE_DIR)
+
+mark_as_advanced(
+ XIO_LIBRARY
+ XIO_INCLUDE_DIR
+ )
diff --git a/src/ceph/cmake/modules/Findzfs.cmake b/src/ceph/cmake/modules/Findzfs.cmake
new file mode 100644
index 0000000..d92dd1f
--- /dev/null
+++ b/src/ceph/cmake/modules/Findzfs.cmake
@@ -0,0 +1,28 @@
+# find libzfs or libzfslinux
+# Once done, this will define
+#
+# ZFS_FOUND - system has libzfs
+# ZFS_INCLUDE_DIR - the libzfs include directories
+# ZFS_LIBRARIES - link these to use libzfs
+
+find_package(PkgConfig)
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(ZFS QUIET libzfs)
+else()
+ find_path(ZFS_INCLUDE_DIR libzfs.h
+ HINTS
+ ENV ZFS_DIR
+ PATH_SUFFIXES libzfs)
+
+ find_library(ZFS_LIBRARIES
+ NAMES zfs
+ HINTS
+ ENV ZFS_DIR)
+ set(XFS_LIBRARIES ${LIBXFS})
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(zfs DEFAULT_MSG
+ ZFS_INCLUDE_DIRS ZFS_LIBRARIES)
+
+mark_as_advanced(ZFS_INCLUDE_DIRS XFS_LIBRARIES)
diff --git a/src/ceph/cmake/modules/GetGitRevisionDescription.cmake b/src/ceph/cmake/modules/GetGitRevisionDescription.cmake
new file mode 100644
index 0000000..85eae15
--- /dev/null
+++ b/src/ceph/cmake/modules/GetGitRevisionDescription.cmake
@@ -0,0 +1,130 @@
+# - Returns a version string from Git
+#
+# These functions force a re-configure on each git commit so that you can
+# trust the values of the variables in your build system.
+#
+# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
+#
+# Returns the refspec and sha hash of the current head revision
+#
+# git_describe(<var> [<additional arguments to git describe> ...])
+#
+# Returns the results of git describe on the source tree, and adjusting
+# the output so that it tests false if an error occurs.
+#
+# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
+#
+# Returns the results of git describe --exact-match on the source tree,
+# and adjusting the output so that it tests false if there was no exact
+# matching tag.
+#
+# Requires CMake 2.6 or newer (uses the 'function' command)
+#
+# Original Author:
+# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
+# http://academic.cleardefinition.com
+# Iowa State University HCI Graduate Program/VRAC
+#
+# Copyright Iowa State University 2009-2010.
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+if(__get_git_revision_description)
+ return()
+endif()
+set(__get_git_revision_description YES)
+
+# We must run the following at "include" time, not at function call time,
+# to find the path to this module rather than the path to a calling list file
+get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
+
+function(get_git_head_revision _refspecvar _hashvar)
+ set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+ set(GIT_DIR "${GIT_PARENT_DIR}/.git")
+ while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
+ set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
+ get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
+ if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
+ # We have reached the root directory, we are not in git
+ set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
+ set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
+ return()
+ endif()
+ set(GIT_DIR "${GIT_PARENT_DIR}/.git")
+ endwhile()
+ # check if this is a submodule
+ if(NOT IS_DIRECTORY ${GIT_DIR})
+ file(READ ${GIT_DIR} submodule)
+ string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
+ get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
+ get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
+ endif()
+ set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
+ if(NOT EXISTS "${GIT_DATA}")
+ file(MAKE_DIRECTORY "${GIT_DATA}")
+ endif()
+
+ if(NOT EXISTS "${GIT_DIR}/HEAD")
+ return()
+ endif()
+ set(HEAD_FILE "${GIT_DATA}/HEAD")
+ configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
+
+ configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
+ "${GIT_DATA}/grabRef.cmake"
+ @ONLY)
+ include("${GIT_DATA}/grabRef.cmake")
+
+ set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
+ set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
+endfunction()
+
+function(git_describe _var)
+ if(NOT GIT_FOUND)
+ find_package(Git QUIET)
+ endif()
+ get_git_head_revision(refspec hash)
+ if(NOT GIT_FOUND)
+ set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
+ return()
+ endif()
+ if(NOT hash)
+ set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
+ return()
+ endif()
+
+ # TODO sanitize
+ #if((${ARGN}" MATCHES "&&") OR
+ # (ARGN MATCHES "||") OR
+ # (ARGN MATCHES "\\;"))
+ # message("Please report the following error to the project!")
+ # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
+ #endif()
+
+ #message(STATUS "Arguments to execute_process: ${ARGN}")
+
+ execute_process(COMMAND
+ "${GIT_EXECUTABLE}"
+ describe
+ ${hash}
+ ${ARGN}
+ WORKING_DIRECTORY
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ RESULT_VARIABLE
+ res
+ OUTPUT_VARIABLE
+ out
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(NOT res EQUAL 0)
+ set(out "${out}-${res}-NOTFOUND")
+ endif()
+
+ set(${_var} "${out}" PARENT_SCOPE)
+endfunction()
+
+function(git_get_exact_tag _var)
+ git_describe(out --exact-match ${ARGN})
+ set(${_var} "${out}" PARENT_SCOPE)
+endfunction()
diff --git a/src/ceph/cmake/modules/GetGitRevisionDescription.cmake.in b/src/ceph/cmake/modules/GetGitRevisionDescription.cmake.in
new file mode 100644
index 0000000..6d8b708
--- /dev/null
+++ b/src/ceph/cmake/modules/GetGitRevisionDescription.cmake.in
@@ -0,0 +1,41 @@
+#
+# Internal file for GetGitRevisionDescription.cmake
+#
+# Requires CMake 2.6 or newer (uses the 'function' command)
+#
+# Original Author:
+# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
+# http://academic.cleardefinition.com
+# Iowa State University HCI Graduate Program/VRAC
+#
+# Copyright Iowa State University 2009-2010.
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+set(HEAD_HASH)
+
+file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
+
+string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
+if(HEAD_CONTENTS MATCHES "ref")
+ # named branch
+ string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
+ if(EXISTS "@GIT_DIR@/${HEAD_REF}")
+ configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
+ else()
+ configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
+ file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
+ if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
+ set(HEAD_HASH "${CMAKE_MATCH_1}")
+ endif()
+ endif()
+else()
+ # detached HEAD
+ configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
+endif()
+
+if(NOT HEAD_HASH)
+ file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
+ string(STRIP "${HEAD_HASH}" HEAD_HASH)
+endif()
diff --git a/src/ceph/cmake/modules/MergeStaticLibraries.cmake b/src/ceph/cmake/modules/MergeStaticLibraries.cmake
new file mode 100644
index 0000000..92d4156
--- /dev/null
+++ b/src/ceph/cmake/modules/MergeStaticLibraries.cmake
@@ -0,0 +1,85 @@
+# This function is a helper that will merge static libraries.
+# For example,
+#
+# merge_static_libraries(mylib staticlibX staticlibY)
+#
+# mylib.a will generate a new static library mylib that is
+# a combination of staticlibX and staticlibY
+#
+function(merge_static_libraries target)
+
+ set(dummy_source ${CMAKE_CURRENT_BINARY_DIR}/${target}_dummy.c)
+ add_library(${target} STATIC ${dummy_source})
+
+ # remove duplicates
+ set(libs ${ARGN})
+ list(REMOVE_DUPLICATES libs)
+
+ # validate that all libs are static
+ foreach(lib ${libs})
+ if (NOT TARGET ${lib})
+ message(FATAL_ERROR "${lib} not a valid target")
+ endif()
+
+ get_target_property(libtype ${lib} TYPE)
+ if(NOT libtype STREQUAL "STATIC_LIBRARY")
+ message(FATAL_ERROR "${lib} not a static library")
+ endif()
+
+ # add a dependency on the lib
+ add_dependencies(${target} ${lib})
+ endforeach()
+
+ # Force the merged Make the generated dummy source file depended on all static input
+ # libs. If input lib changes,the source file is touched
+ # which causes the desired effect (relink).
+ add_custom_command(
+ OUTPUT ${dummy_source}
+ COMMAND ${CMAKE_COMMAND} -E touch ${dummy_source}
+ DEPENDS ${libs})
+
+ # only LINUX is currently supported. OSX's libtool and windows lib.exe
+ # have native support for merging static libraries, and support for them
+ # can be easily added if required.
+ if(LINUX)
+ # generate a script to merge the static libraries in to the target
+ # library. see https://sourceware.org/binutils/docs/binutils/ar-scripts.html
+ set(mri_script "open $<TARGET_FILE:${target}>=")
+ foreach(lib ${libs})
+ # we use the generator expression TARGET_FILE to get the location
+ # of the library. this will not be expanded until the script file
+ # is written below
+ set(mri_script "${mri_script} addlib $<TARGET_FILE:${lib}>=")
+ endforeach()
+ set(mri_script "${mri_script} save=end")
+
+ add_custom_command(
+ TARGET ${target} POST_BUILD
+ COMMAND echo ${mri_script} | tr = \\\\n | ${CMAKE_AR} -M)
+ endif(LINUX)
+
+ message("-- MergeStaticLibraries: ${target}: merged ${libs}")
+
+ # we want to set the target_link_libraries correctly for the new merged
+ # static library. First we get the list of link libraries for each
+ # of the libs we are merging
+ set(link_libs)
+ foreach(lib ${libs})
+ get_property(trans TARGET ${lib} PROPERTY LINK_LIBRARIES)
+ list(APPEND link_libs ${trans})
+ endforeach()
+
+ if (link_libs)
+ # now remove the duplicates and any of the libraries we already merged
+ list(REMOVE_DUPLICATES link_libs)
+ foreach(lib ${libs})
+ list(REMOVE_ITEM link_libs ${lib})
+ endforeach()
+
+ # set the target link libraries
+ target_link_libraries(${target} ${link_libs})
+
+ message("-- MergeStaticLibraries: ${target}: remaining ${link_libs}")
+ endif()
+
+endfunction()
diff --git a/src/ceph/cmake/modules/SIMDExt.cmake b/src/ceph/cmake/modules/SIMDExt.cmake
new file mode 100644
index 0000000..5330835
--- /dev/null
+++ b/src/ceph/cmake/modules/SIMDExt.cmake
@@ -0,0 +1,123 @@
+# detect SIMD extentions
+#
+# HAVE_ARMV8_CRC
+# HAVE_ARMV8_SIMD
+# HAVE_ARM_NEON
+# HAVE_INTEL_SSE
+# HAVE_INTEL_SSE2
+# HAVE_INTEL_SSE3
+# HAVE_INTEL_SSSE3
+# HAVE_INTEL_PCLMUL
+# HAVE_INTEL_SSE4_1
+# HAVE_INTEL_SSE4_2
+#
+# SIMD_COMPILE_FLAGS
+#
+
+if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
+ set(HAVE_ARM 1)
+ set(save_quiet ${CMAKE_REQUIRED_QUIET})
+ set(CMAKE_REQUIRED_QUIET true)
+ include(CheckCXXSourceCompiles)
+
+ check_cxx_source_compiles("
+ #define CRC32CX(crc, value) __asm__(\"crc32cx %w[c], %w[c], %x[v]\":[c]\"+r\"(crc):[v]\"r\"(value))
+ asm(\".arch_extension crc\");
+ unsigned int foo(unsigned int ret) {
+ CRC32CX(ret, 0);
+ return ret;
+ }
+ int main() { foo(0); }" HAVE_ARMV8_CRC)
+ check_cxx_source_compiles("
+ asm(\".arch_extension crypto\");
+ unsigned int foo(unsigned int ret) {
+ __asm__(\"pmull v2.1q, v2.1d, v1.1d\");
+ return ret;
+ }
+ int main() { foo(0); }" HAVE_ARMV8_CRYPTO)
+
+ set(CMAKE_REQUIRED_QUIET ${save_quiet})
+ if(HAVE_ARMV8_CRC)
+ message(STATUS " aarch64 crc extensions supported")
+ endif()
+
+ if(HAVE_ARMV8_CRYPTO)
+ message(STATUS " aarch64 crypto extensions supported")
+ endif()
+ CHECK_C_COMPILER_FLAG(-march=armv8-a+crc+crypto HAVE_ARMV8_CRC_CRYPTO_MARCH)
+
+ # don't believe only the -march support; gcc 4.8.5 on RHEL/CentOS says
+ # it supports +crc but hasn't got the intrinsics or arm_acle.h. Test for
+ # the actual presence of one of the intrinsic functions.
+ if(HAVE_ARMV8_CRC_CRYPTO_MARCH)
+ check_cxx_source_compiles("
+ #include <inttypes.h>
+ int main() { uint32_t a; uint8_t b; __builtin_aarch64_crc32b(a, b); }
+ " HAVE_ARMV8_CRC_CRYPTO_INTRINSICS)
+ endif()
+
+ if(HAVE_ARMV8_CRC_CRYPTO_INTRINSICS)
+ message(STATUS " aarch64 crc+crypto intrinsics supported")
+ set(ARMV8_CRC_COMPILE_FLAGS "${ARMV8_CRC_COMPILE_FLAGS} -march=armv8-a+crc+crypto")
+ endif()
+
+ CHECK_C_COMPILER_FLAG(-march=armv8-a+simd HAVE_ARMV8_SIMD)
+ if(HAVE_ARMV8_SIMD)
+ set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -march=armv8-a+simd")
+ endif()
+
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm|ARM")
+ set(HAVE_ARM 1)
+ CHECK_C_COMPILER_FLAG(-mfpu=neon HAVE_ARM_NEON)
+ if(HAVE_ARM_NEON)
+ set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mfpu=neon")
+ endif()
+
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|amd64|x86_64|AMD64")
+ set(HAVE_INTEL 1)
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "i686|amd64|x86_64|AMD64")
+ CHECK_C_COMPILER_FLAG(-msse HAVE_INTEL_SSE)
+ if(HAVE_INTEL_SSE)
+ set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse")
+ endif()
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64")
+ CHECK_C_COMPILER_FLAG(-msse2 HAVE_INTEL_SSE2)
+ if(HAVE_INTEL_SSE2)
+ set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse2")
+ endif()
+ CHECK_C_COMPILER_FLAG(-msse3 HAVE_INTEL_SSE3)
+ if(HAVE_INTEL_SSE3)
+ set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse3")
+ endif()
+ CHECK_C_COMPILER_FLAG(-mssse3 HAVE_INTEL_SSSE3)
+ if(HAVE_INTEL_SSSE3)
+ set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mssse3")
+ endif()
+ CHECK_C_COMPILER_FLAG(-mpclmul HAVE_INTEL_PCLMUL)
+ if(HAVE_INTEL_PCLMUL)
+ set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mpclmul")
+ endif()
+ CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_INTEL_SSE4_1)
+ if(HAVE_INTEL_SSE4_1)
+ set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse4.1")
+ endif()
+ CHECK_C_COMPILER_FLAG(-msse4.2 HAVE_INTEL_SSE4_2)
+ if(HAVE_INTEL_SSE4_2)
+ set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse4.2")
+ endif()
+ endif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64")
+ endif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686|amd64|x86_64|AMD64")
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(powerpc|ppc)64le")
+ set(HAVE_PPC64LE 1)
+ message(STATUS " we are ppc64le")
+ CHECK_C_COMPILER_FLAG("-maltivec" HAS_ALTIVEC)
+ if(HAS_ALTIVEC)
+ message(STATUS " HAS_ALTIVEC yes")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maltivec")
+ set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -maltivec")
+ endif()
+ CHECK_C_COMPILER_FLAG("-mcpu=power8" HAVE_POWER8)
+ if(HAVE_POWER8)
+ message(STATUS " HAVE_POWER8 yes")
+ endif()
+endif()