summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac16
-rw-r--r--distrib/configure.ac.in4
-rw-r--r--mk/config.mk.in2
-rw-r--r--rts/Libdw.c2
-rw-r--r--rts/Libdw.h2
-rw-r--r--rts/LibdwPool.c2
-rw-r--r--rts/LibdwPool.h2
-rw-r--r--rts/ghc.mk8
-rw-r--r--rts/package.conf.in2
-rw-r--r--rts/posix/Signals.c2
10 files changed, 21 insertions, 21 deletions
diff --git a/configure.ac b/configure.ac
index 4adf9c5558..15561d059f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1092,14 +1092,22 @@ AC_DEFINE_UNQUOTED([RTS_LINKER_USE_MMAP], [$RtsLinkerUseMmap],
dnl ** Have libdw?
dnl --------------------------------------------------------------
-AC_ARG_ENABLE(libdw,
+UseLibdw=NO
+USE_LIBDW=0
+AC_ARG_ENABLE(dwarf-unwind,
[AC_HELP_STRING([--enable-dwarf-unwind],
[Enable DWARF unwinding support in the runtime system via elfutils' libdw [default=no]])],
- [AC_CHECK_LIB(dw, dwfl_attach_state, [HaveLibdw=YES], [HaveLibdw=NO])],
- [HaveLibdw=NO]
+ [AC_CHECK_LIB(dw, dwfl_attach_state, [UseLibdw=YES], [UseLibdw=NO])],
+ [UseLibdw=NO]
)
-AC_SUBST(HaveLibdw)
+AC_SUBST(UseLibdw)
+if test $UseLibdw = "YES" ; then
+ USE_LIBDW=1
+fi
+AC_DEFINE_UNQUOTED([USE_LIBDW], [$USE_LIBDW], [Set to 1 to use libdw])
+dnl ** Documentation
+dnl --------------------------------------------------------------
if test -n "$SPHINXBUILD"; then
BUILD_MAN=YES
BUILD_SPHINX_HTML=YES
diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in
index fdd9fd92d6..33023a730f 100644
--- a/distrib/configure.ac.in
+++ b/distrib/configure.ac.in
@@ -93,9 +93,9 @@ dnl ** Have libdw?
dnl --------------------------------------------------------------
dnl Check for a usable version of libdw/elfutils
dnl Currently we need 0.158 or newer.
-BinDistNeedsLibdw=@HaveLibdw@
+BinDistNeedsLibdw=@UseLibdw@
if test "x$BinDistNeedsLibdw" = "xyes" ; then
- AC_CHECK_LIB(dw, dwfl_attach_state, [HaveLibdw=YES],
+ AC_CHECK_LIB(dw, dwfl_attach_state, [UseLibdw=YES],
[AC_MSG_ERROR([Binary distribution was built with libdw support but target system doesn't have supported libdw version (needs at least 0.158)])]
)];
fi
diff --git a/mk/config.mk.in b/mk/config.mk.in
index 5dbde02e55..47198b942a 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -381,7 +381,7 @@ FFIIncludeDir=@FFIIncludeDir@
# GHC needs arch-specific tweak at least in
# rts/Libdw.c:set_initial_registers()
-GhcRtsWithLibdw=$(strip $(if $(filter $(TargetArch_CPP),i386 x86_64),@HaveLibdw@,NO))
+GhcRtsWithLibdw=$(strip $(if $(filter $(TargetArch_CPP),i386 x86_64),@UseLibdw@,NO))
################################################################################
#
diff --git a/rts/Libdw.c b/rts/Libdw.c
index e7968407a6..a16ea59fb5 100644
--- a/rts/Libdw.c
+++ b/rts/Libdw.c
@@ -10,7 +10,7 @@
#include "RtsUtils.h"
#include "Libdw.h"
-#ifdef USE_LIBDW
+#if USE_LIBDW
#include <elfutils/libdwfl.h>
#include <dwarf.h>
diff --git a/rts/Libdw.h b/rts/Libdw.h
index e5fa054155..bb3e71b78f 100644
--- a/rts/Libdw.h
+++ b/rts/Libdw.h
@@ -16,7 +16,7 @@
#include "BeginPrivate.h"
-#ifdef USE_LIBDW
+#if USE_LIBDW
/* Begin a libdw session. A session is tied to a particular capability */
LibdwSession *libdwInit(void);
diff --git a/rts/LibdwPool.c b/rts/LibdwPool.c
index 2363212eaa..8d065c342d 100644
--- a/rts/LibdwPool.c
+++ b/rts/LibdwPool.c
@@ -10,7 +10,7 @@
#include "RtsUtils.h"
#include "LibdwPool.h"
-#ifdef USE_LIBDW
+#if USE_LIBDW
#include <unistd.h>
diff --git a/rts/LibdwPool.h b/rts/LibdwPool.h
index a6b670e6f1..3c4216d09b 100644
--- a/rts/LibdwPool.h
+++ b/rts/LibdwPool.h
@@ -14,7 +14,7 @@
#include "Rts.h"
#include "Libdw.h"
-#ifdef USE_LIBDW
+#if USE_LIBDW
/* Initialize the pool */
void libdwPoolInit(void);
diff --git a/rts/ghc.mk b/rts/ghc.mk
index 6fdc2cc213..49eaab5be3 100644
--- a/rts/ghc.mk
+++ b/rts/ghc.mk
@@ -480,14 +480,6 @@ rts_PACKAGE_CPP_OPTS += '-DFFI_LIB="C$(LIBFFI_NAME)"'
endif
-#-----------------------------------------------------------------------------
-# Add support for reading DWARF debugging information, if available
-
-ifeq "$(GhcRtsWithLibdw)" "YES"
-rts_CC_OPTS += -DUSE_LIBDW
-rts_PACKAGE_CPP_OPTS += -DUSE_LIBDW
-endif
-
# -----------------------------------------------------------------------------
# dependencies
diff --git a/rts/package.conf.in b/rts/package.conf.in
index 5c6d240fc2..b52a8672d5 100644
--- a/rts/package.conf.in
+++ b/rts/package.conf.in
@@ -61,7 +61,7 @@ unresolved symbols. */
,"mingwex"
# endif
#endif
-#ifdef USE_LIBDW
+#if USE_LIBDW
, "elf"
, "dw" /* for backtraces */
#endif
diff --git a/rts/posix/Signals.c b/rts/posix/Signals.c
index 496ec7b2df..d73143bd31 100644
--- a/rts/posix/Signals.c
+++ b/rts/posix/Signals.c
@@ -536,7 +536,7 @@ shutdown_handler(int sig STG_UNUSED)
static void
backtrace_handler(int sig STG_UNUSED)
{
-#ifdef USE_LIBDW
+#if USE_LIBDW
LibdwSession *session = libdwInit();
Backtrace *bt = libdwGetBacktrace(session);
libdwPrintBacktrace(session, stderr, bt);