blob: 9a08b63c20e47cbd3a8d8b4684a994feee7235ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8f7678f..6adf4f1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -122,6 +122,8 @@ endif(WIN32)
set(hexer_defines_h_in "${CMAKE_CURRENT_SOURCE_DIR}/hexer_defines.h.in")
set(hexer_defines_h "${CMAKE_CURRENT_BINARY_DIR}/include/hexer/hexer_defines.h")
+include(CheckIncludeFiles)
+check_include_files(execinfo.h HEXER_HAVE_EXECINFO_H)
configure_file(${hexer_defines_h_in} ${hexer_defines_h})
HEXER_ADD_INCLUDES("" "" ${hexer_defines_h})
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
diff --git a/apps/Utils.cpp b/apps/Utils.cpp
index 92d810b..058539f 100644
--- a/apps/Utils.cpp
+++ b/apps/Utils.cpp
@@ -44,7 +44,9 @@
#include <cxxabi.h>
#include <sys/ioctl.h>
#include <sys/wait.h> // WIFEXITED, WEXITSTATUS
+#ifdef HEXER_HAVE_EXECINFO_H
#include <execinfo.h> // backtrace
+#endif
#include <dlfcn.h> // dladdr
#endif
@@ -600,11 +602,11 @@ double Utils::normalizeLongitude(double longitude)
return longitude;
}
-
std::vector<std::string> Utils::backtrace()
{
std::vector<std::string> lines;
#ifndef WIN32
+#ifdef HEXER_HAVE_EXECINFO_H
const int MAX_STACK_SIZE(100);
void* buffer[MAX_STACK_SIZE];
std::vector<std::string> prefixes;
@@ -657,10 +659,10 @@ std::vector<std::string> Utils::backtrace()
}
}
#endif
+#endif
return lines;
}
-
// Useful for debug on occasion.
std::string Utils::hexDump(const char *buf, size_t count)
{
diff --git a/hexer_defines.h.in b/hexer_defines.h.in
index ded9053..0cdab99 100644
--- a/hexer_defines.h.in
+++ b/hexer_defines.h.in
@@ -25,6 +25,11 @@
#cmakedefine HEXER_HAVE_GDAL
/*
+ * availability of execinfo and backtrace
+ */
+#cmakedefine HEXER_HAVE_EXECINFO_H
+
+/*
* Debug or Release build?
*/
#define HEXER_BUILD_TYPE "@CMAKE_BUILD_TYPE@"
|