[PATCH v4 3/6] perf tools: Separate local and remote unwind support detection

From: He Kuang
Date: Thu May 19 2016 - 07:49:50 EST


This patch changes original CONFIG_LIBUNWIND/NO_LIBUNWIND to
CONFIG_LOCAL_LIBUNWIND/NO_LOCAL_LIBUNWIND for retaining local unwind
features. CONFIG_LIBUNWIND stands for either local or remote or both
unwind are supported and NO_LIBUNWIND means neither local nor remote
libunwind are supported.

Signed-off-by: He Kuang <hekuang@xxxxxxxxxx>
---
tools/perf/config/Makefile | 21 ++++++++++++++++++---
tools/perf/util/Build | 2 +-
2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index a86b864..3035dbf 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -345,16 +345,28 @@ ifeq ($(ARCH),powerpc)
endif

ifndef NO_LIBUNWIND
+ have_libunwind =
ifeq ($(feature-libunwind-x86), 1)
- LIBUNWIND_LIBS += -lunwind-x86
$(call detected,CONFIG_LIBUNWIND_X86)
CFLAGS += -DHAVE_LIBUNWIND_X86_SUPPORT
+ LDFLAGS += -lunwind -lunwind-x86
+ have_libunwind = 1
endif

ifneq ($(feature-libunwind), 1)
msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR);
+ NO_LOCAL_LIBUNWIND := 1
+ else
+ have_libunwind = 1
+ CFLAGS += -DHAVE_LIBUNWIND_LOCAL_SUPPORT
+ $(call detected,CONFIG_LOCAL_LIBUNWIND)
+ endif
+
+ ifneq ($(have_libunwind), 1)
NO_LIBUNWIND := 1
endif
+else
+ NO_LOCAL_LIBUNWIND := 1
endif

ifndef NO_LIBBPF
@@ -392,7 +404,7 @@ else
NO_DWARF_UNWIND := 1
endif

-ifndef NO_LIBUNWIND
+ifndef NO_LOCAL_LIBUNWIND
ifeq ($(ARCH),$(filter $(ARCH),arm arm64))
$(call feature_check,libunwind-debug-frame)
ifneq ($(feature-libunwind-debug-frame), 1)
@@ -403,12 +415,15 @@ ifndef NO_LIBUNWIND
# non-ARM has no dwarf_find_debug_frame() function:
CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
endif
- CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
EXTLIBS += $(LIBUNWIND_LIBS)
CFLAGS += $(LIBUNWIND_CFLAGS)
LDFLAGS += $(LIBUNWIND_LDFLAGS)
endif

+ifndef NO_LIBUNWIND
+ CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
+endif
+
ifndef NO_LIBAUDIT
ifneq ($(feature-libaudit), 1)
msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 25c31fb..ce69721 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -99,7 +99,7 @@ libperf-$(CONFIG_DWARF) += probe-finder.o
libperf-$(CONFIG_DWARF) += dwarf-aux.o

libperf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
-libperf-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
+libperf-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o
libperf-$(CONFIG_LIBUNWIND) += unwind-libunwind_common.o

libperf-$(CONFIG_LIBBABELTRACE) += data-convert-bt.o
--
1.8.5.2