From ee149d69a3a8c1a1bd2832a25870899ee9eca92a Mon Sep 17 00:00:00 2001
From: Matt Fischer <matt.fischer@garmin.com>
Date: Mon, 15 Apr 2013 09:48:28 -0500
Subject: [PATCH 2/3] Added --enable-local

Currently, local unwind support is built automatically whenever
the target architecture matches the host architecture.  However,
there are times when it is useful to be able to override this behavior.
This patch adds the flag --enable-local, which allows explicit control
at configure time over whether local unwind support is built or not.
If not specified, the default is to preserve the existing behavior, by
checking the host/target architectures.
---
 configure.ac | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index b68c1c2..074493d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -118,6 +118,14 @@ AC_ARG_ENABLE(ptrace,
 AC_MSG_CHECKING([if we should build libunwind-ptrace])
 AC_MSG_RESULT([$enable_ptrace])
 
+AC_ARG_ENABLE(local,
+	AS_HELP_STRING([--enable-local],[building local unwind support]),,
+        [AS_IF([test x$target_arch == x$host_arch], [enable_local=yes], [enable_local=no])]
+)
+
+AC_MSG_CHECKING([if we should build local unwind support])
+AC_MSG_RESULT([$enable_local])
+
 AC_MSG_CHECKING([for build architecture])
 AC_MSG_RESULT([$build_arch])
 AC_MSG_CHECKING([for host architecture])
@@ -129,7 +137,7 @@ AC_MSG_RESULT([$target_os])
 
 AM_CONDITIONAL(BUILD_COREDUMP, test x$enable_coredump = xyes)
 AM_CONDITIONAL(BUILD_PTRACE, test x$enable_ptrace = xyes)
-AM_CONDITIONAL(REMOTE_ONLY, test x$target_arch != x$host_arch)
+AM_CONDITIONAL(REMOTE_ONLY, test x$enable_local = xno)
 AM_CONDITIONAL(ARCH_ARM, test x$target_arch = xarm)
 AM_CONDITIONAL(ARCH_IA64, test x$target_arch = xia64)
 AM_CONDITIONAL(ARCH_HPPA, test x$target_arch = xhppa)
@@ -169,14 +177,9 @@ if test x$target_arch = xppc64; then
         AC_SUBST([libdir])
 fi
 
-AC_MSG_CHECKING([whether to restrict build to remote support])
-if test x$target_arch != x$host_arch; then
+if test x$enable_local = xno; then
   CPPFLAGS="${CPPFLAGS} -DUNW_REMOTE_ONLY"
-  remote_only=yes
-else
-  remote_only=no
 fi
-AC_MSG_RESULT([$remote_only])
 
 AC_MSG_CHECKING([whether to enable debug support])
 AC_ARG_ENABLE(debug,
-- 
1.8.0.msysgit.0

