tools/perf/build: Split out feature check: 'backtrace'
authorIngo Molnar <mingo@kernel.org>
Mon, 30 Sep 2013 14:49:38 +0000 (16:49 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 9 Oct 2013 06:48:47 +0000 (08:48 +0200)
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/n/tip-ihnwe6cvglVkudyvcavP1wql@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
tools/perf/config/Makefile
tools/perf/config/feature-checks/Makefile
tools/perf/config/feature-checks/test-backtrace.c [new file with mode: 0644]

index 44affb5477c5e36958742bf40e20d3fc0d3c7d06..c0c83440de9794b0bb68d98d807ece895f8e362a 100644 (file)
@@ -124,6 +124,7 @@ FEATURE_TESTS =                             \
        strlcpy                         \
        libbfd                          \
        on-exit                         \
+       backtrace                       \
        libnuma
 
 $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -448,7 +449,7 @@ ifndef NO_ON_EXIT
 endif
 
 ifndef NO_BACKTRACE
-  ifeq ($(call try-cc,$(SOURCE_BACKTRACE),,-DHAVE_BACKTRACE_SUPPORT),y)
+  ifeq ($(feature-backtrace), 1)
     CFLAGS += -DHAVE_BACKTRACE_SUPPORT
   endif
 endif
index 20f1b8c0f865c9194342fd46d5e2935d08d51364..0e4dbc2d5c8af925e68e270b6f08f77b7119cb4d 100644 (file)
@@ -22,6 +22,7 @@ FILES=                                        \
        test-strlcpy                    \
        test-libbfd                     \
        test-on-exit                    \
+       test-backtrace                  \
        test-libnuma
 
 CC := $(CC) -MD
@@ -124,6 +125,9 @@ test-libbfd:
 test-on-exit:
        $(BUILD)
 
+test-backtrace:
+       $(BUILD)
+
 -include *.d */*.d
 
 ###############################
diff --git a/tools/perf/config/feature-checks/test-backtrace.c b/tools/perf/config/feature-checks/test-backtrace.c
new file mode 100644 (file)
index 0000000..5b79468
--- /dev/null
@@ -0,0 +1,10 @@
+#include <execinfo.h>
+#include <stdio.h>
+
+int main(void)
+{
+       backtrace(NULL, 0);
+       backtrace_symbols(NULL, 0);
+
+       return 0;
+}