diff --git a/programs/Makefile b/programs/Makefile index 9e241357..ac17caee 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -134,8 +134,10 @@ else LZ4_MSG := $(NO_LZ4_MSG) endif -# enable backtrace symbol names for Linux & Darwin -BACKTRACE ?= 0 +# explicit backtrace enable/disable for Linux & Darwin +ifeq ($(BACKTRACE), 0) +DEBUGFLAGS += -DBACKTRACE_ENABLE=0 +endif ifeq (,$(filter Windows%, $(OS))) ifeq ($(BACKTRACE), 1) DEBUGFLAGS += -DBACKTRACE_ENABLE=1 diff --git a/programs/fileio.c b/programs/fileio.c index 8b1e9f2f..16bfd530 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -20,12 +20,6 @@ # define _POSIX_SOURCE 1 /* disable %llu warnings with MinGW on Windows */ #endif -#if !defined(BACKTRACE_ENABLE) \ - && ((defined(__linux__) && defined(__GLIBC__)) \ - || (defined(__APPLE__) && defined(__MACH__)) ) -# define BACKTRACE_ENABLE 1 -#endif - /*-************************************* * Includes @@ -38,9 +32,6 @@ #include #include /* errno */ #include -#if defined(BACKTRACE_ENABLE) && (BACKTRACE_ENABLE >= 1) -# include /* backtrace, backtrace_symbols */ -#endif #if defined (_MSC_VER) # include @@ -168,8 +159,17 @@ static void clearHandler(void) /*-********************************************************* * Termination signal trapping (Print debug stack trace) ***********************************************************/ +#if !defined(BACKTRACE_ENABLE) \ + && ((defined(__linux__) && defined(__GLIBC__)) \ + || (defined(__APPLE__) && defined(__MACH__)) ) +# define BACKTRACE_ENABLE 1 +#endif + + #if defined(BACKTRACE_ENABLE) && (BACKTRACE_ENABLE>=1) +#include /* backtrace, backtrace_symbols */ + #define MAX_STACK_FRAMES 50 static void ABRThandler(int sig) {