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.
#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); })