tools/perf/build: Split out feature check: 'libelf'
authorIngo Molnar <mingo@kernel.org>
Mon, 30 Sep 2013 12:20:25 +0000 (14:20 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 9 Oct 2013 06:48:34 +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-qznhihaasbysfqO7ffvRsf9q@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-libelf.c [new file with mode: 0644]

index a2e0e1b200c3288fef4a1e81c622ace1a74fa121..68654281b973c263814445777c4028e336efde48 100644 (file)
@@ -108,6 +108,7 @@ FEATURE_TESTS =                             \
        volatile-register-var           \
        fortify-source                  \
        bionic                          \
+       libelf                          \
        libnuma
 
 $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -164,8 +165,7 @@ ifdef NO_LIBELF
   NO_DEMANGLE := 1
   NO_LIBUNWIND := 1
 else
-  FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS)
-  ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
+  ifeq ($(feature-libelf), 0)
     FLAGS_GLIBC=$(CFLAGS) $(LDFLAGS)
     ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y)
       LIBC_SUPPORT := 1
index 191df97a031d4c26fbc8c76e712723f0d9560f16..789a38d21a3470e1d010f89470a5c9bf579ae3e5 100644 (file)
@@ -6,6 +6,7 @@ FILES=                                  \
        test-volatile-register-var      \
        test-fortify-source             \
        test-bionic                     \
+       test-libelf                     \
        test-libnuma
 
 CC := $(CC) -MD
@@ -34,6 +35,9 @@ test-fortify-source:
 test-bionic:
        $(BUILD)
 
+test-libelf:
+       $(BUILD) -lelf
+
 test-libnuma:
        $(BUILD) -lnuma
 
diff --git a/tools/perf/config/feature-checks/test-libelf.c b/tools/perf/config/feature-checks/test-libelf.c
new file mode 100644 (file)
index 0000000..1a08f97
--- /dev/null
@@ -0,0 +1,7 @@
+#include <libelf.h>
+
+int main(void)
+{
+       Elf *elf = elf_begin(0, ELF_C_READ, 0);
+       return (long)elf;
+}