BUILD: tools: only include execinfo.h for the real backtrace() function

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.
This commit is contained in:
Willy Tarreau 2024-09-29 09:37:16 +02:00
parent 1d403caf8a
commit 1c4776dbc3

View 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>
@ -47,6 +47,10 @@
#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); })