summaryrefslogtreecommitdiffstats
path: root/kmtrace
diff options
context:
space:
mode:
Diffstat (limited to 'kmtrace')
-rw-r--r--kmtrace/CMakeLists.txt8
-rw-r--r--kmtrace/ConfigureChecks.cmake18
-rw-r--r--kmtrace/ktrace.c6
3 files changed, 30 insertions, 2 deletions
diff --git a/kmtrace/CMakeLists.txt b/kmtrace/CMakeLists.txt
index c2551b0e..126a1013 100644
--- a/kmtrace/CMakeLists.txt
+++ b/kmtrace/CMakeLists.txt
@@ -12,6 +12,7 @@
include_directories(
${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS}
+ ${CMAKE_BINARY_DIR}
)
link_directories(
@@ -21,6 +22,11 @@ link_directories(
set( LD_FLAGS "-Wl,-Bstatic -liberty -Wl,-Bdynamic" )
+##### configure checks ##########################
+
+include( ConfigureChecks.cmake )
+
+
##### other data ################################
configure_file( kminspector.cmake kminspector @ONLY )
@@ -48,7 +54,7 @@ tde_add_library( ktrace_s STATIC
tde_add_library( ktrace SHARED
SOURCES ksotrace.cpp ktrace.c
- LINK dl
+ LINK ${DL_LIBRARIES} ${Backtrace_LIBRARY}
DESTINATION ${LIB_INSTALL_DIR}/kmtrace
)
diff --git a/kmtrace/ConfigureChecks.cmake b/kmtrace/ConfigureChecks.cmake
new file mode 100644
index 00000000..5c06aac6
--- /dev/null
+++ b/kmtrace/ConfigureChecks.cmake
@@ -0,0 +1,18 @@
+
+##### check if GLIBC >= 2.1 compatible backtrace facility exists
+
+if ( CMAKE_MAJOR_VERSION LESS "3" )
+ check_symbol_exists( backtrace "execinfo.h" HAVE_BACKTRACE )
+ if ( HAVE_BACKTRACE )
+ set ( Backtrace_LIBRARY "" )
+ set ( Backtrace_HEADER "execinfo.h" )
+ endif ()
+else ()
+ find_package( Backtrace )
+ if ( Backtrace_FOUND )
+ set ( HAVE_BACKTRACE 1 CACHE INTERNAL "" )
+ endif ()
+endif ()
+if( NOT HAVE_BACKTRACE )
+ tde_message_fatal( "bactrace function is required but not available on your system")
+endif()
diff --git a/kmtrace/ktrace.c b/kmtrace/ktrace.c
index e7eee47b..dcc321e5 100644
--- a/kmtrace/ktrace.c
+++ b/kmtrace/ktrace.c
@@ -25,6 +25,10 @@
or (US mail) as Mike Haertel c/o Free Software Foundation.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#define MALLOC_HOOKS
#define _GNU_SOURCE
@@ -35,8 +39,8 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include <execinfo.h>
#include <unistd.h>
+#include BACKTRACE_H
#ifdef USE_IN_LIBIO
# include <libio/iolibio.h>