changeset 843:b8923a9c7278

error: include ucontext.h only for addrtosymstr Some OSes (most notably macOS don't have the header). Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Thu, 16 Sep 2021 22:38:32 -0400
parents 8ed31ab423c8
children a5955f7c282b
files error.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/error.c	Thu Sep 16 22:38:04 2021 -0400
+++ b/error.c	Thu Sep 16 22:38:32 2021 -0400
@@ -27,9 +27,14 @@
 #include <assert.h>
 #include <pthread.h>
 #include <execinfo.h>
-#include <ucontext.h>
+
+/* need to include this before the below check for ucontext.h */
+#include <jeffpc/config.h>
 
-#include <jeffpc/config.h>
+#ifdef JEFFPC_HAVE_ADDRTOSYMSTR
+#include <ucontext.h>
+#endif
+
 #include <jeffpc/error.h>
 #include <jeffpc/thread.h>