]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: tools: only include execinfo.h for the real backtrace() function
authorWilly Tarreau <w@1wt.eu>
Sun, 29 Sep 2024 07:37:16 +0000 (09:37 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 29 Sep 2024 07:52:23 +0000 (09:52 +0200)
No need to include this possibly non-existing file when using our own
backtrace() implementation, it's only needed for the libc-provided one.
Because of this it's currently not possible to build musl with backtrace
enabled.

include/haproxy/tools.h

index 2be18e34287d7b2640f7f1c51a29b42e02e59a20..8d1afb5d7c3bb48279460b0f422405f11aa87a9c 100644 (file)
@@ -23,8 +23,8 @@
 #define _HAPROXY_TOOLS_H
 
 #ifdef USE_BACKTRACE
+// for backtrace() on Linux
 #define _GNU_SOURCE
-#include <execinfo.h>
 #endif
 
 #include <string.h>
 #include <haproxy/protocol-t.h>
 #include <haproxy/tools-t.h>
 
+#if defined(USE_BACKTRACE) && defined(HA_HAVE_WORKING_BACKTRACE)
+#include <execinfo.h>
+#endif
+
 /****** string-specific macros and functions ******/
 /* if a > max, then bound <a> to <max>. The macro returns the new <a> */
 #define UBOUND(a, max) ({ typeof(a) b = (max); if ((a) > b) (a) = b; (a); })