diff options
author | Haru <haru@dotalux.com> | 2015-08-13 03:40:06 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2015-08-13 04:15:58 +0200 |
commit | 1b4d33767fde9c55aa2e32f1a313688dc48a6ad4 (patch) | |
tree | 60d6a99177d72584e03c24f47af5f29a02fed623 /src/common | |
parent | 08e100ec056ef7f8dabbbe33d3de14410c25f367 (diff) | |
download | hercules-1b4d33767fde9c55aa2e32f1a313688dc48a6ad4.tar.gz hercules-1b4d33767fde9c55aa2e32f1a313688dc48a6ad4.tar.bz2 hercules-1b4d33767fde9c55aa2e32f1a313688dc48a6ad4.tar.xz hercules-1b4d33767fde9c55aa2e32f1a313688dc48a6ad4.zip |
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 <haru@dotalux.com>
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/nullpo.c | 12 |
1 files changed, 6 insertions, 6 deletions
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 <stdarg.h> #include <stdlib.h> #include <string.h> -#if defined(__GNUC__) && !defined(CYGWIN) +#ifdef HAVE_EXECINFO #include <execinfo.h> -#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); } |