From 1b4d33767fde9c55aa2e32f1a313688dc48a6ad4 Mon Sep 17 00:00:00 2001 From: Haru Date: Thu, 13 Aug 2015 03:40:06 +0200 Subject: Added check for execinfo.h/backtrace() to the configure script - This fixes compilation on systems such as FreeBSD, where -lexecinfo is necessary, or Cygwin, where execinfo.h is not available. Signed-off-by: Haru --- src/common/nullpo.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/common/nullpo.c b/src/common/nullpo.c index 395002b64..0db714ae1 100644 --- a/src/common/nullpo.c +++ b/src/common/nullpo.c @@ -12,9 +12,9 @@ #include #include #include -#if defined(__GNUC__) && !defined(CYGWIN) +#ifdef HAVE_EXECINFO #include -#endif +#endif // HAVE_EXECINFO struct nullpo_interface nullpo_s; @@ -28,12 +28,12 @@ struct nullpo_interface nullpo_s; * @param title Message title to display (i.e. failed assertion or nullpo info) */ void assert_report(const char *file, int line, const char *func, const char *targetname, const char *title) { -#if defined(__GNUC__) && !defined(CYGWIN) +#ifdef HAVE_EXECINFO void *array[10]; int size; char **strings; int i; -#endif +#endif // HAVE_EXECINFO if (file == NULL) file = "??"; @@ -42,13 +42,13 @@ void assert_report(const char *file, int line, const char *func, const char *tar ShowError("--- %s --------------------------------------------\n", title); ShowError("%s:%d: '%s' in function `%s'\n", file, line, targetname, func); -#if defined(__GNUC__) && !defined(CYGWIN) +#ifdef HAVE_EXECINFO size = (int)backtrace(array, 10); strings = backtrace_symbols(array, size); for (i = 0; i < size; i++) ShowError("%s\n", strings[i]); free(strings); -#endif +#endif // HAVE_EXECINFO ShowError("--- end %s ----------------------------------------\n", title); } -- cgit v1.2.3-70-g09d2