about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt10
-rw-r--r--lib/Support/MemoryUsage.cpp6
2 files changed, 7 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 26c724c3..041e4143 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -182,9 +182,9 @@ option(KLEE_ENABLE_TIMESTAMP "Add timestamps to KLEE sources" OFF)
 # Include useful CMake functions
 ################################################################################
 include(GNUInstallDirs)
+include(CheckCXXSymbolExists)
 include(CheckIncludeFile)
 include(CheckIncludeFileCXX)
-include(CheckFunctionExists)
 include(CheckPrototypeDefinition)
 include("${CMAKE_SOURCE_DIR}/cmake/string_to_list.cmake")
 include("${CMAKE_SOURCE_DIR}/cmake/klee_component_add_cxx_flag.cmake")
@@ -434,11 +434,9 @@ endif()
 ################################################################################
 # Miscellaneous header file detection
 ################################################################################
-check_function_exists(mallinfo HAVE_MALLINFO) # FIXME: should test CXX compiler not C
-check_function_exists(__ctype_b_loc HAVE_CTYPE_EXTERNALS) # FIXME: should test CXX compiler not C
-
-check_include_file_cxx(malloc/malloc.h HAVE_MALLOC_MALLOC_H)
-check_function_exists(malloc_zone_statistics HAVE_MALLOC_ZONE_STATISTICS)
+check_cxx_symbol_exists(__ctype_b_loc ctype.h HAVE_CTYPE_EXTERNALS)
+check_cxx_symbol_exists(mallinfo malloc.h HAVE_MALLINFO)
+check_cxx_symbol_exists(malloc_zone_statistics malloc/malloc.h HAVE_MALLOC_ZONE_STATISTICS)
 
 # FIXME: This is needed by the runtime not KLEE itself so we are testing the wrong
 # compiler.
diff --git a/lib/Support/MemoryUsage.cpp b/lib/Support/MemoryUsage.cpp
index f1757ad3..2f62dc80 100644
--- a/lib/Support/MemoryUsage.cpp
+++ b/lib/Support/MemoryUsage.cpp
@@ -18,7 +18,7 @@
 #ifdef HAVE_MALLINFO
 #include <malloc.h>
 #endif
-#ifdef HAVE_MALLOC_MALLOC_H
+#ifdef HAVE_MALLOC_ZONE_STATISTICS
 #include <malloc/malloc.h>
 #endif
 
@@ -95,7 +95,7 @@ size_t util::GetTotalMallocUsage() {
   MallocExtension::instance()->GetNumericProperty(
       "generic.current_allocated_bytes", &value);
   return value;
-#elif HAVE_MALLINFO
+#elif defined(HAVE_MALLINFO)
   struct mallinfo mi = ::mallinfo();
   // The malloc implementation in glibc (pmalloc2)
   // does not include mmap()'ed memory in mi.uordblks
@@ -106,7 +106,7 @@ size_t util::GetTotalMallocUsage() {
   return (unsigned)mi.uordblks;
 #endif
 
-#elif defined(HAVE_MALLOC_ZONE_STATISTICS) && defined(HAVE_MALLOC_MALLOC_H)
+#elif defined(HAVE_MALLOC_ZONE_STATISTICS)
 
   // Support memory usage on Darwin.
   malloc_statistics_t Stats;