CHECK_INCLUDE_FILES("fuse/fuse_lowlevel.h" HAVE_FUSE_LOWLEVEL_H)
CHECK_INCLUDE_FILES("curl/curl.h" HAVE_FUSE_LOWLEVEL_H)
CHECK_INCLUDE_FILES("fuse/fuse.h" HAVE_FUSE_H)
-CHECK_INCLUDE_FILES("google/profiler.h" HAVE_PROFILER_H)
CHECK_INCLUDE_FILES("libedit/vis.h" HAVE_LIBEDIT_VIS_H)
CHECK_INCLUDE_FILES("fcgi_config.h" HAVE_FASTCGI_CONFIG_H)
CHECK_INCLUDE_FILES("fastcgi.h" HAVE_FASTCGI_H)
CHECK_INCLUDE_FILES("fcgi_stdio.h" HAVE_FASTCGI_STDIO_H)
CHECK_INCLUDE_FILES("openssl/ssl.h" HAVE_SSL_H)
CHECK_INCLUDE_FILES("snappy.h" HAVE_SNAPPY_H)
-CHECK_INCLUDE_FILES("atomic_ops.h" HAVE_ATOMIC_OPS)
CHECK_INCLUDE_FILES("keyutils.h" HAVE_KEYUTILS_H)
include(CheckSymbolExists)
set(HAVE_FCGI ${FCGI_FOUND})
endif(${WITH_FCGI})
-option(WITH_ATOMICS_OPS "Atomic Ops is here" ON)
-if(${WITH_ATOMIC_OPS})
find_package(atomic_ops REQUIRED)
set(HAVE_ATOMIC_OPS ${ATOMIC_OPS_FOUND})
-endif(${WITH_ATOMIC_OPS})
-
-option(WITH_PROFILER "The Profiler is here" ON)
-if(${WITH_PROFILER})
-find_package(profiler REQUIRED)
-set(HAVE_PROFILER ${PROFILER_FOUND})
-endif(${WITH_PROFILER})
+message(STATUS "${ATOMIC_OPS_LIBRARIES}")
+
+option(WITH_GPERFTOOLS "gperftools is here" ON)
+if(${WITH_GPERFTOOLS})
+ find_package(gperftools)
+ set(HAVE_GPERFTOOLS ${GPERFTOOLS_FOUND})
+ if(${HAVE_GPERFTOOLS})
+ find_file(HAVE_GPERFTOOLS_HEAP_PROFILER_H heap-profiler.h PATHS /usr/include/gperftools)
+ find_file(HAVE_GPERFTOOLS_MALLOC_EXTENSION_H malloc_extension.h PATHS /usr/include/gperftools)
+ find_file(HAVE_GPERFTOOLS_PROFILER_H profiler.h PATHS /usr/include/gperftools)
+ endif(${HAVE_GPERFTOOLS})
+endif(${WITH_GPERFTOOLS})
option(WITH_SNAPPY "Snappy is here" ON)
if(${WITH_SNAPPY})
--- /dev/null
+# - Find atomic_ops
+# Find the native ATOMIC_OPS headers and libraries.
+#
+# ATOMIC_OPS_INCLUDE_DIRS - where to find atomic_ops.h, etc.
+# ATOMIC_OPS_LIBRARIES - List of libraries when using atomic_ops.
+# ATOMIC_OPS_FOUND - True if atomic_ops found.
+
+# Look for the header file.
+FIND_PATH(ATOMIC_OPS_INCLUDE_DIR NAMES atomic_ops.h)
+
+# Look for the library.
+FIND_LIBRARY(ATOMIC_OPS_LIBRARY NAMES atomic_ops)
+
+# handle the QUIETLY and REQUIRED arguments and set ATOMIC_OPS_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(atomic_ops DEFAULT_MSG ATOMIC_OPS_LIBRARY ATOMIC_OPS_INCLUDE_DIR)
+
+# Copy the results to the output variables.
+IF(ATOMIC_OPS_FOUND)
+ SET(ATOMIC_OPS_LIBRARIES ${ATOMIC_OPS_LIBRARY})
+ SET(ATOMIC_OPS_INCLUDE_DIRS ${ATOMIC_OPS_INCLUDE_DIR})
+ELSE(ATOMIC_OPS_FOUND)
+ SET(ATOMIC_OPS_LIBRARIES)
+ SET(ATOMIC_OPS_INCLUDE_DIRS)
+ENDIF(ATOMIC_OPS_FOUND)
+
+MARK_AS_ADVANCED(ATOMIC_OPS_INCLUDE_DIR ATOMIC_OPS_LIBRARY)
+++ /dev/null
-# - Find atomic_ops
-# Find the native ATOMIC_OPS headers and libraries.
-#
-# ATOMIC_OPS_INCLUDE_DIRS - where to find atomic_ops.h, etc.
-# ATOMIC_OPS_LIBRARIES - List of libraries when using atomic_ops.
-# ATOMIC_OPS_FOUND - True if atomic_ops found.
-
-# Look for the header file.
-FIND_PATH(ATOMIC_OPS_INCLUDE_DIR NAMES atomic_ops.h)
-
-# Look for the library.
-FIND_LIBRARY(ATOMIC_OPS_LIBRARY NAMES atomic_ops)
-
-# handle the QUIETLY and REQUIRED arguments and set ATOMIC_OPS_FOUND to TRUE if
-# all listed variables are TRUE
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(ATOMIC_OPS DEFAULT_MSG ATOMIC_OPS_LIBRARY ATOMIC_OPS_INCLUDE_DIR)
-
-# Copy the results to the output variables.
-IF(ATOMIC_OPS_FOUND)
- SET(ATOMIC_OPS_LIBRARIES ${ATOMIC_OPS_LIBRARY})
- SET(ATOMIC_OPS_INCLUDE_DIRS ${ATOMIC_OPS_INCLUDE_DIR})
-ELSE(ATOMIC_OPS_FOUND)
- SET(ATOMIC_OPS_LIBRARIES)
- SET(ATOMIC_OPS_INCLUDE_DIRS)
-ENDIF(ATOMIC_OPS_FOUND)
-
-MARK_AS_ADVANCED(ATOMIC_OPS_INCLUDE_DIR ATOMIC_OPS_LIBRARY)
--- /dev/null
+# Try to find Profiler
+# Once done, this will define
+#
+# GPERFTOOLS_FOUND - system has Profiler
+# GPERFTOOLS_INCLUDE_DIR - the Profiler include directories
+# GPERFTOOLS_LIBRARIES - link these to use Profiler
+
+if(GPERFTOOLS_INCLUDE_DIR AND GPERFTOOLS_LIBRARIES)
+ set(GPERFTOOLS_FIND_QUIETLY TRUE)
+endif(GPERFTOOLS_INCLUDE_DIR AND GPERFTOOLS_LIBRARIES)
+
+INCLUDE(CheckCXXSymbolExists)
+
+# include dir
+
+find_path(GPERFTOOLS_INCLUDE_DIR profiler.h NO_DEFAULT_PATH PATHS
+ /usr/include
+ /usr/include/gperftools
+ /usr/include/google
+ /opt/local/include
+ /usr/local/include
+)
+
+
+# finally the library itself
+find_library(LIBPROFILER NAMES profiler)
+CHECK_INCLUDE_FILES("google/profiler.h" HAVE_PROFILER_H)
+set(GPERFTOOLS_LIBRARIES ${LIBPROFILER})
+
+# handle the QUIETLY and REQUIRED arguments and set GPERFTOOLS_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(gperftools DEFAULT_MSG GPERFTOOLS_LIBRARIES GPERFTOOLS_INCLUDE_DIR)
+
+mark_as_advanced(GPERFTOOLS_LIBRARIES GPERFTOOLS_INCLUDE_DIR)
+++ /dev/null
-# Try to find Profiler
-# Once done, this will define
-#
-# PROFILER_FOUND - system has Profiler
-# PROFILER_INCLUDE_DIR - the Profiler include directories
-# PROFILER_LIBRARIES - link these to use Profiler
-
-if(PROFILER_INCLUDE_DIR AND PROFILER_LIBRARIES)
-set(PROFILER_FIND_QUIETLY TRUE)
-endif(PROFILER_INCLUDE_DIR AND PROFILER_LIBRARIES)
-
-INCLUDE(CheckCXXSymbolExists)
-
-# include dir
-
-find_path(PROFILER_INCLUDE_DIR profiler.h NO_DEFAULT_PATH PATHS
- ${HT_DEPENDENCY_INCLUDE_DIR}
- /usr/include
- /usr/include/google
- /opt/local/include
- /usr/local/include
-)
-
-
-# finally the library itself
-find_library(LIBPROFILER NAMES profiler)
-set(PROFILER_LIBRARIES ${LIBPROFILER})
-
-# handle the QUIETLY and REQUIRED arguments and set PROFILER_FOUND to TRUE if
-# all listed variables are TRUE
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(PROFILER DEFAULT_MSG PROFILER_LIBRARIES PROFILER_INCLUDE_DIR)
-
-mark_as_advanced(PROFILER_LIBRARIES PROFILER_INCLUDE_DIR)
endif()
-set(EXTRALIBS uuid rt dl ${Boost_LIBS})
+set(EXTRALIBS uuid rt dl ${Boost_LIBS} ${ATOMIC_OPS_LIBRARIES})
if(${WITH_PROFILER})
list(APPEND EXTRALIBS profiler)
endif(NSS_FOUND)
endif(USE_NSS)
-if(${HAVE_ATOMIC_OPS})
- set(EXTRALIBS
- atomic_ops
- ${EXTRALIBS})
-endif(${HAVE_ATOMIC_OPS})
-
set(GCOV_PREFIX_STRIP 4)
get_git_head_revision(GIT_REFSPEC CEPH_GIT_VER)
list(APPEND EXTRALIBS ${Xio_LIBRARY} ibverbs rdmacm pthread rt)
endif(HAVE_XIO)
-if(${WITH_TCMALLOC})
+if(${WITH_TCMALLOC} AND ${HAVE_GPERFTOOLS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free")
set(TCMALLOC_LIBS tcmalloc)
set(TCMALLOC_srcs perfglue/heap_profiler.cc)
-else()
+else(${WITH_TCMALLOC} AND ${HAVE_GPERFTOOLS})
set(TCMALLOC_srcs perfglue/disabled_heap_profiler.cc)
-endif(${WITH_TCMALLOC})
+endif(${WITH_TCMALLOC} AND ${HAVE_GPERFTOOLS})
# tcmalloc heap profiler
set(heap_profiler_files ${TCMALLOC_srcs})
add_library(common_mountcephfs_objs OBJECT
${common_mountcephfs_files})
-if(${WITH_PROFILER})
+if(${WITH_GPERFTOOLS})
list(APPEND libcommon_files
perfglue/cpu_profiler.cc)
else()
list(APPEND libcommon_files
perfglue/disabled_stubs.cc)
-endif(${WITH_PROFILER})
+endif(${WITH_GPERFTOOLS})
if(${ENABLE_SHARED})
list(APPEND libcommon_files
${CMAKE_SOURCE_DIR}/src/test/encoding/ceph_dencoder.cc
APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_BINARY_DIR}/src/include/ceph_ver.h)
-if(${WITH_PROFILER})
+if(${WITH_GPERFTOOLS})
target_link_libraries(common profiler)
-endif(${WITH_PROFILER})
+endif(${WITH_GPERFTOOLS})
add_library(common_utf8 STATIC common/utf8.c)
/* Defined if XIO */
#cmakedefine HAVE_XIO
+/* Defined if new gperftools */
+#cmakedefine HAVE_GPERFTOOLS_HEAP_PROFILER_H
+#cmakedefine HAVE_GPERFTOOLS_MALLOC_EXTENSION_H
+#cmakedefine HAVE_GPERFTOOLS_PROFILER_H
+
#endif /* CONFIG_H */