--- /dev/null
+From a0cb41ba72913eda06049d266ec43ea8f52b5bee Mon Sep 17 00:00:00 2001
+From: Carlos Rafael Giani <dv@pseudoterminal.org>
+Date: Fri, 11 Aug 2017 21:21:36 +0200
+Subject: [PATCH] configure: Add switches for enabling/disabling libdw and
+ libunwind
+
+[Original patch modified to be applicable to 1.12.2]
+
+Upstream-Status: Submitted [https://bugzilla.gnome.org/show_bug.cgi?id=778193]
+
+Signed-off-by: Carlos Rafael Giani <dv@pseudoterminal.org>
+---
+ configure.ac | 38 ++++++++++++++++++++++++++++++++------
+ 1 file changed, 32 insertions(+), 6 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index b6b2923..32dd827 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -821,15 +821,41 @@ fi
+ AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
+
+ dnl libunwind is optionally used by the leaks tracer
+-PKG_CHECK_MODULES(UNWIND, libunwind, HAVE_UNWIND=yes, HAVE_UNWIND=no)
+-if test "x$HAVE_UNWIND" = "xyes"; then
+- AC_DEFINE(HAVE_UNWIND, 1, [libunwind available])
++AC_ARG_WITH([unwind],[AS_HELP_STRING([--with-unwind=yes|no|auto],[use libunwind])],
++ [], [with_unwind=auto])
++if [ test "x${with_unwind}" != "xno" ]; then
++ PKG_CHECK_MODULES(UNWIND, [libunwind],
++ [
++ HAVE_UNWIND=yes
++ AC_DEFINE(HAVE_UNWIND, 1, [libunwind available])
++ ],
++ [
++ HAVE_UNWIND=no
++ if [ test "x${with_unwind}" = "xyes" ]; then
++ AC_MSG_ERROR([could not find libunwind])
++ fi
++ ])
++else
++ HAVE_UNWIND=no
+ fi
+
+ dnl libdw is optionally used to add source lines and numbers to backtraces
+-PKG_CHECK_MODULES(DW, libdw, HAVE_DW=yes, HAVE_DW=no)
+-if test "x$HAVE_DW" = "xyes"; then
+- AC_DEFINE(HAVE_DW, 1, [libdw available])
++AC_ARG_WITH([dw],[AS_HELP_STRING([--with-dw=yes|no|auto],[use libdw])],
++ [], [with_dw=auto])
++if [ test "x${with_dw}" != "xno" ]; then
++ PKG_CHECK_MODULES(DW, [libdw],
++ [
++ HAVE_DW=yes
++ AC_DEFINE(HAVE_DW, 1, [libdw available])
++ ],
++ [
++ HAVE_DW=no
++ if [ test "x${with_dw}" = "xyes" ]; then
++ AC_MSG_ERROR([could not find libdw])
++ fi
++ ])
++else
++ HAVE_DW=no
+ fi
+
+ dnl Check for backtrace() from libc
+--
+2.7.4
+
+++ /dev/null
-Make the detection of libunwind deterministic.
-
-Upstream-Status: Pending
-Signed-off-by: Ross Burton <ross.burton@intel.com>
-
-diff --git a/configure.ac b/configure.ac
-index ac88fb2..182c19a 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -829,3 +828,0 @@ AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
--dnl libunwind is optionally used by the leaks tracer
--PKG_CHECK_MODULES(UNWIND, libunwind, HAVE_UNWIND=yes, HAVE_UNWIND=no)
--
-@@ -839,3 +836,7 @@ AC_CHECK_FUNC(backtrace, [
--if test "x$HAVE_UNWIND" = "xyes"; then
-- AC_DEFINE(HAVE_UNWIND, 1, [libunwind available])
--fi
-+dnl libunwind is optionally used by the leaks tracer
-+AC_ARG_WITH([unwind],[AS_HELP_STRING([--with-unwind],[use libunwind])],
-+ [], [with_unwind=yes])
-+AS_IF([test "$with_unwind" = yes],
-+ [PKG_CHECK_MODULES(UNWIND, libunwind)
-+ AC_DEFINE(HAVE_UNWIND, 1, [libunwind available])]
-+)