cmake/eina: check more required functions and link with unwind if found.
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Wed, 25 Jan 2017 21:21:06 +0000 (19:21 -0200)
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Wed, 25 Jan 2017 21:29:20 +0000 (19:29 -0200)
unwind is needed for debug, thus link to that.

cmake/config/common.cmake
src/lib/eina/CMakeLists.txt

index b06fd6c..5056928 100644 (file)
@@ -32,13 +32,13 @@ EFL_OPTION(ENABLE_VALGRIND "Enable valgrind support" "${SUGGEST_VALGRIND}" DEPEN
 HEADER_CHECK(asm/hwcap.h)
 HEADER_CHECK(dirent.h)
 HEADER_CHECK(execinfo.h)
-HEADER_CHECK(libunwind.h NAME HAVE_UNWIND)
 HEADER_CHECK(mcheck.h)
 HEADER_CHECK(stdlib.h)
 HEADER_CHECK(sys/auxv.h)
 HEADER_CHECK(sys/mman.h)
 HEADER_CHECK(sys/types.h)
 
+FUNC_CHECK(backtrace INCLUDE_FILES execinfo.h)
 FUNC_CHECK(clock_gettime INCLUDE_FILES time.h)
 FUNC_CHECK(dirfd INCLUDE_FILES dirent.h sys/types.h)
 FUNC_CHECK(dladdr INCLUDE_FILES dlfcn.h LIBRARIES dl DEFINITIONS "-D_GNU_SOURCE=1")
@@ -53,6 +53,8 @@ FUNC_CHECK(getuid INCLUDE_FILES unistd.h)
 FUNC_CHECK(getxattr INCLUDE_FILES sys/types.h sys/xattr.h)
 FUNC_CHECK(iconv INCLUDE_FILES iconv.h)
 FUNC_CHECK(listxattr INCLUDE_FILES sys/types.h sys/xattr.h)
+FUNC_CHECK(mallinfo INCLUDE_FILES malloc.h)
+FUNC_CHECK(malloc_info INCLUDE_FILES malloc.h)
 FUNC_CHECK(mmap INCLUDE_FILES sys/mman.h)
 FUNC_CHECK(mtrace INCLUDE_FILES mcheck.h)
 FUNC_CHECK(prctl INCLUDE_FILES sys/prctl.h)
@@ -67,6 +69,10 @@ TYPE_CHECK(siginfo_t INCLUDE_FILES signal.h)
 
 # END: HEADER, TYPE and FUNCTION CHECKS
 
+# TODO: move to a FindUnwind.cmake?
+# or is pkg-config enough these days?
+pkg_check_modules(UNWIND libunwind libunwind-generic)
+CHECK_APPEND_DEFINE(HAVE_UNWIND ${UNWIND_FOUND})
 
 CHECK_APPEND_DEFINE(EFL_BETA_API_SUPPORT 1)
 if(CMAKE_THREAD_LIBS_INIT)
index 3323470..bd23e78 100644 (file)
@@ -8,6 +8,10 @@ if(ENABLE_VALGRIND)
   list(APPEND PKG_CONFIG_REQUIRES_PRIVATE valgrind)
 endif()
 
+if(UNWIND_FOUND)
+  list(APPEND PKG_CONFIG_REQUIRES_PRIVATE libunwind libunwind-generic)
+endif()
+
 set(PUBLIC_LIBRARIES
   pthread
 )